Closed Thread
Results 1 to 11 of 11

Adding days to a start date (including weekends & holidays); end date only on workday

  1. #1
    Registered User
    Join Date
    05-15-2009
    Location
    Croatia
    MS-Off Ver
    Excel 2003
    Posts
    2

    Adding days to a start date (including weekends & holidays); end date only on workday

    What formula do I have to use in order to add a number of days to a date entered into a cell, however if the calculated date lands on a weekend or a holiday, then the date needs to go to the next business day. But for the calculation weekend and holiday days have to be counted, the end date just has to be on working day.

    Any help would be appreciated.

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Adding days to a start date (including weekends & holidays); end date only on wor

    Try WORKDAY function

    ili napiši primjer pa da znamo konkretnije o čemu se radi. Na engl normalno

  3. #3
    Registered User
    Join Date
    05-15-2009
    Location
    Croatia
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Adding days to a start date (including weekends & holidays); end date only on wor

    Thanks for the reply, but WORKDAY function is not an option, since weekends and holidays need to be included in the calculation as well.

    Example:

    Start date (January 1 2009) + 9 days (all days, not just business day) = January 10 2009, (but that is Saturday, so the calculation gives the first business day after it), therefore the correct date would be = January 12 2009.

    I hope this formula can be done, because it would save me many days of work.

  4. #4
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Adding days to a start date (including weekends & holidays); end date only on wor

    You can use IF solution:

    =IF(WEEKDAY(B3+$C$1;2)=7;B3+$C$1+1;IF(WEEKDAY(B3+$C$1;2)=6;B3+$C$1+2;B3+$C$1))

    Where B3 is current date and C1 is number of days you adding. If you have different days to add for each day instead of $C$1 write C3 and use formula same way

    Another apporach by lookup function:

    =B3+$C$1+LOOKUP(WEEKDAY(B3+$C$1;2);{1;6;7};{0;2;1})

  5. #5
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Adding days to a start date (including weekends & holidays); end date only on wor

    Or this:

    =B3+$C$1-MIN(0;6-WEEKDAY(B3+$C$1;2))

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

    Re: Adding days to a start date (including weekends & holidays); end date only on wor

    Generally speaking I think the simplest solution is to add 1 day less the total number of days to be added to the date then subsequently add 1 workday to that resulting date, eg:

    =WORKDAY(B3+(C1-1),1,holidays)

    Where:

    B3 is date
    C1 days to add
    holidays is named range containing public holidays to be accounted for in final calc.

    WORKDAY forms part of the Analysis ToolPak add-in.

  7. #7
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Adding days to a start date (including weekends & holidays); end date only on wor

    wanted to add that my last formula doesn't work...
    Last edited by zbor; 05-16-2009 at 03:39 AM.

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

    Re: Adding days to a start date (including weekends & holidays); end date only on wor

    zbor, I think you're misinterpreting slightly...

    OP wants to add x days to a start date inclusive of all days be they workdays, weekends, public holidays... however the final date should be a workday - ie not a weekend date nor a public holiday.

    The formula I provide does this:

    =WORKDAY(B3+(C1-1),1,holidays)

    In general terms the WORKDAY functions adds a number of WORKDAYS to a given date and ensures the result is not a public holiday by using the referenced holidays range.

    In this case we take the start date, let's say:

    B3: 16th May 2009

    We want to add x days as set in C1:

    C1: 15

    B3+C1 = 31st May 2009 - a Sunday

    What my formula does is subtract 1 day from C1

    B3+(C1-1) = 30th May 2009 - a Satuday

    I now say - ok we need to add 1 more day (day 15) but let's ensure day 15 is a WORKDAY using the WORKDAY function

    WORKDAY(B3+(C1-1),1)

    this will return 1st June 2009 - a Monday (the same would be true in C1 were 14 or 16)

    Now let's say we create a named range called "holidays" in which we enter 1st June 2009

    WORKDAY(B3+(C1-1),1,holidays)

    will now return 2nd June as 1st June is a public holiday.
    Last edited by DonkeyOte; 05-16-2009 at 03:44 AM.

  9. #9
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Adding days to a start date (including weekends & holidays); end date only on wor

    I've realize it so I've edited my post. Sorry that you already start to explain it

    WORKDAY is truly best solution but when I read (3rd post) that workday is not an option I try to find some other solution... I had to stick for it as I suggested in 2nd post.
    Last edited by zbor; 05-16-2009 at 03:52 AM.

  10. #10
    Registered User
    Join Date
    01-26-2023
    Location
    Greece
    MS-Off Ver
    office 2019
    Posts
    6

    Re: Adding days to a start date (including weekends & holidays); end date only on workday

    Hello there, =WORKDAY(B3+(C1-1),1,holidays) is a real diamond in a sense that it's elegant and sort.
    If you want to add dates to a date and include both weekends and holidays in the calculation but then if the resulting date is either a weekend or a holiday, go to the next working day this is it.
    It's a way to negate the obsessive compulsion of "workday" to not include weekends when counting (I suppose there could be cases when this would be useful too).
    Would you be so kind as to offer your invaluable knowledge please?
    I need =WORKDAY(B3+(C1-1),1,holidays) keep doing what it does as described above, but I also need it to be able to completely ignore a month or predefined ranges of dates.
    When I say ignore I mean that the formula should act as if a range (August for example or some consecutive dates in A2:A5 & B2:B5) don't exist at all.
    That is to say the formula should not include those dates when counting (pause counting and resume counting just after ie August or that predefined range of consecutive dates in A2:A5 & B2:B5).
    What is more the resulting date cannot be (ie August or one of those predefined consecutive dates in ranges A2:A5 & B2:B5).
    In sort I would like to include weekends and holidays in my calculation (ie count them but go to next working day if my calculation ends on them) and at the same time define some predefined ranges
    which should be ignored/skipped completely when counting as if they didn't exist at all (basecally stop counting at the beginning of a range of dates and resume counting just after the last date in that ragne).
    I've included a book so that you could maybe have a look and see if this is something you would care to spend some time.
    I would like to thank you for any ideas you may come up with.
    Sincerely,
    Panos
    Attached Files Attached Files

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,830

    Re: Adding days to a start date (including weekends & holidays); end date only on workday

    Thank you, but the thread is 15 years old.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

Closed 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