Excel Date and Time formula

I have a spreadsheet with 2 fields, with date and time. See below

Severity               Closed.TIME              Re-Assigned.TIME      
Sev 3              2/2/2012 11:41      1/31/2012 16:09      
Work Order      2/13/2012 10:07      12/22/2011 15:46      
Work Order      3/5/2012 11:14      1/9/2012 18:12      
Work Order      2/14/2012 11:28      1/18/2012 9:10      
Sev 3              2/13/2012 12:13      2/6/2012 9:51      
Sev 3              2/1/2012 7:46              1/30/2012 9:11      
Sev 3              2/1/2012 14:46      1/31/2012 16:32      
Sev 4              2/2/2012 17:11      1/30/2012 17:43      


I want to calculate the total time it took to close the ticket. I assume I am going to create a formula using the 2 fields(re-assigned and closed)? I then want to look at the first column and see what severity it is, and compare the time to another table (See below) If I am within the time frame, I pass SLA, if not I fail.  For example if the total time is less the 24 hours and Column A has Sev3, then I want the formula to say "pass" if its over 24 hours, it should say "fail". Any assistance would be greatly appreciated!


Time Table:
Sev1        4 hours
Sev2        8 hours
sev3   24 hours
sev4   48 hours
LVL 19
Edward PamiasTeam Lead RRS DeskAsked:
Who is Participating?
 
p912sCommented:
Updated with %'s
27646642.xlsx
0
 
Martin LissOlder than dirtCommented:
So the time span is the difference between columns 3 and 2?

What do you want to do with the "Work Order" rows?
0
 
byundtCommented:
You might use a VLOOKUP formula like:
=IF(COUNTA(B2,C2)<>2,"",IF((B2-C2)<VLOOKUP(A2,LookupTable,2,FALSE),"Pass SLA","Fail"))

This formula assumes that A2, B2 and C2 are the severity, closed time and re-assigned time, while LookupTable is a named range with severity in the first column and allowable time in the second.

If the lookup table has time in hours (rather than days), you may need to multiply by 24:
=IF(COUNTA(B2,C2)<>2,"",IF(24*(B2-C2)<VLOOKUP(A2,LookupTable,2,FALSE),"Pass SLA","Fail"))

The bit with COUNTA is to make sure that you have entries in both closed time and re-assigned time before making the Pass/Fail test.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Edward PamiasTeam Lead RRS DeskAuthor Commented:
You can ignore the work orders for now. I will submit another question if need a formula for those. Or you can just add the result to say work order if that's in column A. What ever is easier.  Thanks!
0
 
p912sCommented:
Have a look at the attached workbook.

HTH

Scot
27646642.xlsx
0
 
p912sCommented:
Corrected workbook...
27646642.xlsx
0
 
Edward PamiasTeam Lead RRS DeskAuthor Commented:
P912, this looks good.... I was wondering can you add another field with what percentage I am within SLA, for example, if I closed the ticket in 2 hours and my sla is 4 hours.... can you have it give a result of 50%? This formula is pretty much right on the money of what I need.
0
 
Martin LissOlder than dirtCommented:
No need for time table


Private Sub CommandButton1_Click()
Dim i As Integer
Dim rStart As Range
Dim rEnd As Range
Dim diff As Integer

For i = 1 To Range("A1").End(xlDown).Offset(0, 0).Row
    Set rStart = Range("B" & i)
    Set rEnd = Range("C" & i)
    diff = DateDiff("h", rEnd, rStart)
    Select Case Range("A" & i)
        Case "Sev1"
            If diff < 4 Then
                Range("D" & i).Value = "pass"
            Else
                Range("D" & i).Value = "fail"
            End If
        Case "Sev2"
            If diff < 8 Then
                Range("D" & i).Value = "pass"
            Else
                Range("D" & i).Value = "fail"
            End If
        Case "Sev3"
            If diff < 24 Then
                Range("D" & i).Value = "pass"
            Else
                Range("D" & i).Value = "fail"
            End If
        Case "Sev4"
            If diff < 48 Then
                Range("D" & i).Value = "pass"
            Else
                Range("D" & i).Value = "fail"
            End If
        Case Else
            Range("D" & i).Value = Range("A" & i).Value
    End Select
Next
End Sub
0
 
p912sCommented:
Sure, give me a few minutes and I'll upload another workbook.
0
 
Martin LissOlder than dirtCommented:
In my code "Sev1", etc should be "Sev 1"
0
 
byundtCommented:
Allowing for both Work Order and missing times,:
=IF(OR(COUNTIF($I$2:$I$5,A2)=0,COUNTA(B2,C2)<>2),"",IF(24*(B2-C2)<VLOOKUP(A2,$I$2:$J$5,2,FALSE),"Pass","Fail"))

Returning the % of allowable:
=IF(F2="","",24*(B2-C2)/VLOOKUP(A2,$I$2:$J$5,2,FALSE))
Hours-Q27646642.xlsx
0
 
Edward PamiasTeam Lead RRS DeskAuthor Commented:
MartinLiss, I need to create a report with pivots and pie charts. With the info previously provided. Is this a macro you created? How would I use it?
0
 
Martin LissOlder than dirtCommented:
Put the code in a Command button or macro.
0
 
p912sCommented:
Here's an updated workbook.

HTH

Scot
27646642.xlsx
0
 
Edward PamiasTeam Lead RRS DeskAuthor Commented:
p912s, for the failed SLA's I do not need to post a %.Looking at my data it looks like the format for the percetages should be Anything up to 50% should post <50 % anything up to 75$ should post < 75% anything up to 100% should post < 100%

For example if my SLA percentage is 68% I would want the output to be < 75%. So far so good. I will test the oher examples out once I have tested this sample sheet. See sample below to see how it looks now... In the SLA meter is where I want the % to show as it is below. Instead of the % just have it display the above.

SLA Meter      Severity
< 50%                       Sev 3
< 50%                       Sev 3
0
 
p912sCommented:
epamias ~ I'm happy to help, but your original question has been answered and you're adding on here. I'm a little nervous when you say "so far so good"; sounds like you're going to keep adding to this question.

Not displaying the % on the fails is a quick fix, all that's needed is to remove that part of the if formula.

As for bracketing the results, that would take another series of nested if's with our current structure.

Will that wrap up this question?

Thanks

Scot
0
 
Edward PamiasTeam Lead RRS DeskAuthor Commented:
yes it would..... Thank you.
0
 
p912sCommented:
You're welcome, give me a few minutes...
0
 
Edward PamiasTeam Lead RRS DeskAuthor Commented:
This is great! Thank you! Again, thanks to all for your input.
0
 
p912sCommented:
You're welcome!

Scot
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.