+ Reply to Thread
Results 1 to 6 of 6

Adding hours to start time - Business hours/holidays/weekends

  1. #1
    Registered User
    Join Date
    12-13-2013
    Location
    Stephens City, VA
    MS-Off Ver
    Excel 2010
    Posts
    24

    Adding hours to start time - Business hours/holidays/weekends

    I'm trying to determine the end time of an SLA by using the planned start date plus the SLA goal accounting for business hours, holidays, and weekends.

    I found this formula (by daddylonglegs) which appears to work for the original poster, but does not work correctly for me. I've adapted it to my spreadsheet.

    Please Login or Register  to view this content.
    HLDY = Named range of Holidays
    BusinessStart = named range for the begining of the Business Day (6:00)
    BusinessEnd = named range for end of business day (18:00)
    M2 = Start time
    X2 = Hours to add

    In M2 I have the date of 3/17/2014 10:00 (this date falls on a snow day I added as a HLDY)
    X2 = 15:00 (hours)

    the end result is 3/17/2014 10:37

    The result should be 3/19/2014 9:00. Because the start time is on a HLDY it should rollover to the beginning of the next business day of 3/18/2014 6:00 and then add 15:00 hours.

    It also needs to account for goal times of greater than 24 hours (i.e. 36:00, 60:00)

    Any help would be much appreciated.

    Thank you for your time.

  2. #2
    Registered User
    Join Date
    12-13-2013
    Location
    Stephens City, VA
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Adding hours to start time - Business hours/holidays/weekends

    Also. if it matters. I tried the above formula with a date that actually started WITHIN business hours and not on a Holiday and it didn't give me the correct date time.

    3/18/2014 10:00 + 15:00 came out to 3/18/2014 10:37

  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Adding hours to start time - Business hours/holidays/weekends

    the number of hours is divided by 24 only when the X2 value is a decimal number of hours, if you have an actual time value in X2 like 15:00 you should remove the /24s, so your last example will work with this formula

    =WORKDAY(M2,CEILING((X2+MOD(M2,1)-BusinessStart)/(BusinessEnd-BusinessStart),1)-1,HLDY)+MOD(M2,1)+X2-CEILING(MOD(M2,1)+X2-BusinessStart,BusinessEnd-BusinessStart)+BusinessEnd-BusinessStart

    .....but you want that to work even if M2 is outside working hours?
    Audere est facere

  4. #4
    Registered User
    Join Date
    12-13-2013
    Location
    Stephens City, VA
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Adding hours to start time - Business hours/holidays/weekends

    Yes sir, I would like it to work outside of working hours, just roll over to the next Business Day and/or Time.

  5. #5
    Registered User
    Join Date
    12-13-2013
    Location
    Stephens City, VA
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Adding hours to start time - Business hours/holidays/weekends

    So, I believe I was able to modify your formula and get it working how I want to. It appears to work for now, I've ran it through several tests.

    HTML Code: 
    In the portion of WORKDAY, you had the days as -1. I changed it to 0 or 1 (depending on where the start date began - ie weekend or a holiday)

    If you wouldn't mind looking at it and tell me if I've left anything out or forgotten anything...or any improvements.

    Thank you sir for all of your help.

  6. #6
    Registered User
    Join Date
    12-13-2013
    Location
    Stephens City, VA
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Adding hours to start time - Business hours/holidays/weekends

    Marking this as Solved The last formula appears to be working the way I want it to.

    Thanks for all of your help,

    Tim

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 9
    Last Post: 07-04-2016, 11:42 PM
  2. Calculate Business Hours exluding weekends and holidays with a caveat
    By teamdob in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-22-2012, 11:55 AM
  3. Replies: 4
    Last Post: 08-10-2012, 11:41 AM
  4. Replies: 0
    Last Post: 04-07-2011, 01:46 AM
  5. Replies: 4
    Last Post: 04-28-2010, 04:25 PM

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