Calculating working hours between two dates

Bubuto

New Member
Joined
Jul 24, 2002
Messages
15
How should I calculate working hours between two dates? Say if start at 26 july at 15:00 and finish at 29 july at 10:00, the function should return 4 hours because the working hours are from 8am to 5pm (8 - 17), and there is a weekend between the dates. Preferably the function should work like the NETWORKDAYS() function, but it should also include the time, not just the dates. And also, if have to add say 8 hours to a date, how should I calculate the result? Also this function should aware of the working hours and holidays, so it should ignore those times.

regards,
Petteri Toukoniitty
 
Apologies - had transcribed this badly from Excel formula. Have made some corrections below:

work_hours_in_day is just 24*(work_end_time - work_start_time)

=(NETWORKDAYS(start_date_time,end_date_time)*work_hours_in_day)-IF(WEEKDAY(start_date_time,2)>=6,0,MIN(MAX(24*(MOD(start_date_time,1)-work_start_time),0),work_hours_in_day)) - IF(WEEKDAY(end_date_time,2)>=6,0,MIN(24*MAX((work_end_time-MOD(end_date_time,1)),0),work_hours_in_day))
 
Upvote 0

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Hi Matt,

I would like to adapt this formula to our work environment but am having trouble.

Those that initiate the work are in the US and those that complete the work are in India so I think we will have to use a 24 hour day but exclude weekends and holidays.

Example data:
Case Status Start Date/Time End Date/Time
1393250 Closed 5/16/14 6:54 5/19/14 3:34
1389755 Closed 5/15/14 15:45 5/15/14 16:01
1389726 Closed 5/15/14 15:34 5/16/14 12:19
1389560 Closed 5/15/14 14:34 5/16/14 5:23
1389279 Closed 5/15/14 13:13 5/16/14 9:48
1387441 Closed 5/15/14 6:10 5/15/14 10:16
1383604 Closed 5/14/14 16:24 5/15/14 9:08
1383517 Closed 5/14/14 15:39 5/15/14 8:19
1383397 Closed 5/14/14 15:01 5/19/14 11:05
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,334
Members
452,636
Latest member
laura12345

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