ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   CONDITIONAL COUNTING (https://www.excelbanter.com/excel-discussion-misc-queries/147575-conditional-counting.html)

FARAZ QURESHI

CONDITIONAL COUNTING
 
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.

Toppers

CONDITIONAL COUNTING
 
try:
=SUMPRODUCT(--($A$2:$A$7="A"),--($B$2:$B$72))

"FARAZ QURESHI" wrote:

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.


Bernard Liengme

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.





All times are GMT +1. The time now is 02:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com