Count the number of Ys and Ns by Role

Manny74

Board Regular
Joined
May 6, 2016
Messages
124
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hello All,

So I am trying to get a:
  • grand total count of Ys by 1 (1 is a RN) ....result should be 3
  • grand total count of Ns by 1 (1 is a RN) ...result should be 6
  • grand total count of Ys by 2 (2 is a MD)....result should be 1
  • grand total count of Ns by 2 (2 is a MD) ...result should be 2
Instead of manually counting this, I was thinking of using Countif formulas?
But wasn't sure how to piece this together....

A1B2C2D2
1 for RN, 2 for MDQ1 (Compliant: Y or N)Q2 (Compliant: Y or N)Q3 (Compliant: Y or N)
A3
1​
NNY
A4
2​
NYN
A5
1​
NYN
A6
1​
YNN
1 (RN)6 N3 Y
2 (MD)2 N1 Y
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
How about:

Book1
ABCD
1
21 for RN, 2 for MDQ1 (Compliant: Y or N)Q2 (Compliant: Y or N)Q3 (Compliant: Y or N)
31NNY
42NYN
51NYN
61YNN
7
8RoleNY
9163
10221
Sheet10
Cell Formulas
RangeFormula
B9:C10B9=SUMPRODUCT(($B$3:$D$6=B$8)*($A$3:$A$6=$A9))
 
Upvote 0
How about:

Book1
ABCD
1
21 for RN, 2 for MDQ1 (Compliant: Y or N)Q2 (Compliant: Y or N)Q3 (Compliant: Y or N)
31NNY
42NYN
51NYN
61YNN
7
8RoleNY
9163
10221
Sheet10
Cell Formulas
RangeFormula
B9:C10B9=SUMPRODUCT(($B$3:$D$6=B$8)*($A$3:$A$6=$A9))
Hello Eric, that worked, thank you so much! Do I dare ask, is there a simpler way of getting the same end result, like using a Countif(s), etc.? Just wondering, as I am not too familiar with SUMPRODUCTs :)
 
Upvote 0
Without SUMPRODUCT, you'd need to do something like this:

Book1
ABCD
1
21 for RN, 2 for MDQ1 (Compliant: Y or N)Q2 (Compliant: Y or N)Q3 (Compliant: Y or N)
31NNY
42NYN
51NYN
61YNN
7
8RoleNY
9163
10221
Sheet3
Cell Formulas
RangeFormula
B9:C10B9=COUNTIFS($A$3:$A$6,$A9,$B$3:$B$6,B$8)+COUNTIFS($A$3:$A$6,$A9,$C$3:$C$6,B$8)+COUNTIFS($A$3:$A$6,$A9,$D$3:$D$6,B$8)


You need a separate COUNTIFS for each column.
 
Upvote 0

Forum statistics

Threads
1,215,446
Messages
6,124,904
Members
449,194
Latest member
JayEggleton

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top