• NetWorkDays (Excel 2003)

    Author
    Topic
    #456273

    Hi

    Pls advise how do I set the weekend days as Friday & Saturday instead of Saturday & Sunday
    I have look at the Help but is unable to figure out holidays’ part in the function.
    Syntax : NETWORKDAYS(start_date,end_date,holidays)

    TIA

    regards, francis

    Viewing 2 reply threads
    Author
    Replies
    • #1139351

      As far as I know, the function only treats actual weekends (Sat/Sun) as weekends and it can not be changed. Do you have the option of treating all days as one day ahead? This could work.

      The “holiday” part is a range of cells containing the dates that should be ignored by the networkdays. [If you work one day in the past to get Fri/Sat to be defined as weekends, you must define all the dates 1 day ahead as well]

      Steve

    • #1139357

      Hi Francis

      Try:

      = NETWORKDAYS(A1,B1+1)-1

      Where A1 is the start date and B1 the end date

      • #1139393

        If you don’t work with the offset days but with the actual days, wouldn’t it be:
        = NETWORKDAYS(A1+1,B1+1)

        [Though they may give equivalent results…]

        and the range for the holiday list would be each of the holidays +1 ?

        Steve

        • #1139394

          Hi Steve

          I am just scratching my head to see the difference….I may have missed your point!

          I seem to get the same result with both Functions, see attached.

          • #1139399

            Your number will be 1 less than mine if the Startdate is on a real weekend date. While presuming a Saturday might not be a startdate (since it is weekend in both schemes), a Sunday is not a weekend in the proposed system and would be a valid startdate. Your scheme still treats it as a weekend since you don’t adjust it by 1 day…

            Steve

            • #1139400

              Thanks Steve, all my little tests and that is the one I didn’t do blush

    • #1139392

      Steve’s suggestion of shifting all dates by 1 is the easiest solution.

      If you wish, you could use the series of functions provided at Date/Time: Doing WorkDay Math in VBA. You don’t have to understand the code, the only thing you’d need to do is change one line in the IsWeekend function:

      Case vbSaturday, vbSunday

      should become

      Case vbFriday, vbSaturday

      to count Friday and Saturday as weekend days.

    Viewing 2 reply threads
    Reply To: NetWorkDays (Excel 2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: