+ Reply to Thread
Results 1 to 6 of 6

Adding holidays and weekends to sumproduct formula

  1. #1
    Forum Contributor
    Join Date
    01-05-2010
    Location
    New York
    MS-Off Ver
    Excel 2016
    Posts
    747

    Adding holidays and weekends to sumproduct formula

    Right now the formula is just taking 5 days before and 5 days after and not taking into account holidays and weekends.

    I want to change the formulas in column D and E to 5 workdays/holidays before(column D) and 5 workdays after (column E). The holidays are in Column G.
    Attached Files Attached Files
    Last edited by rhudgins; 04-29-2010 at 10:31 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    02-08-2010
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2007
    Posts
    122

    Re: Adding holidays and weekends to sumproduct formula

    Try this,

    D6=IF(SUMPRODUCT(--($H$6:$H$5000=B6),--($I$6:$I$5000>=C6),--($I$6:$I$5000<=WORKDAY(C6,$F$2,$G$7:$G$60))),"YES","")

    E6=IF(SUMPRODUCT(--($H$6:$H$5000=B6),--($I$6:$I$5000>=WORKDAY(C6,-$F$2,$G$7:$G$60)),--($I$6:$I$5000<=C6)),"YES","")

    And copy down.

    Regards

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

    Re: Adding holidays and weekends to sumproduct formula

    Note that pre XL2007 the WORKDAY function as used above requires activation of the Analysis ToolPak Add-In (via Tools -> Add-Ins)

    If you can not use the Add-In for whatever reason (it must be activated on each client that uses the file) let us know.
    The same can be achieved without it but the syntax is undoubtedly more complex (and longer).

  4. #4
    Forum Contributor
    Join Date
    01-05-2010
    Location
    New York
    MS-Off Ver
    Excel 2016
    Posts
    747

    Re: Adding holidays and weekends to sumproduct formula

    Thanks that formula works. I didnt realize it but the formulas in Column F now needs to be adjusted. Can you help me make this adjustment?

  5. #5
    Valued Forum Contributor
    Join Date
    02-08-2010
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2007
    Posts
    122

    Re: Adding holidays and weekends to sumproduct formula

    Replace >=C6-$F$2 by >=WORKDAY(C6,-$F$2,$G$7:$G$60) and <=C6+$F$1 by <=WORKDAY(C6,$F$2,$G$7:$G$60)

    Regards

  6. #6
    Forum Contributor
    Join Date
    01-05-2010
    Location
    New York
    MS-Off Ver
    Excel 2016
    Posts
    747

    Re: Adding holidays and weekends to sumproduct formula

    Thanks this works!

+ 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