REPLACE Function In Excel
This Excel Tutorial demonstrates how to use the Excel REPLACE Function in Excel to replace text in a cell, with formula examples.
REPLACE Function Description:
The REPLACE Function Replaces a part of a text string, defined by it’s location within the cell, with a new text string.
|Replace 5 Characters||=REPLACE(C5,D5,E5,F5)||replaced text|
|Replace All Remaining Characters||=REPLACE(C6,D6,E6,F6)||replace|
|Replace & Find||=REPLACE(C7,FIND(” this”,C7),E7,F7)||replaced text|
Syntax and Arguments:
The Syntax for the REPLACE Formula is:
Function Arguments ( Inputs ):
old_text – The original string of text.
start_num – The character number from which to start replacing.
num_chars – The number of characters you wish to replace.
new_text – The replacement text.
Use the REPLACE Function when you want to replace text based on it’s location, regardless of content. You may want to use Excel’s FIND Function or Excel’s SEARCH Function to determine the start location. You may also wish to use the LEN Function to count the number of characters to replace.
Use the Substitute Function to find and replace specific strings of text, ignoring location.
REPLACE Examples in VBA
You can also use the REPLACE function in VBA. Type:
For the function arguments (old_text, etc.), you can either enter them directly into the function, or define variables to use instead.
Return to the List of all Functions in Excel
How to use the REPLACE Function in Excel:
To use the AND Excel Worksheet Function, type the following into a cell:
After entering it in the cell, notice how the AND formula inputs appear below the cell:
You will need to enter these inputs into the function. The function inputs are covered in more detail in the next section. However, if you ever need more help with the function, after typing “=REPLACE(” into a cell, without leaving the cell, use the shortcut CTRL + A (A for Arguments) to open the “Insert Function Dialog Box” for detailed instructions:
For more information about the REPLACE Formula visit the