Results 1 to 8 of 8
  1. #1
    3 Star Lounger
    Join Date
    Nov 2005
    Location
    Asia Pacific, Bangkok Metropolis
    Posts
    378
    Thanks
    0
    Thanked 0 Times in 0 Posts

    NetWorkDays (Excel 2003)

    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
    Hope this is helpful

    francis, <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

    My Reading

    Pivot Table 101
    Pivot Table
    Array

  2. #2
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: NetWorkDays (Excel 2003)

    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

  3. #3
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: NetWorkDays (Excel 2003)

    Hi Francis

    Try:

    = NETWORKDAYS(A1,B1+1)-1

    Where A1 is the start date and B1 the end date
    Jerry

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: NetWorkDays (Excel 2003)

    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.

  5. #5
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: NetWorkDays (Excel 2003)

    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

  6. #6
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: NetWorkDays (Excel 2003)

    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.
    Jerry

  7. #7
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: NetWorkDays (Excel 2003)

    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

  8. #8
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: NetWorkDays (Excel 2003)

    Thanks Steve, all my little tests and that is the one I didn't do <img src=/S/blush.gif border=0 alt=blush width=15 height=15>
    Jerry

Posting Permissions

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