TEXTAFTER function
Returns the text that comes after a delimiter, with options for the nth or last occurrence, case-insensitive matching and a not-found value.
Available in Microsoft 365, Excel 2024, Excel for the web
Excel 2024 and laterNot in Google Sheets
Syntax
TEXTAFTER(text, delimiter, [instance_num], [match_mode], [match_end], [if_not_found])| Argument | What it means | |
|---|---|---|
text | Required | The text or cell to search. |
delimiter | Required | The text that marks the split point, e.g. "@". Can be an array of several delimiters like {"-","/"}. |
instance_num | Optional | Which occurrence to use. Default 1. Negative numbers count from the end (-1 = last). |
match_mode | Optional | 0 (default) case-sensitive; 1 ignore case. |
match_end | Optional | 1 treats the end of the text as a delimiter. Default 0. |
if_not_found | Optional | What to return when the delimiter is missing. Default #N/A. |
Returns: The text after the chosen delimiter.
How TEXTAFTER works
TEXTAFTER gives you everything to the right of a delimiter: the domain after @ in an email, the file name after the last / in a path, the reference number after REF: in a bank description. Before it existed you needed a combination of RIGHT, LEN and FIND for this; now it is a single readable function.
Its real power is in the optional arguments. instance_num chooses which occurrence to split at, and a negative number counts from the end, so -1 means "after the last delimiter" - something that used to require awkward tricks. match_mode 1 makes the delimiter case-insensitive, and if_not_found lets you return a friendly value instead of #N/A. You can also pass several delimiters at once in an array constant.
Its counterpart TEXTBEFORE returns the left side, and TEXTSPLIT splits the text at every delimiter into separate cells.
Examples
1Domain from an email
| A | B | |
|---|---|---|
| 1 | ||
| 2 | [email protected] | contoso.com |
Result: contoso.com
Everything after the @ is returned.
2File name after the last slash
| A | B | |
|---|---|---|
| 1 | Path | |
| 2 | Sales/2026/Q1/report.xlsx | report.xlsx |
Result: report.xlsx
instance_num -1 splits at the last slash, however many folders there are.
3Reference number, ignoring case
| A | B | |
|---|---|---|
| 1 | Bank description | |
| 2 | Payment REF: 88213 | 88213 |
Result: 88213
With match_mode 1, ref: matches REF: . The text after it is the reference (as text; wrap in VALUE for a number).
4Friendly result when the delimiter is missing
| A | B | |
|---|---|---|
| 1 | Contact | |
| 2 | Call reception | no email |
Result: no email
There is no @ in the text, so instead of #N/A the if_not_found value is returned.
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
#N/A | The delimiter is not in the text (or not as many times as instance_num asks for). | Supply if_not_found, check the case (or use match_mode 1), or wrap in IFNA. |
#VALUE! | instance_num is 0 or larger than the length of the text. | Use a positive or negative number that can exist. |
#NAME? | The function is not available in Excel 2021 or older. | Use RIGHT(A2,LEN(A2)-FIND("@",A2)) in older versions. |
Tips
- Nest TEXTAFTER inside TEXTBEFORE to get the text between two delimiters:
=TEXTBEFORE(TEXTAFTER(A2,"("),")"). - It works on whole ranges and spills:
=TEXTAFTER(A2:A100,"@")returns every domain at once. - An empty delimiter
""returns the whole text wheninstance_numis 1.
Questions
How do I get the text after the last space?
Use a negative instance: =TEXTAFTER(A2," ",-1).
Is TEXTAFTER case-sensitive?
Yes by default. Set the fourth argument (match_mode) to 1 to ignore case.
Google Sheets
Use REGEXEXTRACT(text, "-(.*)") or MID(text, FIND("-", text) + 1, LEN(text)).
TEXTAFTER in other languages
In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.
| Language | Function name |
|---|---|
| Czech | TEXTZA |
| Dutch | TEKST.NA |
| Finnish | TEKSTI.JÄLKEEN |
| French | TEXTE.APRES |
| German | TEXTNACH |
| Polish | TEKST.PO |
| Portuguese (Brazil) | TEXTODEPOIS |
| Portuguese (Portugal) | TEXTODEPOIS |
| Russian | ТЕКСТПОСЛЕ |
| Spanish | TEXTODESPUES |
| Swedish | TEXTEFTER |
| Turkish | SONRAKİMETİN |