Text
Extract text between parentheses (or brackets) with formulas
Pull SKUs, tickers, or currency codes enclosed in parentheses using TEXTBEFORE/TEXTAFTER or classic MID and FIND.
Two clean ways to isolate enclosed codes
Catalog titles like "Turbine Pump (SKU-4820) - Spare" embed structured IDs inside parentheses. TEXTAFTER(A2, "(") trims everything up to the opening parenthesis ("SKU-4820) - Spare"), and outer TEXTBEFORE(..., ")") stops at the closing parenthesis ("SKU-4820").
In legacy workbooks without TEXTBEFORE/TEXTAFTER, MID(A2, FIND("(", A2) + 1, FIND(")", A2, FIND("(", A2)+1) - FIND("(", A2) - 1) computes the exact start position and enclosed character length.
| ItemLabel (A) | TEXTBEFORE / TEXTAFTER | Legacy MID + FIND |
|---|---|---|
| Turbine Pump (SKU-4820) - Spare | SKU-4820 | SKU-4820 |
| Turbine Pump Direct | No code | No code |
| Turbine Pump (SKU-4820 | No code | No code |
Modern and legacy parentheses extraction formulas
Place IFERROR directly around TEXTBEFORE(TEXTAFTER(...)) so missing or unclosed parentheses return "No code".
=IFERROR(TEXTBEFORE(TEXTAFTER(A2, "("), ")"), "No code")Classic MID + FIND formula for all Excel versions
Subtracting 1 from FIND(")", A2, FIND("(", A2)+1) - FIND("(", A2) excludes both delimiter characters.
=IF(OR(ISERROR(FIND("(", A2)), ISERROR(FIND(")", A2, FIND("(", A2)+1))), "No code", MID(A2, FIND("(", A2)+1, FIND(")", A2, FIND("(", A2)+1)-FIND("(", A2)-1))Inputs and interpretation
This extracts the first opening delimiter and the next closing delimiter after it. Empty parentheses return an empty string. Nested or escaped delimiters require a real parser; the formula does not balance brackets. Replace both delimiter literals for square brackets or another pair.
Try the example
Use the original values or change them to test your understanding.