XL AI Automation
Home › Guides › How to compare two Excel files

How to compare two Excel files

6 min read · Updated 4 December 2026

Someone sends a revised version of a price list, sales file or employee master. What changed? Checking row by row takes hours and misses things. These methods find the differences for you.

First, pick a key column

Comparing works best when each row has an ID that stays the same in both versions: Invoice No, Employee ID, Item Code. Comparing by row position breaks as soon as one row is added or sorted differently.

Method 1: XLOOKUP by key (Excel 2021 and Microsoft 365)

Put both files in one workbook as sheets Old and New. In the New sheet, next to the data, check whether each key exists in Old and whether a value changed:

Exists in old?  =IF(ISNA(XLOOKUP(A2, Old!A:A, Old!A:A)), "Added", "")
Amount changed? =IF(XLOOKUP(A2, Old!A:A, Old!G:G, "")<>G2, "Changed", "")

Repeat the second formula for each column you care about. Then do the reverse from the Old sheet to find removed rows. In older Excel, use VLOOKUP with IFERROR instead.

Method 2: Conditional formatting (same layout only)

If both sheets have exactly the same rows in the same order, select the data in New and add a conditional formatting rule with the formula =A2<>Old!A2. Changed cells are highlighted. This fails if rows were added or sorted.

Method 3: Spreadsheet Compare

Some Office editions for businesses include a separate Spreadsheet Compare app that reports differences between two workbooks. Many home and standard editions don't have it.

Tips

  • Trim spaces first: "Patil Agencies " and "Patil Agencies" look the same but don't match.
  • Check for repeated keys. A duplicate Invoice No makes lookups return the first match only.