Filter function to return multiple values while auto adjusting lookup range against filtered results

irfananeeza

Active Member
Joined
Feb 15, 2008
Messages
338
Office Version
  1. 2010
Hi Experts,

I am using new Filter function to return multiple values from a different workbook data. The filter is does work. However, when it returns matching values against the lookup value the other lookup values right below the matching lookup value does not get pushed down. I would like some kind of formula that determines count of matching values and then automatically push down the 2nd lookup value to the end of the list. This allows me to copy/paste filter formula down to return the matching values for the second lookup and son. I am working with a huge lookup list and doing it manually is tough. I have attached a sample screen and would appreciate your help.

Thanks in advance!

Book1
BCDEF
1Book1_Sheet1Book2_Lookup Array
2FILTER($E$3:$E$12,$F$3:$F$12=B3)
3Invoice#Filter FormulaVin#Invoice#
4ABC123Company1Company1ABC123
5DEF123Company2Company2ABC123
6GHI123Company3Company3ABC123
7Company4Company4ABC123
8Company5Company5ABC123
9Region1DEF123
10EastGHI123
11WestGHI123
12NorthGHI123
13SouthGHI123
Sheet1
Cell Formulas
RangeFormula
C4:C8C4=FILTER($E$4:$E$13,$F$4:$F$13=B4)
Dynamic array formulas.
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
How about
Fluff.xlsm
BCDEF
1Book1_Sheet1Book2_Lookup Array
2
3Invoice#Filter FormulaVin#Invoice#
4ABC123Company1Company1ABC123
5DEF123Company2Company2ABC123
6GHI123Company3Company3ABC123
7Company4Company4ABC123
8Company5Company5ABC123
9Region1Region1DEF123
10EastEastGHI123
11WestWestGHI123
12NorthNorthGHI123
13SouthSouthGHI123
14
Sheet5
Cell Formulas
RangeFormula
C4:C13C4=DROP(REDUCE("",TOCOL(B4:B8,1),LAMBDA(x,y,VSTACK(x,FILTER($E$4:$E$13,$F$4:$F$13=y)))),1)
Dynamic array formulas.
 
Upvote 0
Depending on the consistency of your data, another option:
2024 Review.xlsx
ABCDEF
1Book1_Sheet1Book2_Lookup Array
2
3Invoice#Filter FormulaVin#Invoice#
4ABC123Company1Company1ABC123
5DEF123Company2Company2ABC123
6GHI123Company3Company3ABC123
7Company4Company4ABC123
8Company5Company5ABC123
9Region1Region1DEF123
10EastEastGHI123
11WestWestGHI123
12NorthNorthGHI123
13SouthSouthGHI123
Sheet6
Cell Formulas
RangeFormula
C4:C13C4=FILTER(E4:E13,ISNUMBER(XMATCH(F4:F13,B4:B6)))
Dynamic array formulas.
 
Upvote 0
Many thanks to both @Cubist and @Fluff. I spent time playing around with both variations.

@Cubist, I tried your formula but could not make it work, the message say's there is a problem with the formula.

@Fluff, I have tried your's. It partially worked. The formula seems to return matching results for all the lookup values combined. However, the formula does not push the lookup value down to match the return values. The screen shot shows what results I get when I use your formula vs. the result expected. Would appreciate your help. Thanks.
Book1
BCDEF
1Book1_Sheet1Results from FLUFF's formulaBook2_Lookup Array
2'=FILTER(E4:E13,ISNUMBER(XMATCH(F4:F13,B4:B6)))
3Invoice#Filter FormulaVin#Invoice#
4ABC123Company1Company1ABC123
5DEF123Company2Company2ABC123
6GHI123Company3Company3ABC123
7Company4Company4ABC123
8Company5Company5ABC123
9?Region1Region1DEF123
10?EastEastGHI123
11WestWestGHI123
12NorthNorthGHI123
13SouthSouthGHI123
14
15Result Expected:
16Invoice#Filter Formula
17ABC123Company1
18Company2
19Company3
20Company4
21Company5
22DEF123Region1Celll B22 matching with it's correspoing result
23GHI123EastCell B23 matching with corresponding results
24West
25North
26South
Sheet1
Cell Formulas
RangeFormula
C4:C13C4=FILTER(E4:E13,ISNUMBER((XMATCH(F4:F13,B4:B6))))
C17:C21C17=FILTER($E$4:$E$13,$F$4:$F$13=B17)
Dynamic array formulas.
 
