View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Harlan Grove[_2_] Harlan Grove[_2_] is offline
external usenet poster
 
Posts: 1,231
Default Need assistance with COUNTIF while using multiple data arrays

"Alan Beban" wrote...
If the functions in the freely downloadable file at
http://home.pacbell.net/beban are available to your workbook

=ArrayCountIf(ArrayAlternates(A1:C6,False),4)

will return the number of 4s in the even numbered rows (i.e., 1 for the
sample data posted).

....

But why use udfs which are always slower than several times the number of
built-in function calls? Hardcoding the modulus sought,

=SUMPRODUCT((MOD(ROW(A1:C6),2)=0)*(A1:C6=1))

returns the number of 1s (the number the OP mentioned, just for kicks) in
the odd numbered rows. And it's even a shorter formula. And it can be easily
adapted to do this for every Nth row,

=SUMPRODUCT((MOD(ROW(A1:C6),N)=0)*(A1:C6=1))

which ArrayAlternates doesn't do.