REPLACE replaces part of a text string, based on the number of characters you specify, with a different text string.
REPLACE always counts each character, no matter what the default language setting is.
REPLACE(old_text, start_num, num_chars, new_text)
The REPLACE function syntax has the following arguments:
- Old_text Required. Text in which you want to replace some characters.
- Start_num Required. The position of the character in old_text that you want to replace with new_text.
- Num_chars Required. The number of characters in old_text that you want REPLACE to replace with new_text.
- New_text Required. The text that will replace characters in old_text.
|2||abcdefghijk||=REPLACE(A2,6,5,"*")||abcde*k||Replaces five characters in abcdefghijk with a single * character, starting with the sixth character (f).|
|4||123456||=REPLACE(A4,1,3,"@")||@456||Replaces the first three characters of 123456 with a single @ character.|