TeqFeed home

How-Tos

Excel turned 0017 into 17. Can you still recover the product code?

A four-digit display format can make 17 look like 0017. A catalogue containing both codes shows why that can be the wrong repair.

The code 0017 in illuminated tiles beside Keep the Leading Zero.

Open a copy of the original CSV in a plain-text viewer before doing anything to the spreadsheet. If it still contains 0017, import that column into Excel as text from the untouched source. If all you have is the number 17, Excel cannot tell whether the original supplier code was 17, 017 or 0017. Adding zeros by eye can assign stock to the wrong item.

Highlights

  • Treat product and membership identifiers as text when their exact characters matter.
  • Check the import preview for both 0017 and 17 before loading the data.
  • A custom number format changes the display. It cannot reconstruct an unknown original code.
Warehouse labels show two different codes: 0017 and 17.
A text import can preserve 0017 and 17 as distinct identifiers.

Find out where the digits disappeared

Suppose an Indore stationery shop receives a stock file from two suppliers. One sells a blue notebook with the code 0017. The other uses 17 for a packet of labels. Both quantities are numbers, but neither product code is an amount. There is nothing to add, round or average in the code column. It is a label that needs to survive the trip between systems exactly as supplied.

Make a working copy of the file. Check its first few records in a plain-text viewer, paying attention to the code field rather than a number in another column. If you can see the leading zeros there, the source is still good. If they are already gone, ask for a fresh export or an authoritative catalogue. A second spreadsheet made from the same damaged file is unlikely to settle the ambiguity.

Import the code column deliberately

In desktop Excel for Windows, start with a blank workbook. On Data, choose the option to get data from a text or CSV file. Select the untouched CSV and use Transform Data to inspect the column types before loading. Microsoft’s guide to keeping leading zeros describes choosing Text for the relevant column in Power Query. Leave quantity and unit-price columns numeric if you need to calculate with them.

Inspect the applied steps as well as the displayed type. If an automatic Changed Type step has already converted the code to a number, turning that number back into text can leave you with the string “17”. Remove or revise the numeric conversion for that column so that Text is applied to the original characters. Confirm you can actually see 0017 in the preview before using Close & Load.

A sensible rehearsal uses three harmless records: 0017, 17 and A017. The last one is easy for a spreadsheet to recognise as text and can give false reassurance if you check only that row. The first two do the real work. Look them up separately after import. A filter or catalogue search for the complete identifier should lead you to the correct item in each case.

When a display format is enough

If your own numbering system defines every shelf position as four digits, displaying the number 17 as 0017 may be exactly what you want on a printed shelf label. That is a presentation rule for a field whose meaning you control. It is a different decision when a supplier treats the strings 17 and 0017 as distinct identifiers. One padded numeric value cannot represent both without extra information.

Before accepting a proposed fix, ask what leaves Excel. A colleague looking at a nicely padded cell may assume the stored identifier is a four-character string. A later transformation or a fresh import into another application can interpret it differently. Use the recipient’s actual import method on a sample, then compare its result with the supplier’s source.

Verify the handoff once

Keep an Excel workbook for the reviewed data and a separate export for the receiving system. Open the exported CSV in a text viewer to check its characters. Double-clicking it straight back into Excel can trigger the same automatic conversion again and make a correct CSV appear damaged. Conversely, a good-looking worksheet is not proof that every exported identifier is correct.

If several people need to review the same list, agree on one source file and a small set of sentinel codes covering real variations. In our example, recording that both 0017 and 17 survived is more useful than saying only that the row count matched. Once two distinct labels have collapsed to the same number, an unchanged row count will conceal the error.

The buying or dispatch decision should end with a source-backed match. Preserve the untouched export, rebuild the column from it if possible, and get the supplier to resolve missing digits if the original has already been overwritten.