Skip to content
Excel

SUBSTITUTE function in Excel

Substitutes new text for old text in a text string

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

SUBSTITUTE syntax and parameters

Four arguments, three required.

  • textstringRequired

    The text or the reference to a cell containing text for which you want to substitute characters.

  • old_textstringRequired

    The text you want to replace.

  • new_textstringRequired

    The text you want to replace old_text with.

  • instance_numnumberOptional

    Specifies which occurrence of old_text you want to replace with new_text. If you specify instance_num, only that instance of old_text is replaced. Otherwise, every occurrence of old_text in text is changed to new_text.

SUBSTITUTE examples

Formulas you'll actually reuse.

  1. Strip the hyphens out of a phone number or SKU:

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

    Result"NYC10422"

  2. Replace only the first space — the fourth argument picks which occurrence:

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

    Result"Maria-Lopez Garcia"

SUBSTITUTE in Google Sheets

Same name — your formula ports as-is.

Try SUBSTITUTE in the playground

Edit the example — nothing to install.

Preloaded with the SUBSTITUTE formula from Example 1 — change anything and watch it respond.

Loading the editor…