← All how-to recipes

How to extract text between two characters

✓ Verified in LibreOffice 25.8.7.3 ✓ Verified in Google Sheets (2026-08-30)

Pull out the text between two delimiters — like the part inside parentheses.

The formula

AppFormulaNotes
Excel (desktop)=MID(A2,FIND("(",A2)+1,FIND(")",A2)-FIND("(",A2)-1)Excel 365 alternative: =TEXTBEFORE(TEXTAFTER(A2,"("),")").
Google Sheets=MID(A2,FIND("(",A2)+1,FIND(")",A2)-FIND("(",A2)-1)Identical; REGEXEXTRACT(A2,"\((.*?)\)") is a Sheets-only shortcut.
LibreOffice Calc=MID(A2,FIND("(",A2)+1,FIND(")",A2)-FIND("(",A2)-1)Identical.

How it works

FIND locates the opening and closing characters; MID then grabs the text starting one position after the "(" for a length equal to the distance between the two delimiters minus one. "Widget (blue) large" yields "blue". Swap the two characters for anything — dashes, brackets, quotes. If the delimiters can appear more than once, the newer TEXTBEFORE/TEXTAFTER pair (or REGEXEXTRACT in Sheets) is easier to control.

Verified, not just documented

We ran =MID(A2,FIND("(",A2)+1,FIND(")",A2)-FIND("(",A2)-1) in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned blue — exactly the expected result. We then ran the same formulas in Google Sheets, executed 2026-08-30: a formula-only workbook goes into Google Drive, which converts it to a Sheet and recalculates every formula with Google’s own engine, and comes back out as .xlsx carrying the values Google computed. It returned blue for the worked example, the same value LibreOffice produced. Both engines’ numbers on this page are executed results. The Excel formula follows Microsoft’s official documented syntax — we do not run desktop Excel.

Functions used

MID · FIND — see full Excel, Google Sheets & LibreOffice compatibility for each.

Related recipes

Related comparisons