Smart Systems for Home

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

Compare Excel Documents Step by Step

· 5 min read · Home Tech

In this article
  1. What You Need
  2. Step‑by‑Step
  3. Deepening the Process
  4. Common Mistakes to Avoid
  5. Practical Tips for Accurate Comparisons
  6. Troubleshooting
  7. Additional Techniques
  8. Ensuring Data Integrity
  9. Security and Collaboration Considerations
  10. Final Checks Before Closing

Comparing two Excel files lets you spot differences in values, formulas, and formatting quickly, ensuring data integrity before merging or sharing reports.

What You Need

  • A computer with Microsoft Excel installed (or a compatible program such as Google Sheets, LibreOffice Calc, or Apple Numbers).
  • The two workbooks you want to compare, saved as .xlsx or .xls files.
  • Optional: a diff tool such as Excel's built‑in Compare feature, a third‑party add‑in, or an online spreadsheet diff service.

Step‑by‑Step

  1. Open the first workbook in Excel.
  2. Navigate to the Review ribbon tab.
  3. Click Compare (in newer versions) or Compare Files (in older releases).
  4. In the file picker, select the second workbook and press Open.
  5. Excel creates a new workbook titled Compare.xlsx that contains three worksheets: Workbook 1, Workbook 2, and Differences.
  6. In the Differences sheet, cells are colour‑coded: green for added content, red for deleted content, and blue for modified values.
  7. Scroll through the Differences sheet and double‑click any highlighted cell to jump to the original location in either source workbook.
  8. If you only need to compare specific sheets, rename the sheets identically in both workbooks before starting the comparison; otherwise the tool will skip mismatched sheet names.
  9. To examine formulas rather than displayed values, press Ctrl+Shift+~ (or Ctrl+`) to toggle Show Formulas mode, then repeat the Compare steps.
  10. When the review is complete, save the comparison workbook to preserve a record of the differences.
  11. Close all three workbooks when you are finished.

Deepening the Process

Sometimes the built‑in Compare command is not enough, especially with large or complex spreadsheets. In those cases, follow these additional steps:

  1. Use Conditional Formatting to highlight mismatches visually. Copy the data from both workbooks into separate sheets, then apply a formula such as =IF(A2=Sheet2!A2,0,1) to flag differences.
  2. Leverage the INDIRECT function to compare ranges dynamically when sheet names vary.
  3. If you have many workbooks to audit, write a small VBA macro that loops through each file, runs the Compare method, and outputs a summary report to a new workbook.
  4. For auditors who need a printable record, export the Differences sheet to PDF via File > Export > Create PDF/XPS Document.
  5. When dealing with merged cells or tables, ensure that both workbooks use the same table structure; otherwise the comparison may misinterpret cell boundaries.

Common Mistakes to Avoid

  • Opening the files in Compatibility Mode disables newer features, leading to false negatives.
  • Comparing workbooks with different regional settings (e.g., comma vs. period decimal separators) can cause mismatched values.
  • Leaving filters or hidden rows active before comparison skews the result, because hidden data is still evaluated.
  • Relying solely on colour highlights without checking the underlying formula bar can miss subtle formula changes.
  • Saving over the original workbook before reviewing the Differences sheet can permanently alter data.

Practical Tips for Accurate Comparisons

  • Before comparing, ensure both files are saved in the latest .xlsx format.
  • Turn on Show Formulas (Ctrl+`) to compare formulas directly instead of just cell values.
  • If the Compare button is missing, enable the Analyze Data add‑in through File > Options > Add‑Ins and select Excel Add‑ins.
  • For very large spreadsheets, split the data into multiple worksheets or workbooks to improve performance and reduce memory errors.
  • Document any changes you make during the review in a separate log workbook to maintain an audit trail.
  • When comparing tables, use the Table Design tab to verify that column names and data types match.

Troubleshooting

If the Compare command does not appear or produces unexpected results, follow this order of checks:

  1. Confirm that both files are stored locally; network paths sometimes block the feature.
  2. Update Excel via File > Account > Update Options > Update Now to the latest build.
  3. Verify that the workbooks are not opened in Read‑Only mode, which can prevent modifications needed for the comparison.
  4. If the issue persists, use a third‑party diff utility such as Beyond Compare or an online spreadsheet diff service that can read .xlsx files directly.
  5. When highlighted differences look incorrect, clear any active filters, remove hidden rows, and restart Excel before retrying.

If you encounter a password‑protected workbook, you must first remove the password before the Compare feature can process it, as encrypted files are not supported.

Additional Techniques

Beyond the native Compare tool, you can employ these methods to deepen your analysis:

  • Use Power Query to load both workbooks into separate queries and then perform a Full Outer Join to surface rows that exist in only one source.
  • Export the data to CSV files and run a line‑by‑line diff using command‑line tools like diff on macOS/Linux or fc on Windows.
  • For developers, the Microsoft Graph API provides programmatic access to workbook contents, enabling automated comparison across many files.
  • When comparing large data sets, consider aggregating rows by a unique key (such as an ID column) before applying the Compare function to reduce processing load.

Ensuring Data Integrity

After completing a comparison, verify the results with these checks:

  1. Count the number of highlighted cells in the Differences sheet and compare that count to an independent audit using conditional formatting.
  2. Select a random sample of highlighted cells and manually inspect the original cells to confirm the discrepancy.
  3. Check that no cells are missing from the comparison due to sheet name mismatches; rename sheets to match if necessary.
  4. If the comparison was performed on a subset of data, ensure that the same rows and columns were selected in both workbooks before initiating the Compare operation.
  5. Save a copy of the original workbooks in a separate folder as a backup before making any edits based on the comparison.

Security and Collaboration Considerations

When sharing compared results with teammates, keep these practices in mind:

  • Do not distribute the original password‑protected files unless the recipient also has the password; instead, share the comparison workbook which contains only the differences.
  • If the data is sensitive, store the comparison workbook in a secure location with appropriate access permissions.
  • Avoid using the Compare feature on workbooks that contain macros unless you have verified that the macros do not alter comparison logic.
  • When collaborating in real time via OneDrive, remember that the Compare tool works only on locally saved copies; sync changes after the comparison is complete.

Final Checks Before Closing

Before you close all workbooks, perform these final verification steps:

  1. Confirm that the Differences sheet contains all expected changes by scrolling to the bottom and checking the last row for any unhighlighted data.
  2. Verify that any saved PDF export matches the on‑screen highlights.
  3. Ensure that any VBA macros or scripts used for automation have been disabled to prevent unintended data changes.
  4. Back up the comparison workbook to a version‑controlled folder or source‑control system if the data is critical.
  5. Document the comparison date and the purpose of the review in a separate log file for future reference.