View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Bernard Liengme Bernard Liengme is offline
external usenet poster
 
Posts: 4,393
Default CONDITIONAL COUNTING

This
=SUMPRODUCT(--($A$2:$A$7="A"),--($B$2:$B$72))
will count how many values have an A-cell value of "A" and a B-cell value 2
while
=SUMPRODUCT(--($A$2:$A$7="A"),--($B$2:$B$72),$B$2:$B$7)
will sum those values
For more details, see
http://www.xldynamic.com/source/xld.SUMPRODUCT.html
http://mcgimpsey.com/excel/formulae/doubleneg.html

This also does the count:
{=SUM(IF((A1:A7="A")*(B1:B72),1,0))}
or more simply
{=SUM(((A1:A7="A")*(B1:B72)))}
best wishes
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"FARAZ QURESHI" wrote in message
...
I am trying 2 figure out a formula like a conditional sum but for counting
and not summing up.

Tried:
{=COUNT(IF($A$2:$A$7="A",IF($B$2:$B$72,$B$2:$B$7, 0),0))}
but its not working.

Thanx in advance.