ExcelFlux

SUBSTITUTE function

Normalize ID punctuation while retaining leading zeros.

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 invoice prefixes by content rather than position. The match is case-sensitive.

A worked example from the workbook

RowAB
6DocumentNew segment
7INV-042NEW
8INV-119RCV
9INV-126ARC
Record 1
=SUBSTITUTE(A7,"INV",B7)

Expected resultNEW-042

See the inputs and instructions for all 3 examples

Copyable formulas

English Excel · en-US
=SUBSTITUTE("P-001","-","")
Turkish Excel · tr-TR
=YERİNEKOY("P-001";"-";"")

Example and expected result

Replace the hyphen with empty text. Keep the identifier as text.

Expected result P001.

Worked examples

Replace invoice prefixes by content rather than position. The match is case-sensitive.

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 Document New segment
7 INV-042 NEW
8 INV-119 RCV
9 INV-126 ARC
Case Formula Expected result
Record 1 =SUBSTITUTE(A7,"INV",B7) NEW-042
Record 2 =SUBSTITUTE(A8,"INV",B8) RCV-119
Record 3 =SUBSTITUTE(A9,"INV",B9) ARC-126
Microsoft Excel reference