Replaces existing text with new text in a string.
SUBSTITUTE("search for it","search for","Google")
SUBSTITUTE(A2,"new york","New York")
SUBSTITUTE("January 2, 2012",2,3,1)
SUBSTITUTE(text_to_search, search_for, replace_with, [occurrence_number])
text_to_search- The text within which to search and replace.
search_for- The string to search for within
search_forwill match parts of words as well as whole words; therefore a search for
"vent"will also replace text within
replace_with- The string that will replace
occurrence_number- [ OPTIONAL ] - The instance of
text_to_searchto replace with
replace_with. By default, all occurrences of
search_forare replaced; however, if
occurrence_numberis specified, only the indicated instance of
SUBSTITUTEcan be used to replace one or all instances of a string within
text_to_search. It cannot be used to replace multiple, but not all instances within a single call.
- This function returns text as the output. If a number is desired, try using the
VALUEfunction in conjunction with this function.
TEXT: Converts a number into text according to a specified format.
REPLACE: Replaces part of a text string with a different text string.
Andrew is a Docs and Sheets expert and author of this help page. Leave him feedback below about the page.