Counting Unique values with MAX criteria

dancer5

New Member
Joined
Jan 6, 2023
Messages
14
Office Version
  1. 365
Platform
  1. Windows
Hi there,
I'm trying to find a formula to count the number of unique values that meet criteria, where one of the criteria is a column with a maximum value.

I've tried modifying my UNIQUE(FILTER formula I usually use:
=SUM(--(LEN(UNIQUE(FILTER(A3:A60, (M3:M60=2), "")))>0))
but adding in a criterion for a MAX value has me stuck.
I tried:
=UNIQUE(FILTER(A3:A60, (M3:M60=2)*(MAX(K3:K60)=1)))
and:
=SUM(--(LEN(UNIQUE(FILTER(A3:A60, (M3:M60=2)*(MAX(K3:K60)=1), "")))>0))

but it doesn't work.

Here's an example dataset

- Tables (2024-12-05_1105).xlsx
ABCDEFGHIJKLMNOPQR
1ideventevent_completeSHOULD BE
21Number of IDs with 1 Event#CALC!1
31Number of IDs with 2 Events02
4112Number of IDs with >=3 Events1
5122
61
71
82
92
10212
11222
12232
132
142
152
162
172
18312
19322
203
214
224
23412
244
254
264
274
284
294
example
Cell Formulas
RangeFormula
Q2Q2=UNIQUE(FILTER(A3:A29, (M3:M29=2)*(MAX(K3:K29)=1)))
Q3Q3=SUM(--(LEN(UNIQUE(FILTER(A3:A29, (M3:M29=2)*(MAX(K3:K29)=2), "")))>0))
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Hello, maybe:

Excel Formula:
=IFERROR(ROWS(UNIQUE(FILTER($A$2:$A$29,MAXIFS($K$2:$K$29,$A$2:$A$29,$A$2:$A$29)=1))),0)
 
Upvote 0
Try:
Book1
PQ
1
2Number of IDs with 1 Event1
3Number of IDs with 2 Events2
4Number of IDs with >=3 Events1
Sheet2
Cell Formulas
RangeFormula
Q2Q2=SUM(--(MAXIFS($K$2:$K$29,$A$2:$A$29,UNIQUE($A$2:$A$29))=1))
Q3Q3=SUM(--(MAXIFS($K$2:$K$29,$A$2:$A$29,UNIQUE($A$2:$A$29))=2))
Q4Q4=SUM(--(MAXIFS($K$2:$K$29,$A$2:$A$29,UNIQUE($A$2:$A$29))>=3))
 
Upvote 0
Solution

Forum statistics

Threads
1,224,517
Messages
6,179,233
Members
452,898
Latest member
Capolavoro009

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