TEXTAFTER function
TEXTAFTER returns everything that follows a chosen delimiter in a piece of text. It is a cleaner replacement for RIGHT and FIND combinations when splitting names, paths or emails.
Example
Read it as a sentence: return everything after the first hyphen in a-b-c, which gives b-c.
A
B
C
D
1
b-c
2
3
Syntax
TEXTAFTER(text, delimiter, [instance_num], [match_mode], [match_end], [if_not_found])
Arguments in [square brackets] are optional.
-
text(required) - The text to search.
-
delimiter(required) - The marker to look for.
-
instance_num(optional) - Which occurrence; negative counts from the end. Default 1.
-
match_mode(optional) - 0 case-sensitive (default), 1 ignore case.
-
match_end(optional) - 1 treats the end of text as a delimiter.
-
if_not_found(optional) - Value to return instead of #N/A.
Returns: The text following the delimiter.
What Excel actually returns
Each formula below was run in desktop Excel. The result is exactly what the cell showed, errors included.
| Formula | Excel shows | Case |
|---|---|---|
=TEXTAFTER("a-b-c","-") | b-c | First |
=TEXTAFTER("a-b-c","-",2) | c | Second instance |
=TEXTAFTER("a-b-c","-",-1) | c | From end |
=TEXTAFTER("a-b-c","_",,,,"none") | none | if_not_found |
=TEXTAFTER("aXb","x",,1) | b | Case-insensitive |
=TEXTAFTER("a-b","-",2,,1) | match_end | |
=TEXTAFTER("a-b-c","_") | #N/A | Not found |
=TEXTAFTER("aXb","x") | #N/A | Case-sensitive default |
Watch out for
- Returns #N/A if the delimiter is missing, unless if_not_found is set.
- An instance_num of 0 is invalid.
Where it works
- Excel
- TEXTAFTER arrived in Excel 2024. Older versions do not have it. Excel 2024 and Microsoft 365.
- Google Sheets
- No direct equivalent. Use REGEXEXTRACT or MID/FIND.
Part of Text functions. Every result on this page was measured in desktop Excel, build 16.0.20527. Last updated .