MS Excel: REPLACE Function (WS)
The Microsoft Excel REPLACE function replaces a sequence of characters in a string with another set of characters. Please note that the VBA version of the REPLACE function has different syntax.
REPLACE Function (Syntax)
The syntax for the Microsoft Excel REPLACE function is:
REPLACE( old_text, start, number_of_chars, new_text )
old_text is the original string value.
start is the position in old_text to begin replacing characters.
number_of_chars is the number of characters to replace in old_text.
new_text is the replacement set of characters
The REPLACE function can be used in the following versions of Microsoft Excel:
- Excel 2013, Excel 2011 for Mac, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000
Type of Excel Function
The REPLACE function can be used in Microsoft Excel as:
- Worksheet function (WS)
REPLACE Examples (as Worksheet Function)
Let's look at some Excel REPLACE function examples and explore how you would use the REPLACE function as a worksheet function in Microsoft Excel:
Based on the Excel spreadsheet above, the following REPLACE function examples would return:
|=REPLACE(A1, 1, 5, "Beta")||would return "Betabet Soup"|
|=REPLACE(A2, 5, 2, "1234")||would return "tech1234thenet.com"|
|=REPLACE("apples", 2, 5, "te")||would return "ate"|