View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Harlan Grove[_2_] Harlan Grove[_2_] is offline
external usenet poster
 
Posts: 1,231
Default counting cells that are 0 in a range of non-contiguous cells

"Herbert Seidenberg" wrote...
Select the non-contiguous cells while
holding down CTRL.
Enter a name in the Name Box, say ListA.
=COUNTIF(INDEX(ListA,,,1):INDEX(ListA,,,COUNTA(Li stA)),"0")


Put the following values in A1:A10.

9
0
2
11
3
2
8
6
0
0

Select A1, A3, A5, A7, A9 and name it ListA. Enter your formula in C1.
It returns 7, even though ListA has only 5 cells. Can you figure out
why?

Conditional counting over multiple cell ranges is easiest with
FREQUENCY, e.g., to count the values 0 in ListA as above,

=INDEX(FREQUENCY(ListA,{0}),2)

and to count the values = 9,

=INDEX(FREQUENCY(ListA,{8.99999999999999;9}),2)