Countif based on multiple criteria in multiple columns

BungleNZ

Board Regular
Joined
Sep 9, 2008
Messages
220
Hi

I'm struggling to get a countif formula working in a spreadsheet. With the example sheet I've posted, I'm trying for each "Bowler", I am trying to count, for example, how many times 0 runs are scored for the ball.

Any help anyone could provide would be much appreciated.

Thanks

Jamie

Edit: I can easily get a formula to work by summing separate counts, but I'm trying to get one formula which will do the count based on the bowlers name in a summary sheet.

Excel Workbook
GHIJKLMNOPQ
45BowlerRuns
46Chris L10101
47Chris L-513
48Trav22
49Trav5032
50Miles11
51Miles1-50-50
52Dean203
53Dean-50-5
54Pidge212
55Pidge-522
56Ryan03-51
57Ryan112
58John11
59John0010
60Dingo2013
61Dingo1121
RD 1 - Game 1
Excel 2007
 
Last edited:

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Here is a snip of code that code help. BAsed on your range and names, you would need to adapt it, but in this case the answer would be 1 as Trav is the name in Cell A3

<font face=Courier New><SPAN style="color:#00007F">Sub</SPAN> countcol()<br><SPAN style="color:#00007F">Dim</SPAN> strName <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN><br>strName = Range("A3")<br><SPAN style="color:#00007F">Dim</SPAN> countred <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Integer</SPAN><br><br><SPAN style="color:#00007F">Dim</SPAN> cell <SPAN style="color:#00007F">As</SPAN> Range<br><SPAN style="color:#00007F">For</SPAN> <SPAN style="color:#00007F">Each</SPAN> cell <SPAN style="color:#00007F">In</SPAN> Range("h4:o5")<br><SPAN style="color:#00007F">If</SPAN> cell.Value = strName <SPAN style="color:#00007F">Or</SPAN> cell.Value = "0" <SPAN style="color:#00007F">Then</SPAN> countred = countred + 1<br><SPAN style="color:#00007F">Next</SPAN> cell<br>MsgBox countred<br><br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>

Sample Table

Excel Workbook
ABCDEFGHIJKLMNO
1BowlerBowlerRuns
2Chris LChris L10101
3TravChris L-513
4MilesTrav22
5DeanTrav5032
6PidgeMiles11
7RyanMiles1-50-50
8JohnDean203
9DingoDean-50-5
10Pidge212
11Pidge-522
12Ryan03-51
13Ryan112
14John11
15John0010
16Dingo2013
17Dingo1121
Sheet1
 
Upvote 0

Forum statistics

Threads
1,224,527
Messages
6,179,331
Members
452,907
Latest member
Roland Deschain

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