COUNTIFS with single criteria but multiple column range

oceaner

New Member
Joined
Oct 22, 2018
Messages
3
I'm trying to count # of times a number (coded #) appears over a range (C:Z) in a given month of a given year. Sample data below. The only solution I could come up with was using COUNTIFS, but that only works to count one column at a time

=COUNTIFS(C:C,1,A:A,">="&AH1,A:A,"<"&AI1)

ideally I'd want

=COUNTIFS(C:Z,1,A:A,">="&AH1,A:A,"<"&AI1) which doesn't work

the only solution seems to be to do

=COUNTIFS(C:C,1,A:A,">="&AH1,A:A,"<"&AI1) + COUNTIFS(D:D,1,A:A,">="&AH1,A:A,"<"&AI1) until reaching Z:Z which is extremely redundant, specially since I want to do this over many numbers.

Any solution would be appreciated.

sample data:

cXObwzU.jpg
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Hi,

Try it like this, change/adjust cell references/range as needed, please stay away from Entire Column references:


Book1
H
10
Sheet344
Cell Formulas
RangeFormula
H1=SUMPRODUCT((A1:A1000>=AH1)*(A1:A1000)*(C1:Z1000=1))
 
Last edited:
Upvote 0
Hi,

Try it like this, change/adjust cell references/range as needed, please stay away from Entire Column references:

H
10

<colgroup><col style="width: 25pxpx"><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet344

Worksheet Formulas
CellFormula
H1=SUMPRODUCT((A1:A1000>=AH1)*(A1:A1000<AI1)*(C1:Z1000=1))

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>

Thank you so much! appears to be working like a charm. Didn't realize SUMPRODUCT could do this. Why are entire column references bad if I may ask?
 
Upvote 0
Thank you so much! Why are entire column references bad if I may ask?

You're welcome, Yes SUMPRODUCT can also be used to COUNT (especially useful in arrays as in your case) when set up properly.

Entire Column references, Try it, you'll see that your Worksheet will Slow Down dramatically...(there's over 1 million rows in Each column for the formula to process) :eek:
 
Upvote 0

Forum statistics

Threads
1,215,465
Messages
6,124,975
Members
449,200
Latest member
Jamil ahmed

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