logo
search
Power Query Problems

How to Compare File Versions and Show Changes Using Excel Power Query

John WilsonJohn Wilson Oct 20, 2026 868 views

Question details

The user needs to compare two versions of an Excel file to identify and display only the data that has changed between them.

How to Compare File Versions and Show Changes Using Excel Power Query
Product
Microsoft Excel
Device & OS
not provided
Scenario
Comparing old and new data sets or file versions to find discrepancies and updates.
Observed behavior
The goal state is to see a filtered list of only the changed data between two file versions by using Power Query's merge and conditional logic features.
Before you start

Ensure both versions of your Excel files are accessible, properly formatted as tables, and have a common unique identifier (like an ID column) to accurately match and compare the rows.

Solution 1Recommended

Compare File Versions Using Power Query Merge and Custom Columns

Merge both file versions into a single query, apply conditional logic to spot differences, and filter the output to show only the changed records.

By merging queries, you can bring the old and new data together side by side. Adding a custom conditional column allows Excel to automatically detect mismatched values between the two versions, making it easy to filter out the unchanged data.

1
Import Both File Versions

Open a blank Excel workbook, navigate to 'Data' > 'Get Data' > 'From File' > 'From Workbook', and import both the old and new versions of your file as separate queries.

2
Merge the Queries

From the Power Query Editor Home tab, select 'Merge Queries as New'. Choose the old file query as the first table and the new file query as the second. Click the unique identifier column (e.g., ID) in both previews to link them, then click 'OK'.

3
Expand the Merged Table

In the new merged query, click the expand icon in the column header of the second table. Select the columns you want to compare so that the old and new values are positioned side by side.

4
Add a Conditional Custom Column

Go to 'Add Column' > 'Custom Column'. Write a conditional formula to compare the columns, such as: if [OldValue] <> [NewValue] then "Changed" else "Unchanged". Name the column 'Status' and click 'OK'.

5
Filter and Load the Changes

Click the filter drop-down on your new 'Status' column and uncheck 'Unchanged' to display only the differences. Remove any unnecessary columns, then click 'Close & Load' on the Home tab to output the final results into your workbook.

Compare File Versions Using Power Query Merge and Custom Columns
Updating Future Comparisons: To perform a new comparison in the future, simply update the source files in their original location and click 'Refresh All' in Excel. The query will automatically re-run and show the new differences.
Free Microsoft Office alternative

Compare Data Easily with WPS Office

While Power Query is effective for advanced database handling, WPS Office offers a free, lightweight, and highly compatible alternative. You can easily compare two worksheets side-by-side or use conditional formatting and VLOOKUP formulas to instantly spot differences between file versions without complex queries.

  1. 1. Open Both Versions: Launch WPS Spreadsheet and open both the old and new versions of your file.
  2. 2. Use Conditional Formatting: Select the data range in the new file, go to 'Home' > 'Conditional Formatting' > 'New Rule' to highlight unique or mismatched values against the old data.
  3. 3. Apply Simple Formulas: Alternatively, use a formula like =IF(A2<>Sheet1!A2, "Changed", "") to instantly mark differences right next to your data.
100% compatible with Microsoft Excel (.xlsx) file formats.Free, lightweight, and fast-loading spreadsheet application.Built-in side-by-side view for quick manual file comparisons.Use familiar formulas like VLOOKUP or IF to spot version differences with zero learning curve.
microsoft office alternative - wps office

Frequently Asked Questions

Do I have to rebuild the Power Query every time my file updates?

No, you do not need to rebuild the query. You only need to ensure the updated source file replaces the old one (with the exact same name and file path), then click 'Refresh All' in Excel to update the comparison results.

Why are some differences not showing up in my custom column?

This often happens if there are trailing spaces or formatting differences (like text versus number formats) between the two files. Make sure to use the 'Trim' function on your text columns and match data types in Power Query before completing the merge.

Can I compare multiple columns at once in Power Query?

Yes. You can merge queries based on multiple matching columns by holding down the CTRL key and selecting the columns in the exact same order in both table previews during the merge process.

How do I deal with errors after splitting columns in the query?

If splitting columns generates errors, it is usually due to inconsistent delimiters in your raw data. You can resolve this by adding a step to replace inconsistent characters (e.g., replacing semicolons with commas) before applying the split column function.