+ Reply to Thread
Results 1 to 3 of 3

Combine Options for Single Argument

  1. #1
    Registered User
    Join Date
    11-14-2018
    Location
    Appleton, Wisconsin, USA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    2

    Combine Options for Single Argument

    I am trying to use the WORKDAY() function. The third parameter can be holidays to skip. I have generated 7 formulas to determine the 7 holidays of a given year. Thus my formula I would like to look something like the following: =WORKDAY(A1,1,{NewYears,MemorialDay,IndependenceDay,...}) where formulas would take the place of each holiday looking something like DATE(YEAR(A1),7,4) for IndependenceDay or DATE(G1,11,1)+21+CHOOSE(WEEKDAY(DATE(G1,11,1)),4,3,2,1,0,6,5) for Thanksgiving. etc...

    The temporary solution is to create a range elsewhere with those holidays each taking up a cell in some contiguous block where I could instead make the formula look like =WORKDAY(A1,1,Holidays!$A$1:$G$7). Unfortunately, if I'm still using this worksheet 8 years later, the function becomes useless.

    The second channel I pursued was to make the other sheet called "Holiday" have only 7 cells, each determined by the NOW() function [i.e. =DATE(YEAR(NOW()),12,25) for Christmas] Unfortunately, once a new year hits, all the data for the previous year will get shifted in the column referencing the holidays but not the other columns, rendering it again, useless.

    Any suggestions are appreciated. Thank you.

    [Edit: I figured out how to make it work. MAX(WORKDAY(A1,1,{HolidayFormula1}),WORKDAY(A1,1,{HolidayFormula2}),WORKDAY(A1,1,{HolidayFormula3}),...) If any holidays happen to match up, it will return a later date than all the other WORKDAY() Functions. Add in a special case for the day after Thanksgiving and it will work. I'm still in the market for a more "elegant" solution if anyone knows of it, but You can technically consider the problem solved.]
    Last edited by Dimonium_Anonimo; 11-14-2018 at 10:27 PM.

  2. #2
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2503
    Posts
    13,702

    Re: Combine Options for Single Argument

    Hi Dimonium_Anonimo. Welcome to the forum.

    One way would be to modify your YEAR(NOW()) formula. Make a contiguous row of years. Use that as both a reference in place of YEAR(NOW()) and as a lookup range. Then make a 7 cell range below each of those with holidays unique to that year. Put that lookup table in the sheet 'Holidays'.

    A short example:


    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    1
    2014
    2015
    2016
    2017
    2018
    2019
    2020
    2021
    2022
    2
    12/25/2014
    12/25/2015
    12/25/2016
    12/25/2017
    12/25/2018
    12/25/2019
    12/25/2020
    12/25/2021
    12/25/2022
    In A2 : =DATE(A$1,12,25)
    3
    7/4/2014
    7/4/2015
    7/4/2016
    7/4/2017
    7/4/2018
    7/4/2019
    7/4/2020
    7/4/2021
    7/4/2022
    In A3 : =DATE(A$1,7,4)
    4
    11/27/2014
    11/26/2015
    11/24/2016
    11/23/2017
    11/22/2018
    11/28/2019
    11/26/2020
    11/25/2021
    11/24/2022
    In A4 : =DATE(A$1,11,1)+21+CHOOSE(WEEKDAY(DATE(A$1,11,1)),4,3,2,1,0,6,5)


    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by FlameRetired; 11-14-2018 at 07:27 PM. Reason: Edited formula to clarify reference sheet name.
    Dave

  3. #3
    Registered User
    Join Date
    11-14-2018
    Location
    Appleton, Wisconsin, USA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    2
    Thank You.

    I believe we described the same method, me in my second paragraph. I chose 8 as an arbitrary limit (mostly, I chose column G as an arbitrary limit which would get me 7 years into the future.) Of course I could make the formula and drag it out 100 years no problem and hope I don't live to 125 and still need this sheet. My hope was to make a generic formula that would work today the same as it would 100 years from now without going in and adding more years to the table on the other sheet or increasing the range selected in the 3rd parameter of the WORKDAY() Function. If it's possible (without VBA) great! If not, I already have a temporary workaround. And I'm not exactly a slouch at VBA if it comes to that.

+ 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. Select and combine 5 different items together maximizing 5 different options
    By holyexcel in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-07-2015, 02:27 AM
  2. Replies: 0
    Last Post: 08-26-2014, 08:44 AM
  3. Combine MANY tabs (with single column) into SINGLE tab.
    By nick1000 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-17-2013, 02:31 PM
  4. Excel 2007 : Selecting multiple ranges as a single argument
    By queenofbabes in forum Excel General
    Replies: 2
    Last Post: 10-16-2011, 09:56 AM
  5. if between function as a single argument
    By options in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-07-2008, 08:49 AM
  6. Using single cell reference as table array argument in Vlookup
    By CornNiblet in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-22-2005, 04:15 AM
  7. Function (array argument, range argument, string argument) vba
    By Witek in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-24-2005, 11:07 AM

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