What REPLACE does
REPLACE swaps out characters based on where they sit in the text string. It is useful when the part you want to change always appears in the same position, such as fixed-width imports, account masks, or code formatting.
Practical examples
Replace the first three characters
=REPLACE(A2,1,3,"SKU")
If A2 starts with an old prefix, this formula swaps that prefix for SKU.
Mask part of an ID
=REPLACE(A2,5,4,"XXXX")
This is useful when you want to hide part of a value while keeping the rest visible.
Common mistakes and notes
REPLACE works by position
If the target text does not always start in the same place, SUBSTITUTE is usually safer because it matches the text itself.
start_num counts from 1
Excel text positions start at 1, not 0. Off-by-one mistakes are the most common reason for wrong output.
num_chars controls removal length
If you remove too few or too many characters, the formula still runs but returns the wrong text. Double-check the width of the piece you want to replace.