MS Excel: How to use the REPLACE Function (WS)
This Excel tutorial explains how to use the Excel REPLACE function with syntax and examples.
Description
The Microsoft Excel REPLACE function replaces a sequence of characters in a string with another set of characters.
The REPLACE 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 REPLACE function can be entered as part of a formula in a cell of a worksheet.
Please read our REPLACE function (VBA) page if you are looking for the VBA version of the REPLACE function as it has a very different syntax.
Syntax
The syntax for the REPLACE function in Microsoft Excel is:
REPLACE( old_text, start, number_of_chars, new_text )
Parameters or Arguments
- old_text
- The original string value.
- start
- The position in old_text to begin replacing characters.
- number_of_chars
- The number of characters to replace in old_text.
- new_text
- The replacement set of characters.
Returns
The REPLACE 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 REPLACE function examples and explore how to use the REPLACE function as a worksheet function in Microsoft Excel:
Based on the Excel spreadsheet above, the following REPLACE examples would return:
=REPLACE(A1, 1, 5, "Beta") Result: "Betabet Soup" =REPLACE(A2, 5, 2, "1234") Result: "tech1234thenet.com" =REPLACE("apples", 2, 5, "te") Result: "ate"
Advertisements