Calculating between days/times

scottishmovies

Board Regular
Joined
Mar 11, 2003
Messages
158
Hi All,

I want to calculate against two dates/times to measure response times.

I need to be able to calculate against the work day (exclude Weekends) and the working time (exclude times outwith working) and subtract one from the other to arrive at a severity level. This is to measure if we have acheived a proper timely response. Is this feasible in Excel? What is the formula I needd to put in Col D to make this work?

Hope someone can help as it's driving me nuts! :)

Thanks in advance,
Pat
Excel Workbook
ABCDEF
1
2Work Days = Mon-FriWork Times = 08:30 - 17:30
3
4Severity Level
5A<4 hours
6B> 4 hours<8 hours
7C> 8 hours< 1 week
8D> 1 week
9
10Date 1Date 2Expected response
11101/03/2011 12:0001/03/2011 15:15A
12201/03/2011 12:0001/03/2011 16:15B
13301/03/2011 12:0002/03/2011 14:00C
14401/03/2011 12:0007/03/2011 12:00D
15505/03/2011 16:0007/03/2011 09:00A
16605/03/2011 16:3007/03/2011 12:30B
17
Sheet1
Excel 2007
 
Last edited:
Thanks Biff for the reply as well, appreciate all the time you guys put into these things - I'm so impressed - but totally confused!!

I don't really understand the networkdays function (other than it will show number of working days between two dates) so how come you guys use LOOKUP and VLOOKUP? I thought lookups, well, looked up something??
The first thing we need to do is calculate how many business hours there are from the start date/time to the end date/time.

Once we have that number then we have to "look it up" and compare that number to the defined intervals.

That's what V/LOOKUP does.

We've included the lookup "table" directly within the formula since there aren't that many variables, only 4.

Here's how it wold look if you created a lookup table on the worksheet:

<TABLE style="WIDTH: 56pt; BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=0 width=74 border=0 x:str><COLGROUP><COL style="WIDTH: 28pt; mso-width-source: userset; mso-width-alt: 1184" span=2 width=37><TBODY><TR style="HEIGHT: 12.75pt" height=17><TD class=xl22 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 28pt; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 12.75pt; BACKGROUND-COLOR: transparent" width=37 height=17>0 </TD><TD class=xl22 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext 0.5pt solid; BORDER-LEFT: windowtext; WIDTH: 28pt; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent" width=37>A</TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD class=xl22 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 12.75pt; BACKGROUND-COLOR: transparent" height=17>4 </TD><TD class=xl22 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent">B</TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD class=xl22 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 12.75pt; BACKGROUND-COLOR: transparent" height=17>8 </TD><TD class=xl22 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent">C</TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD class=xl22 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext 0.5pt solid; BORDER-BOTTOM: windowtext 0.5pt solid; HEIGHT: 12.75pt; BACKGROUND-COLOR: transparent" height=17>45 </TD><TD class=xl22 style="BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext; BORDER-LEFT: windowtext; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent">D</TD></TR></TBODY></TABLE>

Let's assume that table is in the range E1:F4.

36 is the number of calculated business hours.

=LOOKUP(36,E1:F4)

=VLOOKUP(36,E1:F4,2)

The result will be C.

36 is >= 8 and < 45.
 
Upvote 0

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Pat,

In both Biff's solution and mine, NETWORKDAYS told us how many full days of hours there were between DATE 1 and DATE 2. Then we calculated the number of partial day hours for DATE 1 and partial day hours for DATE 2. The LOOKUP or VLOOKUP determined the Severity Level category by looking up the total number of hours in the arrays at the end of our formulas and returning the corresponding Severity Level.
 
Upvote 0
WOW! You guys make it sound so easy!

I'm sure that many people searching for this solution will appareciate, as much as I do, the help you give to us all.

Thanks once again for explaining it to to us.

Kind regards,

Pat
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,752
Members
452,940
Latest member
rootytrip

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