The TEXTAFTER function
TEXTAFTER gives you everything after a marker. Use it for the domain of an email address, the surname from a full name, or the extension of a file name.
Use -1 as the instance number to cut at the *last* marker. That's how you get the final word of a name or the part after the last dot.
=TEXTAFTER(text, delimiter, [instance_num], [match_mode], [match_end], [if_not_found])
Arguments
- text
- The text (or cell) to cut.
- delimiter
- The marker to cut at, such as
" ","-"or"@". - instance_numoptional
- Which occurrence of the marker to use. 1 is the first (the default); -1 is the last.
- match_modeoptional
- 0 for case-sensitive matching (the default), 1 to ignore case.
- match_endoptional
- 1 to treat the end of the text as a marker too (or the start, when counting from the end with a negative instance). Usually left out.
- if_not_foundoptional
- What to return when the marker isn't there. Without it you get #N/A.
Try it
=TEXTAFTER(A2,"@") in D2. Everything after the @ is returned: northwind.co.uk.
D2
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Name | File | Domain | ||
| 2 | priya.shah@northwind.co.uk | Mary Ann Jones | invoice.march.2025.pdf | northwind.co.uk | |
| 3 | tom.oakes@harbourmail.com | Rohan Kapoor | Order REF 2291 | ||
| 4 | |||||
| 5 | |||||
| 6 |
Edit the formula in D2, or change the data, and press Enter.
More examples
| Formula | Result | What it does |
|---|---|---|
| =TEXTAFTER(B2," ",-1) | Jones | -1 cuts at the last space, so a middle name doesn't get in the way. |
| =TEXTAFTER(B2," ") | Ann Jones | By default it cuts at the first space. |
| =TEXTAFTER(C2,".",-1) | The file extension: the part after the last dot. | |
| =TEXTAFTER(C3,"ref ",,1) | 2291 | Match mode 1 ignores case, so "ref " matches REF. |
Tips
- Pair with TEXTBEFORE to split a cell into two parts with the same marker.
- Nest them to take a middle piece:
=TEXTBEFORE(TEXTAFTER(A2,"@"),".")gives northwind. - Give a fallback for rows without the marker:
TEXTAFTER(A2,"@",,,,"").
Common mistakes
- The result starts with a space.Include the space in the marker (
", "rather than","), or wrap the result in TRIM. - You only get the middle name, not the surname.Use -1 as the instance number to cut at the last space.
- Rows without the marker show #N/A.Add the if_not_found argument or wrap the formula in IFERROR.
In Google Sheets
Google Sheets doesn't have TEXTAFTER, and nor do desktop versions of Excel up to 2021. Use =MID(A2, FIND(" ", A2) + 1, LEN(A2)) there instead, or SPLIT in Sheets.
Practise TEXTAFTER with instant feedback
Type real formulas into a working spreadsheet and get told straight away whether they work.