Text function

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])
ArgumentWhat it means
textRequiredThe text or cell to search.
delimiterRequiredThe text that marks the split point, e.g. "@". Can be an array of several delimiters like {"-","/"}.
instance_numOptionalWhich occurrence to use. Default 1. Negative numbers count from the end (-1 = last).
match_modeOptional0 (default) case-sensitive; 1 ignore case.
match_endOptional1 treats the end of the text as a delimiter. Default 0.
if_not_foundOptionalWhat 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

B2fx=TEXTAFTER(A2,"@")
AB
1Email
2[email protected]contoso.com

Result: contoso.com

Everything after the @ is returned.

2File name after the last slash

B2fx=TEXTAFTER(A2,"/",-1)
AB
1Path
2Sales/2026/Q1/report.xlsxreport.xlsx

Result: report.xlsx

instance_num -1 splits at the last slash, however many folders there are.

3Reference number, ignoring case

B2fx=TEXTAFTER(A2,"ref: ",,1)
AB
1Bank description
2Payment REF: 8821388213

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

B2fx=TEXTAFTER(A2,"@",,,,"no email")
AB
1Contact
2Call receptionno email

Result: no email

There is no @ in the text, so instead of #N/A the if_not_found value is returned.

⬇Practice workbookExamples with live formulas + practice sheets · .xlsx · 17 KB

Common errors and how to fix them

ErrorWhy it happensFix
#N/AThe 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 when instance_num is 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.

LanguageFunction name
CzechTEXTZA
DutchTEKST.NA
FinnishTEKSTI.JÄLKEEN
FrenchTEXTE.APRES
GermanTEXTNACH
PolishTEKST.PO
Portuguese (Brazil)TEXTODEPOIS
Portuguese (Portugal)TEXTODEPOIS
RussianТЕКСТПОСЛЕ
SpanishTEXTODESPUES
SwedishTEXTEFTER
TurkishSONRAKİMETİN

Recipes that use TEXTAFTER