Calculating Working Hours inc Sat

Kris75

Board Regular
Joined
Jul 29, 2009
Messages
143
Hi Guys
I'm trying to work out the number of working hours passed between two Date/times.

C13= Start date/time
D13=End date/time
X1= Start of Shift (0800) Mon - Fri
Y1= End of Shift (1800) Mon - Fri

using this Formula - i can calculate how many 'working' hours have passed
in a standard mon - Fri 8 - 6 shift - Which is great

what i need to do is add to this a Saturday Shift which starts at 0900 and Ends 1300

Any Suggestions?

Kris
=(NETWORKDAYS(C13,D13)-1)*($Y1-X1)+IF(NETWORKDAYS(D13,D13),MEDIAN(MOD(D13,1),Y1,X1),Y1)-MEDIAN(NETWORKDAYS(C13,C13)*MOD(C13,1),Y1,X1)
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
To count the number of Saturdays between start date and end date:

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(INT(C13)&":"&INT(D13))))=7))
 
Upvote 0
The formula you are using for Monday to Friday allows the C13 and D13 times to be any time (even outside the MF working hours), I assume you need that (otherwise you can use a simpler formula)?

To add Saturday hours you potentially have to count Saturdays in the period .....but also take account of periods that might start (or end) on a Saturday, to do that you can use this formula to calculate just Saturday hours

=INT((WEEKDAY(C13)+INT(D13)-INT(C13))/7)*(Y$2-X$2)-IF(WEEKDAY(C13)=7,MEDIAN(0,MOD(C13,1)-X$2,Y$2-X$2))-IF(WEEKDAY(D13)=7,MEDIAN(0,Y$2-MOD(D13,1),Y$2-X$2))

assuming Saturday start and end times are in X2 and Y2

You can just add that to your existing formula for a total of all hours
 
Upvote 0
Thank you for you for your help Fellas

that was exactly what i wanted

It works like a dream now.
 
Upvote 0

Forum statistics

Threads
1,224,587
Messages
6,179,735
Members
452,939
Latest member
WCrawford

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