Subtract date/time and get elapses days, hours, minues, etc

SRGsMom

New Member
Joined
Jul 20, 2007
Messages
17
I'll try to be very percise here, this is what I want a forumal to do in excel and I'm having some trouble.

Assuming that a workday is from 8:30am to 5:00pm. (also need to not calcualte Saturday and Sunday but this example doesn't show it).


Wednesday, 7/18/07 at 4:00pm (minus) Friday, 7/20/07 at 9:00am (should equal) 10 hours or 1 day, 1 hour and 30 minutes.

Basically what I want to do it determine how much work time has elapsed from the time a message was left on voicemail to the time that someone picks that message up. We only want to assume that a message can be retrieved duruing business hours but a message can be left at anytime!

This is a project on a time crunch!!! Any help is appreciated and I will be continuning to look for help!
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Dumb question...but should I be putting in actual dates where it says StartDt or should I be referencing the cell that contains the start date? I think I'm thinking too hard and confusing myself!
 
Upvote 0
Hve you tried putting the date in an then a cell reference perhaps (",)
 
Upvote 0
If you download the sample workbook it might save you some time, it has already been formatted...If your on a tight deadline it might be a great help to you!
 
Upvote 0
Argggg....well i got some to work! The same formula is used for all of these. (First is Time Message was left, Second is Time Recieved)
Assuming 8:30 am - 5:00 pm is work hours, Monday-Friday.

Any thoughts?

These are Wrong
11/30/06 3:30 11/30/06 13:00 0 days 9.5hours
12/4/06 16:00 12/5/06 9:00 1 days 7 hours
12/26/06 14:00 12/27/06 9:00 1 days 5 hours
1/2/07 16:30 1/3/07 9:30 1 days 7 hours
1/3/07 8:15 1/3/07 17:00 0 days 8.75hours

These are Right
1/5/07 17:00 1/8/07 9:30 0 days 1 hours
7/19/07 16:00 7/20/07 11:30 0 days 4 hours
7/10/07 8:00 7/13/07 13:00 3 days 5 hours

IF(AND(INT(B6)=INT(D6),NOT(ISNA(MATCH(INT(B6), HolidayList,0)))),"0 days 0 hours", IF(INT(B6)=INT(D6), "0 days " & ROUND(24*(D6-B6),2)&"hours", MAX(NETWORKDAYS(B6+1,D6-1,HolidayList),0)+INT(24*(((D6-INT(D6))-(B6-INT(B6)))+(DayEnd-DayStart))/(24*(DayEnd-DayStart)))&
" days "&MOD(ROUND(((24*(D6-INT(D6)))-24*DayStart)+(24*DayEnd-(24*(B6-INT(B6)))),2),ROUND((24*(DayEnd-DayStart)),2))&" hours "))

Everyone's help is greatly appreciated!
 
Upvote 0
Do you use the example workbook?
And dont you have your right and wrong the wrong way round?
If i use the example workbook on the example:
1/5/07 17:00 1/8/07 9:30
it returns:
DateInterval.xls
ABCDE
1StartDTEndDTDayStartDayEndHolidayList
205/01/200700:0008/01/200700:0017:0009:300
3FriMon######
4
58.5Monday
68.5Tuesday
78.5Wednesday
88.5Thursday
98.5Friday
10
11
12Interval
131days0hours
147.5hours
Sheet1


I believe this is right as it doesnt count Saturday and Sunday?....
 
Upvote 0
Chip's formula may be more complex than you need.

Assuming you have start time and date in B6 and end time and date in D6 and both of these times will be within working hours you can use this formula to give the result in hours and minutes, e.g. 10:00 for your example

=(NETWORKDAYS(B6,D6)-1)*("17:00"-"08:30")+MOD(D6,1)-MOD(B6,1)

format result cell as [h]:mm

You can insert a holiday range in the NETWORKDAYS function if you wish

edit:

sorry didn't read your post properly :cry: . Given that your start time (B6) can be anytime but D6 will be within business hours try this formula

=(NETWORKDAYS(B6,D6)-1)*("17:00"-"08:30")+MOD(D6,1)-MEDIAN(NETWORKDAYS(B6,B6)*MOD(B6,1),"08:30"+0,"17:00"+0)

again, format as [h]:mm

Chip's formula doesn't work correctly if either time is outside business hours
 
Upvote 0
We only want to assume that a message can be retrieved during business hours but a message can be left at anytime!

Barry, as I understand it the message can be received at anytime, during, or outside of working hours
 
Upvote 0

Forum statistics

Threads
1,215,022
Messages
6,122,721
Members
449,093
Latest member
Mnur

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