Power Query - Combine List.Contains with Greater Than or Equal To

berian

New Member
Joined
Jul 8, 2022
Messages
6
Office Version
  1. 365
Platform
  1. Windows
I have two tables which look like below:

Lookup
QtyStock Code
500LANDECCOM130
200SANWETSCR157
2000CAJGGRCOR01

Data
Stock CodeQtyCustomer NameMobile No.
LANDECCOM130
652​
Customer 1+447123456781
SANWETSCR157
121​
Customer 2+447123456782
SANWETSCR157
212​
Customer 3+447123456783
LANDECCOM130
258​
Customer 4+447123456784
CAJGGRCOR01
1288​
Customer 5+447123456785
SANWETSCR157
91​
Customer 6+447123456786
CAJGGRCOR01
4050​
Customer 7+447123456787

Using power query I would like to use every row from the lookup table to pull the only those rows in the data table.

For example Show all rows that are have the Stock Code 'LANDECCOM130' and a 'Qty' greater than or equal to 500 - AND - Show all rows that are have the Stock Code 'SANWETSCR157' and a 'Qty' greater than or equal to 200, etc.

I've tried using a list.contains on the stock code and that pulls the stock codes for me, but I can't seem to be able to combine this with the greater than or equal to for the quantity.

Any advice would be gratefully received.
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
You could do a simple merge of the two tables using the stock code to add a column to the data table showing the relevant Qty threshold. Then simply add a calculated column that checks if the actual qty is greater than the threshold and filter the resulting query for rows where the calculation is true.
 
Upvote 1
Solution
You could do a simple merge of the two tables using the stock code to add a column to the data table showing the relevant Qty threshold. Then simply add a calculated column that checks if the actual qty is greater than the threshold and filter the resulting query for rows where the calculation is true.
Perfect! Think I was over thinking things here!

Thanks for the assist!
 
Upvote 0

Forum statistics

Threads
1,216,028
Messages
6,128,393
Members
449,446
Latest member
CodeCybear

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