Change the First Digit of Six-Digit Numbers in Excel
Question details
Change the leading digit from 1 to 2 only in six-digit values, preserving the other five digits.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A worksheet contains values such as 122811 that need to be changed to 222811 without altering other digits or nonmatching values.
- Observed behavior
- Only six-digit values beginning with 1 should receive a new first digit; other populated values should remain unchanged.
Identify the column containing the values and choose an empty adjacent column for the formula. Check that the values are stored as six digits, rather than merely displayed with six digits by number formatting.
Use a Formula to Replace the Leading Digit
Use this method to change only six-digit values that begin with 1 and leave other populated values unchanged.
If the first value is in A1, select B1 and enter =IF(AND(LEN(A1)=6,LEFT(A1,1)="1"),"2"&RIGHT(A1,5),A1). Adjust A1 if your data starts in another cell.
Drag the fill handle from the bottom-right corner of B1 down alongside the populated cells in column A.
Compare the original values in column A with column B. For example, 122811 should become 222811, while 105440 should become 205440.
Select and copy the results in column B, then select A1 and use Home > Paste > Paste Special > Values to replace the original values without copying the formulas.

Change Leading Digits in WPS Spreadsheet
Use the same conditional formula in WPS Spreadsheet to change the first digit of matching six-digit values, then paste the results as values if needed.
- 1. Open the workbook: Open WPS Spreadsheet and use File > Open to select your workbook.
- 2. Enter the formula: If your first value is in A1, select B1 and enter =IF(AND(LEN(A1)=6,LEFT(A1,1)="1"),"2"&RIGHT(A1,5),A1).
- 3. Apply it to the column: Drag the fill handle on B1 down beside the populated source cells, then check the results.
- 4. Paste values if needed: Copy the result cells, select A1, and use Home > Paste > Paste Special > Values to replace the originals.

Frequently Asked Questions
Will the formula change every 1 in a value?
No. It changes only the first digit, and only when the value has six digits and begins with 1. The remaining five digits are preserved.
What happens to values that do not match?
A populated value that is not six digits long or does not begin with 1 is returned unchanged. An empty source cell may return 0.
Why is the changed result stored as text?
The formula joins "2" to the last five digits with the & operator, which produces text. If you need numbers for calculations, convert the pasted results to numbers after checking them.
Can I use the formula with a different starting cell?
Yes. Replace both references to A1 in =IF(AND(LEN(A1)=6,LEFT(A1,1)="1"),"2"&RIGHT(A1,5),A1) with the cell containing your first value. The formula contains four A1 references in total; update all of them.




