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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
byundtMechanical EngineerCommented:
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
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
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

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
byundtMechanical EngineerCommented:
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
p912sCommented:
Updated with %'s
27646642.xlsx
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Applications

From novice to tech pro — start learning today.