SUBSTITUTE function
Replaces every occurrence (or one chosen occurrence) of a specific text with new text. Case-sensitive.
Available in All versions of Excel, including Microsoft 365, Excel for Mac and Excel for the web
In every Excel versionWorks in Google Sheets
Syntax
SUBSTITUTE(text, old_text, new_text, [instance_num])| Argument | What it means | |
|---|---|---|
text | Required | The text or cell to change. |
old_text | Required | The exact text to find. Case matters. |
new_text | Required | The text to put in its place. "" deletes old_text. |
instance_num | Optional | Which occurrence to replace (1 = first, 2 = second ...). Omit it to replace all of them. |
Returns: The text with the replacements made.
How SUBSTITUTE works
SUBSTITUTE is Excel's find-and-replace in formula form. It looks for an exact piece of text and swaps it for another, everywhere it appears: =SUBSTITUTE(A2,"-","") removes all hyphens from a phone number, =SUBSTITUTE(A2,"St.","Street") expands abbreviations. Unlike the Replace dialog (Ctrl+H) it leaves the original data untouched and updates automatically when the data changes.
The optional fourth argument replaces only one specific occurrence: instance_num 2 changes the second match and leaves the others. SUBSTITUTE is case-sensitive, so "st." will not replace "St."; it does not support wildcards. To change several different things, nest SUBSTITUTE calls inside each other.
A classic trick uses SUBSTITUTE to count: the length of a text minus the length of the same text with every comma removed equals the number of commas. Use REPLACE when you know the position rather than the content, and REGEXREPLACE for pattern-based replacements in Microsoft 365.
Examples
1Remove hyphens from phone numbers
| A | B | |
|---|---|---|
| 1 | Contact | |
| 2 | Phone: 210-555-0147 | Phone: 2105550147 |
Result: Phone: 2105550147
Every hyphen is replaced with an empty string; the rest of the text is unchanged.
2Replace only the second occurrence
| A | B | |
|---|---|---|
| 1 | Date (text) | |
| 2 | 2026-03-15 | 2026-03/15 |
Result: 2026-03/15
With instance_num 2 only the second hyphen becomes a slash.
3Count items in a list
| A | B | |
|---|---|---|
| 1 | Order items | |
| 2 | pens, paper, ink, toner | 4 |
Result: 4
Removing the commas makes the text 3 characters shorter, so there are 3 commas and therefore 4 items.
4Several replacements at once
| A | B | |
|---|---|---|
| 1 | Address | |
| 2 | 12 Baker St., Mill Rd. | 12 Baker Street, Mill Road |
Result: 12 Baker Street, Mill Road
The inner SUBSTITUTE expands St.; the outer one then expands Rd. in the result.
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
#VALUE! | instance_num is 0 or negative. | Use 1 or higher, or leave it out to replace every occurrence. |
Tips
- SUBSTITUTE is case-sensitive. For a case-insensitive replacement use REGEXREPLACE with
case_sensitivity1, or convert the text with LOWER first. =SUBSTITUTE(A2,CHAR(160)," ")fixes non-breaking spaces from web data that TRIM cannot remove.- SUBSTITUTE on a number returns text; wrap in VALUE to get a number back, e.g.
=VALUE(SUBSTITUTE(A2,"$","")).
Questions
What is the difference between SUBSTITUTE and REPLACE?
SUBSTITUTE swaps a known piece of text wherever it is. REPLACE swaps whatever is at a given position.
How do I make several replacements in one formula?
Nest the calls: =SUBSTITUTE(SUBSTITUTE(A2,"a","b"),"c","d"). In Microsoft 365, REDUCE with LAMBDA can apply a whole replacement table.
Can SUBSTITUTE use wildcards?
No, it only replaces exact text. Use REGEXREPLACE for patterns.
Google Sheets
SUBSTITUTE also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.
SUBSTITUTE in other languages
In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.
| Language | Function name |
|---|---|
| Czech | DOSADIT |
| Danish | UDSKIFT |
| Dutch | SUBSTITUEREN |
| Finnish | VAIHDA |
| French | SUBSTITUE |
| German | WECHSELN |
| Hungarian | HELYETTE |
| Italian | SOSTITUISCI |
| Norwegian (Bokmål) | BYTT.UT |
| Polish | PODSTAW |
| Portuguese (Brazil) | SUBSTITUIR |
| Portuguese (Portugal) | SUBST |
| Russian | ПОДСТАВИТЬ |
| Spanish | SUSTITUIR |
| Swedish | BYT.UT |
| Turkish | YERİNEKOY |
Recipes that use SUBSTITUTE
- How to create a dependent drop-down list in Excel
- How to extract text between two characters in Excel
- How to remove line breaks in Excel
- How to remove spaces in Excel
- How to split first and last name in Excel