Counting unique values with criteria
Try this...
Data in the range A2:B6. Assumes no empty cells in the "Case" range.
D2:D3 = stroke, cancer
Enter this array formula** in E2 and copy down as needed:
=SUM(IF(FREQUENCY(IF(B$2:B$6=D2,A$2:A$6),A$2:A$6), 1))
** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT
key then hit ENTER.
--
Biff
Microsoft Excel MVP
"Chuck" wrote in message
...
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.
|