How to Replace Characters by Position in Excel

REPLACE swaps characters at a given position — great for codes with a fixed layout. Roll invoice numbers into a new fiscal year.

You will learn to

  • Overwrite characters at a fixed position with REPLACE
  • Insert characters by replacing zero characters
  • Find the position first, then REPLACE

How it works

=REPLACE(old_text, start_num, num_chars, new_text) removes num_chars characters starting at start_num and puts new_text in their place. =REPLACE("FY25-0042",3,2,"26") returns "FY26-0042". Because it works by position, REPLACE is ideal for codes with a fixed layout, where SUBSTITUTE might change the wrong match.

Set num_chars to 0 to insert without deleting: =REPLACE("ACC10442",4,0,"-") returns "ACC-10442". When the position varies, calculate it with FIND first, e.g. =REPLACE(A2,FIND("v",A2)+1,1,"4").

=REPLACE(A2,3,2,"26")