New Tool Radar

AI for Data & Spreadsheets

How to Check AI-Extracted IDs and Codes Keep Their Leading Zeros

Check AI-extracted ID codes for lost leading zeros and codes that Excel turned into numbers.

Schematic illustration for How to Check AI-Extracted IDs and Codes Keep Their Leading Zeros: three numbered steps - Format codes as text first; Compare each code to source; Flag shortened codes.

An ID code such as 00417 becomes 417 the moment a spreadsheet treats it as a number, and the shortened code will not match any system that expects the full code. Codes must be stored as text from the start, and each one checked against the source for its full length.

Prerequisites

  • The source document with the codes
  • The extracted sheet
  • A copy of the source file, so the original stays untouched.

Steps

  1. Before pasting any codes, format the code column as Text so leading zeros are kept.
  2. Read each code in the sheet against the same code in the source, counting the characters.
  3. Flag any code that is shorter than the source code, which usually means a leading zero was lost.
  4. Use a LEN check column to list the character count of each code, and compare it with the expected length.
  5. Fix shortened codes by retyping them as text, never by adding zeros by guesswork.

Worked example: Fictional product codes, five items

The practice table below is a fictional five-code list. The length column is the character count of each code, and the total is their sum. The table below is fictional practice material, with fictional values. It is the expected result, worked out by hand, not a run of any tool.

Product Code Length
Paper clips 00417 5
Staples 00892 5
Folders 01345 5
Pens 02731 5
Labels 00058 5
Total 25

Expected result. Five codes checked, each is 5 characters long, and the lengths add to 25. UNTESTED: no AI extraction was run for this guide; the table shows the expected values a check should produce.

Limits

  • Formatting a column as Text after pasting does not restore zeros already lost; the codes must be re-entered.
  • A code that looks numeric may still be an identifier, so never sum a code column.

Sources

See all