SUBSTITUTE replaces every occurrence of one text string with another inside a cell — the formula-based equivalent of find and replace.
SUBSTITUTE replaces occurrences of a specified text string within a larger string. Unlike Find & Replace which changes cells permanently, SUBSTITUTE does it inside a formula — non-destructively, dynamically, and on the fly.
=SUBSTITUTE(text, old_text, new_text, [instance_num])| Argument | Description |
|---|---|
| =SUBSTITUTE(text, old_text, new_text, [instance_num]) | |
| text required | The string to search in. |
| old_text required | The text to find and replace. |
| new_text required | The replacement text. Use "" to delete the old_text entirely. |
| [instance_num] optional | Which occurrence to replace. Omit to replace all occurrences. |
=SUBSTITUTE(A2, " ", "")Replaces every space with nothing — different from TRIM which keeps single spaces between words.
=SUBSTITUTE(A2, "-", "")Turns "INV-2026-001" into "INV2026001".
=SUBSTITUTE(A2, "Ltd", "Limited")Updates all instances of "Ltd" to "Limited" in a company name.
=SUBSTITUTE(A2, "-", "/", 2)The instance_num 2 replaces only the second hyphen.
=LEN(A2)-LEN(SUBSTITUTE(A2,",",""))Count commas: original length minus length without commas.
SUBSTITUTE shines when you have data from multiple sources that uses different conventions for the same thing. One system uses "Ltd", another uses "Limited", a third uses "LTD". SUBSTITUTE standardises all of them: =SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A2,"LTD","Ltd"),"LIMITED","Ltd"),"limited","Ltd"). Chain SUBSTITUTE formulas to handle all variations.
Another powerful use is removing characters that should not exist in a value — like removing all spaces from a phone number to get a consistent dialable format: =SUBSTITUTE(A2," ",""). Or removing all hyphens from product codes before comparison: =SUBSTITUTE(A2,"-","").
SUBSTITUTE is also how you count occurrences of a character. =LEN(A2)-LEN(SUBSTITUTE(A2,",","")) counts the number of commas — which tells you how many items are in a comma-separated list. Divide by the character length of what you're searching for if it is more than one character.
Practice this formula yourself — type it in a real spreadsheet and get instant feedback. Free, no download needed.
Start the Excel Basics track free →