Excel guide · 4 min read
How to extract text after a character in Excel
=TEXTAFTER(A2,"-") to return everything after the first dash. In any version, =MID(A2,FIND("-",A2)+1,LEN(A2)) does the same: FIND locates the dash, and MID starts one character later and takes the rest.Sample data
Every result on this page was calculated from this sheet by the same spreadsheet engine the Cellwise app uses.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Order ref | Product code | Ticket | File path |
| 2 | Order #48213 | TSH-RED-L | Priority: High | Finance/2026/Q3/budget.xlsx |
| 3 | Order #48214 | MUG-BLU-12 | Priority: Low | Sales/leads.csv |
| 4 | Order #48219 | CAP-BLK-OS | Priority: Medium | HR/2026/rota.xlsx |
| 5 | Phone order | BAG-GRN-XL | Priority: High | readme.txt |
Method 1: TEXTAFTER (Excel 365 and 2024)
TEXTAFTER takes the text and the delimiter, and returns whatever follows the first match. The delimiter can be several characters long, so ": " drops both the colon and the space after it in one go. No TRIM needed.
TEXTAFTER is available in Excel for Microsoft 365, Excel for the web and Excel 2024. In Excel 2021 and older it returns #NAME?, so use Method 2 in files you share with people on older versions.
Result: Medium
Returns "Medium", the text after the colon and space.
Method 2: MID and FIND (every version)
FIND returns the position of the character. Add 1 so you start just after it. MID then takes characters from that point on. For the length, LEN(B3) is simply "more than enough": MID stops at the end of the text, so you never need to work out the exact count.
You will also see =RIGHT(B3,LEN(B3)-FIND("-",B3)). It gives the same answer by counting how many characters sit to the right of the dash. MID is easier to adapt when the delimiter is longer than one character: change the +1 to the delimiter's length.
Result: BLU-12
Returns "BLU-12". FIND gives 4 for the first dash, so MID starts at character 5.
After the second occurrence
Product codes like TSH-RED-L have more than one dash. To get just the size, start the second FIND one character after the first dash. It skips the first match and lands on the second one.
In Excel 365, TEXTAFTER has an instance_num argument that does this directly: =TEXTAFTER(B2,"-",2) returns the text after the second dash.
Result: L
Returns "L", the size after the second dash.
After the last occurrence (file names from paths)
Paths have a different number of slashes on every row, so "the second slash" is no use. You want the last one. In Excel 365, =TEXTAFTER(D2,"/",-1) does it: a negative instance_num counts from the end.
In older versions, count the slashes with LEN minus LEN of the text with the slashes removed. Then use SUBSTITUTE's instance argument to swap only that last slash for a character that never appears in your data, such as |. FIND locates the |, and MID takes everything after it.
Result: budget.xlsx
Returns "budget.xlsx". There are 3 slashes, so only the third becomes | and MID starts after it.
Turn the extracted part into a number
TEXTAFTER, MID and RIGHT always return text, even when the result looks like 48213. Text numbers sit on the left of the cell, SUM skips them, and lookups against real numbers fail. Wrap the formula in VALUE, or add +0 or -- in front.
Result: 48213
Returns the number 48213, ready to sum, sort or look up.
When the character is missing
Row 5 says "Phone order" with no # at all. FIND returns #VALUE! and TEXTAFTER returns #N/A when the delimiter is not there. Wrap the formula in IFERROR to show a blank or a message instead.
TEXTAFTER also has its own if_not_found argument, the sixth one: =TEXTAFTER(A5,"#",,,,"") returns an empty string without IFERROR, which is safer because it will not hide other errors.
Result: "" (empty text, so the cell looks blank)
Returns an empty cell instead of #VALUE!, because there is no # in "Phone order".
Common mistakes
Forgetting the +1
=MID(B2,FIND("-",B2),LEN(B2)) starts on the dash itself and returns "-RED-L". Add 1 to start after it, or add the delimiter's length if it is longer than one character.
A stray space at the start of the result
With "Priority: High", splitting on ":" leaves " High". Include the space in the delimiter (": ") or wrap the result in TRIM.
Using FIND for letters that may be capitalised differently
FIND is case-sensitive, so FIND("x",A2) misses "X". Use SEARCH when case should not matter.
Summing the extracted numbers
The result is text and SUM ignores it. Convert with VALUE or -- before adding.
FAQ
How do I extract text after a space in Excel?
Use =TEXTAFTER(A2," ") in Excel 365, or =MID(A2,FIND(" ",A2)+1,LEN(A2)) in any version. For a full name, this returns everything after the first name.
How do I get the text after the last comma or slash?
In Excel 365, use a negative instance number: =TEXTAFTER(A2,"/",-1). In older Excel, use the SUBSTITUTE and MID formula above, which swaps only the last slash for a marker and takes the text after it.
Can I extract text after a character without a formula?
Yes. Data > Text to Columns with your character as the delimiter splits the column into pieces. Or type the first result in the next column and press Ctrl+E for Flash Fill. Neither updates when the source changes.
Why does TEXTAFTER give #NAME?
Your version of Excel does not have it. TEXTAFTER is in Microsoft 365, Excel for the web and Excel 2024. Use MID with FIND instead.
Functions used
TEXTAFTERText after a delimiterMIDCharacters from the middleFINDPosition of text (case-sensitive)LENLength of textSUBSTITUTEReplaces textVALUEText to numberIFERRORFallback when a formula errorsRIGHTCharacters from the end
Related guides
- How to extract text before a character in Excel
- How to extract the domain from an email address in Excel
- How to separate first and last name in Excel
- How to remove characters from a cell in Excel
- How to replace text in Excel with a formula
- How to extract numbers from a string in Excel
- How to add leading zeros in Excel
Updated