Excel function

SUBSTITUTEfunction

Replaces specific text inside a text with other text.

All versions
=SUBSTITUTE("2026-11-17", "-", "/")

Text10 chars

12
20
32
46
5-/
61
71
8-/
91
107

Result10 chars

12
20
32
46
5/
61
71
8/
91
107

Click a "-" in the text strip to replace only that one. Clear new_text to remove the characters. Try breaking it on purpose to see the errors.

Result

2026/11/17

text

The text containing the characters to replace.

old_text

The text to replace. It is case-sensitive and does not use wildcards.

new_text

The text to put in its place. Leave it empty to remove the matches.

instance_num

Which occurrence to replace. Leave it out to replace all.

What is the SUBSTITUTE function?

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

SUBSTITUTE finds specific characters in a text and replaces them with others. It is widely used to clean data, such as changing date separators or removing hyphens and spaces.

Leave out instance_num to replace every match; give a number to replace only that occurrence. Clicking a character in the strip above sets instance_num to its order.

Arguments

text
The text or cell containing the characters to replace.
old_text
The text to replace. It is case-sensitive.
new_text
The text to put in its place. "" (empty text) removes the matches.
instance_num
Optional. Which occurrence to replace.

SUBSTITUTE examples

  1. Example 1. Change a separator

    =SUBSTITUTE("2026-11-17", "-", "/")

    "2026/11/17".

  2. Example 2. Replace only the second

    =SUBSTITUTE("2026-11-17", "-", "/", 2)

    "2026-11/17".

  3. Example 3. Remove hyphens

    =SUBSTITUTE("2026-11-17", "-", "")

    "20261117".

  4. Example 4. Example from Microsoft

    =SUBSTITUTE("Quarter 1, 2011", "1", "2", 3)

    Only the third "1" changes: "Quarter 1, 2012".

Common mistakes

FAQ

Replace several things at once?
Nest SUBSTITUTE: =SUBSTITUTE(SUBSTITUTE(A2,"-",""),"/","")
What if old_text is not found?
The original text is returned unchanged.