Help needed with timesheet/shceduling formulas

Waiting2Excel

New Member
Joined
Nov 22, 2017
Messages
4
Hi,

I've been reading through threads for days and need help with a couple of formulas. I'm creating a scheduling spreadsheet for my office. I want it to calculate total hours scheduled for the office per day, and also total the employees total hours scheduled for the week, minus a 30 minute lunch break on days worked, and counting any "OFF" days or "Vacation" Days that I schedule as 0 so I do not receive any "#value s!".

5-Jan6-Jan7-Jan8-Jan9-Jan10-Jan11-Jan
FRIDAYSATURDAYSUNDAYMONDAYTUESDAYWEDNESDAYTHURSDAY
STARTSTOPSTARTSTOPSTARTSTOPSTARTSTOPSTARTSTOPSTARTSTOPSTARTSTOPTOTAL
112:00 PM10:00 PMOFFOFF10
2OFFOFFOFFOFFOFFOFF1:00 PM5:00 PM5:00 PM10:15 PM9.25
30
40
50
60
70
80
HOURS SCHEDULED#value !#value !#value !#value !4:000:005:15

<tbody>
</tbody>



So far I have been able to get it to calculate my scheduled hours for the week using this formula that I found online:

=(SUMIF($B$3:$O$3,"STOP",B4:O4)-SUMIF($B$3:$O$3,"START",B4:O4))*24

But I need it to subtract a 30 minute lunch ONLY from the days actually scheduled, and ignore the "OFF and/or VACATION" days.

I was able to calculate my total hours scheduled in the office for the day using this formula that I pieced together:

=(IF(COUNT(B4,C4)=2,MOD(C4-B4,1),0)-1/48)+(IF(COUNT(B5,C5)=2,MOD(C5-B5,1),0)-1/48)+(IF(COUNT(B6,C6)=2,MOD(C6-B6,1),0)-1/48)+(IF(COUNT(B7,C7)=2,MOD(C7-B7,1),0)-1/48)+(IF(COUNT(B8,C8)=2,MOD(C8-B8,1),0)-1/48)+(IF(COUNT(B9,C9)=2,MOD(C9-B9,1),0)-1/48)+(IF(COUNT(B10,C10)=2,MOD(C10-B10,1),0)-1/48)+(IF(COUNT(B11,C11)=2,MOD(C11-B11,1),0)-1/48)

But my issue is that it subtracts a 30 minute lunch from even the "OFF" days, and I get #value ! if I have blanks.

Please help, I'm so close yet sooo far. Thanks for any help
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Try:

=((SUMIF($B$3:$O$3,"STOP",B4:O4)-SUMIF($B$3:$O$3,"START",B4:O4))*24) - (0.5*COUNTIFS($B$3:$O$3,"START",B4:O4,">"&DATE(2000,1,1)))

EDIT: Sorry - misread. if "OFF" is in the shift times, then try:

=((SUMIF($B$3:$O$3,"STOP",B4:O4)-SUMIF($B$3:$O$3,"START",B4:O4))*24) - (0.5*COUNTIFS($B$3:$O$3,"START",B4:O4,">"&DATE(2000,1,1),B4:O4,"<>OFF"))

Cheers
JB
 
Last edited:
Upvote 0
Try:

=((SUMIF($B$3:$O$3,"STOP",B4:O4)-SUMIF($B$3:$O$3,"START",B4:O4))*24) - (0.5*COUNTIFS($B$3:$O$3,"START",B4:O4,">"&DATE(2000,1,1)))

EDIT: Sorry - misread. if "OFF" is in the shift times, then try:

=((SUMIF($B$3:$O$3,"STOP",B4:O4)-SUMIF($B$3:$O$3,"START",B4:O4))*24) - (0.5*COUNTIFS($B$3:$O$3,"START",B4:O4,">"&DATE(2000,1,1),B4:O4,"<>OFF"))

Cheers
JB

I tried that, however it returns only the total hour sum, it does not subtract the 30 minute lunch.
 
Upvote 0
I thought this after I hit post - are the times just "09:00" or in the formula bar are they actually "dd/mm/yyyy 09:00"?

I normally work with formatted datetimes, and didn't think to check.

If that is the case, then the COUNTIFS() will result in 0, so no breaks.

Change it to:
=((SUMIF($B$3:$O$3,"STOP",B4:O4)-SUMIF($B$3:$O$3,"START",B4:O4))*24) - (0.5*COUNTIFS($B$3:$O$3,"START",B4:O4,">"&0,B4:O4,"<>OFF"))

Cheers
JB
 
Upvote 0
WHOOO MAN, THAT WORKED LIKE A CHARM! THANKS!

Any suggestions on my formula for calculating my daily scheduled hours? Can your same formula be tweaked to provide a daily total per column?
 
Upvote 0
WHOOO MAN, THAT WORKED LIKE A CHARM! THANKS!

Any suggestions on my formula for calculating my daily scheduled hours? Can your same formula be tweaked to provide a daily total per column?

Sure it can! It's simpler though, as you don't need to worry about START and STOP so no SUMIFS required, 1 column is 1, 1 is the other so:

Code:
[COLOR=#333333][COLOR=#333333][I]=((SUM(C4:C11)-SUM(B4:B11))*24)-(COUNT(B4:B11)*0.5)    ' COUNT will only count numeric values, so "OFF" will be ignored, but times are counted as numeric so are included.[/I][/COLOR][/COLOR][COLOR=#333333]
[/COLOR]

I've not tested it, but I think that's right for your file.

Cheers
JB
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,624
Messages
6,120,591
Members
448,973
Latest member
ksonnia

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