totn Excel Functions

MS Excel: How to use the SUBSTITUTE Function (WS)

This Excel tutorial explains how to use the Excel SUBSTITUTE function with syntax and examples.

Description

The Microsoft Excel SUBSTITUTE function replaces a set of characters with another.

The SUBSTITUTE function is a built-in function in Excel that is categorized as a String/Text Function. It can be used as a worksheet function (WS) in Excel. As a worksheet function, the SUBSTITUTE function can be entered as part of a formula in a cell of a worksheet.

Syntax

The syntax for the SUBSTITUTE function in Microsoft Excel is:

SUBSTITUTE( text, old_text, new_text, [nth_appearance] )

Parameters or Arguments

text
The original string to use to perform the substitution.
old_text
The existing characters to replace.
new_text
The new characters to replace old_text with.
nth_appearance
Optional. It is the nth appearance of old_text that you wish to replace. If this parameter is omitted, then every occurrence of old_text will be replaced with new_text.

Returns

The SUBSTITUTE function returns a string/text value.

Applies To

  • Excel for Office 365, Excel 2019, Excel 2016, Excel 2013, Excel 2011 for Mac, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000

Type of Function

  • Worksheet function (WS)

Example (as Worksheet Function)

Let's look at some Excel SUBSTITUTE function examples and explore how to use the SUBSTITUTE function as a worksheet function in Microsoft Excel:

Microsoft Excel

Based on the Excel spreadsheet above, the following SUBSTITUTE examples would return:

=SUBSTITUTE(A1, "bet", "con", 1)
Result: "Alphacon soup"

=SUBSTITUTE(A2, "t", "4", 2)
Result: "techon4henet.com"

=SUBSTITUTE(A2, "t", "4")
Result: "4echon4hene4.com"