Power Query - filter & lookup values based on another table

ASB21

New Member
Joined
Sep 28, 2022
Messages
11
Office Version
  1. 2021
Platform
  1. Windows
Hi all,

I have a table that I would like to add to a Power Query and then:
  • filter one of the columns based on values that appear in a column in a separate table in a different worksheet
  • add an additional column that gets populated using a lookup against the separate table
I've provided some simplified sample data below - in that example I'd like to filter Table1 to only show the Product Refs that appear in Table2, and then add a new column called Category into Table1 that does a lookup off Table2 to find the correct category for each Product Ref.

Book1
ABC
1Product RefProduct NameStock Quantity
2101ABC50
3104DEF100
4102GHI20
5109JKL40
6110MNO60
7103PQR10
8106STU20
9108VWX30
10105YZA50
11107BCD60
Sheet1

Book1
AB
1Product RefCategory
2101C
3102B
4103A
5104D
6105B
Sheet2


Thank you in advance for any help you can offer!
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
You can use a Merge where you keep all records from your Filter By list.
 
Upvote 0
Thank you but I'm quite new to Power Query - do you have any more detail on how I go about doing this please?

Many thanks
 
Upvote 0
First, make a connection to Table2 and load it. Then a connection to Table1, where you choose Merge queries, and merge with Table2 (inner join; this will exclude rows only found in Table1) by highlighting Product Ref in both queries. Then Expand the new merged column (the data says "Table") using the icon to the right of the column name, keeping only the field "Category".
 
Upvote 0
Solution
First, make a connection to Table2 and load it. Then a connection to Table1, where you choose Merge queries, and merge with Table2 (inner join; this will exclude rows only found in Table1) by highlighting Product Ref in both queries. Then Expand the new merged column (the data says "Table") using the icon to the right of the column name, keeping only the field "Category".
That's amazing, worked perfectly, thank you so much!
 
Upvote 0
Upvote 0
Thanks for the recommendation Alan, I will definitely grab a copy - very keen to learn more on Power Query (I've been using Excel regularly for 20 years and can't believe I've only just discovered Power Query in the past 2 weeks!)
It truly is Excel's best-kept secret. I am actually a bit shocked it isn't offered as a solution in more threads in this forum.
 
Upvote 0

Forum statistics

Threads
1,215,018
Messages
6,122,703
Members
449,093
Latest member
Mnur

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