Example 1
The domain after the @
C2 =TEXTAFTER(A2,"@")
Result: example.com
Everything after the first @.
C2 =TEXTAFTER(A2,"@") returns example.com
Returns the text that comes after a delimiter, counting from the start or the end of the text.
Syntax
=TEXTAFTER(, , , , , )
Excel for Microsoft 365, Excel 2024 and later, and Excel for the web. Not available in Excel 2021 or earlier.
Try it
Edit the formula in C2 or change the inputs. The sheet recalculates as you type.
C2 =TEXTAFTER(A2,"@") returns example.com
TEXTAFTER returns the text that comes after a delimiter. Use it to take the domain from an email address, the lot code at the end of a batch number, or the value after a label such as Ref:. It replaces the combination of MID, FIND and LEN that older workbooks needed.
#N/A.=TEXTAFTER("dana.whitfield@example.com","@") returns example.com.
For PW-24-0113-A7:
=TEXTAFTER(A2,"-") returns 24-0113-A7, everything after the first dash.=TEXTAFTER(A2,"-",2) returns 0113-A7, everything after the second.=TEXTAFTER(A2,"-",-1) returns A7, everything after the last.The negative instance is the feature that earlier formulas found hardest. The last word after a space, the file name after the last slash, and the extension after the last dot all become one short formula: =TEXTAFTER(A2,".",-1).
TEXTAFTER returns #N/A if the delimiter isn't in the text. Supply the sixth argument to replace it: =TEXTAFTER(A2,"-",1,0,0,"No lot"). IFERROR also works.
Matching is case-sensitive unless match_mode is 1. =TEXTAFTER("Ordered. REF: 7719","ref: ",1,1) finds the label despite the different capitals and returns 7719.
The old way to get the text after a dash was =MID(A2,FIND("-",A2)+1,100) or =RIGHT(A2,LEN(A2)-FIND("-",A2)). Both work in every version of Excel, and you will still see them. TEXTAFTER is shorter and is less likely to break when text is longer than the number you guessed. If the workbook has to open in Excel 2021 or earlier, use those instead.
Combine it with TEXTBEFORE to cut text from the middle: =TEXTBEFORE(TEXTAFTER(A2,"("),")") returns what sits inside the first pair of brackets. The inner TEXTAFTER drops everything up to the opening bracket, and the outer TEXTBEFORE drops everything from the closing one.
TEXTAFTER returns text. If the part after the delimiter is a number, convert it with VALUE. Any spaces next to the delimiter stay in the result, so include them in the delimiter, as in ": ", or wrap the result in TRIM. To get every piece, rather than one, use TEXTSPLIT.
A2."@" or "-". It can be several characters long, or an array of alternatives such as {"-","/"}.1, the first. A negative number counts from the end, so -1 is the last one. 0, or a number larger than the text length, returns #VALUE!.0, the default, is case-sensitive. 1 ignores case.1 treats the start of the text as a delimiter. The default, 0, doesn't."No dash". By default TEXTAFTER returns #N/A.Each example is a live sheet. Change the inputs or the formula and watch the result.
Example 1
C2 =TEXTAFTER(A2,"@")
Result: example.com
Everything after the first @.
C2 =TEXTAFTER(A2,"@") returns example.com
Example 2
C3 =TEXTAFTER(A3,"-",-1)
Result: B12
-1 counts delimiters from the end, so this finds the text after the last dash, whatever its length.
C3 =TEXTAFTER(A3,"-",-1) returns B12
Example 3
C2 =TEXTAFTER(A2,"-",2)
Result: 0113-A7
Instance 2 starts after the second dash. The remaining dash stays in the result.
C2 =TEXTAFTER(A2,"-",2) returns 0113-A7
Example 4
C2 =TEXTAFTER(A2,"ref: ",1,1)
Result: 7719
The label is lower case in the formula and in capitals in the text. match_mode 1 ignores the difference. The space after the colon is part of the delimiter, so it is not in the result.
C2 =TEXTAFTER(A2,"ref: ",1,1) returns 7719
Example 5
C3 =TEXTAFTER(A3,"-",1,0,0,"No suffix")
Result: No suffix
FX1085 has no dash. The sixth argument replaces the #N/A that would otherwise show.
C3 =TEXTAFTER(A3,"-",1,0,0,"No suffix") returns No suffix
Solve it in the sheet. Every answer is checked, with hints if you need them.
Task 1 of 2
In B2, return the part of the email address in A2 after the @. Fill it down to B5.
Answer in B2, then it fills down to B5.
#N/A. Give if_not_found a value, or wrap the formula in IFERROR.#VALUE!. An instance number higher than the number of delimiters returns #N/A.": ", or wrap the formula in TRIM.#NAME?. Use MID or RIGHT with FIND there.Use `=TEXTAFTER(A2,"-")`, with your character in quotes. In older versions, use `=MID(A2,FIND("-",A2)+1,100)`.
Set instance_num to -1: `=TEXTAFTER(A2," ",-1)` or `=TEXTAFTER(A2,"/",-1)`. A negative number counts delimiters from the end.
Use `=TEXTAFTER(A2,".",-1)`. The -1 makes it use the last dot, so names with several dots work too.
The delimiter isn't in the text, or there are fewer occurrences than instance_num asks for. Check the spelling and case, or supply if_not_found.
Combine the two functions: `=TEXTBEFORE(TEXTAFTER(A2,"("),")")` returns the text between the first opening and closing bracket.
TEXTAFTER is taught in Logic and text, lesson 13: TEXTBEFORE and TEXTAFTER. Each lesson is a short, graded exercise like the one above.