Formula to Determine which Rows share ALL of a list of common values

mnty89

Board Regular
Joined
Apr 1, 2016
Messages
66
I think I am overlooking something incredibly simple. Whether this is just reformatting the data in a specific pivot table or adding in a logic step with a formula on the rows, but I can't currently figure out how to do it.

Here is the issue. I have a data set with quite a few lines. There are essentially two aspects to the data. One is the location, the second is the item. Each location has a row for however many items it carries. I want to separate this data into only locations that carry a certain list of items. I need to "filter out" from the list of locations to keep only the locations which carry the list of items I want.

For example: I have locations 1-10, and items 1-5. I want to find all locations that have all items 1&2. The challenging thing is, the locations that remain need to have ALL of the items I want to select, not just one or some of them. Any ideas on what I'm missing that is totally obvious? The hard part is that there are a few hundred items and a few thousand locations...
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
or example: I have locations 1-10, and items 1-5. I want to find all locations that have all items 1&2. The challenging thing is, the locations that remain need to have ALL of the items I want to select, not just one or some of them.
locationitems
loc1135
loc21247####
loc3145
loc4234
loc5235
loc6345
loc712512
loc812313
loc9245
loc1012415
###by using this formula the row number of locations
with both item 1 and 2 are given
=IF(ISERROR(VALUE(SEARCH("1",D7))*VALUE(SEARCH("2",D7))),"",ROW())
you can filter or pivot or use offset match to get a list of locations
17loc2^^^^^^
212loc7^^^^^
313loc8=IF(D28="","",OFFSET($E$5,MATCH(D28,$E$6:$E$15,0),-2))
415loc10
5the SMALL function is used to pull the matching rows
6
7
8
9
10

<colgroup><col><col span="15"></colgroup><tbody>
</tbody>
 
Upvote 0
This works too:


Excel 2010
ABCDEF
1LocationItemMatches List?List
2TZZTRUECC
3WZZFALSEXX
4EXXTRUEZZ
5RCCTRUE
6TCCTRUE
7YVVFALSE
8QVVFALSE
9QVVFALSE
10EZZTRUE
11TXXTRUE
12RXXTRUE
13ECCTRUE
14WZZFALSE
15QZZFALSE
16YXXFALSE
17UXXFALSE
18YZZFALSE
19TCCTRUE
20RZZTRUE
Sheet2
Cell Formulas
RangeFormula
C2{=COUNT(MATCH($F$2:$F$4,IF($A$2:$A$20=A2,$B$2:$B$20),0))=COUNTA($F$2:$F$4)}
Press CTRL+SHIFT+ENTER to enter array formulas.


And you can filter the falses
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,045
Messages
6,122,840
Members
449,096
Latest member
Erald

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