Average time elapsed in hh:mm format between 2 dates after accounting for weekends and business hours

Yemjay

New Member
Joined
Dec 1, 2017
Messages
1
Hi

I have a ticket resolution data as shown below. I would need this data to monitor my SLA compliance.

Excel 2007 32 bit
ABCDEF
2TicketAssigned DateAcknowledged DateResolved DateTime Elapsed (Assigned To Acknowledged)Time Elapsed (Assigned to Resolved)
3Ticket 103-08-2017 21:0604-08-2017 15:1607-08-2017 18:29
4Ticket 204-08-2017 15:0307-08-2017 16:2709-08-2017 23:00
5Ticket 314-09-2017 00:5114-09-2017 00:5116-09-2017 08:51

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Ticket Sheet



I have a few set of conditions, which I would want to build into my time elapsed formula -
1. If the ticket assigned date is before 8.30 AM that day (i.e. for example Ticket 3 was assigned at 00:31) the formula should consider assigned time by default as 8.30 AM on that day itself. In my ticket 3 example, the new assigned date would be 14-09-2017 08:30. Time elapsed should be calculated using this date and time.

2. If the ticket assigned date is after 5.30 PM that day (i.e. Ticket 1 in my example) the formula should consider assigned time by default as 8.30 AM on the next working day. In my ticket 1 example, the new assigned date would be 04-08-2017 08:30. Suppose the next day is a weekend (Sat and Sun are weekends) then new date would be 06-08-2017 08:30.

3. When calculating Time elapsed (both acknowledged and resolved) it would need the unit to be in HH:MM format.

4. The time elapsed should be calculated after removing the weekends and non business hours, if any. i.e in Ticket 2 example, the assigned date (04-08-2017) is a Friday and the Acknowledged and Resolved dates are Monday and Wednesday respectively. So time elapsed in this case should be the hours between these dates after removing the weekends and non-business hours within the week days.

Business Hours are - 8.30 AM to 5.30 PM and Business days are Monday to Friday.

This would be a typical support call scenario for calculating SLAs.
I had tried accounting for the business hours by the below logic.

Excel 2007 32 bit
ABCDEF
27AssignedDateTimeAfter 8.30 AMBefore 5.30 PMNew Assigned Date
2803-08-2017 21:0603-08-20179:06 PMYesNo04-08-2017 08:30:00
2914-09-2017 00:5114-09-201712:51 AMNoYes14-09-2017 08:30:00

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Ticket Sheet

Worksheet Formulas
CellFormula
D28=IF([COLOR=rgb(255]C28>TIME(8,30,0),"Yes","No"[/COLOR])
E28=IF([COLOR=rgb(255]C28<TIME(17,30,0),"Yes","No"[/COLOR])
F28=IF([COLOR=rgb(255]D28="Yes",IF(E28="No",TEXT([COLOR=0)]B28+1,"dd-mm-yyyy"[/COLOR])&" "&TEXT([COLOR=0)]TIME([COLOR=rgb(0]8,30,0[/COLOR]),"hh:mm:ss"[/COLOR]),A28),TEXT(B28,"dd-mm-yyyy")&" "&TEXT(TIME([COLOR=0)]8,30,0[/COLOR]),"hh:mm:ss")[/COLOR])
D29=IF([COLOR=rgb(255]C29>TIME(8,30,0),"Yes","No"[/COLOR])
E29=IF([COLOR=rgb(255]C29<TIME(17,30,0),"Yes","No"[/COLOR])
F29=IF([COLOR=rgb(255]D29="Yes",IF(E29="No",TEXT([COLOR=0)]B29+1,"dd-mm-yyyy"[/COLOR])&" "&TEXT([COLOR=0)]TIME([COLOR=rgb(0]8,30,0[/COLOR]),"hh:mm:ss"[/COLOR]),A29),TEXT(B29,"dd-mm-yyyy")&" "&TEXT(TIME([COLOR=0)]8,30,0[/COLOR]),"hh:mm:ss")[/COLOR])

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>



But when taking the elapsed time using the newly derived assigned dates, excel only calculates difference between these dates with an assumption that both times are in a single day. I guess excel does not look into the difference in dates. Also I am not sure how I can account for the weekends in the above logic.

Would be really helpful if some one could suggest some logic to calculate the elapsed time incorporating for my conditions.

Thanks.
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Forum statistics

Threads
1,213,533
Messages
6,114,179
Members
448,554
Latest member
Gleisner2

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