Dynamic Filter

RAMU

Active Member
Joined
Dec 11, 2009
Messages
345
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
  2. Mobile
Hi,
I have an excel file where Sheet1 & Sheet2 carrying Data.
In Sheet one is a table (Table1) mentioned below:

item CodeClosing qty
apple
45​
ginger
25​
guava
65​
mango
30​
potato
50​

In sheet2 a bunch of Data are in A1:C9


item Codewarehouseqty
guava
1​
20​
mango
2​
30​
potato
1​
50​
ginger
2​
25​
guava
1​
25​
apple
3​
20​
apple
1​
25​
guava
3​
20​

I need a dynamic filter formula in F1 (Sheet2), when I shall filter the Table1 (Sheet1) Item Code Column, as an example if I filter it as guava, in the F1 of Sheet 2 will give me result like this:

item Codewarehouseqty
guava
1​
45​
guava
3​
20​

Pls help
Thanks in advance
Regards
RAMU
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
MS office 365

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
The following might be an option if I understand correctly what you are after:

Excel Formula:
=LET(
u,UNIQUE(A2:B9),
a,UNIQUE(A2:A9&B2:B9),
b,DROP(REDUCE("",a,LAMBDA(x,y,VSTACK(x,SUM(FILTER(C2:C9,A2:A9&B2:B9=y))))),1),
c,HSTACK(u,b),
IFERROR(FILTER(c,CHOOSECOLS(c,1)=FILTER(Sheet1!A2:A6,BYROW(Sheet1!A2:A6,LAMBDA(x,SUBTOTAL(3,x))))),0))

But it is rather complicated as @Skyybot rightly pointed out - i.e. it might be easier and more user-friendly with pivot table or at least with drop-down list.
 
Upvote 0
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
Done Sir, thanks for your advice
 
Upvote 0
The following might be an option if I understand correctly what you are after:

Excel Formula:
=LET(
u,UNIQUE(A2:B9),
a,UNIQUE(A2:A9&B2:B9),
b,DROP(REDUCE("",a,LAMBDA(x,y,VSTACK(x,SUM(FILTER(C2:C9,A2:A9&B2:B9=y))))),1),
c,HSTACK(u,b),
IFERROR(FILTER(c,CHOOSECOLS(c,1)=FILTER(Sheet1!A2:A6,BYROW(Sheet1!A2:A6,LAMBDA(x,SUBTOTAL(3,x))))),0))

But it is rather complicated as @Skyybot rightly pointed out - i.e. it might be easier and more user-friendly with pivot table or at least with drop-down list

Pivot Table also accepted but how can I link the filter in between the Table of sheet1 & pivot table of Sheet2 ? Kindly help
 
Last edited:
Upvote 0
Wouldn't a PivotTable of Sheet2 data work?
Hi,
Yes no issue using pivot table but is it possible to link the filter of Table in sheet1 & Pivot in sheet2 ? Also suppose instead of filtering the item code in the table if I only select the Item Code in Table, Can it be possible to auto filter the same item code in Pivot & get the data ?
 
Upvote 0
Pivot Table also accepted but how can I link the filter in between the Table of sheet1 & pivot table of Sheet2 ? Kindly help
The following might be an option if I understand correctly what you are after:

Excel Formula:
=LET(
u,UNIQUE(A2:B9),
a,UNIQUE(A2:A9&B2:B9),
b,DROP(REDUCE("",a,LAMBDA(x,y,VSTACK(x,SUM(FILTER(C2:C9,A2:A9&B2:B9=y))))),1),
c,HSTACK(u,b),
IFERROR(FILTER(c,CHOOSECOLS(c,1)=FILTER(Sheet1!A2:A6,BYROW(Sheet1!A2:A6,LAMBDA(x,SUBTOTAL(3,x))))),0))

But it is rather complicated as @Skyybot rightly pointed out - i.e. it might be easier and more user-friendly with pivot table or at least with drop-down list.
The formula showing 0

1727597777942.png
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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