SUBSTITUTE function
OriginalText
The original text string.
OldText
The text string to be replaced.
NewText
The replacement text.
Which
A number which specifies which occurrence of the second parameter to replace (counting from the left). If omitted, 1 is assumed.
Returns
The resulting text string.
Substitutes new text for old text in a text string and returns it. SUBSTITUTE("abc def", "def", "xyz")SUBSTITUTE("abc def"; "def"; "xyz") returns "abc xyz", a version of the first parameter where all occurrences of the second parameter, "def", have been replaced by the third parameter, "xyz".
Use REPLACE to replace text where the position of the text to be replaced is known. Use REGEXREPLACE to replace text using powerful regular expressions which find the text to replace.
Examples
Returns "abc xyz".
Returns "abc xyz". The regular expression "d\w\w" matches a literal "d", followed by exactly two letters, thereby matching "def".