TEXTAFTER Function

Excel Functions › Text

Excel 365

The Excel TEXTAFTER function returns everything in a text value that comes after a delimiter — the domain after the @, the file name after the last slash, the surname after the final space. It kills the infamous MID/FIND/LEN formula chains, and a negative instance number counts delimiters from the end, which used to be the hardest trick in Excel text-wrangling. Its twin is TEXTBEFORE; for all the pieces at once, use TEXTSPLIT.


Quick answer: to get everything after the @ in an email address:
=TEXTAFTER(A2, "@")
The killer move is instance_num = -1: =TEXTAFTER(A2, "/", -1) returns whatever follows the last slash — e.g. a file name at the end of a path.

Syntax

=TEXTAFTER(text, delimiter, [instance_num], [match_mode], [match_end], [if_not_found])
ArgumentDescription
textRequiredThe text to search in.
delimiterRequiredThe character(s) to look for. Can be more than one character, or an array of alternatives.
instance_numOptionalWhich occurrence to cut at. Default 1. Negative counts from the end: -1 is the last occurrence.
match_modeOptional0 (default) = case-sensitive · 1 = case-insensitive.
match_endOptional1 treats the start/end of the text as a delimiter, so a missing delimiter returns gracefully instead of erroring. Default 0.
if_not_foundOptionalWhat to return when the delimiter isn’t found — without it you get #N/A.

Available in: Excel for Microsoft 365 and Excel for the web only. Excel 2021 and earlier show #NAME? — there the equivalent is MID(A2, FIND("@",A2)+1, LEN(A2)).

Grab the text after a delimiter

Emails in column A, domains wanted in column C. One argument pair does it:

AC
1EmailDomain
2jane.doe@dfwexcel.comdfwexcel.com
3m.alvarez@example.orgexample.org
4kim@plano.k12.tx.usplano.k12.tx.us
=TEXTAFTER(A2, "@") // everything right of the @

Multi-character delimiters work too — split on a whole word:

=TEXTAFTER("Invoice no. 4417 due June", "no. ") // returns "4417 due June"

And instance_num picks which occurrence to cut at:

=TEXTAFTER("2026-06-11-final", "-", 3) // returns "final" — after the 3rd dash

Try it: interactive TEXTAFTER demo

Live demo

Edit the text, pick a delimiter and an instance number. Try -1 on the path to pull out the file name.

Last-occurrence tricks and power moves

The negative instance number solves the classic “get the file name from the path” problem in one step:

=TEXTAFTER("reports/2026/q2/sales.xlsx", "/", -1) // returns "sales.xlsx"

Same trick for last names — everything after the last space survives middle names:

=TEXTAFTER("Mary Jo van Dyke", " ", -1) // returns "Dyke" — watch out for two-word surnames

Sandwich TEXTAFTER inside TEXTBEFORE to cut a piece out of the middle — the quarter folder from the path:

=TEXTBEFORE(TEXTAFTER(A2, "/", 2), "/") // returns "q2"

Grab the file extension, then make missing delimiters harmless with if_not_found:

=TEXTAFTER(A2, ".", -1) // extension: "xlsx"
=TEXTAFTER(A2, "@", , , , "not an email") // fallback instead of #N/A

Errors & common pitfalls

#N/A — delimiter not found. The delimiter (or the nth instance) isn’t in the text. Pass if_not_found for a fallback value, or set match_end to 1.

#VALUE! — instance_num is 0 or out of range. Zero is never valid, and asking for more instances than the text could hold also fails.

#NAME? — older Excel. TEXTAFTER ships only in Excel for Microsoft 365 and Excel for the web. The legacy equivalent is =MID(A2, FIND("@",A2)+1, LEN(A2)).

Pitfall: case-sensitive by default. Searching for "q" skips "Q" until you set match_mode to 1.

Pitfall: numbers come back as text. Extract "4417" and it’s a string — SUM ignores it. Coerce with VALUE or -- before doing math: =--TEXTAFTER(A2, "no. ").

Practice workbook

📊
Download the free TEXTAFTER practice workbook
Every example on this page, ready to open in Excel — plus practice challenges with answers on a separate tab. No sign-up required.

Frequently asked questions

What's the difference between TEXTAFTER and TEXTBEFORE?
Mirror images with identical arguments: TEXTAFTER keeps what follows the delimiter, TEXTBEFORE keeps what precedes it. Nest one inside the other to extract a middle piece.
How do I get the text after the LAST occurrence of a character?
Use a negative instance number: =TEXTAFTER(A2, "/", -1). That replaces the old SUBSTITUTE/CHAR(160)/FIND workaround that everyone used to copy off the internet.
How do I extract text between two delimiters?
Nest the twins: =TEXTBEFORE(TEXTAFTER(A2, "["), "]") returns whatever sits between the brackets.
Why does TEXTAFTER return #N/A and how do I stop it?
The delimiter you asked for isn’t in that cell. Either supply the sixth argument — =TEXTAFTER(A2, "@", , , , "") returns an empty string instead — or set match_end to 1.
What's the TEXTAFTER equivalent in Excel 2021 and earlier?
The classic pattern is =MID(A2, FIND("@", A2) + 1, LEN(A2)). It only handles the first occurrence; last-occurrence logic needs the SUBSTITUTE trick or a helper column.
Is the extracted result text or a number?
Always text. Wrap the formula in VALUE or prefix -- if you need to add, average, or compare it as a number.

Master functions like this in one day

This page covers one function. Our Excel Formulas and Functions class covers the 30 that matter most — live, hands-on, taught by professionals in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.

See the Formulas & Functions Class

Related functions: TEXTBEFORE · TEXTSPLIT · TEXTJOIN · IFERROR · CONCAT