SUBSTITUTE Function
Replace occurrences of a text in a string with another text. SUBSTITUTE replaces old_text in text with new_text, and is case-sensitive. When instance_num is given, only that occurrence is replaced; otherwise every occurrence is. An instance_num of zero or less returns #VALUE!. Use REPLACE to replace text at a position instead.
Syntax
SUBSTITUTE(text, old_text, new_text, instance_num)
Category: Text. Minimum arguments: 3. Maximum arguments: 4.
Available for supported offline calculation.
Examples
=SUBSTITUTE("a-b-b","b","x",2)
The formula returns a-b-x: only the second b is replaced.
Cell and range examples require appropriate input values in the referenced cells. Handle invalid arguments, formula errors and array and spill constraints.