How to Compare Two Excel Files and Highlight the Differences
To compare two Excel files, match each row by an ID column such as a SKU or order number, then compare the matched rows cell by cell. A formula that compares row 2 with row 2 breaks as soon as one row is inserted or the list is re-sorted. XLOOKUP by ID works in plain Excel. The free browser tool and the Table Compare add-in do it in one click and highlight the changes.
Table of contents
Why row by row fails
Most methods compare cells by position: row 5 of the old file against row 5 of the new one. That only works while both files hold the same rows in the same order. Insert one row, delete one, or sort the new file differently, and every row below the change looks different.
The example is a product list from September and one from October. October is sorted differently, two products are new, one is gone, and four rows were edited. October has 41 rows, and a formula that compares row by row flags every one of them. The real answer is much shorter.
| Result | Row by row | Matched by SKU |
|---|---|---|
| Rows that differ | All 41 | 4 changed |
| New products found | No | 2 new |
| Deleted products found | No | 1 missing |
| Tells you which cell changed | Only by position | Yes, old and new value |
So the one rule that matters: find the column that identifies each row, and pair the rows by it before you compare anything. Every method below either does that or does not.
Methods compared
You can look at both files side by side, compare cells with an IF formula or conditional formatting, match rows by ID with XLOOKUP, use Microsoft’s Spreadsheet Compare if your Office plan includes it, or use a tool that matches rows by ID for you.
| Method | Handles sorted or inserted rows | Finds new and missing rows | Where it works |
|---|---|---|---|
| View Side by Side | No | Only by eye | Excel for Windows |
| IF formula on a third sheet | No | No | Every Excel version |
| Conditional formatting | No | No | Every Excel version |
| XLOOKUP by ID | Yes | Yes, with a second check | Excel 2021, Microsoft 365, the web |
| Power Query merge | Yes | Yes, with anti joins | Excel for Windows (the Mac editor is more limited) |
| Spreadsheet Compare | See below | See below | Windows, enterprise plans only |
| Free browser tool or Table Compare | Yes | Yes | Any browser, or Excel on Windows, Mac and the web |
For a quick look, View Side by Side is fine. Open both files, go to View, click View Side by Side and turn on Synchronous Scrolling. Both windows scroll together. It shows you nothing on its own, though, so it only works for a handful of rows.
IF formula and conditional formatting
Put both sheets in one workbook, add a third sheet, and enter an IF formula that compares the same cell on both sheets. Conditional formatting does the same with colors. Both are quick, and both compare by position, so they only work when the rows line up.
The classic formula goes in cell A1 of a new sheet and is filled across and down:
=IF(September!A1<>October!A1, "Sep: "&September!A1&" | Oct: "&October!A1, "")
For colors instead, select the data on the October sheet, go to Home, Conditional Formatting, New Rule, choose Use a formula to determine which cells to format and enter =A1<>September!A1. Pick a fill and click OK.
Both are good for one job: checking a copy of a sheet where nobody added, removed or sorted rows, such as a price list where only values were edited. In my practice file, the Row by row sheet holds this kind of check, and you can watch it flag all 41 rows because October is sorted by name.
Watch out: the = and <> operators in Excel ignore upper and lower case. “Usb-C hub” and “USB-C hub” count as equal. Use EXACT() when case matters.
Compare by ID with XLOOKUP
Use XLOOKUP to fetch the old value for each row by its ID, then compare it with the new value. A row whose ID is not in the old list is new. Run the same check the other way round to find rows that are missing. Sorting no longer matters.
On a sheet next to the October list, with the SKU in column A, these formulas do the work. They need Excel 2021, Microsoft 365 or Excel on the web.
-
Status of each new row. XMATCH looks for the SKU in the old list. No hit means the product is new:
=IF(ISNA(XMATCH(A3, September!$A$2:$A$200)), "New", IF(D3="", "Same", "Changed")) -
Which columns changed. For each column, fetch the September value by SKU and compare it with October. TEXTJOIN lists the names of the columns that differ:
=TEXTJOIN(", ", TRUE, IF(XLOOKUP(A3, September!$A$2:$A$200, September!$D$2:$D$200)<>October!D2, "Price", ""), IF(XLOOKUP(A3, September!$A$2:$A$200, September!$E$2:$E$200)<>October!E2, "Stock", "")) -
Missing rows. Next to the September list, check every old SKU against the new list:
=IF(ISNA(XMATCH(A2, October!$A$2:$A$200)), "Missing", "Found")
On the practice data this gives the right answer: 3 changed, 2 new and 1 missing. The fourth edit, “Usb-C hub” to “USB-C hub”, is only a change of case, and Excel’s comparison ignores it.
The limits are worth knowing. You write one comparison per column, the formulas need to be copied to every row and fixed when the ranges grow, and an ID that is typed twice or left blank gives a wrong answer without a warning. Older Excel versions can do the same with INDEX and MATCH. Power Query can also do it: merge the two tables on the ID with a left anti join to get new rows, swap the tables to get missing rows, and use an inner join to compare the rest. That is a solid route for big files, though it takes a while to set up.
If you would rather do this in code, my post on comparing two Excel sheets with a different number of rows in Python does the same with pandas.
Spreadsheet Compare and Inquire
Only if your Office plan has it. Spreadsheet Compare is a separate Microsoft program for Excel for Windows, included with Microsoft 365 Apps for enterprise and equivalent editions. It is not on the Mac, not in Excel on the web, and missing from many business and home plans.
If you have it, search for Spreadsheet Compare in the Windows Start menu, click Compare Files, and pick the older and the newer workbook. It lists differences in its own window, and it also checks formulas, formatting and VBA code. Inside Excel, the Inquire add-in offers the same comparison from its own ribbon tab, once you turn it on under File, Options, Add-ins, COM Add-ins. Microsoft explains the details in Compare two versions of a workbook by using Spreadsheet Compare.
The result stays in that window, not next to your data, so it is better suited to auditing a model than to checking this month’s export against last month’s.
Compare and highlight in one click
Use a tool that finds the ID column, pairs the rows by it and compares the paired rows for you. My free Excel compare tool does that for two files in your browser. The Table Compare add-in does it inside Excel and also highlights the changes in your own sheets.
For two files you already have, the free Excel compare tool is the quickest start. Drop in the old and the new file, and it shows what changed, what is new and what is missing. Both files are read in your browser and nothing is uploaded. You can download the result as an Excel report. If you only need to compare two columns, Compare Two Lists shows what is only in list A, only in list B, and in both.
When the tables live in your workbook and you check them every month, I built Table Compare. Here are the steps on the September and October lists from the practice file.
-
Pick the old and the new version. Click inside the September list and click Use selection next to Old. Do the same with October for New. The pane names the ID column it found, here Match rows by SKU (auto). If it picked the wrong one, click Change.

