XcelFormulas
  • Excel Formulas
  • Formula by Task
  • Most Used Formulas

Archives

  • October 2026
  • September 2026

Categories

  • Excel Formulas
  • Excel Formulas
  • Formula by Task
  • Most Used Formulas
0 Likes
0 Followers
0 Followers
XcelFormulas
XcelFormulas
  • Excel Formulas
  • Formula by Task
  • Most Used Formulas
  • Excel Formulas

SUBSTITUTE Function in Excel

  • October 22, 2026
  • Hawk
Total
0
Shares
0
0
0
Total
0
Shares
Share 0
Tweet 0
Pin it 0
Share 0
Share 0
Share 0
What To Read Hide
  1. SUBSTITUTE Function Syntax and Arguments
  2. Example 1: Remove Dashes From Phone Numbers Using SUBSTITUTE
  3. Example 2: Replace a Word Using SUBSTITUTE (Street to St)
  4. Example 3: Remove All Spaces From Text Using SUBSTITUTE
  5. Example 4: Replace Only the Nth Occurrence Using instance_num
  6. Example 5: Substitute Multiple Characters Using Nested SUBSTITUTE
  7. Example 6: Count How Many Times a Character Appears
  8. SUBSTITUTE vs REPLACE: What’s the Difference?
    1. Excel SUBSTITUTE Function

If you want to swap out specific text inside your cells—such as stripping dashes from phone numbers or shortening “Street” to “St”—the Excel SUBSTITUTE function is the tool you need. Unlike manual Find and Replace methods that permanently alter your data, SUBSTITUTE runs dynamically via formulas so your original text stays intact and updates automatically.

A lot of people reach for Find and Replace, but that changes your data permanently and can’t run down a whole column live as the data changes. SUBSTITUTE does it with a formula, so the original stays put and the result updates on its own.

In this article, I’ll show you how to use SUBSTITUTE in Excel with six practical examples, from cleaning phone numbers to replacing only a specific occurrence of a word.

SUBSTITUTE Function Syntax and Arguments

SUBSTITUTE replaces specific text in a string with new text you choose. It looks for the actual characters you name, not a position in the cell.

Here is the syntax:

=SUBSTITUTE(text, old_text, new_text, [instance_num])

Here is what each argument means:

  • text – The text (or the cell holding it) you want to change.
  • old_text – The text you want to find and replace.
  • new_text – The text you want to put in its place.
  • instance_num – (Optional) Which occurrence of old_text to replace. Leave it out and every occurrence gets replaced.

Pro Tip: SUBSTITUTE is case-sensitive. “St” and “st” are treated as two different things, so make sure old_text matches the exact case in your cells.

SUBSTITUTE works in every modern version of Excel, including Excel 2019, 2021, 2024, Microsoft 365, and the web version.

Example 1: Remove Dashes From Phone Numbers Using SUBSTITUTE

Let’s start with a common cleanup job. Below I have a list of phone numbers in column A that were entered with dashes, and I want a clean version with the dashes removed.

Excel dataset showing a column of phone numbers with dashes and an empty column for cleaned numbers

Here is the formula:

=SUBSTITUTE(A2:A11,"-","")
Excel formula =SUBSTITUTE(A2:A11, "-", "") used to remove dashes from a list of phone numbers in column B

I gave old_text a dash and new_text an empty string (“”), which tells Excel to remove the dashes instead of swapping them for something.

If you’re on Microsoft 365 or Excel 2021 and later, one formula in the top cell fills the whole column on its own. This is called a spill, and you don’t need to drag anything down.

On Excel 2019 or older, write it for the first row as =SUBSTITUTE(A2,"-","") and copy it down the column instead.

Example 2: Replace a Word Using SUBSTITUTE (Street to St)

Now let’s swap one word for another. Below I have a list of street addresses in column A, and I want to shorten the word “Street” to “St” in each one.

Excel dataset showing a column of full addresses with Street and an empty column for Shortened Address

Here is the formula:

=SUBSTITUTE(A2:A11,"Street","St")
Excel formula =SUBSTITUTE(A2:A11, "Street", "St") used to replace Street with St in a list of addresses

Excel finds “Street” in each address and replaces it with “St”, leaving the house number and everything else untouched.

The single formula in the top cell spills the cleaned addresses down the whole column in Microsoft 365 and Excel 2021 or later.

Remember the case rule here. “Street” will not match “street” with a lowercase s, so type old_text exactly as it appears in your data.

Example 3: Remove All Spaces From Text Using SUBSTITUTE

Sometimes you need text with no spaces at all, like turning a name into a username or cleaning up a code. Below I have a list of full names in column A, and I want to remove every space.

Excel dataset with Full Name in column A and empty No Spaces column B for SUBSTITUTE function practice

Here is the formula:

=SUBSTITUTE(A2:A11," ","")
Excel formula =SUBSTITUTE(A2:A11, " ", "") used to remove spaces from full names in column B

Here old_text is a single space and new_text is an empty string, so every space in the name gets stripped out.

This removes all spaces, including the ones in the middle. If you only want to trim spaces from the start and end, use the TRIM function instead, which keeps single spaces between words.

Example 4: Replace Only the Nth Occurrence Using instance_num

This is where SUBSTITUTE does something Find and Replace can’t. You can tell it to change only one specific occurrence of the text and leave the rest alone.

