Filter function to filter an array of conditions

CErnst

New Member
Joined
Nov 30, 2021
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Long time listener, first time caller.

Please see attached image. I'm trying to use the filter function to essentially return the content column (C) based on a variable list from the key column (B). That variable list would be contained in the List column (E). Column G is what I'm expecting the results to look like. I2 is the formula that I have in my head, but not sure why it isn't working. I read the formula in I2 as "I'm filtering column c, when column B contains any word found in an array constructed from column E that has a value"


I'm willing to bet the answer will be relatively easy, but I'm just not seeing it. I would appreciate any help.
 

Attachments

  • double_filter.jpg
    double_filter.jpg
    62.1 KB · Views: 47

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
MrExcelPlayground5.xlsx
BCDEFG
1KeyContentListResult
2catcat line 1catcat line 1
3catcat line 2dogcat line 2
4catcat line 3birdcat line 3
5dogdog line 1dog line 1
6dogdog line 2dog line 2
7dogdog line 3dog line 3
8birdbird line 1bird line 1
9birdbird line 2bird line 2
10birdbird line 3bird line 3
11snakesnake line 1
12snakesnake line 2
13snakesnake line 3
Sheet13
Cell Formulas
RangeFormula
G2:G10G2=FILTER(C2:C13,NOT(ISNA(MATCH(B2:B13,E2:E4,0))))
Dynamic array formulas.

This is if col B equals something in col E. If you wanted something that contains something in Col E, that can be managed too.
 
Upvote 0
Hi & welcome to MrExcel.
Another option
+Fluff 1.xlsm
ABCDEFG
1KeyContentListResult
2catcat line 1catcat line 1
3catcat line 2dogcat line 2
4catcat line 3birdcat line 3
5dogdog line 1dog line 1
6dogdog line 2dog line 2
7dogdog line 3dog line 3
8birdbird line 1bird line 1
9birdbird line 2bird line 2
10birdbird line 3bird line 3
11snakesnake line 1
12snakesnake line 2
13snakesnake line 3
14
Data
Cell Formulas
RangeFormula
G2:G10G2=FILTER(C2:C20,(C2:C20<>"")*(COUNTIFS(E2:E4,B2:B20)<>0))
Dynamic array formulas.
 
Upvote 0
oh I forgot about match to find the rows. I knew it was something simple.

I like to use whole columns, so James' formula cleaned up to: =FILTER(C:C,NOT(ISNA(MATCH(B:B,E:E,0))))
 
Upvote 0
James, data set is just a sample to get the mechanics working.

Fluff, data set is fairly large, about 1100 rows. I could make the list of column E look at a chunk of 50 cells. I'm playing with real data set now. Making a dynamic BOM based on SKUs. The whole system is not really great, but trying to make things as flexible as possible based on what is provided to work with.
 
Upvote 0
Format everything as a table, and let excel do the hard work?
MrExcelPlayground5.xlsx
BCDEFG
1KeyContentListResult
2catcat line 1catcat line 1
3catcat line 2snakecat line 2
4catcat line 3birdcat line 3
5dogdog line 1bird line 1
6dogdog line 2bird line 2
7dogdog line 3bird line 3
8birdbird line 1snake line 1
9birdbird line 2snake line 2
10birdbird line 3snake line 3
11snakesnake line 1
12snakesnake line 2
13snakesnake line 3
Sheet13
Cell Formulas
RangeFormula
G2:G10G2=FILTER(Table1[Content],NOT(ISNA(MATCH(Table1[Key],Table2[List],0))))
Dynamic array formulas.
 
Upvote 0
I would say that 1100 rows is quite small & you can always expand the range to more than is enough without using whole column references, like
Excel Formula:
=FILTER(C2:C5000,(C2:C5000<>"")*(COUNTIFS(E2:E5000,B2:B5000)<>0))
 
Upvote 0

Forum statistics

Threads
1,214,983
Messages
6,122,583
Members
449,089
Latest member
Motoracer88

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