Example 1
Remove a character
C2 =SUBSTITUTE(A2,"-","")
Result: FX1010BLK
Replacing the dash with an empty string deletes every dash.
C2 =SUBSTITUTE(A2,"-","") returns FX1010BLK
Replaces specific text inside a string with other text. It matches case exactly and can target one occurrence.
Syntax
=SUBSTITUTE(, , , )
All versions of Excel.
Try it
Edit the formula in C2 or change the inputs. The sheet recalculates as you type.
C2 =SUBSTITUTE(A2,"-","") returns FX1010BLK
SUBSTITUTE replaces specific text inside a string with other text. Use it to strip dashes from a code, swap one word for another, turn line breaks into spaces, or change just the second dash in a reference. It finds text by what it says, not where it sits. For position-based edits, use REPLACE.
"" removes the old text.2, only the second occurrence changes.=SUBSTITUTE("FX-1010-BLK","-","") returns FX1010BLK. =SUBSTITUTE("PW-24-0113","-","/",2) returns PW-24/0113, because only the second dash was replaced.
=SUBSTITUTE("Ltd and LTD","ltd","Limited") changes nothing, because neither word is spelled ltd. If case should not matter, make both sides the same case first. =SUBSTITUTE(LOWER(A2),"ltd","limited") finds every spelling, at the price of turning the whole text into lower case. SUBSTITUTE has no wildcards either: * and ? are ordinary characters.
SUBSTITUTE changes one piece of text per call, so to change several, nest the calls. =SUBSTITUTE(SUBSTITUTE(A2," ",""),"-","") removes both spaces and dashes. Excel works from the inside out, so the inner result becomes the first argument of the outer call. For many replacements, a nest of four or five is the practical limit for readability. In Microsoft 365, you can keep it readable with LET.
"", as in the dash example above.=SUBSTITUTE(A2,CHAR(10)," "). CLEAN would delete the line break and join the words.=SUBSTITUTE(A2,UNICHAR(160)," ") converts it.=LEN(A2)-LEN(SUBSTITUTE(A2,",","")).Use SUBSTITUTE when you know what to change. Use REPLACE when you know where. =REPLACE(A2,1,3,"NSW") overwrites the first three characters, whatever they were. SUBSTITUTE with the same old and new text swaps every match, wherever it appears.
SUBSTITUTE always returns text, even if the result looks like a number. After removing a thousands comma from "1,250", you get "1250" as text. Wrap it in VALUE to turn it into a number. If old_text is not found, SUBSTITUTE returns the original text unchanged and doesn't show an error.
A2.* and ? are ordinary characters, not wildcards."" to delete old_text.1 for the first, 2 for the second, and so on. If you leave it out, every occurrence is replaced.Each example is a live sheet. Change the inputs or the formula and watch the result.
Example 1
C2 =SUBSTITUTE(A2,"-","")
Result: FX1010BLK
Replacing the dash with an empty string deletes every dash.
C2 =SUBSTITUTE(A2,"-","") returns FX1010BLK
Example 2
C2 =SUBSTITUTE(A2,"-","/",2)
Result: PW-24/0113
instance_num 2 limits the change to the second dash. Without it, both dashes would become slashes.
C2 =SUBSTITUTE(A2,"-","/",2) returns PW-24/0113
Example 3
C2 =SUBSTITUTE(SUBSTITUTE(A2," ",""),"-","")
Result: 0255500142
The inner SUBSTITUTE removes the space. The outer one removes the dash from the result. The answer is text, so the leading zero stays.
C2 =SUBSTITUTE(SUBSTITUTE(A2," ",""),"-","") returns 0255500142
Example 4
C2 =SUBSTITUTE(A2,UNICHAR(160)," ")
Result: Floor cleaner
The space in A2 is character 160, which TRIM cannot remove. UNICHAR(160) names it so SUBSTITUTE can swap it for an ordinary space.
C2 =SUBSTITUTE(A2,UNICHAR(160)," ") returns Floor cleaner
Solve it in the sheet. Every answer is checked, with hints if you need them.
Task 1 of 2
In B2, return the SKU in A2 with the dashes removed. Fill it down to B5.
Answer in B2, then it fills down to B5.
=SUBSTITUTE(A2,"ltd","Limited") leaves "LTD" and "Ltd" alone. Convert with LOWER first, or nest one call per spelling.=SUBSTITUTE(A2,"*","") removes literal asterisks, not "anything".=LEN(A2)."1250" won't be counted by SUM. Wrap the formula in VALUE.SUBSTITUTE(A2,UNICHAR(160)," ").Replace it with an empty string: `=SUBSTITUTE(A2,"-","")`. To remove several characters, nest the calls: `=SUBSTITUTE(SUBSTITUTE(A2,"-","")," ","")`.
SUBSTITUTE finds text by its content: "replace every dash". REPLACE works by position: "overwrite 3 characters starting at position 1". Use SUBSTITUTE when the text is known and REPLACE when the location is known.
Yes. `"Ltd"` and `"LTD"` are different. To ignore case, convert the text with LOWER or UPPER before substituting, and use the same case for old_text.
Use the fourth argument: `=SUBSTITUTE(A2,"-","/",2)` replaces only the second dash. Leave it out to replace all of them.
The space may be a non-breaking space, character 160, which looks identical. Use `=SUBSTITUTE(A2,UNICHAR(160),"")`. A trailing line break needs `CHAR(10)` instead.
SUBSTITUTE is taught in Logic and text, lesson 9: SUBSTITUTE. Each lesson is a short, graded exercise like the one above.