Below I have a list of file paths in column A. Each uses a dash as a separator, and I want to replace only the second dash with a slash, keeping the first dash as is.

Excel dataset with file paths in column A and a header for replacing the second dash with a slash in column B

Here is the formula:

=SUBSTITUTE(A2:A11,"-","/",2)
Excel formula bar showing SUBSTITUTE function replacing the second dash with a slash in a list of file paths

The 4th argument (instance_num) is set to 2, so Excel replaces only the second dash and leaves the first one alone. Change it to 1 and it would swap only the first dash.

This is the answer to “what is instance number in SUBSTITUTE”. It’s simply which occurrence you want to target, counting from the left. Leave it out and every occurrence gets replaced.

Example 5: Substitute Multiple Characters Using Nested SUBSTITUTE

SUBSTITUTE only handles one piece of text per call, but you can nest several together to clean up multiple characters at once. Below I have a list of product codes in column A with slashes and dots mixed in, and I want to remove both.

Excel dataset with Product Code column containing slashes and dots, ready for nested SUBSTITUTE function processing

Here is the formula:

=SUBSTITUTE(SUBSTITUTE(A2:A11,"/",""),".","")
Excel formula bar showing a nested SUBSTITUTE function to remove slashes and periods from product codes in column B

The inner SUBSTITUTE removes the slashes first. That cleaned text is then passed to the outer SUBSTITUTE, which removes the dots. You can keep nesting more layers to strip additional characters.

Read it from the inside out. The result of each SUBSTITUTE becomes the text argument for the next one wrapped around it.

Example 6: Count How Many Times a Character Appears

You can use SUBSTITUTE for a handy counting trick too. Below I have a list of sentences in column A, and I want to count how many times the letter “a” appears in each one.

Excel dataset with 10 sentences in column A and an empty Count of a column B for SUBSTITUTE function practice

Here is the formula:

=LEN(A2)-LEN(SUBSTITUTE(A2,"a",""))
Excel formula using SUBSTITUTE and LEN to count occurrences of the letter a in column A cells

The idea is simple. LEN measures the original length, then you measure the length again after SUBSTITUTE removes every “a”. The difference tells you how many “a” characters were there, a neat way to count characters in Excel.

I’ve kept this one as a per-row formula that you copy down, since it reads more clearly that way. Remember it counts lowercase “a” only, because SUBSTITUTE is case-sensitive.

SUBSTITUTE vs REPLACE: What’s the Difference?

These two functions sound similar but work in opposite ways, and mixing them up is a common mistake.

  • SUBSTITUTE replaces text by matching the actual characters. You tell it what text to find, and it swaps every match (or a specific one) regardless of where it sits.
  • REPLACE replaces text by position. You tell it to start at character 3 and change the next 4 characters, without caring what those characters are.

Use SUBSTITUTE when you know the text you want to change, like a word or a symbol. Use the Excel REPLACE Function when you know the exact position in the string, like the first three digits of a code.

Hawk

Excel SUBSTITUTE Function

Excel SUBSTITUTE Function
0 100 0 1
Master the Excel SUBSTITUTE function. Learn text replacement syntax, how to remove dashes, swap words, target specific instances, and nest formulas.
Master the Excel SUBSTITUTE function. Learn text replacement syntax, how to remove dashes, swap words, target specific instances, and nest formulas.
Total
0
Shares
Share 0
Tweet 0
Pin it 0
Related Topics
  • Data Cleaning
  • Excel Formulas
  • Excel SUBSTITUTE Function
  • Excel Tutorial
  • Spreadsheet Tips
  • Sumit Bansal
  • Trump Excel
Hawk

Previous Article
  • Excel Formulas

Excel CONCATENATE function

  • October 22, 2026
  • Hawk
View Post
You May Also Like
View Post
  • Excel Formulas

Excel CONCATENATE function

  • Hawk
  • October 22, 2026
View Post
  • Excel Formulas

Step-by-step Guide to VLOOKUP vs HLOOKUP & XLOOKUP for Excel and Google Sheets

  • Hawk
  • October 21, 2026
View Post
  • Excel Formulas

Excel HLOOKUP formula

  • Hawk
  • October 21, 2026
View Post
  • Excel Formulas

How to Use the Excel COUNTIFS Function (With Examples)

  • Hawk
  • October 20, 2026
View Post
  • Excel Formulas

IFERROR formula in Excel With Examples

  • Hawk
  • October 20, 2026
View Post
  • Excel Formulas

How to Make a Checklist in Excel in 5 Easy Steps

  • Hawk
  • October 19, 2026
View Post
  • Excel Formulas

How to Create a Scroll Bar in Excel – Step by Step Tutorial

  • Hawk
  • October 19, 2026
View Post
  • Excel Formulas

VSTACK HSTACK

  • Hawk
  • October 17, 2026
Recent Posts
  • Excel CONCATENATE function
    • October 22, 2026
  • Step-by-step Guide to VLOOKUP vs HLOOKUP & XLOOKUP for Excel and Google Sheets
    • October 21, 2026
  • Excel HLOOKUP formula
    • October 21, 2026
XcelFormulas
  • Contact Us
  • Privacy Policy
  • Terms and Conditions
  • Cookie Policy
  • Disclaimer
  • Sitemap
Excel Formulas & Functions

Input your search keywords and press Enter.