Text
TEXTAFTER function playground
Returns the text that comes after a delimiter, such as the domain after the @ in an email.
The playground runs in your browser. Nothing you type is sent anywhere.
How TEXTAFTER works
TEXTAFTER finds the delimiter and returns everything to its right. instance_num picks the occurrence, and -1 means the last one, which is handy for the last part of a code or a file extension.
If the delimiter isn't there you get #N/A, unless you give if_not_found a value.
It replaces RIGHT with LEN and FIND, so formulas are shorter and easier to read.
Syntax
=TEXTAFTER(text, delimiter, [instance_num], [match_mode], [match_end], [if_not_found])| Argument | What it means |
|---|---|
textrequired | The text to search. |
delimiterrequired | The text that marks the cut, such as "@". |
instance_numoptional | Which occurrence to use. 1 by default; -1 is the last one. |
match_modeoptional | 0 case-sensitive (default), 1 ignore case. |
match_endoptional | 1 treats the end of the text as a delimiter. 0 by default. |
if_not_foundoptional | What to return when the delimiter isn't found. Without it you get #N/A. |
Examples
| Formula | What it does | Result |
|---|---|---|
=TEXTAFTER(B2,"@") | The email domain. | contoso.com |
=TEXTAFTER(A2,", ") | The first name after the comma and space. | Grace |
=TEXTAFTER(C2,"-",-1) | The last part of the order code. | B |
=TEXTAFTER(C2,"-",2) | Everything after the second dash. | 0412-B |
=TEXTAFTER(B2,".",-1) | The top-level domain: the text after the last dot. | com |
Common mistakes
#N/AThe delimiter isn't in the text. Add an if_not_found value or check for extra spaces.
Picking the wrong occurrence1 is the first delimiter from the left. Use -1 for the last one.
VersionTEXTAFTER needs Microsoft 365, Excel 2024 or Excel for the web. In older versions use RIGHT, LEN and FIND.
Related functions
Learn more
Download the example workbook (.xlsx)
The workbook has the same sample data and formulas, plus a practice sheet.