Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Excel File Comparison: How to Compare Two Sheets

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To compare two Excel files, the quickest reliable method is to open both workbooks and use View > View Side by Side for a visual check, or write a simple formula such as =A2=Sheet2!A2 in a helper column to flag differences row by row. For larger or recurring comparisons, use Conditional Formatting > Highlight Cells Rules > Duplicate Values or a VLOOKUP/XLOOKUP formula to find mismatches. Excel has no single built-in "compare files" button, so the right approach depends on whether you need a quick visual check, a cell-by-cell audit, or an automated report.

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 changes are not lost.
  • Identical or near-identical column layouts in both files — comparison formulas rely on matching column positions or headers.
  • A backup copy of the original files before you edit either one.

Step-by-Step

  1. Open both workbooks. In Excel, go to File > Open and select the first file, then repeat for the second. Both should appear in the taskbar or in the View tab's Switch Windows list.
  2. Arrange them side by side. On the View tab, click View Side by Side. If prompted, choose the other open workbook. Enable Synchronous Scrolling so both sheets scroll together. Note that menu labels can differ slightly by Excel version and platform; on Mac Excel the same commands are under View as well.
  3. Do a visual scan first. With synchronous scrolling on, scroll through both sheets and look for obvious differences in row counts, totals, or formatting. This catches gross errors before you build formulas.
  4. Add a helper column for a cell-by-cell check. In the first workbook, click an empty column header (for example, column Z) and type a header such as Diff. In the first data row, enter a formula like =A2=Sheet2!A2 (replace Sheet2 with the actual sheet name in the second file). This returns TRUE if the cells match and FALSE if they differ.
  5. Copy the formula down. Drag the fill handle down to the last row, or double-click the fill handle to auto-fill to the end of the adjacent data. Repeat for each column you want to compare, or use a single formula that concatenates the row: =A2&B2&C2=Sheet2!A2&Sheet2!B2&Sheet2!C2.
  6. Filter for FALSE. Select the helper column header, go to Data > Filter, and filter to show only FALSE values. Those rows contain differences. Review each one to confirm whether it is a real discrepancy or a formatting artefact (for example, a number stored as text in one file).
  7. Use Conditional Formatting for a visual highlight. Select the range you want to check in the first sheet, then go to Home > Conditional Formatting > New Rule > Use a formula to determine which cells to format. Enter a formula such as =A2<>Sheet2!A2 and choose a fill colour. Differences will be highlighted automatically.
  8. For row-level matching by a key column, use XLOOKUP or VLOOKUP. If the rows are not in the same order, add a column in the first sheet with =XLOOKUP(A2,Sheet2!A:A,Sheet2!B:B,"Not found") to pull the matching value from the second sheet, then compare the two columns with a simple = formula. XLOOKUP is available in Excel for Microsoft 365 and Excel 2021 and later; older versions need VLOOKUP or INDEX/MATCH.
  9. Save a comparison report. Once you have identified differences, copy the filtered rows to a new sheet and add a note column explaining each discrepancy. Save this as a separate file so the original data stays intact.

Common Mistakes

  • Comparing sheets with different row orders. A direct cell-by-cell formula only works if the rows line up. If they do not, use a key column and XLOOKUP/VLOOKUP instead.
  • Ignoring data types. A number stored as text in one file and as a number in the other will show as a difference even if the value looks identical. Use =VALUE() or check the cell format.
  • Forgetting hidden rows or columns. Filters or hidden rows can make it look like data is missing. Clear all filters and unhide rows before comparing.
  • Overwriting the original file. Always work on copies; a mistaken paste can destroy the data you are trying to compare.
  • Relying on the web version for complex comparisons. Excel for the web supports basic formulas but not all features (for example, some Conditional Formatting rules and macros). Use the desktop app for full functionality.

Tips

  • Name the sheets clearly (for example, Jan_Original and Jan_Revised) so formulas are easy to read.
  • Use Freeze Panes on the header row in both workbooks to keep column labels visible while scrolling.
  • For recurring comparisons, save the helper-column formulas as a template so you can reuse them each month.
  • If you only need to check a few cells, the Watch Window (Formulas > Watch Window) lets you monitor specific cells across workbooks without switching windows.
  • Convert both ranges to Excel Tables (Ctrl+T) before comparing; structured references make formulas more robust when rows are added.

Troubleshooting

  • "View Side by Side" is greyed out. This happens when only one workbook is open. Open the second file first, then try again.
  • Formulas return #REF! or #NAME?. Check that the sheet name in the formula matches exactly, including spaces (use single quotes around names with spaces, e.g., 'Sheet 2'!A2). If XLOOKUP is not recognised, your Excel version may be older; use VLOOKUP instead.
  • All cells show as different when they look the same. Likely a data-type or whitespace issue. Use =TRIM() to remove extra spaces and =VALUE() to convert text-numbers. Also check for non-printing characters with =CLEAN().
  • Conditional Formatting does not highlight anything. Confirm the formula uses relative references correctly (no dollar signs on the row/column you want to move) and that the range selected matches the formula's starting cell.
  • Excel is slow or unresponsive during comparison. Large workbooks with many formulas can lag. Close other applications, or compare in smaller chunks (for example, by month or by department) rather than the whole file at once.

Frequently Asked Questions

Can Excel compare two files automatically?

Not with a single button. You can automate comparisons with formulas, Conditional Formatting, or Power Query (Get & Transform Data), but you still need to set up the logic. Power Query is useful for merging tables from two workbooks and flagging mismatches.

What is the fastest way to compare two columns in Excel?

Use a simple equality formula in a helper column, such as =A2=B2, and copy it down. Filter for FALSE to see differences. For visual highlighting, use Conditional Formatting with the rule =$A2<>$B2.

How do I compare two Excel files without opening both?

You can use Power Query to load data from both files into one workbook and compare there. Alternatively, third-party add-ins exist, but they are not part of Excel. The built-in method requires both files to be accessible, though not necessarily open at the same time if you use Power Query.

Why do identical-looking cells show as different?

Common causes are trailing spaces, numbers stored as text, or different date formats. Use =TRIM() and =VALUE() to normalise values before comparing, and check cell formatting with Ctrl+1.

Can I compare more than two files at once?

Not directly with the side-by-side view, which supports two workbooks. For three or more files, use Power Query to append or merge the data into a single table, then apply comparison formulas across columns.

Does Excel for the web support file comparison?

It supports basic formulas and some Conditional Formatting, but not all features (for example, View Side by Side is limited). For full comparison tools, use the desktop version of Excel.