Increment a Number in the Middle of an Excel Text String
Question details
Create sequential identifiers with an incrementing number in the middle and leading zeros preserved.

- 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.
Choose an empty column for the identifiers and decide which prefix, suffix, starting number, and minimum number of digits you need.
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.
Select the first output cell, such as B2, and enter ="XXX/"&TEXT(ROW(A1),"0000")&"/2022-23". Press Enter.
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.
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.

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. Open a spreadsheet: Open WPS Office, choose Spreadsheet, and open an existing workbook or create a blank one.
- 2. Enter the formula: Select an empty cell and enter ="XXX/"&TEXT(ROW(A1),"0000")&"/2022-23", then press Enter.
- 3. Extend the sequence: Select the formula cell and drag its fill handle down to create as many identifiers as needed.
- 4. Save the workbook: Choose File > Save As and select an Excel-compatible format such as XLSX.

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.




