Excel SUBSTITUTE Function

SUBSTITUTE replaces matching text inside a text value.

Use it to clean labels, swap separators, remove known words, normalize IDs, or replace only one occurrence of repeated text.

1
Choose source text This is the string to edit
2
Find exact text Excel searches for old_text
3
Replace matches All or one occurrence can change

SUBSTITUTE syntax & arguments

Syntax

=SUBSTITUTE(text, old_text, new_text, [instance_num])
Required Optional
  1. 1

    text

    Required

    The text value, cell reference, or formula result where replacements should happen.

  2. 2

    old_text

    Required

    The exact text to find inside text. SUBSTITUTE is case-sensitive.

  3. 3

    new_text

    Required

    The text that should replace each matched old_text value.

  4. 4

    instance_num

    Optional

    Which occurrence of old_text to replace. If omitted, SUBSTITUTE replaces every occurrence.

Example

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

Replace every hyphen in A2 with a space.

SUBSTITUTE caveats

  • It is case-sensitive

    "ID" and "id" are different matches. SUBSTITUTE only replaces text that matches the case you provide.

  • Omitting instance_num replaces every match

    Use instance_num only when one specific occurrence should change and other matches should remain.

  • Spaces are part of the match

    old_text must match every character, including leading, trailing, or repeated spaces.

Cleaning messy labels? Use TRIM after SUBSTITUTE when the replacement can leave extra spaces behind.

Intro SUBSTITUTE practice problems

No intro SUBSTITUTE problems are currently available.

Advanced SUBSTITUTE practice problems

Use SUBSTITUTE alongside other Excel functions in realistic, less-prescriptive challenges.