Yes, you can compare two Excel spreadsheets to find differences, but Excel does not have a single "Compare Files" button. Instead, you must use the built-in Inquire add-in for older versions, the "Compare and Merge Workbooks" feature in newer versions, or formulas like VLOOKUP and Conditional Formatting for manual analysis. The method you choose depends on whether you need a visual highlight of changes or a list of exact values that match or differ.
What You'll Need
- Two Excel files (.xlsx, .xls, or .xlsm) that are similar in structure (same columns and headers).
- A computer running Windows with Microsoft Excel installed (the steps below apply to Excel for Microsoft 365 and Excel 2019/2021; older versions use the Inquire add-in).
- Basic familiarity with spreadsheet functions like VLOOKUP or the ability to use the "Conditional Formatting" rule editor.
- Internet access is not strictly required, but it is helpful for accessing Excel's online help documentation.
Step-by-Step
- Prepare your files: Ensure both spreadsheets contain the same headers in the same rows. For example, if one file has columns for "First Name", "Last Name", and "Email" starting in A1, the other file must have the same headers in A1, B1, and C1. If the data is in different places, move the columns so they align before comparing.
- Open the Add-in (Optional but Recommended): For the most robust comparison, use the Inquire add-in in Excel 2013 and 2016. Go to File > Options > Add-ins. At the bottom, select COM Add-ins and click Go.... Check the box next to Inquire and click OK. You will now see a new Inquire tab in the ribbon. If you do not see this tab, your version of Excel may not support it, or it was not installed by your organization.
- Start the Comparison (Inquire Method): Click the Inquire tab. Select Compare Files from the toolbar. In the dialog that appears, click the folder icon next to Original File and select the first spreadsheet you want to compare. Then, click the folder icon next to Modified File and select the second spreadsheet. Click OK. Excel will generate a report showing the differences between the two files, including new sheets, deleted sheets, and renamed sheets.
- Compare and Merge Workbooks (Legacy Method): For users on Excel 2019 or later, the Compare and Merge Workbooks feature is still available but is often hidden. Open the first file. Go to the Review tab and click Compare and Merge Workbooks. Select the second file. Excel will ask you where to save the merged version. This is useful for combining changes from multiple users, but it is not ideal for simply seeing what changed. To use this feature, you must first save both files in a shared folder location or use a cloud service like OneDrive or SharePoint.
- Using VLOOKUP to Find Missing Data: This formulaic method is best if you want to identify which rows exist in one file but not the other. In a blank part of your first spreadsheet, type a header like Status in a new column (e.g., Column D). In the first row of that column (D2), enter the following formula:
=IF(ISERROR(VLOOKUP(A2, [SecondFile.xlsx]Sheet1!$A:$A, 1, 0)), "Only in File 1", "Found in Both"). Press Enter. This formula checks if the value in cell A2 exists in Column A of the second file. If it is not found, it returns "Only in File 1"; otherwise, it returns "Found in Both". Drag this formula down to the bottom of your data. Repeat this process in a new column (E) to find rows only in the second file by swapping the file names in the VLOOKUP formula. - Conditional Formatting to Highlight Duplicates: For a visual check of data that appears in both files but might have different values, use Conditional Formatting. Select the range of cells you want to compare (e.g., A2:C100). Go to the Home tab and click Conditional Formatting > Highlight Cells Rules > Equal To.... In the input box, type an equal sign (=
=) and then click on the cell in the *second* spreadsheet that you want to use as a reference. For example, if you want to compare the first spreadsheet's A2 to the second sheet's A2, type=A2and then click on the cell in the other file. Select the formatting style (e.g., a red fill) and click OK. This will highlight any cell in the first file that does not match the corresponding cell in the second file. This method requires you to click on the second file each time you set up a new rule. - Using the Spill Range for Dynamic Comparison (Excel 365): If you have Excel 365, you can create a dynamic report that automatically updates when the source files change. In a new sheet, list your unique keys (e.g., Unique IDs) in a column. In the column to the right, use the `XLOOKUP` function to pull data from both files. For example:
=XLOOKUP(A2, [File1.xlsx]Sheet1!$A:$A, [File1.xlsx]Sheet1!$B:$B, "Not Found")and=XLOOKUP(A2, [File2.xlsx]Sheet1!$A:$A, [File2.xlsx]Sheet1!$B:$B, "Not Found"). This creates two columns of data. You can then use a simple formula in a third column to compare them:=IF(A2=B2, "Match", "Diff"). This method is powerful because the entire comparison updates instantly. - Save and Validate: Once you have identified the differences, save your comparison file. Review the highlighted cells or the list of differences generated by the Inquire report. Make a note of the changes you need to apply to the original files. It is a good practice to keep the comparison file open while you edit the original files to ensure your changes are accurate.
Common Mistakes
- Comparing files with different headers: The most common error is trying to compare two files that have different column names or are in a different order. The VLOOKUP and Conditional Formatting formulas rely on the data being in the same columns, so ensure the headers match exactly before running any comparison.
- Ignoring case sensitivity: Excel's default comparison is case-sensitive. "Apple" and "apple" are considered different values. If you want them to be treated as the same, wrap your comparison in the `EXACT` function:
=IF(EXACT(A2, B2), "Match", "Diff"). - Not accounting for formatting: The Inquire add-in will tell you if two cells have different formulas, but it may not highlight if the values are the same but formatted differently (e.g., one is a date and the other is a number). Always double-check the underlying value of a cell by looking at the formula bar, not just the cell itself.
- Using the wrong file in the formula: When using formulas like VLOOKUP or XLOOKUP, it is easy to accidentally reference the wrong file or the wrong sheet. Always double-check the file name and sheet name inside the brackets:
[Filename.xlsx]SheetName!Range.
Tips
- Use a unique identifier: When using VLOOKUP, always search for a unique identifier like a Product ID or SSN, rather than a name or address, to avoid getting the wrong match.
- Freeze the comparison file: If you are using formulas to compare two files, it can be confusing to have the source files open at the same time. You can freeze the comparison file so it stays on top by right-clicking the tab and selecting Move or Copy.... Check the box for Create a copy and click OK. This gives you a separate window that you can maximize.
- Check for hidden rows: If your comparison results seem incomplete, check if there are hidden rows or columns in either file. The comparison will only analyze the visible data.
- Use a checksum: For very large files, a quick way to check if the data is identical is to calculate a checksum for a small, representative sample of data from each file. Compare the two checksums. If they are the same, the data is likely identical; if they are different, there is a difference.
Troubleshooting
- The Inquire tab is missing. If you do not see the Inquire tab, it is likely because you are using Excel 2019 or a newer version, or your organization has disabled it. The Compare and Merge Workbooks feature is still available in the Review tab for these versions, though it is often hidden. You can also use the VLOOKUP and Conditional Formatting methods as an alternative.
- VLOOKUP returns #N/A. This means the value you are searching for was not found in the second file. This could be because the value is misspelled, the file name is incorrect, or the sheet name is incorrect. Check your spelling and file references.
- Conditional Formatting is not working. Ensure that the cells you selected actually contain the data you want to compare. Also, check that you are using the correct reference to the second file. The rule editor will often create a relative reference (e.g., A2) that will not work if you select a cell in the other file. You must type the equal sign (
=) and then click on the cell in the second file to create an absolute reference. - Files are very large and Excel is slow. If you are comparing files with tens of thousands of rows, formulas like VLOOKUP can be slow. Consider using the Inquire add-in, which is optimized for this task. Alternatively, you can try to reduce the size of your files by removing unnecessary formatting and charts.
Frequently Asked Questions
Can I compare two Excel files on a Mac?
Yes, but the steps are slightly different. The Inquire add-in is not available on Mac. You can use the "Compare and Merge Workbooks" feature by saving the files to a shared folder, but it is often more reliable to use formulas like VLOOKUP or XLOOKUP, which work the same way on both platforms.
What is the difference between "Compare Files" and "Compare and Merge Workbooks"?
"Compare Files" (Inquire) is for analysis; it shows you what changed but does not save the changes for you. "Compare and Merge Workbooks" is for collaboration; it combines the changes from multiple files into a single master file.
Why does VLOOKUP return #REF!
A #REF! error usually means you have referenced a range that is too small for the data you are trying to look up. Ensure that your lookup range includes the column you want to return (e.g., if you want to return data from Column B, your range must start at Column A).
Is there a limit to how many files I can compare at once?
No, there is no built-in limit to the number of files you can compare using the Inquire add-in. However, the process can become very slow and resource-intensive if you are comparing dozens of large files.
Can I compare files stored in different folders?
Yes, you can compare files stored in different folders by using the file path in the formula. For example: =VLOOKUP(A2, 'C:\Users\Name\Documents\[File2.xlsx]Sheet1'!$A:$A, 1, 0). This allows you to keep your files organized in different locations while still comparing them.
What if the columns are in a different order?
If the columns are in a different order, you can still compare the files by using the column number in the VLOOKUP formula instead of the column name. For example, if the value you want to compare is in the first column of both files, you can use =VLOOKUP(A2, [File2.xlsx]Sheet1!$A:$A, 1, 0) regardless of what the column header says.