Home › Functions › Text › SUBSTITUTE
Text function
SUBSTITUTE function in Google Sheets
SUBSTITUTE replaces specific text inside a cell with something else, everywhere it appears or just one occurrence. It's a find-and-replace that lives in a formula.
Syntax
=SUBSTITUTE(text_to_search, search_for, replace_with, [occurrence_number])
text_to_searchThe original text. search_forThe text to replace. replace_withThe new text ("" to delete). occurrence_numberOptional. Replace only this occurrence (1 = first).
Practice SUBSTITUTE
Remove all the dashes from the phone number in A2 . Answer in B2 .
Check answer
Hint
Show answer
↻ New data
Tip: while typing a formula, click a cell or drag across cells to insert references. Press Enter to check, and Tab to accept a function suggestion.
This interactive exercise needs JavaScript enabled.
SUBSTITUTE examples
Each example below runs against this sample sheet. The results are calculated by the same engine as the practice grid.
Messy imported data
Tips and common mistakes
SUBSTITUTE is case-sensitive: searching for "refund" won't replace "Refund". Nest several SUBSTITUTEs to replace different things in one go.
Related functions
Learning step by step? SUBSTITUTE is covered in Lesson 27: SUBSTITUTE Function of the free course.