Excel Substitute Function

This post will guide you how to use Excel SUBSTITUTE function with syntax and examples in Microsoft excel.

Description

The Excel SUBSTITUTE function replaces a new text string for an old text string in a text string.

The SUBSTITUTE function is a build-in function in Microsoft Excel and it is categorized as a Text Function.

The SUBSTITUTE function is available in Excel 2016, Excel 2013, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000, Excel 2011 for Mac.

Syntax

The syntax of the SUBSTITUTE function is as below:

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

Where the SUBSTITUTE function arguments are:
Text -This is a required argument. The text string that containing the old text to be substituted with new text string.
Old_text – This is a required argument. The substring that you want to replace.
New_text – This is a required argument. The new substring to replace Old_text substring with.
Instance_num – This is an optional argument.  The number value will specify which occurrence of old substring you want to replace with new substring.
Note: If Instance_num value is omitted, every occurrence of old substring will be replaced with new substring.

Excel SUBSTITUTE Function Example

The below examples will show you how to use Excel SUBSTITUTE Text function to replace old substring with a new substring.

#1 To substitute first instance of “excel”old text string with a new text string “Microsfot excel” in B1 cell, just using formula=SUBSTITUTE(B1,”excel”,” Microsfot excel”,1).

excel substitute function example1

#2  To substitute second instance of “excel”old text string with a new text string “excelfunction” in B1 cell, just using formula: =SUBSTITUTE(B1,”excel”,” excelfunction “,2).

excel substitute function example2


More Excel SUBSTITUTE Function Examples

  • Remove Leading and Trailing Spaces
    To remove leading and trailing spaces from text string in Cells, you can use the TRIM function to remove extra spaces.If you want to quickly remove leading and trailing spaces, you can write an  Excel VBA macro code…
  • Remove Spaces from a String
    how to remove extra spaces between words or text string from the specified range of cells in excel. How to delete all spaces from excel cells. …
  • Sort List of Cells by Word Count
    If you want to sort the list by word count in excel, you need to create an excel formula based on the LEN function and the SUBSTITUTE function…….
  • Replace Last Comma in String with “and” word
    If you have a list of data (B1:B4) that contain the text string and each word is separated by comma character. And you want to replace the last comma character with a new word “and”.You need to create a new complex formula based on the SUBSTITUTE function, and the LEN function to achieve the result……..
  • Insert The File Path and Filename into Cell
    If you want to insert a file path and filename into a cell in your current worksheet, you can use the CELL function to create a formual……..
  • Removing Dash Characters in Excel
    If you want to remove all dash characters in one cell in Excel, you can use a formula based on the SUBSTITUTE function……..
Related Posts

Find and Replace Multiple Values

This post will guide you how to find and replace multiple values at once with VBA macro or using formula  in Excel. How do I make multiple find and replace in Excel. Suppose that you have a few cells containing ...

Extract Last Two Words From Multiple Cells

Just assume that you have a few cells containing values/words and you want to extract the last two words from each cell into another separate cell; then you might think that it's not a big deal; because you would prefer ...

Extract Multiple Lines From A Cell

Suppose that you have listed some text in a single cell which is separated by the line break(you can do it by pressing ALT + ENTER after entering the text), and now you want to extract multiple lines of text ...

How to Remove All Asterisk Characters from Cells in Excel

Sometimes when we opening an excel spreadsheet to check data, we may notice that there are some asterisks exist in texts for security or other reasons. If you feel these special characters are invalid you can remove them from cells. ...

How to Convert Date Format from Dot MM.DD.YYYY to Slash MM/DD/YYYY in Excel

We often enter dates in excel tables, and we can enter current date by quickly press ‘Ctrl+;’ simultaneously. If in some cases we enter a date format that is not what we want, we have to switch the date format ...

Sidebar