How to Compare Excel Files for Differences
In this article
To compare two Excel files for differences, the fastest reliable method is to open both workbooks side by side and use Excel's built-in Compare Files feature (available in Microsoft 365 and Excel 2021 and later) or, if you don't have that, use formulas like =A1=Sheet2!A1 in a helper column or apply conditional formatting to highlight changed cells. For a quick visual check, arrange both windows side by side and turn on synchronous scrolling. For a thorough audit, copy both sheets into one workbook on separate tabs and use a formula-driven difference report. The steps below walk through each approach, from the simplest to the most robust.
What You'll Need
- Microsoft Excel (desktop version recommended; the web version has fewer comparison features).
- Both files saved and closed before you start, so neither is locked by another user.
- If the files are on a shared drive or OneDrive, make sure you have at least read access to both.
- For the formula method: a basic understanding of cell references and how to drag a formula across a range.
- Optional: a third blank workbook to hold your difference report, so you don't accidentally overwrite the originals.
Menu labels can differ slightly by Excel version, device and region, so if you don't see an exact label, look for the closest match in the same tab.
Step-by-Step
- Back up both files first. Copy each workbook to a separate folder or add a date to the filename. Comparison steps that involve pasting or overwriting can destroy data if you pick the wrong cell, and a backup is the only undo that works after you close the file.
- Open both workbooks in Excel. Go to View and click View Side by Side. If you have more than two workbooks open, Excel will ask which one to compare against; pick the other file. Then click Synchronous Scrolling so both sheets scroll together. This is the quickest way to spot obvious layout or value changes.
- Check the sheet structure first. Look at the tab names, the number of rows and columns, and whether headers match. If one file has an extra column or a renamed header, formulas that reference the other sheet by column letter will give false differences. Fix structural mismatches before comparing values.
- Use the Compare Files feature if you have it. In Excel for Microsoft 365 and Excel 2021+, go to Review and look for Compare Files (sometimes labelled Compare or Spreadsheet Compare depending on your version). Select the two workbooks and run the comparison. Excel produces a report highlighting changed cells, inserted or deleted rows, and formula changes. If you don't see this option, your version doesn't include it; use the formula method below instead.
- Build a formula-based difference report. Open a new blank workbook. Copy the first sheet from file A into Sheet1 and the matching sheet from file B into Sheet2. In Sheet3, in cell A1, enter
=IF(Sheet1!A1=Sheet2!A1,"","DIFF"). Drag this formula across the full used range (for example, A1:Z1000). Any cell showing DIFF is a difference. To see the actual values side by side, add two more columns:=Sheet1!A1and=Sheet2!A1. - Use conditional formatting for a visual highlight. On Sheet1, select the range you want to compare, go to Home > Conditional Formatting > New Rule > Use a formula to determine which cells to format, and enter a formula such as
=A1<>Sheet2!A1. Choose a fill colour and click OK. Changed cells now stand out in the original layout, which is easier to read than a list of DIFF flags. - Compare formulas, not just values. If you need to know whether a formula changed (not just the result), switch to Formulas > Show Formulas in both workbooks and compare the text. Alternatively, use
=FORMULATEXT(Sheet1!A1)=FORMULATEXT(Sheet2!A1)in your report sheet. This catches cases where the value is the same but the logic behind it is different. - Check for hidden rows, columns and sheets. Right-click any row or column header and look for Unhide. Right-click a sheet tab and look for Unhide. Differences hidden this way are easy to miss and often explain why totals don't match.
- Review the report and document the changes. Work through the DIFF cells one by one, note what changed and why, and keep the report workbook as an audit trail. If you're comparing versions of a budget or inventory, save the report with a clear name like comparison_2024-06-01.xlsx.
Common Mistakes
- Comparing the wrong sheets. If file A's data is on Sheet1 and file B's is on Sheet2, a formula that points to the wrong tab will flag every cell as different. Double-check tab names before dragging formulas.
- Ignoring formatting-only differences. A cell can look different (bold, red fill) while holding the same value. Decide up front whether you care about formatting; if not, compare values only.
- Forgetting about trailing spaces. "Apple" and "Apple " look identical but compare as different. Use
=TRIM(A1)=TRIM(Sheet2!A1)if you suspect stray spaces. - Comparing dates as text. A date stored as text in one file and as a real date in the other will always show a difference. Check the cell format in both files.
- Overwriting the original. Pasting comparison results into the source workbook instead of a third file is the most common way to lose data. Always work in a copy.
Tips
- Name your ranges (Formulas > Define Name) before comparing. Named ranges make formulas easier to read and less likely to break when rows are inserted.
- Use
EXACT()instead of=when case matters:=EXACT(A1,Sheet2!A1)treats "Apple" and "apple" as different. - For large files, compare in chunks (for example, rows 1–500, then 501–1000) so Excel stays responsive.
- If you compare often, save your difference-report workbook as a template with the formulas already in place, then just paste in new data each time.
- Turn off automatic calculation (Formulas > Calculation Options > Manual) while building large comparison formulas, then switch back to Automatic and press F9 to recalculate.
Troubleshooting
- Every cell shows as different. The most likely cause is a misaligned reference (wrong sheet name, or one file has an extra header row). Delete the extra row or adjust the formula range.
- Compare Files is greyed out or missing. This feature is not available in Excel for the web or in older versions. Use the formula or conditional formatting method instead.
- Formulas return #REF! errors. A referenced sheet was renamed or deleted. Re-point the formula to the correct tab.
- Differences appear that you can't see. Check for hidden rows/columns, trailing spaces, or numbers stored as text. Use
=LEN(A1)in both sheets to spot invisible characters. - Excel freezes during comparison. Close other workbooks, switch calculation to Manual, and compare a smaller range. If it still freezes, restart Excel and try again.
Frequently Asked Questions
Can I compare two Excel files without opening them?
No. Excel needs both workbooks open to compare them. Some third-party tools can compare files on disk, but Excel's own features require the files to be open.
Does Excel have a built-in compare tool?
Yes, in Microsoft 365 and Excel 2021 and later there is a Compare Files option under the Review tab. In older versions and Excel for the web, you need to use formulas or conditional formatting.
How do I compare two sheets in the same workbook?
Use the same formula method but reference both sheet names in one workbook, for example =IF(Sheet1!A1=Sheet2!A1,"","DIFF"). You can also use View > New Window to open two windows of the same workbook and arrange them side by side.
Why do identical-looking cells show as different?
Usually because of hidden characters (trailing spaces), numbers stored as text, or different date formats. Use TRIM(), check cell formatting, and compare with EXACT() to isolate the cause.
Can I compare more than two files at once?
Excel's built-in Compare Files handles two workbooks at a time. For three or more, compare them in pairs and keep a master difference report, or use a formula-based report that pulls from multiple sheets.
Will comparing files change either original?
No, as long as you follow the steps and work in a separate report workbook. The comparison itself is read-only; only pasting or overwriting changes data.