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
Argument | Type | Description |
---|---|---|
string | String | The string to do substitutions within |
old | String | The existing string to replace |
new | String | The new string to use during replacing |
instance | Number | (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"
Updated 10 months ago