View Single Post
  #18   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default count unique with mulitple criteria

Harlan almost never makes mistakes but when he does it is nice to point it
out.

--
Don Guillett
SalesAid Software

"PapaDos" wrote in message
...
Because it doesn't work as it is now ?
--
Festina Lente


"Don Guillett" wrote:

I think it should

why?

--
Don Guillett
SalesAid Software

"PapaDos" wrote in message
...
Nice !

Isn't the last term of your "hardcoded" one wrong ?
A probable typo error, be ROW($A2:$A8) instead of
ROW($A2)...
--
Festina Lente


"Harlan Grove" wrote:

Domenic wrote...
....
If the data can contain the following...

Mike JOB1
Karen JOB2
Unfilled JOB1
Unfilled JOB2
Unfilled JOB1
Alex JOB2 <---
Alex JOB1 <---

...I believe the unique count should be 4. If this is correct, the
above formula will fail and return 3. Similar to the above formula,
mine can be shortened to...

=COUNT(1/FREQUENCY(IF(B$2:B$8=D2,IF(A$2:A$8="Unfilled",ROW( A$2:A$8)
-ROW(A$2)+1,MATCH(A$2:A$8,A$2:A$8,0))),ROW(A$2:A$8)-ROW(A$2)+1))
....

Or mine could be corrected to

=COUNT(1/(INDEX(TBL,0,2)=JOB)/IF(INDEX(TBL,0,1)="Unfilled",1,MATCH(INDEX(TBL,0,1 ),
IF(INDEX(TBL,0,2)=JOB,INDEX(TBL,0,1)),0)-1+MIN(ROW(TBL))=ROW(TBL)))

If I were to hardcode the ranges, it reduces to

=COUNT(1/($B2:$B8=D2)/IF($A2:$A8="Unfilled",1,MATCH($A2:$A8,
IF($B2:$B8=D2,$A2:$A8),0)-1+MIN(ROW($A2:$A8))=ROW($A2)))