Blog
How to Compare Two Excel Sheets for Differences
To compare two Excel sheets, you either compare cells in the same position or match rows by a key column and compare what comes back. If both sheets have the same rows in the same order, =Sheet1!B2=Sheet2!B2 is enough. Real comparisons rarely look like that. An export from the student information system arrives sorted by last name instead of by period, with a couple of students dropped and a few added, and one missed difference becomes a wrong grade on a report card. The same problem shows up at home when two versions of a budget or two bank exports disagree.
Below are the methods that fit each situation, a complete gradebook comparison from start to finish, and what to check when the results look wrong.
Pick the method by how the sheets line up
| Situation | Method | Output |
|---|---|---|
| Same rows, same order | =Sheet1!B2=Sheet2!B2 | TRUE or FALSE per row |
| Same layout, you want to see the differences | Conditional formatting =B2<>Sheet2!B2 | Changed cells colored |
| Different order, shared key such as student ID | VLOOKUP or XLOOKUP | The other sheet's value, or #N/A |
| Rows that exist in only one sheet | COUNTIF or MATCH | 0 or #N/A means missing |
| Tens of thousands of rows, repeated every term | Power Query merge | A separate result table |
The rule of thumb: if you can't be sure row 50 on one sheet is the same student as row 50 on the other, don't compare by position. Use a key column that is unique per row.
1. The = operator for identical layouts
Put =Sheet1!B2=Sheet2!B2 in a helper column and fill down. TRUE means the values match; FALSE means they don't. Filter the helper column to FALSE and only the changed rows remain.
Two details trip people up. The = operator ignores case, so "abc-01" equals "ABC-01"; use =EXACT(A2,B2) when case matters. And the number 87 does not equal the text "87", so a file exported from another system can show FALSE on every row until the formats match.
2. Conditional formatting to color what changed
Select the range on the first sheet, go to Home > Conditional Formatting > New Rule > Use a formula to determine which cells to format, and enter =B2<>Sheet2!B2 with a light red fill.

Leave B2 without dollar signs so each cell compares to its own counterpart. This is the fastest way to eyeball changes, but it doesn't produce a list you can send to anyone, so for a list move on to the lookup methods.
3. VLOOKUP or XLOOKUP when the order differs
Match rows by key and pull the other sheet's value next to yours. =VLOOKUP(A2,New!$A:$C,3,FALSE) finds the ID from A2 in column A of the New sheet and returns the third column. The last argument must be FALSE (or 0) for an exact match.

A key that isn't on the other sheet returns #N/A, and that #N/A is information: it means "missing". Label it instead of hiding it. Wrapping the lookup in IFERROR replaces the error with text you choose.

In Microsoft 365 and Excel 2021 or later, XLOOKUP is simpler: =XLOOKUP(A2,New!$A:$A,New!$C:$C,"Missing"). You point at the lookup column and return column separately, so there's no column number to count, and the fourth argument sets the not-found text directly.
4. COUNTIF or MATCH for rows on one side only
When you only need to know whether a key exists, COUNTIF reads most clearly. =COUNTIF(New!$A:$A,A2) returns 0 if the student is gone from the other list. Run the same check in the other direction to find added students. =MATCH(A2,New!$A:$A,0) returns the row position, or #N/A when the key isn't there.

Worked example: checking final grades against the SIS export
A high school social studies teacher keeps final grades in her own spreadsheet and enters them into the district's student information system by hand. Before the grading window closes, she exports what the SIS now holds and compares it with her sheet. Her Grades sheet has 156 students: student ID (A), name (B), period (C) and final grade (D). The export has 158 rows, sorted by last name. Its IDs are text with leading zeros and a few trailing spaces, such as "004512 ", and its grades are text like "87%".

