Count when someone works between the hours of 17:00 and 19:00 during the weekend

Gratoc

New Member
Joined
Jun 13, 2015
Messages
1
Hi,

I have a spreadsheet for working weekly on-call and I'm trying to create a formula for counting how many times work was carried out on a weekend between 17:00 and 19:00 hours.
I tried something like this, which is not working:
<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit;">=COUNTIFS(Oncall[Date],WEEKDAY(2>=6),
Oncall[Time Start],">=17:00",Oncall[Time Start],"<=19:00")

=SUMPRODUCT(--(WEEKDAY(Oncall[Date],2)>=6),
--(Oncall[Time Start]>="17:00"),--(Oncall[Time Start]<="19:00"))</code>
Example of the On-call spreadsheet below
DateTime startTime finish
14/06/1517:0018:00
14/06/1522:0022:10
15/06/1517:0019:00
20/06/1518:3020:30

<tbody>
</tbody>

<colgroup><col><col></colgroup><tbody>
</tbody>

Any help will be greatly appreciated.

Thanks
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Momentman

Well-known Member
Joined
Jan 11, 2012
Messages
4,142
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Like this

=SUMPRODUCT((WEEKDAY(A2:A5,2)>=6)*(B2:B5>=TIME(17,0,0))*(C2:C5<=TIME(19,0,0)))
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,010
Messages
5,834,880
Members
430,325
Latest member
Thony

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
Top