+ Reply to Thread
Results 1 to 6 of 6

Counting workday formula - help

  1. #1
    Registered User
    Join Date
    02-08-2010
    Location
    Madison, Wisconsin
    MS-Off Ver
    Excel 2007
    Posts
    47

    Counting workday formula - help

    In column G in the attached worksheet I have a formula that counts the workdays each month. On a separate sheet is a list of ll holidays and it attempts to exclude them. It does manage to put an "H" when there is a holiday, but it still counts that as a workday so that the following day is one number higher than it should be.

    I thought this same formula was working before - and then I removed the weekends (which creates part of the formula moot, but I wouldn't think would mess up the counting so as to count holidays. Can anyone figure out what is going wrong here? Thank you so much!


    ADD: Here's the formula if it helps to see it here: =IF(COUNTIF(HOLIDAYS!$C$4:$C$14,A5),"H",IF(OR(F5="Sat",F5="Sun")," ",SUMPRODUCT(--(WEEKDAY(A5+1-ROW(INDIRECT("1:"&DAY(A5))),2)<6),--ISNA(MATCH(A5+1-ROW(INDIRECT("1:"&DAY(A5))),HOLIDAYS!$C$4:HOLIDAYS!$C$14,0)))))
    Attached Files Attached Files
    Last edited by joeljoel; 08-07-2011 at 04:33 PM.

  2. #2
    Valued Forum Contributor gjlindn's Avatar
    Join Date
    08-01-2011
    Location
    Dodgeville, WI
    MS-Off Ver
    Excel 2003, 2007, 2010, 2013
    Posts
    369

    Re: Counting workday formula - help

    I'm not sure what you're saying...do you want, for instance, $G$5 to = 1 instead of 2 because $G$4 is set to "H"? Thanks!
    -Greg If this is helpful, pls click Star icon in lower left corner

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

    Re: Counting workday formula - help

    Perhaps:

    Please Login or Register  to view this content.
    The above simply validates if the date is a weekday, if it is whether or not it is a public holiday, if it is not it then calculates how many working days have occurred to that point in the month (inclusive)

    The use of INDEX with Holidays Range is used to identify the appropriate column of your public holiday range based on year of date.

    If you can, try to avoid using SUMPRODUCT in large quantity esp. where Volatile (as was the case here c/o INDIRECT)

    edit:

    If preferred you could replace the first NETWORKDAYS call (with INDEX) with a standard COUNTIF... whichever seems more intuitive to you:

    Please Login or Register  to view this content.
    Last edited by DonkeyOte; 08-07-2011 at 02:59 AM.

  4. #4
    Registered User
    Join Date
    02-08-2010
    Location
    Madison, Wisconsin
    MS-Off Ver
    Excel 2007
    Posts
    47

    Re: Counting workday formula - help

    Quote Originally Posted by gjlindn View Post
    I'm not sure what you're saying...do you want, for instance, $G$5 to = 1 instead of 2 because $G$4 is set to "H"? Thanks!

    Exactly what I am looking for.

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

    Re: Counting workday formula - help

    You should find the prior suggestion does as requested (the formula can be applied to the calculation range in it's entirety without need for modification)

  6. #6
    Registered User
    Join Date
    02-08-2010
    Location
    Madison, Wisconsin
    MS-Off Ver
    Excel 2007
    Posts
    47

    Re: Counting workday formula - help

    Yes, Donkey Ote, it works GREAT! Sorry for taking so long to acknowledge this - we have a 2 week old baby and I've catching up on asleep and have been on baby duty.

    Both options work well. It's a bit out of my league. But this is a real lifesaver. Thank you so much!

+ Reply to 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