Counting with multiple criteria

amcclintock

New Member
Joined
Nov 4, 2013
Messages
1
I need help getting a formula to count how many instances happen between a certain time on a certain day.

For example in column A5:A15 I have the Date of the incident and in column B5:B15 I have the Time of the incident. I want to count how many incidents happened between a certain time on certain days. For example, how many incidents happened between 06:00 am and 12:00 pm on Monday. Then how many happened between 12:00pm and 18:00 on Monday.

Basically I have 6 hour windows and want to know how many incidents happen between each time frame on each specifc day. The closest I have gotten is I get it to count the number of times it happens on Monday and the number of times between the time frame, but then it multiplies the numbers.

Here is the formula I have:

=SUMPRODUCT(--(WEEKDAY(May!$A$5:$A$45)=4)*(COUNTIFS(May!$B$5:$B$45,">="&TIME(6,0,0))-COUNTIF(May!$B$5:$B$45,">"&TIME(12,0,0))))

I'm using the WEEKDAY function to count the days and a COUNTIF to count the time. "May!" refers to the worksheet I want to pull from.

HELP PLEASE!! I'm starting to go insane from trying to figure this out!
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Welcome to MrExcel.

Does this work for you?

=SUMPRODUCT(--(WEEKDAY(May!$A$5:$A$45)=4),--(May!$B$5:$B$45>=TIME(6,0,0)),--(May!$B$5:$B$45<=TIME(12,0,0)))
 
Upvote 0

Forum statistics

Threads
1,223,247
Messages
6,171,007
Members
452,374
Latest member
keccles

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