I am using Excel 2013.
I have a table with three columns: Start Date, End Date, and Holiday - a column containing a formula to check if a holiday falls between the Start Date and End Date. The Start Date and End Date columns contain references to other columns where the date is calculated. The formula in the Holiday column uses an Index
/Match
function to look in a list of holidays (on a separate sheet called SLA Holidays). This table has thousands of records ranging over a one-week time span, and is updated daily.
The holiday formula does not work - it returns FALSE
even when there is a holiday in the time frame. Upon evaluating the formula, it says that the first logical of the AND
function is FALSE
; however, it is true (9/3/2018 > 8/31/2018). The formula correctly evaluates the second logical of the AND
function.
When I replace my table references to Start Date and End Date with references to cells outside of the table containing those dates, the formula works correctly.
Below is a screenshot of a few records from the table, showing the 3 columns. I've also included an HTML version for copy-ability. The formula is as follows:
{=AND(INDEX('SLA Holidays'!$A$2:$A$7,MATCH(MIN(ABS('SLA Holidays'!$A$2:$A$7-[@[Start Date]])),ABS('SLA Holidays'!$A$2:$A$7-[@[Start Date]]),0))>[@[Start Date]],INDEX('SLA Holidays'!$A$2:$A$7,MATCH(MIN(ABS('SLA Holidays'!$A$2:$A$7-[@[Start Date]])),ABS('SLA Holidays'!$A$2:$A$7-[@[Start Date]]),0))<[@[End Date]])}
Start Date End Date Holiday
08/31/2018 9/4/2018 FALSE
08/31/2018 9/4/2018 FALSE
08/31/2018 9/4/2018 FALSE
When I use the exact same formula, but switch the table references with cell references containing the same dates, the formula works. Here is that updated formula:
{=AND(INDEX('SLA Holidays'!$A$2:$A$7,MATCH(MIN(ABS('SLA Holidays'!$A$2:$A$7-AC5)),ABS('SLA Holidays'!$A$2:$A$7-AC5),0))>AC5,INDEX('SLA Holidays'!$A$2:$A$7,MATCH(MIN(ABS('SLA Holidays'!$A$2:$A$7-AC5)),ABS('SLA Holidays'!$A$2:$A$7-AC5),0))<AD5)}
Is there a way to make this formula work with references to dates within the table?
@
. Take a look at this site to get a better understanding of structured references. – TotsieMae