Adding Business Hours to a date

egagnon

New Member
Joined
Mar 18, 2005
Messages
9
Good Day... I'm having a problem figuring out how to add time to a date and exclude non-working hours/holidays/and weekends. If I use this formula "MOD(D26,1)-MOD(B26,1)+(NETWORKDAYS(B26,D26)-1)*3/8" for example if my inputs are 03/18/2005 2:00 PM and 03/21/2005 9:00 AM it returns a time of 4 hours, which is correct. My problem is that I need my inputs to be the first date and the number of hours and a formula that returns the later date. Any help would be appreciated....
 
Yes, and I've raised the issue twice.

You say that we should calculate 8 hours per day

but

working hours 8 am - 5 pm, without lunch = 9 hours


That inconsistancy will get you one hour off at some occasions - you found one.
 
Upvote 0

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
I'm sorry, I must not have understood. I need to calculate on a nine hour day. Will changing the division from a 9 to an 8 fix the problem, or is there more?
 
Upvote 0
Yes.

=IF(17-MOD(A2,1)*24>B2,A2+B2/24,WORKDAY(A2,MAX(1,INT((B2-(17-MOD(A2,1)*24))/9)))+"08:00"+MOD((B2-(17-MOD(A2,1)*24)),9)/24)

should do it.
 
Upvote 0
That fixed some of the problem, but also, when the time is wrapping around two days, it is not working correctly. When it should go on to the next day, it will instead start over at 8:00 am. For example, if i put 03/21/05 2:30 PM it will report correct up to 11 hours, which will be 03/22/05 4:30 PM, but when I put 12 hours it should report 03/23/05 8:30 AM, but instead it reports this as 8:30 AM on the 22nd. The same thing happens as I increase the time to 3:30 in the example, it will not wrap to the next day for 11 hours. It will not go two days unless you count all they way through the clock again and then it will report on the 23rd. Do you know how to fix this?
 
Upvote 0
Hmm

Really too tired now but try:

=IF(17-MOD(A2,1)*24>B2,A2+B2/24,WORKDAY(A2,1+INT((B2-(17-MOD(A2,1)*24))/9))+"08:00"+MOD((B2-(17-MOD(A2,1)*24)),9)/24)


I'll take a second look at it tomorrow.
 
Upvote 0

Forum statistics

Threads
1,215,548
Messages
6,125,472
Members
449,231
Latest member
Sham Yousaf

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