+ Reply to Thread
Results 1 to 8 of 8

Count working days and toggle include today or not, taking into account holidays

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    03-14-2013
    Location
    England
    MS-Off Ver
    2007
    Posts
    191

    Count working days and toggle include today or not, taking into account holidays

    In the attached example I am counting the number of working days in the current month excluding holidays, where the holiday dates are input by the user. It also lists the number of working days so far, and the number remaining (again also taking into account any holiday dates entered).

    I have a couple of issues here that I need help with please if possible.....

    Firstly I find myself having to put a -1 in at the end of the formula for total working days some months, but not others... but I can't figure out why this happens.

    Secondly, and this is the main thing I want help with... On a given day, the formulas will calculate the number of days to go and days remaining including today. I want the user to be able to decide easily if today should be included or not without having to edit the formulas.
    So I added a checkbox for 'include today', and do a plus or minus 1 on the formulas for whether it's checked or not (using a linked cell), and realise its going to be rather more complicated due to having to take into account todays date.

    Whether the checkbox is checked or not should effect the number working days left to go, and the number remaining, only if today is a working day, ie. today is not a weekend day or one of the holiday dates input by the user. This surely is doable but I think a little beyond my current skill level.

    I think you will get what I mean if you have a go at the example, any help is much appreciated.
    Attached Files Attached Files

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Count working days and toggle include today or not, taking into account holidays

    You should do the adding/subtracting based on the checkbox on the date within the networkdays function.
    NOT on the end result of the function.
    And the beginning/end dates within the networkdays should reflect the first and last day of the month (not the day before or after)

    Try these (I put the TODAY() function in C1)

    Total working days: =NETWORKDAYS(EOMONTH(C1,-1)+1,EOMONTH(C1,0),$A$10:$A$28)
    Working days so far: =NETWORKDAYS(EOMONTH(C1,-1)+1,C1-NOT(H2),$A$10:$A$28)
    Working days left: =NETWORKDAYS(C1+NOT(H2),EOMONTH(C1,0),$A$10:$A$28)

  3. #3
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: Count working days and toggle include today or not, taking into account holidays

    For the 2nd part, in I2 put:
    =NETWORKDAYS(NOW(),NOW(),A10:A14) * H2
    Then add this to your calculation ie where you have the IF statement relating to the checkbox simply add I2

    eg B4 should be changed from:
    =NETWORKDAYS(TODAY(),EOMONTH(TODAY(),0),$A$10:$A$28)-IF($H$2=TRUE,1,0)
    to
    =NETWORKDAYS(EOMONTH(TODAY(),-1),TODAY()-1,$A$10:$A$28)+$I2
    EDIT Forgot to say, reverse your question ie make it "EXCLUDE TODAY" for the above to work.
    If someone has helped you then please add to their Reputation

  4. #4
    Forum Contributor
    Join Date
    03-14-2013
    Location
    England
    MS-Off Ver
    2007
    Posts
    191

    Re: Count working days and toggle include today or not, taking into account holidays

    Hi Jonbo,

    Sorry for my slow reply, yes this is what I meant, thanks for that. With the include today or not though I mean if its not included in working days so far, then it should be included in working days left instead, today should be included in one or the other depending on the checkbox, with the total of those 2 always adding up to the total working days. I think need to change the working days left formula slightly, any ideas?

  5. #5
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Count working days and toggle include today or not, taking into account holidays

    No worries, that can be adjusted.

    But just for clarity
    IF the Checkbox IS checked (H2 is TRUE) then today is included in which formula?
    If the Checkbox is NOT checked (H2 is FALSE) then today is included in which formula?

  6. #6
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Count working days and toggle include today or not, taking into account holidays

    Assuming
    TRUE = include today in working days so far
    FALSE = include today in working days remaining

    Should just remove the NOT from the days remaining formula
    =NETWORKDAYS(C1+H2,EOMONTH(C1,0),$A$10:$A$28)

  7. #7
    Forum Contributor
    Join Date
    03-14-2013
    Location
    England
    MS-Off Ver
    2007
    Posts
    191

    Re: Count working days and toggle include today or not, taking into account holidays

    Oh I see, yes I get it now, I thought it had something to do with the not, I tried just about everything other than taking it out all together.

    This works perfectly now, many thanks for your help

  8. #8
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Count working days and toggle include today or not, taking into account holidays

    You're welcome.

+ 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. [SOLVED] Display last working day of month, taking into account national holidays?
    By will1565 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-29-2015, 06:53 PM
  2. SLA Status formula taking into account Business Days
    By Chris_Mck in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-27-2015, 06:34 AM
  3. [SOLVED] Count 6 working days (excluding Sunday, Holidays & half days)
    By eve_star1 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-29-2015, 08:00 AM
  4. Count Working days by subtracting bank holidays and weekends
    By aman1234 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-08-2014, 07:40 AM
  5. Replies: 5
    Last Post: 05-18-2012, 10:24 AM
  6. Replies: 3
    Last Post: 03-09-2012, 08:19 AM
  7. If statement to include working days, exclude holidays
    By rhudgins in forum Excel General
    Replies: 2
    Last Post: 05-27-2010, 09:46 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