Features of !SEMTools
↑ Navigate Excel tasks and !SEMTools add-in features ↑

TEXTAFTER

, creator of !SEMToolsPublished 5 min read

The TEXTAFTER function returns everything after a delimiter. To get “In stock” from “Status: In stock”, use a colon followed by a space as the delimiter. If you need to process an entire column in place, use the text extraction tool.

TEXTAFTER syntax and Excel versions

TEXTAFTER is one of the Excel text functions available in Excel 2024 and Microsoft 365.

=TEXTAFTER(text, delimiter, [instance_num], [match_mode], [match_end], [if_not_found])
ArgumentWhat to enter
textThe string or cell containing the text.
delimiterThe character or string to look for, such as “@” or a colon followed by a space.
instance_numDefaults to 1. Use 2 for the second match from the left or −1 for the last match.
match_modeUse 0 for a case-sensitive match or 1 to ignore case. The default is 0.
match_endUse 1 to count the end of the string as another delimiter. The default, 0, only counts actual matches.
if_not_foundWhat to return instead of #N/A. This can be the source text, an empty string, or a label for review.

Get text after a character or string

Column A contains the source and column B contains the delimiter. Select a result in column C to copy its formula. The delimiter in the first row of data includes a space on either side of the vertical bar.

Text after the first delimiter
C2=TEXTAFTER(A2,B2)
ABC
1Source textDelimiterResult
2SKU-041 | USB-C adapter | USB-C adapter=TEXTAFTER(A2,B2)
3Status: In stock: In stock=TEXTAFTER(A3,B3)
4SKU-0042-0042=TEXTAFTER(A4,B4)
5sales@example.com@example.com=TEXTAFTER(A5,B5)

The delimiter itself stays out of the result. If you need the other half, use TEXTBEFORE to get the text before the delimiter. I use the tool for extracting text after a character for one-off checks on a full column. To keep the first half of each cell in place, use the procedure that removes text after a character.

Get text after the second or last delimiter

In “Operations / Warehouse / Dallas / Reserve”, instance 2 returns “Dallas / Reserve”. Instance −1 counts from the right and returns “Reserve”. The same setting returns the file name after the last slash in a path.

Count delimiters from the left or from the right
C2=TEXTAFTER(A2,B2)
ABCDE
1Source textDelimiterAfter firstAfter secondAfter last
2Operations / Warehouse / Dallas / Reserve / Warehouse / Dallas / Reserve=TEXTAFTER(A2,B2)Dallas / Reserve=TEXTAFTER(A2,B2,2)Reserve=TEXTAFTER(A2,B2,-1)
3north/retail/invoices/2026.pdf/retail/invoices/2026.pdf=TEXTAFTER(A3,B3)invoices/2026.pdf=TEXTAFTER(A3,B3,2)2026.pdf=TEXTAFTER(A3,B3,-1)

Handle case, missing delimiters, and the end of a string

Column C uses the default match settings. Each formula in column D changes one option. The blank result in D4 contains a formula you can still select and copy.

What the fourth, fifth, and sixth arguments change
C2=TEXTAFTER(A2,B2)
ABCD
1Source textDelimiterDefault matchChanged setting
2CODE: QX-19code: #N/A=TEXTAFTER(A2,B2)QX-19=TEXTAFTER(A2,B2,,1)
3SKU-0042:#N/A=TEXTAFTER(A3,B3)SKU-0042=TEXTAFTER(A3,B3,,,,A3)
4Status: Reserve: #N/A=TEXTAFTER(A4,B4,2)=TEXTAFTER(A4,B4,2,,1)

In the first row of data, match_mode 1 lets “code: ” match “CODE: ”. In the next row, if_not_found returns the original text from A3 because there is no colon. In the last row, instance_num is 2. With match_end set to 1, the end of the string counts as the second delimiter, so the formula returns an empty string.

If you get #N/A even though the delimiter looks correct, check its case, the spaces around it, and the instance number. Instance 0 returns #VALUE!. An asterisk or question mark in the delimiter matches the literal character.

Extract text between parentheses

Use TEXTAFTER to get everything after the opening parenthesis, then TEXTBEFORE to stop at the closing parenthesis. This can pull a pack size from a product name. To return every part in a separate cell, use TEXTSPLIT.

Pack size between parentheses
B2=TEXTBEFORE(TEXTAFTER(A2,"("),")")
AB
1Product namePack size
2USB-C cable (2-pack) black2-pack=TEXTBEFORE(TEXTAFTER(A2,"("),")")

Alternatives to TEXTAFTER in Excel 2013 and 2021

In Excel 2013, FIND gives the position of the first delimiter. Add its length with LEN to get the starting position for MID. Using the length of the source as the character count gives MID enough room to return everything after the delimiter.

Text after the first delimiter in Excel 2013
C2=MID(A2,FIND(B2,A2)+LEN(B2),LEN(A2))
ABC
1Source textDelimiterResult
2Operations :: Warehouse :: Warehouse=MID(A2,FIND(B2,A2)+LEN(B2),LEN(A2))
3SKU-0042-0042=MID(A3,FIND(B3,A3)+LEN(B3),LEN(A3))
4sales@example.com@example.com=MID(A4,FIND(B4,A4)+LEN(B4),LEN(A4))

The same formula works in Excel 2021. To start after the last slash, use LET with SEQUENCE to generate character positions. IF keeps the slash positions for MAX to find the last one. If the cell has no slash, the formula returns the entire string.

File name after the last slash in Excel 2021
B2=LET(pos,SEQUENCE(MAX(1,LEN(A2))),MID(A2,MAX(IF(MID(A2,pos,1)="/",pos,0))+1,LEN(A2)))
AB
1File pathFile name
2D:/Reports/2026/Balance.xlsxBalance.xlsx=LET(pos,SEQUENCE(MAX(1,LEN(A2))),MID(A2,MAX(IF(MID(A2,pos,1)="/",pos,0))+1,LEN(A2)))
3Readme.txtReadme.txt=LET(pos,SEQUENCE(MAX(1,LEN(A3))),MID(A3,MAX(IF(MID(A3,pos,1)="/",pos,0))+1,LEN(A3)))
4D:/Reports/=LET(pos,SEQUENCE(MAX(1,LEN(A4))),MID(A4,MAX(IF(MID(A4,pos,1)="/",pos,0))+1,LEN(A4)))

Extract text after a delimiter with !SEMTools

Select the column with the file paths. Go to EXTRACT → Characters → After substring... → First from right, not including, then enter the delimiter. Run it on a copy of the column when you need to keep the original values.

To keep the text after the first match, use the tool for deleting through the first delimiter. It leaves the rest of the cell intact.

Extract file names, product codes, or status values directly in a selected range with !SEMTools. Choose the delimiter and run the tool without writing a formula or filling it down.

Choose a method for extracting text after a delimiter

Use a formula when the result needs to update with the source. In most cases two arguments are enough. Add the instance number when the delimiter repeats. For a one-time cleanup of a selected column, use the extraction tool.