Insert a Period After the Third Character of ICD-10 Codes in Excel
Question details
Insert a period after the third character of an ICD-10 code only when additional characters exist, accounting for trailing spaces.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A worksheet contains ICD-10 codes that need a decimal point before the fourth character.
- Observed behavior
- Codes longer than three characters should receive a period after the third character; shorter codes should remain unchanged.
Identify the column containing your codes and choose an empty column for the results. Check that the codes do not already contain periods or leading spaces.
Use an Excel Formula to Insert the Period
Use this formula when the source codes are in column D and trailing spaces should not affect the length check.
Click E2, or another empty cell on the same row as the first code in D2.
Type =IF(LEN(TRIM(D2))<=3,D2,REPLACE(TRIM(D2),4,0,".")) and press Enter.
Drag the fill handle from E2 down alongside the remaining codes in column D.
Confirm that a code such as E119 becomes E11.9 and a three-character code such as E11 remains unchanged.

Preserve Trailing Spaces in the Formatted Codes
Use this variation if trailing spaces in longer codes must remain in the result.
Format ICD-10 Codes in WPS Spreadsheets
Use a formula in WPS Spreadsheets to insert a period after the third character of longer ICD-10 codes while leaving shorter codes unchanged.
- 1. Open the worksheet: Open WPS Spreadsheets and select Open to load the file containing the ICD-10 codes.
- 2. Choose a result cell: Click an empty cell such as E2 next to the first code in D2.
- 3. Enter the formula: Enter =IF(LEN(TRIM(D2))<=3,D2,REPLACE(TRIM(D2),4,0,".")) and press Enter.
- 4. Fill the column: Drag the fill handle down from E2 to apply the formula to the other rows.

Frequently Asked Questions
Will the formula add a period to a three-character code?
No. The IF function checks the length after TRIM removes surrounding spaces. If the trimmed code has three or fewer characters, it returns the original cell unchanged.
What happens if a code already contains a period?
The formula does not check for an existing period, so it can add another one. Check the source column and remove existing periods before applying it.
How can I keep trailing spaces in longer codes?
Use =IF(LEN(TRIM(D2))<=3,D2,REPLACE(D2,4,0,".")) in an empty cell. Make sure the source codes have no leading spaces, because the insertion position is based on the original cell.
How do I apply the formula to an entire list?
Enter the formula next to the first code, then drag the result cell's fill handle down to the last row. Excel or WPS Spreadsheets will adjust the cell reference for each row.




