To keep every digit of a UPC code in Excel, select the UPC column, press Ctrl+1, choose Custom, type 000000000000 (twelve zeros) in the Type box, and click OK. Every code now shows all 12 digits, including leading zeros. UPC-A barcodes are 12 digits long, and many start with a zero. Excel treats them as numbers, so it drops the leading zero and may switch long values to scientific notation. The custom format fixes the display without changing the value, and it works in all current desktop versions of Excel.
How to Format UPC Codes in Excel
- Select the cells or the whole column that holds the UPC codes.
- Open the Format Cells dialog with the Ctrl+1 shortcut, or from the right-click menu.
- In the Category list on the Number tab, pick Custom.
- In the Type box, enter 000000000000 (twelve zeros). Use thirteen zeros for EAN-13 codes.
- Click OK. Widen the column if you see number signs instead of digits.

UPC Formatting Options
| Method | Best for |
|---|---|
| Custom format 000000000000 | Numbers you still want to sort as numbers |
| Text format before typing | Codes you paste or type by hand |
| Apostrophe before the code | Fixing a single cell quickly |
| Import as Text | Bringing codes in from a CSV file |
Should I store UPCs as text or numbers?
Text is safest if you never do math with them, especially for codes longer than 15 digits, which Excel cannot store exactly as numbers.
Why does Excel show 1.23457E+11?
The General format switches to scientific notation for long numbers in narrow columns. A custom or Number format with no decimals fixes it.
When Leading Zeros or Digits Go Missing
- Leading zeros are already gone: the format only adds display zeros, which works for UPCs because the length is fixed. For codes of mixed length, retype them into cells formatted as Text.
- Codes turn into scientific notation after opening a CSV: import the file with Data, From Text/CSV and set the column to Text.
- For more on stopping unwanted conversions, read how to stop Excel from changing numbers into dates.
- For the basics of number formats, see how to apply number formatting to a cell in Excel.

Kermit Matthews runs Live2Tech from just outside Philadelphia. He is an IT specialist with over 20 years of experience, from a university help desk to small-business IT, IT management and his own consulting practice, and has written tech guides full time since 2020. Steps are checked against the current software on a real device or the maker’s official documentation. More about Kermit.