+ Reply to Thread
Results 1 to 16 of 16

Counting difference between hours if outside of business hours

  1. #1
    Registered User
    Join Date
    01-16-2013
    Location
    Australia
    MS-Off Ver
    excel 2010
    Posts
    8

    Counting difference between hours if outside of business hours

    Hi All,

    I'm working on an excel spreadsheet and I need to sum the hours between two different times (basically, counting how many hours a call was open - the days open is listed in another column which works fine).

    My time is placed into its own column on purpose, I have a "Time Allocated" column and a "Passback" column and I wish to calculate how many hours were between the two times within work hours of 8:30AM and 5:00PM.

    EDIT: I forgot I can't actually upload at work so it'll have to wait.. but it's a lot like this:

    Call ID Depo Call Type Priority Time Allocated Allocated to us Installs Closed/Reallocated Reall Passback Instances DO HMO
    110538 PTCSYD ETS Equipment P4 4:25 PM 14-Jun-2013 17-Jun-2013 2:21 PM 3 21:56

    (Just plop it into Excel, tried to format it but it's a ***** on this site. result I'm looking for in the above is 6 hours 26 minutes or something like that)

    The formula is for tracking KPI's but the counter stops after 5:00PM until 8:30AM the next morning.
    I need to replicate this function in excel so I can assign a priority to them.

    The HMO column is where the result should go, so if the call was raised at 3:00PM and we closed it at 9:00am, the HMO Column should only show 2:30.
    It also should handle times where the time allocated is minus the passback (because it was raised the previous day or something).

    The formula I was using to get the hours (without stopping the count of hours after 5PM to 8:30AM) was:

    =IF(Table42[[#This Row],[Time Allocated]]>Table42[[#This Row],[Passback]],IF(Table42[[#This Row],[Time Allocated]]>Table42[[#This Row],[Passback]],Table42[[#This Row],[Passback]]+1-Table42[[#This Row],[Time Allocated]],Table42[[#This Row],[Time Allocated]]-Table42[[#This Row],[Passback]]),IF(Table42[[#This Row],[Passback]]-Table42[[#This Row],[Time Allocated]]=0,"",Table42[[#This Row],[Passback]]-Table42[[#This Row],[Time Allocated]]))


    Sorry if this is a long post, not too sure how I'm going to describe it I'm pretty noobish at Excel.

    Thanks in advance for any help guys,
    Phil
    Last edited by joytech22; 06-20-2013 at 12:49 AM.

  2. #2
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Counting difference between hours if outside of business hours

    Hi Joytech,

    welcome to the forum.

    Please upload a sample workbook to support your query. Thanks


    Regards,
    DILIPandey
    <click on below * if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), [email protected]

  3. #3
    Registered User
    Join Date
    01-16-2013
    Location
    Australia
    MS-Off Ver
    excel 2010
    Posts
    8

    Re: Counting difference between hours if outside of business hours

    Book1.xls

    Here you go, I've added notes in the sheet to explain what I'm looking for.

  4. #4
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Counting difference between hours if outside of business hours

    Hi Joytech22,

    3:59 PM 20-Jun-2013 minus 25-Jun-2013 7:52 AM = 15:52
    How you got this result for call Id 110778 ?




    Regards,
    DILIPandey
    <click on below * if this helps>

  5. #5
    Registered User
    Join Date
    01-16-2013
    Location
    Australia
    MS-Off Ver
    excel 2010
    Posts
    8

    Re: Counting difference between hours if outside of business hours

    Quote Originally Posted by dilipandey View Post
    Hi Joytech22,

    3:59 PM 20-Jun-2013 minus 25-Jun-2013 7:52 AM = 15:52
    How you got this result for call Id 110778 ?




    Regards,
    DILIPandey
    <click on below * if this helps>

    I'll upload a spreadsheet with the formula I used:
    Example.xlsx
    Last edited by joytech22; 06-25-2013 at 07:26 PM.

  6. #6
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Counting difference between hours if outside of business hours

    Okay... so are you satisfied with that output ? or you are looking for some other result there, and if so then what is your expected result ?


    Regards,
    DILIPandey
    <click on below * if this helps>

  7. #7
    Registered User
    Join Date
    01-16-2013
    Location
    Australia
    MS-Off Ver
    excel 2010
    Posts
    8

    Re: Counting difference between hours if outside of business hours

    Not satisfied at all.

    The result I'm looking for from 110778 in the HMO column is 1 hour 1 minute (or 1:01) - I explain below.

    There are two/four columns in the spreadsheet worth noting, the DO and HMO columns both serve different functions.
    DO calculates days open using the two date columns while the HMO determines the total hours difference between the "Time Allocate" and "Passback" columns.

    DO works fine, I can't figure out a formula for HMO to calculate the difference between "Time Allocate" and "Passback" between the hours of 8:30AM and 5:00PM. I want to ignore or minus counting any time before and after 8:30AM and 5:00PM. At the moment it just counts the difference without consideration for the time rules I want to set, which is upsetting my KPI's.

    For example.. Call ID 110778 column HMO should show exactly 1:01 because the counter stops at 5PM, the call was passed back before work hours (8:30AM).

    As you can probably tell, I'm not too experienced with Excel.
    Last edited by joytech22; 06-26-2013 at 07:56 PM.

  8. #8
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Counting difference between hours if outside of business hours

    Okay... can you provide your expected output for few more Call IDs like you provided 1:01 for 110778 ? Thanks.


    Regards,
    DILIPandey
    <click on below * if this helps>

  9. #9
    Registered User
    Join Date
    01-16-2013
    Location
    Australia
    MS-Off Ver
    excel 2010
    Posts
    8

    Re: Counting difference between hours if outside of business hours

    Note: Results will be in H:MM format

    110276 I would expect 2 hours 03 minutes (or 2:03) as I'm only counting the time from 3:35PM up until 5:00PM - ignoring everything after-hours between 5:00PM and 8:30AM and then counting from 8:30AM up until it was closed off at 9:08 AM

    110807 I would expect 5 hours 16 minutes (or 5:16) as I'm only counting the time from 12:44PM up until 5:00PM (Resulting in a count of 4 h 16 m) - ignoring everything after-hours between 5:00PM and 8:30AM and then counting from 8:30AM up until it was closed off at 9:30 AM (resulting in 1 h 0 m) Sum both of those results to get 5h:16m

    Do note though, there will be many calls that we close the call on the same day, so the formula must account for that also.
    Example: Call opened at 9:00AM, closed at 1:00PM, Open a total of 4 hours.

  10. #10
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Counting difference between hours if outside of business hours

    Okay.. see the attached file and let me know if any scenario need to be adjusted / added:-


    Book1.xls

    Regards,
    DILIPandey
    <click on below * if this helps>

  11. #11
    Registered User
    Join Date
    01-16-2013
    Location
    Australia
    MS-Off Ver
    excel 2010
    Posts
    8

    Re: Counting difference between hours if outside of business hours

    Close my friend, but not quite..

    A few strange results that I wasn't able to fix myself - A call raised at 12:30 PM and closed at 12:53 PM was somehow open for 8 hours and 53 minutes..
    Attached is example of the miscalculations I'm getting, and answers to what they should be to the right of the table.

    Expect the results to be off by a minute in some cases, as seconds are also implemented into a few of the times.
    Issues.xls

  12. #12
    Registered User
    Join Date
    01-16-2013
    Location
    Australia
    MS-Off Ver
    excel 2010
    Posts
    8

    Re: Counting difference between hours if outside of business hours

    I suppose this responseless thread means nobody knows how to perform this task...

  13. #13
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Counting difference between hours if outside of business hours

    sorry did actually read all the back log

    seems to only occur when it is the same day
    if that case

    put into m17 check for less than 1 day
    Please Login or Register  to view this content.
    i note something about after hours which is 17,0,0
    so

    Please Login or Register  to view this content.
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  14. #14
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,586

    Re: Counting difference between hours if outside of business hours

    Pl see the attached file.
    Attached Files Attached Files

  15. #15
    Registered User
    Join Date
    01-16-2013
    Location
    Australia
    MS-Off Ver
    excel 2010
    Posts
    8

    Re: Counting difference between hours if outside of business hours

    Quote Originally Posted by kvsrinivasamurthy View Post
    Pl see the attached file.
    Hi kvsrinivasamurthy,
    Your formula doesn't quite work properly for a few scenarios.
    In J7 the result is 8:00, but the call was opened and closed at 8:00 AM and therefore the result should be 0:00 because it was outside of working hours.

    J8 has a result of 1:30, the proper result is actually 0:30 because we start counting at 8:30AM and I'm not sure where the extra hour comes from.

    J9 shows 23:00 which would be impossible in this situation, because the maximum duration for any result is 8:30 (we purely want to calculate the time the call was open, ignoring all time and dates before 8:30am and after 5:00 PM therefore every result afterwards is counting every day as hours. Please see my previously uploaded example for an idea on what I require.

    Thanks for the effort though, I'll probably save your formula for use in another project. Both yours and humdingaling's (whos result is more what I'm looking for minus a few strange results)
    Last edited by joytech22; 07-15-2013 at 12:33 AM.

  16. #16
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,586

    Re: Counting difference between hours if outside of business hours

    Pl see the attached file.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1