Clean up and summarize data

Why do 00123 and 123 fail to match in Excel data?

Distinguish text codes from number formatting before joining data. Keep meaningful leading zeros and understand why changing the type cannot restore lost digits.

Registered text codes 00123, 123 and 12.5 beside numeric transaction codes 123 and 12.5.
Illustration with fictional data, not a screenshot of the app.

The code 00123 is different from 123 when the leading zeros are part of its stored text. Set both code columns to Text in JOIN SHEET if those zeros distinguish products. Changing a column to Text cannot restore zeros or digits already lost in the source.

A displayed zero may not be stored data

Excel can display the number 123 as 00123 through number formatting. That is not the same as storing the text value “00123.” Inspect the imported values rather than relying only on how the source cells look.

In this fictional registry, 00123 is Part A and 123 is Part B. The transaction sheet contains the number 123. Removing zeros to force a match could assign Part B's transaction to Part A.

Align types without changing the code's meaning

  1. Load Registry and Transactions. Decide whether each code is an identifier or a number intended for arithmetic.
  2. Click the type badge for Registered code and select Text.
  3. Set Transaction code to Text as well. Numeric 123 is interpreted as the text “123.”
  4. Connect the code columns and select All rows from Sheet 1, plus matches from Sheet 2, with Registry first.
  5. Check unmatched codes in Result preview, rather than hiding them with a matching-only join.

Diagram of setting both code columns to Text and retaining all registry records.

An unmatched code can be the correct result

Registered code Product name Transaction code Quantity
00123 Part A — —
123 Part B 123 4
12.5 Part C 12.5 2

The result retains three registry rows. Part A has no matching transaction because “00123” and “123” are different text values.

Diagram showing matches for 123 and 12.5 while preserving 00123 as unmatched.

Can JOIN SHEET add the missing leading zeros?

Not by selecting Text. If every identifier must be five digits and 123 definitely means 00123, standardize the source using that rule before reimporting. Do not infer a padding rule where variable-length codes are valid.

The same limitation applies to long identifiers that were rounded or truncated before import. Preserve identifiers as text in the exporting system whenever possible. Check representative zero-prefixed codes and hidden spaces before trusting the join.

Try it with your own data

Spend less time on repetitive work

Connect and compare sheets to get the results you need.

This walkthrough uses the Pro plan.

Start with JOIN SHEET ↗

Use a desktop computer for Excel and CSV work. Opens in a new tab without replacing your current work.

Example last verified:

Sources

How to stop Excel from Auto-formatting and making it work like a number crunching program — Super User

XLookup to lookup data from 2 sheets with leading zeros — Reddit r/excel

These discussions informed the type-and-format problem. Part names and codes are fictional, not community members' business data.