Merge two worksheets using PowerQuery

eduzs

Well-known Member
Joined
Jul 6, 2014
Messages
704
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
I have two workshets "ShtA", "ShtB", with columns A-H with data, I want to use PowerQuery to write in "ShtC" all "ShtB" data plus the data that is in ShtA but not in ShtB using clomun "A" to verify this.
How can I do that?
Thanks.
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
using XL2BB show structure of data from both sheets

anyway you can
  • use append feature
  • use merge feature with key column but you don't want it
  • use index column for each table as key columns and merge
but I don't know the structure of your data so that's all what I can say
 
Last edited:
Upvote 0
Solution
Without knowing the value in column A to validate, we can only answer in generic terms. First, it's easiest for naming if you have the data in each sheet in a table.

Load each table into Power Query using the "From Table/Range" ribbon choice in the Data menu. Let's say the queries are called tblA and tblB.

You will want to merge tblA with a left join on tblB based on the values in column A.

The new merged query (tblC) will have values where tblA and tblB matched. Delete the rows where this happens... now you will have only rows from tblA that did not match to anything in tblB.

Now append tblC query to tblB query (tblD).

Finally, load tblD to a new worksheet - make queries tblA, tblB, tblC Connection Only as there's no need to load them to the data model.
 
Upvote 0
I managed to create two tables TblA and TblB, now I need to creat a query that returns all records from TblA plus records that are in TblB but not in TblA. How can I do that with PowerQuery?
 
Upvote 0
Thanks! I managed to do it using append feature and removing duplicates.
Much easier than I thought.
 
Upvote 0

Forum statistics

Threads
1,223,744
Messages
6,174,254
Members
452,553
Latest member
red83

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top