# Multiple COUNTIFS

#### tera dactil

##### New Member
Hello everyone. I have a table with two columns that I need to query: Effective Date, Effective Time.

 A B 02/02/2020 07:01 05/03/2020 17:59 02/01/2020 08:00 02/02/2020 13:01

I also have a lookup table which delineates a 24 hour interval:

 A B Hour 0 start 00:01 Hour 0 end 00:59 Hour 1 start 01:00 Hour 1 end 01:59

etc

So, my objective is to count how many events in the Table fall within the hourly intervals. So that i can build a matrix in a summary worksheet that gives volumes by hour:

00:00-00:59 9
01:00-01:59 2
02:00-02:59 7

etc

I can get COUNTIFS to work by doing this:

=COUNTIFS('Table1'!A2:A100,">="&'Table2'!A1,'Table1'!A2:A100,"<="&'Table2'!A2
(this would be for the first result row. Then i replicate it with different lookups for the successive hourly intervals.

Obviously, the limitation here is that the array lookup in Table1 is static; I'd ideally like to have a match on the date on my summary worksheet against any qualifying dates in Table1. I've spent a day trying to use a combination of COUNTIFS, INDEX, MATCH, SUMPRODUCT, and it has stumped me. Any help would be much appreciated!

### Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

#### yky

##### Well-known Member
What does the summary sheet look like? Would you post it with some expected results?

#### tera dactil

##### New Member
Certainly, yes. Attached is a screen capture of what my customer wants to see.

#### Attachments

• Annotation 2020-05-19 074050.png
35.5 KB · Views: 5

#### yky

##### Well-known Member
I modified your hour listing so it's easier to work with. If you don't like it, hide the column.

 A B 2/2/2020 7:01 5/3/2020 17:59 2/1/2020 8:00 2/2/2020 13:01 5/3/2020 16:42 5/3/2020 16:07 5/4/2020 6:51 5/4/2020 8:33 5/4/2020 8:44

 hours 5/1/2020 5/2/2020 5/3/2020 5/4/2020 0:00 0 0 1:00 0 0 2:00 0 0 3:00 0 0 4:00 0 0 5:00 0 0 6:00 0 1 7:00 0 0 8:00 0 2 9:00 0 0 10:00 0 0 11:00 0 0 12:00 0 0 13:00 0 0 14:00 0 0 15:00 0 0 16:00 2 0 17:00 1 0 18:00 0 0 19:00 0 0 20:00 0 0 21:00 0 0 22:00 0 0 23:00 0 0 0:00

Cell Formulas
RangeFormula
D4D4=COUNTIFS(Table1!\$A\$2:\$A\$100,"="&D\$3,Table1!\$B\$2:\$B\$100,">="&\$A4,Table1!\$B\$2:\$B\$100,"<"&\$A5)

#### tera dactil

##### New Member
WOW. Thank you so much! I was WAY overthinking this, wasn't i?

Much gratitude, yky

Replies
4
Views
231
Replies
9
Views
252
Replies
33
Views
778
Replies
3
Views
358
Replies
4
Views
138

1,129,984
Messages
5,639,391
Members
417,085
Latest member
Aman2626

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

### Which adblocker are you using?

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

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