Smart Systems for Home

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

Comparing 2 Excel Worksheets

· 7 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

You can compare two worksheets in Excel by opening them side-by-side in separate windows, using the built-in "Compare and Merge Workbooks" feature, or leveraging the "Conditional Formatting" tool to highlight differences in values or formulas. This process helps identify data discrepancies, missing entries, or errors between versions of the same file.

What You'll Need

  • Two Excel workbooks containing the data you wish to compare.
  • A computer with Microsoft Excel installed (Excel 2013 or later versions are recommended for the best compatibility with these tools).
  • Basic knowledge of Excel features like sorting, filtering, and using formulas.

Step-by-Step

  1. Prepare Your Workbooks: Ensure both worksheets are saved in a compatible file format (like .xlsx or .xls). If you are comparing data from different sources, try to align the data columns as closely as possible. For instance, ensure that the "Name" column in Workbook A corresponds to the "Client Name" column in Workbook B. If the column headers are different, you may need to rename them to match or use a helper column to map the data.
  2. Open the First Workbook: Launch Excel and open the first worksheet you want to use as the reference. This is the version you are comparing against. For example, if you are comparing a current report to a previous month's report, open the current report first.
  3. Activate the Window: Make sure the active window is the one you just opened. You can verify this by looking at the title bar at the very top of the Excel window; it should display the name of your file.
  4. Open the Second Workbook: With the first workbook still open, go to the File menu and select Open. Navigate to the location where your second workbook is saved and select it to open it in the same Excel instance. This will place both workbooks in the same application window.
  5. Arrange the Windows: Once both workbooks are open, you need to arrange them so you can see them side-by-side. Go to the View tab on the ribbon. In the "Window" group, you will see a button labeled "Arrange All." Click on this button.
  6. Choose the Arrangement: In the "Arrange Windows" dialog box, select the radio button labeled "Tiled." This option will fit both windows into the available space on your screen, typically placing them side-by-side horizontally if you have a wide monitor. Click OK.
  7. Adjust the View: You can now see both worksheets. To compare data effectively, you may want to freeze the panes in one or both windows. Go to the View tab and click on "Freeze Panes." Choose "Freeze Top Row" if your data has headers, or "Freeze Panes" to lock a specific row and column range. This helps when scrolling through large datasets, ensuring you always see the headers while comparing rows.
  8. Use the "New Window" Feature (Optional): For a more focused comparison, you can create a new window for one of the workbooks. In the View tab, click on "New Window.” This will create a duplicate view of the current workbook. Now, follow steps 5 and 6 to arrange the original workbook and the new window side-by-side. This is particularly useful if one workbook has a lot of data and you want to keep one window static while you scroll through the other.
  9. Compare Data Visually: With both windows open and arranged, you can now manually compare the data. Look for differences in values, text, or formulas. If you are using the conditional formatting approach, refer to the next section for a more automated method.
  10. Use Conditional Formatting to Highlight Differences: This method is more automated and powerful. Go to your first worksheet. Select the range of cells you want to compare. On the Home tab, in the Styles group, click on "Conditional Formatting." Select "New Rule.”
  11. Create a Formula-Based Rule: In the New Formatting Rule dialog box, select the rule type "Use a formula to determine which cells to format." In the formula input box, you will need to write a formula that checks if the value in the current cell matches the corresponding cell in the second workbook. Assuming your first sheet is on the left and the second on the right, the formula for the cell in the top-left corner of your selected range (A1) would look like this: =A1<>[Workbook2.xlsx]Sheet1!$A$1. Replace "Workbook2.xlsx" with the actual filename of your second workbook and "Sheet1" with the name of the sheet you are comparing to. Replace "$A$1" with the actual cell address of the corresponding cell in the second workbook. This formula checks if the value in cell A1 is not equal to the value in the corresponding cell in the other workbook. If it is not equal, the rule is triggered.
  12. Apply Formatting: Click on the Format button. In the Format Cells dialog box, go to the Fill tab. Choose a color that will make the cell stand out, such as a light red. You can also go to the Font tab to change the text color to bold or red. Click OK to close the Format Cells dialog box, and then click OK again to close the New Formatting Rule dialog box.
  13. Review Highlighted Cells: Excel will now highlight any cells where the value does not match the corresponding cell in the second workbook. You can scroll through the entire range to review all the differences. This method is excellent for spotting missing data or incorrect values.
  14. Using the "Compare and Merge Workbooks" Feature (Advanced): This feature is designed for tracking changes between multiple users who have edited the same workbook. It creates a report of all changes made. To use this, you must save both workbooks in a shared location. Go to the Review tab and click the "Compare and Merge Workbooks" button. This button is only available if you have a file open that was previously saved as a shared workbook or if you have saved the file as a "Shared Workbook.” Select the two files to compare, and Excel will generate a new workbook with a "Changes to Workbook" sheet that lists all the additions, deletions, and modifications.

Common Mistakes

One of the most frequent errors is attempting to compare data that has different column orders or headers. If the columns are not aligned, the conditional formatting formulas will compare apples to oranges, leading to a high number of false positives. Always verify that the data is structured identically before applying comparison tools. Another mistake is not saving the files in the correct location or format before using the "Compare and Merge Workbooks" feature, which requires the files to be accessible and in a compatible state.

Tips

To make the comparison process more efficient, use the "Freeze Panes” feature to keep column headers visible while scrolling. This prevents you from losing context while scanning for differences. If you are dealing with very large datasets, consider using the “Filter” feature to narrow down the data to specific rows or columns that are most likely to have differences. This reduces the amount of data you need to visually scan. For the most accurate results, ensure that both workbooks are closed before starting the comparison process, as Excel sometimes struggles to read data from files that are currently being used by another process.

Troubleshooting

If the windows do not arrange correctly after clicking "Arrange All,” ensure that you have selected the correct option in the dialog box. Tiled is the most common choice, but Cascade can be useful if the windows are too large for your screen. If the conditional formatting rule is not working, double-check the filename in the formula. A common issue is that the filename has spaces or special characters that are not enclosed in brackets. The formula =A1<>[Workbook 2.xlsx]Sheet1!$A$1 is correct, but =A1<>'Workbook 2.xlsx'!$A$1 is also valid if the filename contains spaces. Ensure that the sheet name in the formula matches the actual name of the tab in the workbook. If you receive an error saying that the workbook is not saved, make sure you have actually saved the file before attempting to reference it in a formula.

Frequently Asked Questions

Can I compare two different file types, like .xlsx and .csv?

Yes, you can open a CSV file directly in Excel, and it will be treated as a workbook. You can then follow the side-by-side window method to compare it with an .xlsx file, provided the data structure is compatible.

Why is the "Compare and Merge Workbooks" button grayed out?

This button is typically grayed out unless you have a file open that was previously saved as a "Shared Workbook” or you have saved the file as a Shared Workbook. It is not available for standard, single-user workbooks.

Is there a limit to the number of cells I can compare?

There is no specific hard limit in Excel for the number of cells you can compare visually. However, for very large datasets (over a million rows), the performance of conditional formatting and manual scrolling may degrade significantly.

Does the comparison process modify my original files?

No, the side-by-side window method and the conditional formatting method do not modify your original files. The "Compare and Merge Workbooks” feature creates a new, separate workbook containing the change report and does not alter the source files.

Can I compare data that is on different sheets within the same workbook?

Yes, you can. Simply open the workbook, go to the View tab, and use the "New Window” feature to create a duplicate. Then, use "Arrange All” to view the original sheet and the new window side-by-side.