Remove Specific Characters from Text

Excel Formulas › Text

All versionsSUBSTITUTE

To strip out unwanted characters — dashes and parentheses from phone numbers, currency symbols, stray punctuation — nest SUBSTITUTE calls, each replacing one character with nothing. It’s the reliable way to clean codes and IDs.


Quick formula: to remove dashes, spaces, and parentheses from a phone number:
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A2,"-",""),"(",""),")","")," ","")
Each SUBSTITUTE(…, char, ) deletes one character; nest them to remove several.

Functions used (tap for the full reference guide):

The example

Phone numbers stripped to digits only.

AB
1RawDigits only
2(555) 123-45675551234567
3555-987-65435559876543

The formula

Cleaned to digits:

=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A2,"(",""),")",""),"-","")," ","") // "(555) 123-4567" → "5551234567"

How it works

Each SUBSTITUTE peels off one character:

  1. SUBSTITUTE(A2, "(", "") removes every open parenthesis by replacing it with an empty string.
  2. Wrap that in another SUBSTITUTE for ")", another for "-", another for " " — each layer strips one more character.
  3. The innermost runs first, so the result of one feeds into the next.
  4. What’s left is just the characters you didn’t remove — here, the digits.

Keep only digits (Excel 365): instead of removing each junk character, keep the wanted ones: =TEXTJOIN("",1,IFERROR(MID(A2,SEQUENCE(LEN(A2)),1)*1,"")) keeps numeric characters and drops everything else.

Try it: interactive demo

Live demo

Type text and the characters to remove (no separators).

Result:

Variations

Remove all non-digits (365)

Keep only the numbers:

=TEXTJOIN("",1,IFERROR(MID(A2,SEQUENCE(LEN(A2)),1)*1,""))

Remove line breaks

Strip CHAR(10):

=SUBSTITUTE(A2, CHAR(10), "")

Remove a word, not a character

SUBSTITUTE works on strings too:

=TRIM(SUBSTITUTE(A2, "Inc.", ""))

Pitfalls & errors

Nesting gets unwieldy. For many characters, the formula grows long. The 365 “keep only digits” approach is cleaner when you want one character class.

SUBSTITUTE is case-sensitive. Removing “inc” won’t catch “Inc.” Match the case, or LOWER the text first.

Result is text. A “cleaned” phone number is still text; wrap in VALUE only if you truly need a number (and don’t mind losing leading zeros).

Practice workbook

📊
Download the free Remove Specific Characters from Text practice workbook
Phone numbers cleaned with nested SUBSTITUTE (results shown), the keep-only-digits and remove-line-break variants, plus 4 challenges with answers. No sign-up required.

Frequently asked questions

How do I remove specific characters from text in Excel?
Nest SUBSTITUTE calls, each replacing one character with an empty string: =SUBSTITUTE(SUBSTITUTE(A2,"-",""),"(",""). Add a layer per character you want gone.
How do I keep only the numbers in a cell?
In Excel 365 use =TEXTJOIN("",1,IFERROR(MID(A2,SEQUENCE(LEN(A2)),1)*1,"")), which keeps numeric characters and drops the rest.
How do I remove line breaks from a cell?
Use =SUBSTITUTE(A2, CHAR(10), "") to strip line-feed characters, or CLEAN(A2) to remove non-printing characters in bulk.

Stop fighting formulas. Learn them in a day.

This recipe is one of hundreds of real-world formulas we teach. Our Excel Formulas & Functions class covers lookups, logic, text, and dynamic arrays hands-on — live in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.

See the Formulas & Functions Class

Related formulas: Clean up messy text · Find and replace text · Extract numbers from text

Function references: SUBSTITUTE · TEXTJOIN