+ Reply to Thread
Results 1 to 5 of 5

Excel 2007 : Processing Time that excludes holiday, weekends, and non-business hours

Hybrid View

  1. #1
    Registered User
    Join Date
    04-27-2010
    Location
    Cincinnati, OH
    MS-Off Ver
    Excel 2007
    Posts
    7

    Processing Time that excludes holiday, weekends, and non-business hours

    this is my first post so if you need more info just let me know.

    I am trying to write a formula that will calculate the time between two dates/times. The clock should stop on all weekends and federal holiday. It should also stop at 5 PM and resume at 8 AM the next business day. If the second date is during a non-working day or hour, it should calculate as 5PM the previous business day

    The following formula gets me part of the way but it seems to have a problem when the start date is on a holiday or weekend.

    =IF(AND(INT(A5)=INT(B5),NOT(ISNA(MATCH(INT(A5),D$2:D$113,0)))),0,ABS(IF(INT(A5)=INT(B5),ROUND(24*(B5-A5),2),(24*(F$2-E$2)*(MAX(NETWORKDAYS(A5+1,B5-1,D$2:D$113),0)+INT(24*(((B5-INT(B5))-(A5-INT(A5)))+(F$2-E$2))/(24*($F$2-$E$2))))+MOD(ROUND(((24*(B5-INT(B5)))-24*E$2)+(24*F$2-(24*(A5-INT(A5)))),2),ROUND((24*(F$2-E$2)),2))))))

    A=Application date
    B=First activity date

    D=List of excluded dates
    E=Business day start time
    F=Business day end time

    I have attached a sample spreadsheet with the formula above.

    Thanks for the help
    Attached Files Attached Files
    Last edited by tonedog54; 04-28-2010 at 04:32 PM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Processing Time that excludes holiday, weekends, and non-business hours

    Not clear if you want the results as true time values or in decimal hours.

    In terms of true time, perhaps:

    =MAX(0,(NETWORKDAYS($A5,$B5,$D$2:$D$113)-1)*($F$2-$E$2)+IF(NETWORKDAYS($B5,$B5,$D$2:$D$113),MEDIAN(MOD($B5,1),$F$2,$E$2),$F$2)-MEDIAN(NETWORKDAYS($A5,$A5,$D$2:$D$113)*MOD($A5,1),$F$2,$E$2))
    copied down
    format cell as [h]:mm:ss

    if you want in terms of decimal hours (eg 1.5 for 1:30) multiply above result by 24.

  3. #3
    Registered User
    Join Date
    04-27-2010
    Location
    Cincinnati, OH
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Processing Time that excludes holiday, weekends, and non-business hours

    Thanks for the quick response. It appears this solved my issue. I will apply it to the enter spreadsheet and verify it tomorrow.

    I do have 1 question, as a co-worker appears to have came up with a very simiar equation to this but left out the =MAX(0....) on his. What did this function correct in the overall formula? As with that being left out, some of the data was incorrect.

    thanks again!

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Processing Time that excludes holiday, weekends, and non-business hours

    Could you outline some examples which otherwise generated errors ?

    (edit: I would expect that if for ex. start > end)
    Last edited by DonkeyOte; 04-28-2010 at 02:59 AM.

  5. #5
    Registered User
    Join Date
    04-27-2010
    Location
    Cincinnati, OH
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Processing Time that excludes holiday, weekends, and non-business hours

    My co-worker was close on his formula but did not have the Max 0 part of it. He was wondering what that does. I have tested it to the best of my ability and it work on every example I can think of. Thanks for the solution

+ 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