TEXTAFTER function
TEXTAFTER returns everything after a delimiter, such as the domain after the @ or the last part of a file path. Set instance_num to -1 to split at the last delimiter, which handles file names and last names cleanly.
- Available in
- Excel 2024 and Microsoft 365
- Category
- Text functions
- Returns
- The text after the chosen delimiter.
Syntax
=TEXTAFTER(text, delimiter, [instance_num], [match_mode], [match_end], [if_not_found])
| Argument | Required? | What it is |
|---|---|---|
text | Required | The text or cell to split. |
delimiter | Required | The character or text to split at. |
instance_num | Optional | Which delimiter to use: 1 for the first (default), 2 for the second, -1 for the last. |
match_mode | Optional | 0 for a case-sensitive match (default), 1 to ignore case. |
match_end | Optional | 1 treats the end of the text as a delimiter. The default is 0. |
if_not_found | Optional | What to return when the delimiter isn't there, instead of #N/A. |
Examples
Each result below is calculated from the sample sheet by our formula engine, the same one that grades the practice.
| Cell | Formula | Result | What it shows |
|---|---|---|---|
| D2 | =TEXTAFTER(A2,"@") | acme.com | The domain after the @ |
| D3 | =TEXTAFTER(B3,"/",-1) | budget.csv | The file name after the last slash |
| D4 | =TEXTAFTER(C4," - ",,,,"Pending") | Pending | No status yet, so if_not_found fills in |
Try it live
This is the sample sheet. Change any number or text, or edit a formula, and the results update.
Show the sample data as a table
| Path | Order note | Result | |
| maya.chen@acme.com | C:/reports/2026/q3.xlsx | Order 1042 - Shipped | acme.com |
| raj@globex.io | D:/archive/budget.csv | Order 1043 - Backorder | budget.csv |
| lee.wong@initech.net | E:/notes/today.txt | Order 1044 | Pending |
Practice TEXTAFTER
From lesson 16, TEXTBEFORE, TEXTAFTER & FIND. Graded instantly, then re-checked on changed data.
Domain
C2, return everything after the @. Fill down to C6.Common mistakes
| What you see | Why, and how to fix it |
|---|---|
| #N/A | The delimiter isn't in the text. Add an if_not_found value as the sixth argument. |
| #NAME? | TEXTAFTER is only in Excel 2024 and Microsoft 365. In older versions, use =MID(A2,FIND("@",A2)+1,LEN(A2)). |
| You get the middle instead of the end | TEXTAFTER splits at the first delimiter by default. Use -1 as instance_num to split at the last one. |
Tips
- Get a file extension even when the name has other dots: =TEXTAFTER(A2,".",-1).
Questions
How do I get the text after a character in Excel?
In Excel 2024 or Microsoft 365, use =TEXTAFTER(A2,"@"). In older versions, use =MID(A2,FIND("@",A2)+1,LEN(A2)).
How do I get the last word in a cell?
=TEXTAFTER(A2," ",-1) returns everything after the last space.
Lessons that use TEXTAFTER
Last reviewed October 2026. Every example result on this page is calculated live by the Spreadsheet Practice formula engine.