In this guide, we’re going to show you how to compare two tables using Get & Transform Data in Excel.
In our example, there are two identical tables with the same column names. Although both tables contain the same data under the Name column, there are differences in the data under the Form column.
For example, both tables contain “Charizard”, while the left table has “Mega X” and the right one has “Mega Y”.
We can join these two tables to compare them by using Get & Transform Data. Get & Transform Data feature consists of tools previously known as Power Query. You can get more information about this here: Power Query 101.
Creating queries from tables
First step is to convert the tables into Power Query structure.
- Select one your tables.
- Open the Data tab and click the corresponding icon in Get & Transform Data section to get data from your workbook.
- Clicking the button opens the Power Query Editor. You can do any preliminary work on your data in this window. For example, you can filter the data, remove or merge columns without modifying the actual data, and so on.
- Once you are done with your changes, click Close & Load To under the Close & Load list to see other options.
- Make sure to select Only Create Connection under Import Data. This option will save the table as a connection rather that populating the queried data inside the worksheet.
- Apply the same steps 1-5 to the other table. At the end you should have two queries corresponding with your tables. You can see these tables in the Queries & Connections pane.
Joining queries to compare two tables using Get & Transform Data
Next step is to join (merge) the queries in a new table. This will allow us to see the differences between tables.
- Once the queries from the tables are ready, follow Data > Get Data > Combine Queries > Merge to open the Merge dialog of Power Query.
- Select each table in the drop downs.
- Select the columns with different data. For example, if we do not select both Form columns, we will see each Charizard item on both tables in the same row.
- Finally select the Full Outer option for Join Kind to join all rows from both tables.
- Click OK to apply.
- You will see a new column for the second table next to the first table. Click the button next to the column title.
- Make sure that the Expand option is selected.
- Uncheck any columns you do not want to insert into the comparison table.
- Click OK to populate the data of the second table.
- Once you are satisfied, click Close & Load to populate the entire data into your worksheet.
After populating the merged table, you can easily find any rows containing different data. The rows that contain the same data in the specified columns are listed in the same column. Empty columns indicate rows with different data.