-
Click Compare. The tiles show how many rows are changed, new, missing and the same. Below them, every difference is listed with its old and new value, such as Monitor stand from 24.90 to 26.90. Click a difference and Excel selects that cell.

-
Remove false differences. One change here is USB-C hub written in capitals. Under Edit setup, open Options and tick Ignore upper and lower case, then compare again. The same panel ignores extra spaces, treats 00123 and 123 as the same, and allows a small difference in numbers.

-
Highlight the differences in your sheets. Click Highlight in my sheets. Changed cells turn yellow, new rows green and the missing row red, right in your data. Remove highlights takes the colors away again.

-
Create a report sheet. Create report sheet adds one row per changed, new or missing product, each with a link back to the row. A second sheet lists every changed cell with the difference and the change in percent. Both are normal Excel tables, so you can filter them.

Your old version can also be a separate file. Under Edit setup, click Choose file and pick it from your computer (.xlsx, .xlsm, .xls or .csv). Excel only lets add-ins read the open workbook, which is why the other file is picked from disk instead of from the list of open workbooks. The guide to comparing with another file covers that route.
The add-in runs in Excel on Windows, Mac and the web, with Microsoft 365 or Excel 2021 and later. The tables are compared on your computer, and the free version has every feature for tables of up to 200 rows each. If you have never added an Office add-in on a Mac, my guide to installing an Excel add-in on a Mac walks through it.
Practice file
The workbook has the September and October lists, plus both formula methods from this post, ready to explore.
Compare two Excel files: practice workbook
Two versions of a product list (re-sorted, with new, missing and edited rows), a row-by-row check that shows why position fails, and an XLOOKUP check by SKU that gets it right.
To practice the file-to-file route, copy the September sheet into a new workbook and save it on its own.
Troubleshooting
Almost always it is one of four things: rows are paired by position instead of by ID, the ID is repeated or blank, values differ only in spaces, case or leading zeros, or a column was renamed. Check them in that order.
- No real ID column. If nothing identifies a row on its own, two columns together often do, such as an order number and a line number. Combine them in a helper column, or choose both in the add-in’s Match rows by option.
- Repeated or blank IDs. XLOOKUP returns the first hit and says nothing. Count each ID with
COUNTIFfirst. Table Compare points these rows out in a Check line instead of guessing. - Invisible differences. Trailing spaces, numbers stored as text, 00123 against 123, or prices that differ in the fifth decimal. Clean them with
TRIMandVALUE, or use the ignore options. - Volatile formulas.
NOW(),TODAY()andRAND()give a new value on every calculation. Paste them as values before you compare. - IDs spelled differently. If the same customer is written two ways, no exact method can pair the rows. That is a fuzzy matching job, and my guide to fuzzy matching in Excel covers it.
For the add-in, the docs page every row shows as changed goes through each case with the exact setting to change.
FAQ
How do I compare two Excel sheets and pull out only the new rows?
With formulas, filter the status column for New. In Power Query, merge with a left anti join. In Table Compare, click the New tile and then Copy these rows to a new sheet.
Does comparing files check formulas and formatting?
The formula methods and Table Compare compare values, which is what you see in the cells. Table Compare can compare formula text instead, with Compare formulas instead of values. Formatting and VBA code are something only Spreadsheet Compare checks.
Pick the old and the new table, click Compare, and see every changed, new and missing row, matched by ID and highlighted in your own sheets. Free for tables up to 200 rows, on Windows, Mac and the web.
