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.
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
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
| Situation | First action |
|---|---|
| You have not entered the IDs yet | Set the destination cells to Text first. |
| A CSV import changed the IDs | Start again from the untouched source with that column treated as text. |
| Every code has a documented fixed width | Consider padding in a separate helper column, then compare with the source. |
| The correct width is unknown | Recover 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.
- Microsoft: Keeping leading zeros and large numbersChecked 2026-09-20
- Microsoft: TEXT functionChecked 2026-09-20
- Microsoft: Data import and analysis options in ExcelChecked 2026-09-20
A step no longer matches your app? Report a correction with the guide URL and version you use.
Related fixes
OneDrive files will not open offline: check availability before you travel
A visible filename is not proof of an offline copy. Check the file state, download only what you need, and distinguish Windows from Mac indicators.
Excel dates will not sort correctly: check text values before changing the format
Diagnose mixed date types, convert a small sample safely, and keep each date attached to the correct project or client row.
Word or Excel still saves to OneDrive: check the file location, not just the default
Save a separate local copy, check whether Documents is backed up, and understand why the default setting does not move existing cloud files.