SUBSTITUTE replaces old text with new text in a string.


SUBSTITUTE (text,old,new,which)

  • text is the text in which text segments are to be exchanged.
  • old is the text segment that is to be replaced (a number of times).
  • new is the text that is to replace the text segment.
  • which is an optional argument that indicates how many occurrences of the search text are to be replaced. If this parameter is missing the search text is replaced throughout.


SUBSTITUTE("123123123","3","abc") returns 12abc12abc12abc.

SUBSTITUTE("123123123","3","abc",2) returns 12312abc123.