How to Compare Two Excel Sheets for Differences (6 Methods)

Two Excel spreadsheets with a highlighted price difference

To compare two Excel sheets for differences, use an IF formula or conditional formatting when both sheets have the same layout. If records can appear in different positions, compare them by a unique identifier using XLOOKUP and COUNTIF instead. For larger recurring comparisons, Power Query can combine the two tables into a report showing added, removed and changed records.

This guide includes six methods and a worked inventory example. You can reproduce the sample in a blank workbook without installing an external add-in. The featured illustration is conceptual rather than a screenshot of the sample workbook.

For long comparison tables, freeze the header rows in Excel so column names stay visible. Where both sheets use the same predefined categories, create a drop-down list in Excel to reduce inconsistent input before comparing records.

Choose the right comparison method

What you need to compareRecommended method
Small sheets with a similar layoutView Side by Side
Values in the same cell positionsIF formula
Visible highlights on a worksheetConditional formatting
Records in a different row orderCOUNTIF and XLOOKUP
Recurring comparisons of large tablesPower Query full outer merge
Workbook formulas, formatting and valuesSpreadsheet Compare, where supported

Position-based comparisons answer whether the same cell address contains the same value. Identifier-based comparisons answer whether a particular record has changed, regardless of its location. Choose the method according to that distinction. Keep both original worksheets intact and build your comparison in a separate sheet or working copy.

Prepare two sample Excel sheets

Create two worksheets named Old and New. Enter the following fictional inventory records, beginning at cell A1 on each sheet. Column A contains the item ID, B contains the description, C contains quantity and D contains unit price. The prices use a consistent, unspecified currency.

Old worksheet

IDItemQuantityUnit price
P101Laptop10800
P102Monitor15220
P103Printer5300
P104Scanner3180

New worksheet

IDItemQuantityUnit price
P103Printer8320
P101Laptop10800
P102Monitor15220
P105Router4100

The expected result is two unchanged records (P101 and P102), one changed record (P103), one removed record (P104) and one added record (P105). Notice that the first three records are not in the same order. Use this expected result to check your formulas and merged report.

1. Compare worksheets side by side

For a quick visual review in supported desktop Excel versions, open both workbooks or create a second window of the same workbook using View → New Window. Select the desired worksheet in each window, then choose View Side by Side from the View ribbon. Use Synchronous Scrolling when the two sheets are arranged identically.

This approach helps inspect column widths, headings and nearby cells, but it is easy to miss differences in a long list. If records are sorted differently, turn off synchronous scrolling or use an ID-based method. Microsoft’s side-by-side worksheet guide describes the window controls.

2. Compare matching cells with an IF formula

When the same records occupy the same cells, create a separate worksheet called Check. To compare quantity cells in row 2, enter:

=IF(Old!C2=New!C2,"Match","Different")

Fill the formula down for the relevant rows. For a full positional grid, start with a comparison of Old!A2 and New!A2 and copy it across and down. The relative references will move as the formula is filled.

=IF(Old!A2=New!A2,"Match","Different")

In our original sample, the row order differs, so this approach would flag cells merely because records moved. Do not interpret those results as changes to the item itself. To use a positional comparison, first confirm both sheets contain the same unique IDs in the same order. Sorting alone does not solve the problem when records were added or removed.

Standard equality compares calculated values rather than formula text and is not case-sensitive for text. If case matters, use EXACT for text comparison. A blank and a zero can also be treated as equal by ordinary comparison in some circumstances; if that distinction matters, explicitly check ISBLANK on both cells.

3. Highlight differences with conditional formatting

To highlight changes in aligned sheets, create a comparison grid on Check. Enter the following formula in A2 and fill across to D5:

=Old!A2<>New!A2
  1. Select Check!A2:D5, beginning with A2 as the active cell.
  2. Choose Home → Conditional Formatting → New Rule.
  3. Select the formula-based rule option and enter =A2=TRUE.
  4. Choose a contrasting fill color and confirm the rule.

The TRUE cells indicate positional differences and will be highlighted. This helper-grid approach avoids compatibility issues with direct references to another worksheet inside a conditional formatting rule. Alternatively, supported Excel editions let you use cross-sheet references in formula rules. Review Microsoft’s conditional formatting guidance. Check the Applies to range and relative references when highlighting an entire grid.

Do not apply the same positional rule to unsorted data and assume every highlighted cell represents a changed record. For the original sample, use the next method to highlight the status of each ID instead.

4. Compare unsorted records with COUNTIF and XLOOKUP

To compare records even when their order changes, use column A as the unique key. First add a status column E to the Old worksheet. This formula identifies records that are absent from the New worksheet:

=IF(COUNTIF(New!$A$2:$A$5,A2)=0,"Removed","Present")

Copy the formula down to E5. It identifies P104 as removed. Next, add a status column E to New. The following formula checks whether each ID was added, duplicated or already present:

=IF(COUNTIF(Old!$A$2:$A$5,A2)=0,"Added",IF(COUNTIF(Old!$A$2:$A$5,A2)>1,"Duplicate ID","Present"))

Copy this formula down. P105 is added. For these formulas, the sample identifiers contain no wildcard characters. COUNTIF treats characters such as * and ? as wildcards, so escape them or use another exact-key approach if they occur in real identifiers.

Find changes in quantity and price

After verifying that IDs are unique in both worksheets, enter the following formula in New!F2. It compares the matching record’s quantity, regardless of its original row position:

