Excel and data work

Compare two Excel exports and find added or removed rows

Compare two Excel or CSV exports by choosing a stable key, normalizing columns, and using a text diff only for a small, deliberate review.

5 min read 914 words

Start by deciding what makes two rows the same

Two Excel exports cannot be compared safely until you choose a stable identifier. A customer ID, SKU, invoice number, or another unique key is usually better than a name, email address, or row position. If one export is sorted differently, row-by-row comparison can report a page of changes even when the records are identical.

For example, imagine an inventory export from Monday and another from Friday. Before looking for additions or removals, check that both reports cover the same warehouse, date range, active-status filter, and columns. A changed filter is not an added product. Save untouched copies of both files so you can restart if a cleanup step goes wrong.

Import CSV deliberately in Excel

For current desktop Excel versions covered by Microsoft Support, use Data > From Text/CSV when you need to inspect a text export before loading it. The preview lets you choose a delimiter and see the result. This matters when a comma, semicolon, tab, quoted value, date, or leading zero has been interpreted differently from the source system.

Opening a CSV directly can be fine for a quick view, but it uses current default data-format settings. Microsoft also notes that text/CSV formats have feature limits and that saving a worksheet as text only saves the current worksheet. Treat the CSV as an exchange format, not as a complete replacement for the original workbook.

After import, confirm these basics in both sheets:

  • Use the same header spelling and column order, or create a separate normalized view.
  • Keep IDs as text when leading zeros are meaningful.
  • Trim accidental spaces and use one date/time format before comparing.
  • Sort both lists by the same stable ID; do not sort only one list.
  • Record the report filters and export time beside the comparison.

Find additions and removals with formulas for a real list

When each list has a stable key, Excel formulas are the better choice for recurring or sizeable comparisons. Put the old and new exports in separate sheets, then use XLOOKUP, COUNTIF, or a helper column to ask whether each ID in one list appears in the other. Filter the helper column for missing IDs, then repeat in the opposite direction to find removals.

The exact formula depends on your Excel version and header layout, so test it on a small known sample first. A duplicate ID needs separate treatment: COUNTIF can tell you that a value exists, but it does not by itself prove that every repeated row is the intended match. For transaction exports, a database query or a reconciliation process may be more appropriate than spreadsheet formulas.

Use a text diff only for a small, prepared review

For a short list or a configuration-like export, copy the normalized rows from Excel and paste them into the Text Diff tool. Its line mode makes added and removed lines easy to inspect after both sides have the same headers and sort order. This is useful for a human review of a few dozen lines, not for opening an .xlsx file or matching records automatically.

For instance, you might compare two sorted SKU-and-quantity extracts after removing a generated-at timestamp. If the diff shows every line as changed, stop and check the delimiter, whitespace, column order, and sorting before concluding that inventory changed. The tool compares text by line, word, or character; it cannot determine whether Acme Ltd. and ACME LIMITED are the same customer.

For larger CSV files, inspect the structure first with the CSV Preview tool and use Excel, Power Query, or a database workflow with explicit keys. Do not paste confidential customer exports into a browser tool unless your organization permits that handling.

Verify the result before reporting it

Count the new-only and old-only IDs, then spot-check several rows against each source export. Check one expected addition, one expected removal, and one unchanged record. Also inspect blank IDs and duplicate IDs; they commonly create false positives. Keep the comparison workbook and a note of the filters used so another person can reproduce the result.

Comparison is a decision aid, not proof that an operational change should be made. If the list controls billing, access, stock, or compliance, have the responsible owner validate the exceptions against the source system.

Frequently asked questions

Can I compare two Excel files by putting them side by side?

You can inspect them that way, but it is unreliable when rows are sorted differently or when one export has extra columns. Choose a stable ID and normalize both lists first.

Why did Excel remove leading zeros from my IDs?

Excel may interpret a CSV column using default data settings. Import through Data > From Text/CSV and set or preserve the column as text when the zeros are part of the identifier.

Is a CSV the same as an Excel workbook?

No. CSV is a text format with limited features. It does not preserve every workbook feature, and saving as text applies to the current worksheet.

Can the Text Diff tool compare an XLSX file directly?

No. It compares pasted text. Export or copy a prepared, non-sensitive text representation, then use Excel or a database for structured matching.

What should I do with duplicate IDs?

Do not treat a simple match as final. Group or count duplicates, add a second stable field where appropriate, and confirm the records against the source system.