Forum Discussion
Comparing Similar tables in excel - Power Query?
OK. Below I detail a bit how I went about solving this. I would still like to know if anyone can tell me -
Can I choose which results will create new worksheets out of the queries pane table results in the PQ editor, and can I name the new worksheets it will create before close and load so they do not appear as Sheet 1, Sheet 2, Sheet 3 etc within the existing workbook?
Quick learner but maybe not the best or most efficient way to compare two tables, I'm not sure but I achieved what I wanted WAY quicker than I had been doing it.
I loaded the two tables to one workbook on separate sheets, and named them as per below.
I'm a bit of an excel dummy, so written for people like me:
- Office 365 Excel - data tab. Choose one cell in one of the two tables to compare - for me I called them NewData & OldData and named their respective sheets to match.
- Far left for me, choose get data from table/range - power query editor opens with a sheet that is whichever of the two sheets you chose, I used a cell within NewData.
- At left is a hidden queries pane, I clicked that to expand, right clicked NewData and chose Duplicate.
- Choose the duplicated result and at the right in query settings for the duplicated result, click source
- In formula pane(Menu View- check box if there is no formula pane) where it showed "NewData" I changed to "OldData" - names of the tables not the worksheets. The contents changed to reflect the table OldData
- At the top menu - I chose drop down Merge Queries as new, merge dialog opens
- Top drop down menu - NewData, select first column. Second drop down menu select OldData and also select it's first column
- Below at Join Kind drop down I chose left anti - then OK
- BOOM! New table created called Merge1 in the queries pane listing all the New Cables I wanted to identify and only them - Requirement 1 check.
- Repeat above steps but at top drop down menu of merge dialog, chose OldData, NewData at second one, choose both first columns again and Left anti join kind again, Boom! Now I have the shortlist of all first column entries that had been removed from the OldData in the new table
I went on to convert original Old/NewData sheets, all to data, create a custom column and combine for both NewData and OldData sheets, appended the tables and close and loaded. This produced a table that merged all contents of both tables into one table on one sheet.
By then going to the last combined column, selecting the contents and removing duplicates, then sorting the first column and highlighting duplicates in first column I got a look instantly at the results where anything at all had changed for the row values that were common to both sheets.
If you ever need to do this and this last bit is unclear I can try to detail a bit better - Though I'm wondering if I am the only one who ever needed to do this and got sick of inserting columns and copy/pastes to see differences between two data sets. With over 4200 rows and 13 odd columns to compare, this is a great solution that is working for me.
Hope it can help someone else!