My formula is giving me the #INVALID VALUE message and I'm not sure why

Hello! I want to have a column that returns a value of 1 if the date in another column is 6 months or more in the past, and returns 0 if the date is less than 6 months in the past using the following formula:
=IF([Date Accrued]@row <= DATE(YEAR(TODAY()), MONTH(TODAY()) - 6, DAY(TODAY())), 1, 0)
The formula has resulted in #INVALID VALUE and I can't tell why.
Here is a screenshot of my sheet:
Best Answer
-
@Lindsay Scarey Here is a work around:
=IF([Column3]@row <= DATE(YEAR(TODAY()), IF(MONTH(TODAY()) < 7, MONTH(TODAY()) + 6, MONTH(TODAY()) - 6), DAY(TODAY())), 1, 0)
Answers
-
Is your Date Accrued column formatted as Date?
-
@VBAGuru yes, it is
-
Is Column10 just Text/Number format?
-
-
It doesn't seem to like the -6 in the Date formula. Below works for me:
=IF([Column3]@row <= DATE(YEAR(TODAY()), MONTH(TODAY() - 182), DAY(TODAY())), 1, 0)
-
I see why now! It doesn't roll the month to 12, with - 6 the month is zero.
-
@VBAGuru Aha! Thank you! Do you know the fix for that?
-
That was the minus 182
-
@Lindsay Scarey Here is a work around:
=IF([Column3]@row <= DATE(YEAR(TODAY()), IF(MONTH(TODAY()) < 7, MONTH(TODAY()) + 6, MONTH(TODAY()) - 6), DAY(TODAY())), 1, 0)
-
@VBAGuru Awesome, that worked. Thank you so much!
-
@Lindsay Scarey Thinking a bit more, you were going to run into some issues on specific dates. August 29-31 in particular. But also the year would be wrong for the first half of the year. This is what I cam up with:
=IF([Date Accrued]@row <= DATE(IF(MONTH(TODAY()) < 7, YEAR(TODAY()) - 1, YEAR(TODAY())), IF(MONTH(TODAY()) < 7, MONTH(TODAY()) + 6, MONTH(TODAY()) - 6), IF(DAY(TODAY()) > 28, 28, DAY(TODAY()))), 0, 1)
-
But also wondering why it needs to be this complex. Could you just use:
=IF([Date Accrued]@row <= Today()-182, 0, 1)
Help Article Resources
Categories
Check out the Formula Handbook template!