View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default Counting unique values with criteria

I would be inclined to do that with a pivot table. Check out this link on
counting unique in a pivot.

http://www.contextures.com/xlPivot07.html#Unique

here is how you do it...
In column C add this formula
=IF(SUMPRODUCT(($A$2:$A2=A2)*($B$2:$B2=B2))1,0,1)
and copy down. Add a heading called Unique.

Now create a pivot table off of that data. Add the Case to the left column
and Unique to the data section...

You could also just do a sumif formula at this point...
=SUMIF(B2:B6, "=Cancer", C2:C6)
--
HTH...

Jim Thomlinson


"Chuck" wrote:

I need to count the number of unique cases given certain criteria. For
example,

Case # Code
3356 Stroke
3356 Stroke
3357 Cancer
3357 Cancer
3356 Cancer
The results should indicate: 1 unique case for Stroke; 2 unique cases for
Cancer. Thanks for any help.