Step 1: Put both lists in one workbook
Right-click the export's sheet tab, choose Move or Copy, pick her grade workbook, tick Create a copy, and rename the copy SIS. Work on a copy of the grade file, not the only one she has.
Step 2: Clean the keys and grades first
Her own sheet stores IDs as numbers, so 004512 already shows as 4512. On the SIS sheet, she adds helper columns: =--TRIM(A2) turns "004512 " into the number 4512, and =VALUE(SUBSTITUTE(C2,"%","")) turns "87%" into 87. Skip this and the same student returns #N/A, and the same grade shows as changed.
Step 3: Pull the SIS grade beside her own
On the Grades sheet, column E gets =XLOOKUP(A2,SIS!$F:$F,SIS!$G:$G,"Missing") against the cleaned columns. Column F gets the difference, =IF(E2="Missing","",E2-D2).
Step 4: Split the result three ways
Filter column E to "Missing" for students on her sheet who aren't in the SIS export. Filter column F to non-zero for grades that don't match. On the SIS sheet, =COUNTIF(Grades!$A:$A,F2) equal to 0 marks students the SIS has but her sheet doesn't. Say that produces 2 missing, 4 extra and 11 mismatched grades: she reviews 17 lines instead of 156.
Step 5: Review and fix
Every mismatched grade was either a typo during entry or a late assignment she had updated in her sheet but not in the SIS, and she corrected all 11 before the window closed. Two of the four extra students had been added to her roster the week before and had no grades in her sheet yet, which would have meant blank report cards. She sent the counseling office one short email with ID, name and period for the remaining schedule questions.
👉 VLOOKUP Not Working? How to Fix #N/A, #REF! and #VALUE!
Why a lookup returns #N/A for rows that exist
When an ID is clearly on both sheets but the lookup says #N/A, the values are different in a way you can't see:
- Number stored as text. A green triangle in the cell's corner gives it away. Use Convert to Number or wrap the key in
--A2orVALUE(). - Hidden spaces or line breaks. If
=LEN(A2)is longer than the visible text, clean it withTRIMandCLEAN. - A drifting range. A lookup range without dollar signs shifts as you fill down, so lower rows search a smaller area. Lock it with
$A:$C.
The reverse also happens: grades that differ in the second decimal place, such as 89.46 and 89.5, look identical when the column shows whole numbers, and that matters when a grade sits right at a cutoff. =ROUND(E2-D2,2) in the difference column shows what really changed. Before trusting any comparison, look up three or four students by hand on both sheets. It takes a minute and catches a wrong key column right away.
Large lists: compare with a Power Query merge
At tens of thousands of rows, such as a year of bank transactions or a whole grade level's assignment scores, thousands of lookup formulas make a workbook slow. Power Query does the comparison outside the grid. Load each list with Data > From Table/Range, then in the Power Query Editor choose Home > Merge Queries, select the ID column in both, and choose the join kind.
The join kind is the comparison. Left Anti returns rows only in the first table, which are your missing rows. Right Anti returns rows only in the second, the added rows. An Inner join plus a custom column that subtracts the two values isolates the changes. Close & Load writes the result to a sheet, and next grading period you paste the new export into the source table and click Refresh All.
Comparing two whole workbooks
To compare two files visually, open both and click View > Window > View Side by Side, with Synchronous Scrolling on so both scroll together. For two sheets in the same file, click New Window first, then View Side by Side.
When you need every difference in values, formulas and formatting cell by cell, use Microsoft's Spreadsheet Compare. According to Microsoft's Spreadsheet Compare guide, it ships with Office Professional Plus 2013, 2016 and 2019 and Microsoft 365 Apps for enterprise. Launch it from the Windows Start menu, click Compare Files, choose the two workbooks, and the results grid colors differences by type. It isn't included in Microsoft 365 Personal or Business Standard, where the formula methods above do the job.
FAQ
Q. Can I use the = operator if the rows are in a different order?
No. It compares cells in the same position, so a different order gives wrong answers. Sort both sheets by the same key first, or use XLOOKUP, VLOOKUP or COUNTIF, which find rows by value.
Q. What if there is no student ID, only names?
Build a combined key on both sheets, such as =TRIM(B2)&"|"&TRIM(C2) for last name and first name, and match on that. Students whose names are written differently, such as a nickname or a hyphenated last name, will show as missing, so gather those rows and check them by hand.
Q. How do I compare several columns at once?
Concatenate the columns into one string on each sheet and compare the strings. Any row where one column differs shows up. To see which column changed, keep one comparison formula per column.
Q. Can I compare against a sheet in another workbook?
Yes. With both files open, click into the other workbook while writing the formula and Excel inserts a reference like [SIS_Export.xlsx]Sheet1!$A:$C. Close that file and the reference becomes a full path, and moving the file breaks it, so for a one-time comparison copy the sheet into the same workbook.
inline AI for comparing rosters and grade exports
inline AI opens the SIS export next to your own grade sheet, and when you say "compare by student ID and list mismatched grades, students only in the export and students only in my sheet," it cleans the formats, matches the rows and returns the three lists.
Gradebooks and spreadsheets, finished by inline AI in the file itself.
Ask in one sentence for roll-ups, trackers and the cleanup you repeat every week. Your files never leave your computer.




