Formula guide · Excel and Google Sheets · Updated May 13, 2026

Extract Text Between Two Characters

Extract text between parentheses, brackets, dashes, or other delimiters.

Quick Answer

Use TEXTAFTER to start after the first delimiter, then TEXTBEFORE to stop before the second delimiter.

Copyable Formula

=TEXTBEFORE(TEXTAFTER(A2,"("),")")

Syntax

=TEXTBEFORE(TEXTAFTER(A2,"("),")")

Excel and Google Sheets

Worked Example

AB
Raw textExtracted
Project (A-104)A-104
Order (ZX-9)ZX-9

Result: Returns the text inside the parentheses.

Steps

  • Identify the opening delimiter.
  • Use TEXTAFTER to remove everything before it.
  • Use TEXTBEFORE to stop at the closing delimiter.
  • Wrap with IFERROR if some rows do not contain both delimiters.

Common Mistakes

  • Using fixed character positions when the text length changes.
  • Ignoring rows with missing delimiters.
  • Extracting before cleaning nonstandard spaces or punctuation.

Excel vs Google Sheets Notes

The core idea works in both Excel and Google Sheets, but separators, function availability, and array behavior can vary by account, locale, and version.

Editorial check: This guide was last updated May 13, 2026. Formula behavior can vary by Excel version, Google Sheets rollout, and spreadsheet locale.

FAQ