View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Kent (thanks)
 
Posts: n/a
Default Using sum(1/countif....) not returning expected result

I have a spreadsheet where I am trying to count the number of unique values
in Column A, based on set criteria in Column B. I have searched all over the
internet and the most popular solution seems to be the formula below. For
examples purposes assume the following:
A B
1 X
2 Y
2 X
3 Y
3 Y
4 X
4 X
4 X

I use the following array formula to count the number of unique numbers in
column A, based on (X) in column B.

=SUM(1/COUNTIF(A1:A8,A1:A8)*(B1:B8="x"))

I would expect the result to be 3, but instead I get 2.5

Any suggestions on how to correct my formula? My actual spreadsheet
includes both numeric and alpha fields that need to be counted, but no blank
spaces.

Thanks in advance for your assistance,