Function Problems

Increment a Number in the Middle of an Excel Text String

Kushani NimanthikaKushani Nimanthika Nov 18, 2026 869 views

Question details

Create sequential identifiers with an incrementing number in the middle and leading zeros preserved.

Increment a Number in the Middle of an Excel Text String
Product
Microsoft Excel
Device & OS
not provided
Scenario
Generate identifiers such as XXX/0001/2022-23 while keeping the prefix and suffix fixed.
Observed behavior
The numeric portion should increase in each row, producing identifiers such as XXX/0001/2022-23 and XXX/0002/2022-23.
Before you start

Choose an empty column for the identifiers and decide which prefix, suffix, starting number, and minimum number of digits you need.

Solution 1Recommended

Use TEXT and ROW to increment the middle number

Use a formula to generate identifiers with a fixed prefix and suffix and a four-digit number.

1
Enter the formula

Select the first output cell, such as B2, and enter ="XXX/"&TEXT(ROW(A1),"0000")&"/2022-23". Press Enter.

2
Fill the formula down

Select the formula cell and drag its fill handle down the column. The relative reference A1 changes to A2, A3, and so on, incrementing the number.

3
Check the results

Confirm that the first rows show XXX/0001/2022-23 and XXX/0002/2022-23. Edit the quoted prefix or suffix in the formula if needed.

Use TEXT and ROW to increment the middle number
Numbers above 9999: The format "0000" sets a minimum of four digits; numbers above 9999 will display all their digits.
Create sequential identifiers

Generate sequential text identifiers in WPS Spreadsheet

Use the same TEXT and ROW formula in WPS Spreadsheet to increment the middle of an identifier while keeping leading zeros and fixed text.

  1. 1. Open a spreadsheet: Open WPS Office, choose Spreadsheet, and open an existing workbook or create a blank one.
  2. 2. Enter the formula: Select an empty cell and enter ="XXX/"&TEXT(ROW(A1),"0000")&"/2022-23", then press Enter.
  3. 3. Extend the sequence: Select the formula cell and drag its fill handle down to create as many identifiers as needed.
  4. 4. Save the workbook: Choose File > Save As and select an Excel-compatible format such as XLSX.
Generate numbered identifiers with leading zerosCompatible with Microsoft Excel XLSX and XLS filesFill formulas down a column using a familiar spreadsheet interfaceFree and easy to use
microsoft office alternative - wps office

Frequently Asked Questions

How do I start the sequence at a number other than 1?

Add an offset inside the formula. For example, use ="XXX/"&TEXT(ROW(A1)+99,"0000")&"/2022-23" to start at 0100, then fill the formula down.

How can I change the number of leading zeros?

Change the TEXT format in the formula. For example, use "00000" for a minimum of five digits, producing 00001 as the first number.

Can I change the prefix or year suffix?

Yes. Edit the quoted text in the formula, such as "XXX/" or "/2022-23", and fill the revised formula down.

Will the sequence still work if the first formula is not in row 1?

Yes. Enter ROW(A1) in the first formula cell, even if that cell is B2 or another location. When you fill down, the reference advances to A2, A3, and so on.