Excel & Google Sheets Function
TEXTBEFORE & TEXTAFTER function in Excel (with interactive examples)
TEXTBEFORE and TEXTAFTER extract text before or after a delimiter (such as username before "@" or domain after "@") without nested FIND/MID math.
Syntax
=TEXTBEFORE(text, delimiter, [instance_num]) | =TEXTAFTER(text, delimiter, [instance_num])Live Interactive Exercise — Try it nowNo login required
Interactive practice grid (TEXTBEFORE & TEXTAFTER reference)
Try our live spreadsheet engine: total Q1 sales in cell B5 using =SUM(B2:B4).
B5fx
| A | B | |
|---|---|---|
| 1 | Month | Sales |
| 2 | Jan | $1,100.00 |
| 3 | Feb | $1,350.00 |
| 4 | Mar | $1,550.00 |
| 5 | Total | type here |
Insert:
Arguments explained
| text | Required | Text cell to parse. |
| delimiter | Required | Separator string such as "@" or "-". |
Common errors & fixes
#N/A: Delimiter was not found in the cell; use IFNA() or the optional if_not_found argument.
Excel vs Google Sheets
Excel 365 native; in Google Sheets use SPLIT() or REGEXEXTRACT().
Practise TEXTBEFORE & TEXTAFTER in a full 4-minute lesson
Every lesson is free to study — build real speed with instant feedback.
Free 1-Page Excel, Google Sheets & SQL Interview Cheat Sheet
The 25 formulas, keyboard shortcuts, and SQL patterns tested most in analyst interviews — emailed instantly, zero spam.