Skip to main content

SUBSTITUTE

The SUBSTITUTE function replaces existing text with new text in a text string.

Syntax

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

Parameters

  • text: The text or reference to a cell containing text in which you want to substitute characters
  • old_text: The text you want to replace
  • new_text: The text you want to replace old_text with
  • instance_num: Optional. Specifies which occurrence of old_text you want to replace

Examples

=SUBSTITUTE("Hello World", "o", "0") // Returns "Hell0 W0rld"
=SUBSTITUTE("Hello World", "o", "0", 1) // Returns "Hell0 World"
=SUBSTITUTE("Hello Hello", "Hello", "Hi") // Returns "Hi Hi"