The TEXTAFTER function
Returns the text after a delimiter, such as the domain after the @ in an email address. You can choose which occurrence of the delimiter to use.
Syntax
TEXTAFTER(text, delimiter, [instance_num], [match_mode], [match_end], [if_not_found])- text
- The text to search.
- delimiter
- The character or text to start after.
- instance_num (optional)
- Which occurrence to use. 1 or left out for the first, 2 for the second, -1 for the last.
- match_mode (optional)
- 1 to ignore upper and lower case. Left out, 0, which matches case.
- match_end (optional)
- 1 to treat the end of the text as a delimiter. Left out, 0.
- if_not_found (optional)
- What to return when the delimiter is missing. Left out,
Examples
C1
=TEXTAFTER(1A2,2"@")| A | B | C | |
|---|---|---|---|
| 1 | example.com | ||
| 2 | ann.berg@example.com |
In plain words: Return the text in 1the email address in A2 that comes 2after the @.
B1=TEXTAFTER("C:/Reports/2024/sales.xlsx","/",-1)
| A | B | |
|---|---|---|
| 1 | sales.xlsx |
B1=TEXTAFTER("Invoice 2024-117","-")
| A | B | |
|---|---|---|
| 1 | 117 |
Practice TEXTAFTER
Questions
How do I get the text after the last space or slash?
Use -1 as the occurrence, as in =TEXTAFTER(A2,"/",-1). TEXTAFTER then counts from the end of the text.
How do I do the same in older versions of Excel?
Combine MID or RIGHT with FIND, as in =MID(A2,FIND("@",A2)+1,100), which takes up to 100 characters after the @.