Templates, guides & honest tool reviews for small business

Sunday, November 29, 2026

SUBSTITUTE Function in Excel: Replace Text, Remove Characters and Count Them

SUBSTITUTE function in Excel with examples
Illustration: SUBSTITUTE function in Excel

The SUBSTITUTE function in Excel replaces specific text inside a cell with new text. =SUBSTITUTE(A2, "-", "") removes every hyphen from the text in A2. The REPLACE function does a similar job by position instead of by matching text. This guide shows both, explains when to use which, and covers replacing only the second match, removing several characters, counting a character and fixing common mistakes. The sample data is made up.

SUBSTITUTE syntax

=SUBSTITUTE(text, old_text, new_text, [instance_num])

  • text is the cell or text to change.
  • old_text is the text to find.
  • new_text is what to put in its place.
  • instance_num is optional. It says which match to replace. Leave it out to replace all of them.

SUBSTITUTE is case sensitive. "a" and "A" are different to it.

SUBSTITUTE function syntax in Excel
Text, old, new, instance (illustration).

Replace text in a cell

To change "Blue" to "Navy" in A2:

=SUBSTITUTE(A2, "Blue", "Navy")

Remove a character

Use an empty string as the new text. To remove hyphens from a phone number such as 555-0100:

=SUBSTITUTE(A2, "-", "")

The result is 5550100, but it may be text, so convert it with VALUE if you need a number.

Remove hyphens from a phone number with SUBSTITUTE in Excel
Made-up numbers (illustration).

Remove several characters

Nest SUBSTITUTE calls. To remove hyphens, spaces and brackets:

=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A2, "-", ""), " ", ""), "(", "")

The inner call runs first, and each outer call works on the result.

Replace only one occurrence

Add the instance number. To change only the second hyphen in "A-B-C" to a slash:

=SUBSTITUTE(A2, "-", "/", 2)

The result is "A-B/C".

REPLACE: change text by position

=REPLACE(old_text, start_num, num_chars, new_text)

REPLACE does not look for text. It cuts out a number of characters from a position and puts new text in. To replace the first 3 characters of "ABC123" with "XYZ":

=REPLACE(A2, 1, 3, "XYZ")

Use REPLACE when the position is fixed, and SUBSTITUTE when you know the text but not where it is.

SUBSTITUTE versus REPLACE in Excel
By text or by position (illustration).

Count how many times a character appears

Compare the length before and after you remove the character:

=LEN(A2) - LEN(SUBSTITUTE(A2, ",", ""))

This counts the commas in A2. It works for one character. For a longer piece of text, divide the result by its length.

Count a character in a cell with LEN and SUBSTITUTE
Length before and after (illustration).

Clean up hidden spaces

SUBSTITUTE can swap the non-breaking space, character 160, for a normal space with =SUBSTITUTE(A2, CHAR(160), " "). The full method is in our guide to removing extra spaces in Excel.

Find and Replace instead

Ctrl+H changes the cells directly, in one step. SUBSTITUTE keeps the original and leaves a formula. Use the formula when the data is refreshed or you need to keep the source. Related text tools are covered in the LEFT, RIGHT and MID guide and the TEXT function guide.

Common mistakes

  • Wrong case. "blue" will not match "Blue".
  • Wildcards. SUBSTITUTE does not use * or ?. It treats them as plain characters.
  • Result is text. A number made by SUBSTITUTE is text until you convert it.
  • Forgetting the quotes. Text arguments need double quotes.

Questions and answers

Is SUBSTITUTE case sensitive?

Yes. Use UPPER or LOWER on the text first if you need to ignore case.

What is the difference between SUBSTITUTE and REPLACE?

SUBSTITUTE finds text and replaces it. REPLACE swaps characters at a position.

Does it work in Google Sheets?

Yes. Google Sheets has SUBSTITUTE and REPLACE with the same arguments.

Can I replace several different words at once?

Nest the calls as shown above. For a long list of words, a helper table and a different approach may be easier.

العربية