The SUBSTITUTE function substitutes new text for old text in a text string. This enables you to replace a specified text string with another text string (see REPLACE if you wish to replace text at a specific location in a text string).
text contains the text string that is to be replaced.
old_text is the text that is to be replaced.
new_text is the text that is to be substituted for old_text.
instance_num specifies which instance of old_text is to be replaced (if this is omitted all instances of old_text are replaced).
For example:
SUBSTITUTE("Happy New Year", "New Year", "Birthday")
returns "Happy Birthday"
SUBSTITUTE("Apri1/1/1997", "9", "8", 2)
returns "April/1/1987"
SUBSTITUTE(SUBSTITUTE("(x + y)/(x - y)", "(", "["), ")", "]")
returns "[x + y]/[x - y]"
See also: