Excel templates and practical guides

Excel problem solving

How to Compare Two Excel Sheets When Rows Are in a Different Order

Auditably.co · Published 29 November 2026 · 3 minute read

Comparing A2 on one sheet with A2 on another only works when both lists have the same records in the same order. Sort one list, insert a row or remove an item, and the apparent differences can multiply even though most records are unchanged.

Match records by a stable ID instead. The practice workbook contains Original and Updated lists plus a Compare sheet. It shows changed amounts, removed records, new records and duplicate IDs as separate cases.

In this guide
Compare lists by ID: actual workbook preview with fictional example entries
Actual preview of the Compare sheet. Open the full-size image to inspect the figures.

Choose a key that identifies one record

A customer name is rarely a good key. Two customers can share a name, and spelling can change. Use the source system's record ID where possible. For line-level data, an invoice number may need a line number as well.

Check the key before looking up values. If A04 appears twice in the updated list, a lookup returning the first match can look successful while ignoring the other row. The workbook reports Duplicate ID rather than selecting one arbitrarily.

This version uses case-insensitive Excel criteria matching. Use consistent alphanumeric IDs without wildcard characters *, ? or ~. Numeric-looking text IDs and case-sensitive identifiers need additional normalisation or a stricter matching method; do not assume 00123 and 123 are interchangeable.

What the example should return

ID Original Updated Expected result
A01 100 110 Changed, increase of 10
A02 200 Missing Removed
A03 300 300, in a different row Same
A04 400 Two records Duplicate ID
A05 Missing 500 Added

A05 appears on the Updated tab with an Added status. The Compare tab starts from the old list, so it cannot by itself show records that only exist in the new list. Reviewing both directions is essential.

A safe comparison sequence

  1. Keep untouched copies of both exports.
  2. Put the old IDs and amounts on Original and the new ones on Updated.
  3. Resolve blank IDs, nonnumeric amounts and duplicate-ID warnings on both input tabs.
  4. Review the Compare result for changed or removed old records.
  5. Review Updated for added records.
  6. Trace important changes back to the source, not just the spreadsheet export.

The prepared ranges are rows 9 to 58. If you extend them, update all three tabs' formulas. A new row outside one matching range can be incorrectly reported as absent.

Why a lookup alone is not enough

For a unique ID, a lookup can return the corresponding amount regardless of row order. But it still needs rules for missing keys, duplicates and blank values. In this workbook, COUNTIF checks the number of matching IDs before the amount is compared.

The difference is calculated only for Same or Changed results. Removed records are not treated as a change to zero, and duplicate records do not receive an apparently precise difference. Those are different questions requiring different follow-up.

Blank amounts and zero amounts are different

A zero can be a valid recorded amount. A blank may mean the export omitted the value or someone has not entered it. The input checks require a numeric amount, including a valid zero. Resolve every input warning before relying on the comparison output; the output is not a substitute for those checks.

If you are comparing descriptions, dates or several fields, add separate comparisons for each field with a clear rule. This download deliberately compares one numeric amount per record. It does not perform a whole-workbook cell-by-cell comparison.

Should I sort both sheets first?

Sorting can help a person inspect the lists, but it does not remove the need for a key. One missing row will still shift all later rows. Keep the key-based method even when the display is sorted, and retain the original exports so the comparison can be reproduced.