These docs are for v1.0. Click to read the latest docs for v1.2.

SUBSTITUTE

Replaces a string with another string in a specified string. If an instance number is specified, only substitutes the instance-th match.

Syntax

=SUBSTITUTE(string, old, new, instance)

Arguments

ArgumentTypeDescription
stringStringThe string to do substitutions within
oldStringThe existing string to replace
newStringThe new string to use during replacing
instanceNumber(Optional) Instance found in which substitution occurs

Examples

=SUBSTITUTE("ABACADAE", "A", "X")"XBXCXDXE"
Replaces every character "A" with the character "X"

=SUBSTITUTE("ABACADAE", "A", "X", 3)"ABACXDAE"
Replaces the 3rd instance of the character "A" with the character "X"