Replacing Text With SUBSTITUTE
Swap out characters or words inside a string with SUBSTITUTE.
The Need to Replace Text
Data often needs find-and-replace inside formulas: stripping dashes from phone numbers, swapping a word, or removing stray symbols.
The SUBSTITUTE function finds a piece of text inside a cell and replaces every occurrence with new text, all without changing the original cell.
It is the formula-based equivalent of Find & Replace, but it updates automatically as your data changes.
The SUBSTITUTE Syntax
SUBSTITUTE takes up to four arguments:
- text the original string or cell
- old_text the text to find
- new_text the text to put in its place
- instance_num (optional) which occurrence to replace
The shape is =SUBSTITUTE(text, old_text, new_text, [instance_num]). If you omit the last argument, all occurrences are replaced.
=SUBSTITUTE(A2, "-", "")All lessons in this course
- Merging Text With CONCAT
- Joining With Separators Using TEXTJOIN
- Changing Case With UPPER, LOWER, PROPER
- Replacing Text With SUBSTITUTE