Calculate working hours between two dates

Pat from Melb.

New Member
Joined
Aug 16, 2002
Messages
4
How do I calculate the number of working hours between two dates
For example day 1 06-August-02 09:00am
day 2 13-August-02 03:15pm
I need to know the working hours between these two dates, based on a working day starting at 8:00am in the morning and finishing at 5:00pm.
Please excuse me I am new at this.
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Is 51 hours and 15 minutes the answer to your example above?
I have an old UDF I wrote to figure net hours worked. Wanted to see if it might help you out???
If you would like to include the valid holiday dates for (Australia?), say... for the next year, I can incorporate these holidays into the function.
Not hardcoded, but I would like to use valid holiday dates so you can test it out for yourself.
Thanks,
Tom
This message was edited by TsTom on 2002-08-17 23:43
 
Upvote 0
On 2002-08-17 23:29, TsTom wrote:
Is 51 hours and 15 minutes the answer to your example above?
Yes , this is the answer, Thaks.
I have an old UDF I wrote to figure net hours worked. Wanted to see if it might help you out???
Yes, I would appreciate this.
If you would like to include the valid holiday dates for (Australia?), say... for the next year, I can incorporate these holidays into the function.
Australian Holidays
26- Jan (Aust. day)
25- Dec (Christmas day)
26-Dec (boxing Day)
1-Jan (new years day)
26- Jan (Aust. day)

Thanks
PAt
 
Upvote 0
Hello Pat
credit for following to Daniel.M (daniel.maher@bigfoot.com)

1. your times in Col A and Col B, threshold times in cells named sT and eT, holiday list named H_D (it is not essential to name the ranges)
2. ensure Analysis ToolPak is installed
3. result in hours
=NETWORKDAYS(A3,B3,H_D)*(eT-sT)-(NETWORKDAYS(A3,A3,H_D)*MAX(0,MIN(eT,MOD(A3,1))-sT))-(NETWORKDAYS(B3,B3,H_D)*MAX(0,eT-MAX(MOD(B3,1),sT)))

4. result converted to rounded decimal (relevant if you multiply result by a rate per hour)
=ROUND((NETWORKDAYS(A1,B1,H_D)*(eT-sT)-(NETWORKDAYS(A1,A1,H_D)*MAX(0,MIN(eT,MOD(A1,1))-sT))-(NETWORKDAYS(B1,B1,H_D)*MAX(0,eT-MAX(MOD(B1,1),sT))))*24,2)

Note. adjust the references to fit your information.

HTH Dave
 
Upvote 0
Hi Dave.
I tried the above function with a return of 3:15?

=NETWORKDAYS(A3,B3,H_D)*(eT-sT)-(NETWORKDAYS(A3,A3,H_D)*MAX(0,MIN(eT,MOD(A3,1))-sT))-(NETWORKDAYS(B3,B3,H_D)*MAX(0,eT-MAX(MOD(B3,1),sT)))

Cell A3 = 8/6/2002 9:00:00 AM
Cell B3 = 8/13/2002 3:15:00 PM
Range("sT") = 8:00:00 AM
Range("eT") = 5:00:00 PM
Range("H_D") = 25-Dec-02,26-Dec-02,1-Jan-03,26-Jan-03

The answer should be 51 hrs and 15 minutes.
Do I have the arguments set up correctly?

Thanks,
Tom

PS Nevermind. It works! I had the formatting wrong. Returned 51.25
This message was edited by TsTom on 2002-08-18 11:42
 
Upvote 0
Update on this formula w/calendar - PLEASE HELP TODAY......

Please refer to the e-mail located at www.mrexcel.com/board2/printview.php?t=20483&start=0. We are looking at implementing this type of format, but we will need to use a variable calendar (meaning that the work day won't ALWAYS be, say 6:00-4:00 p.m. ). Does the user or Mr. Excel know how to implement this into the equation? We'd like to get an answer today, if possible.

Thanks for your awesome help!

Laura
 
Upvote 0
Hello Everyone,

I have a need for calculating the hours in decimal format from a start date cell to an end date cell in the format mm/dd/yyyy hh:mm in much the same way described here in this post. I vaguely remember how to setup the ranges, so all you have to do is reference "sT", "eT" and "H_D". Could someone refresh my memory on this, please.
 
Upvote 0

Forum statistics

Threads
1,216,046
Messages
6,128,489
Members
449,455
Latest member
jesski

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