Microsoft 365 / Troubleshooting

Excel removes leading zeros: preserve IDs before you import or paste

Choose text storage for identifiers, distinguish display padding from missing data, and avoid silently changing long codes.

Documentation reviewed · Not hands-on tested
Quick answer

If Excel changes a client code from 00482 to 482, preserve the original source before saving over it. For identifiers, the characters matter more than their numerical value. Store the column as text before importing or entering it; adding zeros later cannot establish what the original code was.

In this guide
Applies to

Excel for Microsoft 365 desktop on Windows and Mac. Automatic Data Conversions also applies to Excel 2024; its Windows settings path is shown here. Web and mobile import controls are outside this guide. Documentation reviewed; not tested in Excel.

Decide whether the value is an identifier

Work on a copy of the workbook and keep the original CSV or export unchanged. Pick several records you can compare against the source, including the longest identifier and one with two initial zeros.

Choose the branch that matches the data

SituationFirst action
You have not entered the IDs yetSet the destination cells to Text first.
A CSV import changed the IDsStart again from the untouched source with that column treated as text.
Every code has a documented fixed widthConsider padding in a separate helper column, then compare with the source.
The correct width is unknownRecover the original values; do not guess how many zeros belong there.

For manual entry, select the destination column and choose Text in the number-format controls before pasting. A leading apostrophe also marks an individually entered value as text. For a text/CSV import using Power Query, change the identifier column to Text in the editor. If the Change Column Type dialog appears, choose Replace Current so you replace the existing conversion instead of adding a text conversion after it. Confirm that the preview still contains the original leading zeros before loading. These methods are described in Microsoft's identifier-preservation guidance.

If the zeros have already disappeared

A display format and the stored value are different decisions. For a known five-character code, =TEXT(A2,"00000") in a helper column produces a text representation padded to that width. Keep the original column beside it while checking the result. Microsoft's TEXT reference explains that its result is text, which can affect later calculations.

A custom number format can make a worksheet look correct while the underlying value remains numeric. Prefer explicit text identifiers when another system will consume the data. Check the exported file too, rather than relying only on the worksheet's appearance.

If Excel already converted a code longer than 15 significant digits to a number, formatting cannot reconstruct lost digits. Return to the source.

Prevent repeat conversions

In supported Windows desktop editions, open File → Options → Data and inspect the automatic-conversion choices. Clear Remove leading zeros and convert to a number to preserve incoming numerical text; a separate option covers long numbers. Microsoft's data-options guide documents these controls. Changing them does not repair an already altered workbook.

Before replacing an import workflow, compare a small sample end to end: source file, imported cells, and the file delivered to the next application. If values still change, use Microsoft Support with the Excel edition, import method, and a nonsensitive sample. Do not share real client IDs in a public forum.

Sources and review date

Official documentation consulted on 2026-09-20. Diagnostic suggestions are editorial guidance, not a promise of a particular result.

A step no longer matches your app? Report a correction with the guide URL and version you use.

Related fixes