Text function
TEXTAFTER function in Excel
TEXTAFTER returns the part of a text that comes after a delimiter, such as everything after the first space.
Checked against Microsoft's and Google's documentation on · Example calculated on a live sheet
- Excel 2016
- Excel 2019
- Excel 2021
- Excel 2024
- Microsoft 365
- Google Sheets
Syntax
TEXTAFTER(text, delimiter, [instance_num], [match_mode], [match_end], [if_not_found])Arguments in [brackets] are optional. Google Sheets doesn't have this function.
Example
=TEXTAFTER(B2," ") reads: Return everything after the first space in the phone number B2.
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Customer | Phone | Order | Amount | City | Local number |
| 2 | Okafor, Mara | +44 20 7946 0321 | ORD-2026-0412 | $1,250.00 | London | 20 7946 0321 |
| 3 | Lind, Jonas | +46 40 123 456 | ORD-2026-0413 | $89.90 | Malmö | 40 123 456 |
| 4 | Raman, Priya | +91 20 5550 1234 | ORD-2026-0419 | $2,040.00 | Pune | 20 5550 1234 |
| 5 | Ruiz, Tomás | +34 954 000 111 | ORD-2026-0420 | $15.00 | Seville | 954 000 111 |
| 6 | Demir, Elif | +90 232 555 0199 | ORD-2026-0425 | $310.50 | Izmir | 232 555 0199 |
| 7 | Mori, Kenji | +81 6 5550 7788 | ORD-2026-0431 | $799.00 | Osaka | 6 5550 7788 |
F2 shows 20 7946 0321: everything after the first space in Mara's phone number.
How the spreadsheet calculates it
The text after a delimiter. Here it's given B2 and " ".
- 1. TEXTAFTER: The text after a delimiter. Here it's given
B2and" ".text=`B2`: the cell to cutdelimiter=`" "`: the separator, in quotes
More TEXTAFTER examples
=TEXTAFTER(B2,"@")The domain of the email in B2.=TEXTAFTER(A2," ",-1)The last word of A2.=TEXTAFTER(A2,"-",1,,,A2)Everything after the first hyphen, or the whole text when there isn't one.
Paste any of these into the formula explainer to see it step by step.
Tips
- Use a negative instance_num to count from the end: -1 is the last occurrence.
- Give if_not_found a value (often the original text) so rows without the delimiter don't show #N/A.
- Pair it with TEXTBEFORE to take the part between two delimiters:
TEXTBEFORE(TEXTAFTER(A2, "("), ")"). - For files that go to Google Sheets or older Excel, use MID and FIND instead.
What TEXTAFTER is used for
Taking the domain from an email address, the last name from “First Last”, the number after a prefix like INV-, or everything after a label in imported text.
Arguments
| Argument | Required | What it is |
|---|---|---|
| text | Yes | The text to search in. |
| delimiter | Yes | The character or text to split at, such as " " or ", ". |
| instance_num | No | Which occurrence to split at; 1 is the first, and a negative number counts from the end. |
| match_mode | No | 0 (the default) is case-sensitive; 1 ignores case. |
| match_end | No | Treat the end of the text as a delimiter. |
| if_not_found | No | What to return when the delimiter isn't there, instead of #N/A. |
Common mistakes
Sharing the file with Google Sheets or Excel 2021 users: they'll see #NAME?.
Using it in a file shared with Google Sheets, which doesn't have TEXTAFTER.
Using it in Excel 2021 or older, where it isn't available (Excel 2024 and Microsoft 365 only).
In Google Sheets
Google Sheets doesn't have TEXTAFTER (it's missing from Google's function list). Use MID(B2, FIND(" ", B2) + 1, LEN(B2)), or SPLIT to break the text into parts.
Errors you may see with TEXTAFTER
Questions
How do I get the text after the last space?
Use instance_num -1: TEXTAFTER(A2, " ", -1) returns the last word.
What works in every version?
MID(text, FIND(delimiter, text) + LEN(delimiter), LEN(text)), shown in clean up messy text.
TEXTAFTER or TEXTSPLIT?
TEXTAFTER returns one piece (after a delimiter); TEXTSPLIT splits the whole text into every piece and spills them. Both need Excel 2024 or Microsoft 365.
Sources
Official documentation the facts on this page were checked against.