Substitute

Finds instances of a text value and substitutes it with a different text value.

Syntax

Substitute(text, findText, newText, [numberOfInstances])

The Substitute function syntax has the following arguments:

  • Text Required. The text or the reference to a cell containing text for which you want to substitute characters.

  • findText Required. The text you want to replace.

  • newText Required. The text you want to replace findText with.

  • numberOfInstances Optional. Specifies which occurrence of findText you want to replace with newText. If you specify numberOfInstances, only that instance findText is replaced. Otherwise, every occurrence of findText in text is changed to newText.

Example

FormulaResult
=Substitute("the brown fox", "brown", "yellow")the yellow fox