Last edited:
Upvote 0
You have included Cubist's formula, which you said didn't work, but not mine. :confused:

How about
Fluff.xlsm
BCDEF
1Book1_Sheet1Book2_Lookup Array
2
3Invoice#Filter FormulaVin#Invoice#
4ABC123Company1ABC123
5DEF123Company2ABC123
6GHI123Company3ABC123
7Company4ABC123
8Company5ABC123
9?Region1DEF123
10?EastGHI123
11WestGHI123
12NorthGHI123
13SouthGHI123
14
15Result Expected:
16Invoice#Filter Formula
17ABC123Company1
18Company2
19Company3
20Company4
21Company5
22DEF123Region1
23GHI123East
24West
25North
26South
Sheet5
Cell Formulas
RangeFormula
B17:C26B17=DROP(REDUCE("",TOCOL(B4:B8,1),LAMBDA(x,y,LET(f,FILTER($E$4:$E$13,$F$4:$F$13=y),VSTACK(x,HSTACK(EXPAND(y,ROWS(f),,""),f))))),1)
Dynamic array formulas.
 
Upvote 0
Hi @Fluff,

Thanks for your response. Sorry, it was my mistake I mixed up @Cubist and @Fluff.

@Cubist formula worked partially as it returns all matches but it would not push down the corresponding lookup value.

@Fluff, your initial formula with Lambda gave me error message saying "there is a problem with formula". But thanks your version 2, it worked beautifully. I am very thankful for your help. It is complex formula whereas I found @Cubist formula relatively easy. @Fluff, if you don't mind I follow up with @Cubist to see if he can provide me an amended formula to get the desired result because it is easier for me to understand it.

Hi @Cubist, I found your formula "=FILTER(E4:E13,ISNUMBER((XMATCH(F4:F13,B4:B6))))" relatively easy to apply. It did work but partially. Is there a possibility that you can help tweak it a bit to produce the desired result i.e. the lookup values in column B get pushed down to match the filter returned values.?

Thanks to both of you.
 
Upvote 0
Are you OK with having the Inv# on all entries? It's simpler than just the first instances. Try:
2024 Review.xlsx
ABCDEF
1Book1_Sheet1Book2_Lookup Array
2
3Invoice#Filter FormulaVin#Invoice#
4ABC123Company1ABC123
5DEF123Company2ABC123
6GHI123Company3ABC123
7Company4ABC123
8Company5ABC123
9Region1DEF123
10EastGHI123
11WestGHI123
12NorthGHI123
13SouthGHI123
14
15Result Expected:
16Invoice#Filter Formula
17ABC123Company1
18ABC123Company2
19ABC123Company3
20ABC123Company4
21ABC123Company5
22DEF123Region1
23GHI123East
24GHI123West
25GHI123North
26GHI123South
Sheet7
Cell Formulas
RangeFormula
B17:C26B17=FILTER(HSTACK(F4:F13,E4:E13),ISNUMBER(XMATCH(F4:F13,B4:B6)))
Dynamic array formulas.
 
Upvote 0
Solution
Hi @Cubist, it worked perfectly exactly what I was looking for and its relatively easy to apply. Thank you for your help.

@Fluff, I also want to thank you for your help as well. Having two options always better.

Both of you are amazing.
 
Upvote 0

Forum statistics

Threads
1,225,504
Messages
6,185,363
Members
453,288
Latest member
rlmorales2000

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