The Excel REPLACE function is used to replace existing characters in a cell with a different set of characters, or with nothing. These unwanted characters can appear as a result of importing or copying data into Excel.
The syntax for the REPLACE function is:
=REPLACE(old_text, start_num, num_chars, new_text)
Argument | Purpose |
---|---|
Old_text | The text that you want to change. Usually entered as a cell reference |
Start_num | The start position of the first character in old_text that you want to replace |
Num_chars | The number of characters from start_num that you want to replace |
New_text | The new data to be added. Leave it blank to just remove the unwanted characters |
The examples below show the REPLACE function being used change characters in an existing cell.
Function | Result |
---|---|
=REPLACE(A2,1,5,) | 1,245.40 |
=REPLACE(A3,6,4,”Duo”) | Hans Duo |
=REPLACE(A4,9,4,”crazy”) | Computercrazy |