=IF(E2<>"Present",E2,IF(C2=XLOOKUP(A2,Old!$A$2:$A$5,Old!$C$2:$C$5),"Match","Changed"))

For price, enter this version in New!G2:

=IF(E2<>"Present",E2,IF(D2=XLOOKUP(A2,Old!$A$2:$A$5,Old!$D$2:$D$5),"Match","Changed"))

Fill both columns down to row 5. P103 should show Changed in both columns. P101 and P102 should show Match, while P105 should show Added. The separate Old status column reports the missing P104. These checks compare quantity and price only; add equivalent checks for any other fields, such as the description, that need review.

IDPresenceQuantity statusPrice status
P103PresentChangedChanged
P101PresentMatchMatch
P102PresentMatchMatch
P105AddedAddedAdded

To show the quantity variance instead of a status, use:

=IF(E2="Present",C2-XLOOKUP(A2,Old!$A$2:$A$5,Old!$C$2:$C$5),"")

P103 returns 3 because its quantity increased from 5 to 8. Its unit price increased by 20. Use conditional formatting on the status columns to highlight Added and Changed, and apply a separate rule to the Old status column for Removed.

Alternative for Excel 2016 and 2019

XLOOKUP is not available in Excel 2016 or 2019. With the sample layout, use an exact-match VLOOKUP in F2 instead:

=IF(E2<>"Present",E2,IF(C2=VLOOKUP(A2,Old!$A$2:$D$5,3,FALSE),"Match","Changed"))

For price, compare D2 and use column index 4. VLOOKUP requires the key to be in the first column of the lookup range. See Microsoft’s XLOOKUP and VLOOKUP documentation.

5. Compare large tables with Power Query

Power Query is useful when comparing weekly inventory exports or other regularly updated lists. Convert each source range into an Excel table, name the tables OldItems and NewItems, and confirm that each contains unique, nonblank IDs.

  1. Select OldItems and use Data → From Table/Range in a supported Excel version. Set the ID column type to Text and quantity and price to appropriate numeric types. Load as a connection where available.
  2. Repeat for NewItems and use the same data types.
  3. In Power Query Editor, choose Merge Queries as New. Select OldItems and NewItems, click the ID column in both, and choose Full outer as the join kind.
  4. Expand the NewItems table to include its ID, quantity and price. Give the old and new columns distinguishable names.
  5. Identify removed rows by a missing New ID, added rows by a missing Old ID, and compare quantity and price for records with both IDs.
  6. Load the resulting comparison to a separate worksheet. Refresh when the source tables change.

A full outer merge retains records from both sources, unlike an inner merge that keeps only matches. The sample should yield five distinct IDs. If the input contains duplicate IDs, the join can multiply matching rows; investigate those duplicates before interpreting totals. Do not treat missing records as zero-value transactions unless your reporting rules explicitly require it.

See Microsoft’s full outer join reference for the underlying operation. Power Query feature availability varies across Excel versions and platforms.

6. Compare two workbooks with Spreadsheet Compare

Microsoft Spreadsheet Compare can inspect two workbook files for differences in values, formulas, formatting and other supported features. It is available only with eligible Windows Office editions; it is not a universal Excel command.

  1. Save separate copies of the two workbook versions.
  2. Open Spreadsheet Compare through Windows search, if installed, or use the Compare Files command in the supported Inquire add-in.
  3. Select the older file as the baseline and the newer file as the comparison.
  4. Review the categories of differences and export the results if needed.

This is particularly helpful when auditing formula changes that happen to produce the same displayed values. It compares workbook structure and cell positions, so rearranged records may still require an ID-based comparison. See Microsoft’s Spreadsheet Compare overview and comparison instructions.

Check totals, duplicate IDs and data types

Before relying on the comparison, check that your keys are unique and consistently typed. A code stored as text in one file and as a number in another can cause lookup inconsistencies; leading zeros and trailing spaces may also matter. Do not convert identifiers into numbers if their leading zeros are meaningful.

=COUNTIF($A$2:$A$5,A2)

Run this check on both input sheets. For the simple sample, every ID should return 1. If a record can legitimately appear more than once, define a composite key or aggregate it using an explicit business rule instead of silently deleting duplicates.

For calculated values that differ only by rounding, choose an appropriate tolerance for your data. For currency recorded to two decimals, you may compare ROUND applied to both amounts rather than their unrounded binary values. Keep genuine missing cells and zeros distinct when required.

Finally, reconcile inventory value (quantity multiplied by unit price). In our sample, the old total is 13,340 and the new total is 14,260, a net increase of 920. The changed printer contributes an increase of 1,060, the removed scanner decreases value by 540, and the added router increases it by 400. The changes reconcile to 920. These are illustrative values, not financial records. A matching total does not prove every record is correct.

Frequently asked questions

How do I compare two Excel sheets with different row orders?

Use a unique ID and exact-match lookup formulas, or a Power Query merge. Avoid comparing corresponding cell positions when the rows are arranged differently.

Can Excel highlight differences automatically?

Yes. Conditional formatting can highlight results from a comparison formula. A query-based report can also be refreshed when source tables change.

Can I compare two Excel files without copying their data?

Yes, you can view workbooks side by side, import them into Power Query or use Spreadsheet Compare in an eligible edition. External workbook formula references can also work, but may create links that depend on the original files.

What if two cells look identical but are flagged as different?

Check their actual values, data types, hidden spaces and precision. Number formatting may make different underlying values look identical.

Explore more practical spreadsheet tutorials on TechHowGrid.


More technology guides