# Using Countif with a wide range of data

#### wangaa11

##### New Member
Hello, I am trying to use the countifs fomula to find out the number of times "yes" appears per colour see example below. I would upload an example but for some reason it never lets me.

In this example I want to count the number of times there is a "Yes" with the colour red. The answer should be 7. I have over 20 columns of data and I am wondering if there is a better formula to use outside of =countifs(A1:A7,"Red",B1:B7,"Yes")+countifs(A1:A7,"Red",C1:C7,"Yes")+countifs(A1:A7,"Red",D1:D7,"Yes")+ so on and so on.

Any help is greatly appreciated

 A B C D E F G 1 Red Yes No Yes Yes Yes Yes 2 Blue No Yes N/A Yes N/A No 3 Red N/A No N/A Yes N/A No 4 Red Yes N/A No No N/A No 5 Green Yes N/A No No N/A N/A 6 Green Yes N/A No No N/A N/A 7 Blue N/A No Yes No No N/A

### Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

#### Fluff

##### MrExcel MVP, Moderator
+Fluff v2.xlsm
ABCDEFGHIJ
1ABCDEFG
2RedYesNoYesYesYesYesRed7
3BlueNoYesN/AYesN/ANoBlue3
4RedN/ANoN/AYesN/ANoGreen2
5RedYesN/ANoNoN/ANo
6GreenYesN/ANoNoN/AN/A
7GreenYesN/ANoNoN/AN/A
8BlueN/ANoYesNoNoN/A
List
Cell Formulas
RangeFormula
J2:J4J2=SUMPRODUCT((\$A\$2:\$A\$8=I2)*(\$B\$2:\$G\$8="Yes"))

#### wangaa11

##### New Member
+Fluff v2.xlsm
ABCDEFGHIJ
1ABCDEFG
2RedYesNoYesYesYesYesRed7
3BlueNoYesN/AYesN/ANoBlue3
4RedN/ANoN/AYesN/ANoGreen2
5RedYesN/ANoNoN/ANo
6GreenYesN/ANoNoN/AN/A
7GreenYesN/ANoNoN/AN/A
8BlueN/ANoYesNoNoN/A
List
Cell Formulas
RangeFormula
J2:J4J2=SUMPRODUCT((\$A\$2:\$A\$8=I2)*(\$B\$2:\$G\$8="Yes"))
That is worked thank you so much

#### Fluff

##### MrExcel MVP, Moderator
You're welcome & thanks for the feedback.

Replies
7
Views
163
Replies
4
Views
81
Replies
1
Views
48
Replies
1
Views
220
Replies
7
Views
105

1,127,831
Messages
5,627,149
Members
416,223
Latest member
RichardHell

### 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?

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