ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   How to do count with if (https://www.excelbanter.com/new-users-excel/189623-how-do-count-if.html)

no-1

How to do count with if
 
Hai,

Need a sugestion from you all. I have problem to count my data. For example,
I want to count for each Team how many coaching or counseling had been done.

ColumnA .....ColumnC
TEAM Action
Level 1 Coaching
Level 1 Coaching
Level 2 Caunseling
Level 3 Counseling
Level 2 Coaching
Level 3 Coaching
Level 1 Counseling

I tried using this formula, but it giving me all result as 1

=COUNT(IF((A2:A11="Level 1")*(C2:C11="Coaching"),C2:C11))

And when I tried this formula, the result will be 0

=SUM(IF(A2:A11="Level 1",IF(C2:C11="Coaching",1,0)))

Please help.
--
Thanks! =)

Roger Govier[_3_]

How to do count with if
 
Hi

Try
=SUMPRODUCT((A2:A11="Level 1")*(C2:C11="Coaching"))
Instead of using "level1" or "Coaching", you could put those values in say
cells D1 and E1 and use
=SUMPRODUCT((A2:A11=D1)*(C2:C11=E1))

Changing the values in D1 and E1 will give you results for different queries
without changing the formula.

It works because each test produces a result of True or False.
Multiplying them together coerces True to 1 and False to 0 so you end up
with and array of
1 x 1 = 1
1 x 1 = 1
0 x 0 = 0
0 x 0 = 0
0 x 0 = 0
0 x 0 = 0
1 x 0 = 0

which Sumproduct then totals to give a result of 2
--
Regards
Roger Govier

"no-1" wrote in message
...
Hai,

Need a sugestion from you all. I have problem to count my data. For
example,
I want to count for each Team how many coaching or counseling had been
done.

ColumnA .....ColumnC
TEAM Action
Level 1 Coaching
Level 1 Coaching
Level 2 Caunseling
Level 3 Counseling
Level 2 Coaching
Level 3 Coaching
Level 1 Counseling

I tried using this formula, but it giving me all result as 1

=COUNT(IF((A2:A11="Level 1")*(C2:C11="Coaching"),C2:C11))

And when I tried this formula, the result will be 0

=SUM(IF(A2:A11="Level 1",IF(C2:C11="Coaching",1,0)))

Please help.
--
Thanks! =)



no-1

How to do count with if
 
Dear Roger,

The formula did help me.

Thank you very much! =)

--
Thanks!


"Roger Govier" wrote:

Hi

Try
=SUMPRODUCT((A2:A11="Level 1")*(C2:C11="Coaching"))
Instead of using "level1" or "Coaching", you could put those values in say
cells D1 and E1 and use
=SUMPRODUCT((A2:A11=D1)*(C2:C11=E1))

Changing the values in D1 and E1 will give you results for different queries
without changing the formula.

It works because each test produces a result of True or False.
Multiplying them together coerces True to 1 and False to 0 so you end up
with and array of
1 x 1 = 1
1 x 1 = 1
0 x 0 = 0
0 x 0 = 0
0 x 0 = 0
0 x 0 = 0
1 x 0 = 0

which Sumproduct then totals to give a result of 2
--
Regards
Roger Govier

"no-1" wrote in message
...
Hai,

Need a sugestion from you all. I have problem to count my data. For
example,
I want to count for each Team how many coaching or counseling had been
done.

ColumnA .....ColumnC
TEAM Action
Level 1 Coaching
Level 1 Coaching
Level 2 Caunseling
Level 3 Counseling
Level 2 Coaching
Level 3 Coaching
Level 1 Counseling

I tried using this formula, but it giving me all result as 1

=COUNT(IF((A2:A11="Level 1")*(C2:C11="Coaching"),C2:C11))

And when I tried this formula, the result will be 0

=SUM(IF(A2:A11="Level 1",IF(C2:C11="Coaching",1,0)))

Please help.
--
Thanks! =)




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

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