Find and filter on two different unique values

trishcollins

Board Regular
Joined
Jan 7, 2006
Messages
71
I have an excel table that is almost 7000 rows. It is a list of control numbers and some have a lot of duplicates. In addition to the control ID, each of the rows is assigned to one for four categories. I have managed to create a formula that identifies the duplicates sequentially, so all new IDs start with with 1, and if there are duplicates, they are numbered 2, 3, 4, etc. For the purposes of this exercise, I want to see both only "1" but two of the four categories. Not all ID are assigned to all four categories, but you can have the same category assigned to same ID multiple times. Basically I want to filter this table to display rows 1 (AC-2 and PBMM) and row 5 (AC-2 and PBHH), as well as row 6 (AC-3 and PBMM) and row 8 (AC-3 and PBHH). And to make it more complex, if the ID doesn't isn't assigned to BOTH PBMM and PBHH, I want it filtered out. So to recap, I only want to see 2 of ever ID, one for PBMM and one for PBHH, but only if the ID number is assigned to both.


RowIDCategoryDuplicate Sequence
1AC-2PBMM1
2AC-2PBMM2
3AC-2PBHM3
4AC-2PBMH4
5AC-2PBHH5
6AC-3PBMM1
7AC-3PBHM2
8AC-3PBHH3
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Which version of Excel are you using?
 
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’)
 
Upvote 0
Try:
Book4
ABCDE
1IDCategoryResult
2AC-2PBMMAC-2PBMM
3AC-2PBMMAC-2PBHH
4AC-2PBHMAC-3PBMM
5AC-2PBMHAC-3PBHH
6AC-2PBHH
7AC-3PBMM
8AC-3PBHM
9AC-3PBHH
10AC-4PBHH
11AC-4PBMK
Sheet1
Cell Formulas
RangeFormula
D2:E5D2=UNIQUE(FILTER(A2:B11,MAP(A2:A11,B2:B11,LAMBDA(a,b,((b="PBMM")+(b="PBHH"))*SUM(--(COUNTIFS(A2:A11,a,B2:B11,{"PBMM","PBHH"})>0))=2))))
Dynamic array formulas.
 
Upvote 0
Try:
Book4
ABCDE
1IDCategoryResult
2AC-2PBMMAC-2PBMM
3AC-2PBMMAC-2PBHH
4AC-2PBHMAC-3PBMM
5AC-2PBMHAC-3PBHH
6AC-2PBHH
7AC-3PBMM
8AC-3PBHM
9AC-3PBHH
10AC-4PBHH
11AC-4PBMK
Sheet1
Cell Formulas
RangeFormula
D2:E5D2=UNIQUE(FILTER(A2:B11,MAP(A2:A11,B2:B11,LAMBDA(a,b,((b="PBMM")+(b="PBHH"))*SUM(--(COUNTIFS(A2:A11,a,B2:B11,{"PBMM","PBHH"})>0))=2))))
Dynamic array formulas.
Thanks, will give it a try
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,399
Latest member
alchavar

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