ExcelFlux

REPLACE function

Replaces characters within text.

Text

Where can you use it?

Data preparation and reporting teams. Use this group to clean, split or reformat IDs, names and descriptions before using them in reports.

Scenario in the workbook

Replace three characters starting at position five in a fixed-width code. The position and length are independent.

A worked example from the workbook

RowAB
6InputSecond input
7INV-03592B
8REF-12550C
9POX-37210A
Record 1
=REPLACE(A7,5,3,B7)

Expected resultINV-92B

See the inputs and instructions for all 3 examples

Copyable formulas

English Excel · en-US
=REPLACE("INV-042",5,3,"125")
Turkish Excel · tr-TR
=DEĞİŞTİR("INV-042";5;3;"125")

Expected result

“INV-125”

Worked examples

Replace three characters starting at position five in a fixed-width code. The position and length are independent.

Open the English sheet. Inputs begin at A6. F7:F9 show the live results and G7:G9 show the original results for comparison.

Row A B
6 Input Second input
7 INV-035 92B
8 REF-125 50C
9 POX-372 10A
Case Formula Expected result
Record 1 =REPLACE(A7,5,3,B7) INV-92B
Record 2 =REPLACE(A8,5,3,B8) REF-50C
Record 3 =REPLACE(A9,5,3,B9) POX-10A
Microsoft Excel reference