#Invaldi Operation when a date dell is blank

Trying to analyze multiple date columns against a current date to ensure the training has occurred within the last year and if not then flag as needing to be trained. But when I incorporate the various date cells for reference I get the #invalid operation error for the blanks.
Formula: =IF(OR([DTMC & Trainer Training Date]@row <= [Current Date]@row, [SSS Training Date]@row <= [Current Date]@row, [SESIR Training Date]@row <= [Current Date]@row, [DTMC Training Date]@row <= [Current Date]@row, [Trainer Training Date]@row <= [Current Date]@row), "Green", "Red")
The ones that are showing green are because I limited to just that cell to ensure the formula worked at an individual row level, but the others are using the full formula above.
Best Answers
-
So if any cell that contains a date has a date that is less that [Current Date]@row, flag it as "Green"?
Try this:
=IF(IFERROR(MIN(COLLECT([First Date Column]@row:[Last Date Column]@row, [First Date Column]@row:[Last Date Column]@row, ISDATE(@cell))), [Current Date]@row + 1) <= [Current Date]@row, "Green", "Red")
But keep in mind, the above (and the logic you used in your formula) won't quite capture what you described as wanting. These formulas will flag green for any date that is less than or equal to [Current Date]@row (meaning red for anything in the future), but it sounds by your description, that you want green for anything within the past year. In that case you want to flag green for any date that is greater than or equal to a year ago which would look more like this:
=IF(IFERROR(MIN(COLLECT([First Date Column]@row:[Last Date Column]@row, [First Date Column]@row:[Last Date Column]@row, ISDATE(@cell))), [Current Date]@row + 1) >= DATE(YEAR([Current Date]@row) - 1, MONTH([Current Date]@row), DAY([Current Date]@row)), "Green", "Red")
-
Ok. Give this a try:
=IF(COUNTIFS([SSS Training Date]@row:[DTMC & Trainer Training Date]@row, ISDATE(@cell)) = 0, "output if all blanks", IF(IFERROR(MIN(COLLECT([SSS Training Date]@row:[DTMC & Trainer Training Date]@row, [SSS Training Date]@row:[DTMC & Trainer Training Date]@row, ISDATE(@cell))), [Current Date]@row + 1) >= DATE(YEAR([Current Date]@row) - 1, MONTH([Current Date]@row), DAY([Current Date]@row)), "Green", "Red"))
-
Answers
-
What would you expect to have output if a date is blank?
-
It should output the date for only the column that has a date, and ignore the blanks.
-
I tried to expand the formula to:
=IF(OR([SSS Training Date]@row <= [Current Date]@row, [SESIR Training Date]@row <= [Current Date]@row, [DTMC Training Date]@row <= [Current Date]@row, [Trainer Training Date]@row <= [Current Date]@row, [DTMC & Trainer Training Date]@row <= [Current Date]@row, [SSS Training Date]@row = "", [SESIR Training Date]@row = "", [DTMC Training Date]@row = "", [Trainer Training Date]@row = "", [DTMC & Trainer Training Date]@row = ""), "Green", "Red")
-
So if any cell that contains a date has a date that is less that [Current Date]@row, flag it as "Green"?
Try this:
=IF(IFERROR(MIN(COLLECT([First Date Column]@row:[Last Date Column]@row, [First Date Column]@row:[Last Date Column]@row, ISDATE(@cell))), [Current Date]@row + 1) <= [Current Date]@row, "Green", "Red")
But keep in mind, the above (and the logic you used in your formula) won't quite capture what you described as wanting. These formulas will flag green for any date that is less than or equal to [Current Date]@row (meaning red for anything in the future), but it sounds by your description, that you want green for anything within the past year. In that case you want to flag green for any date that is greater than or equal to a year ago which would look more like this:
=IF(IFERROR(MIN(COLLECT([First Date Column]@row:[Last Date Column]@row, [First Date Column]@row:[Last Date Column]@row, ISDATE(@cell))), [Current Date]@row + 1) >= DATE(YEAR([Current Date]@row) - 1, MONTH([Current Date]@row), DAY([Current Date]@row)), "Green", "Red")
-
thank Paul, that worked, I just had to make one change to set the < = to be >= to flag any dates that were older than one year as red
-
=IF(IFERROR(MIN(COLLECT([SSS Training Date]@row:[DTMC & Trainer Training Date]@row, [SSS Training Date]@row:[DTMC & Trainer Training Date]@row, ISDATE(@cell))), [Current Date]@row + 1) >= [Current Date]@row, "Green", "Red")
-
One last item Paul, how can I modify to allow for any cell that is blank for those positions that do not require any of the trainings listed in the table. We have some folks who do not require training so those dates will be blank.
-
The above should do that by leveraging the ISDATE function to "collect" only the fields that have dates in them then pulling the oldest one of those dates using the MIN function which is then compared to [Current Date].
-
I get #Invalid Operation for the row where there are no dates listed, because the role doesn't require training.
=IF(IFERROR(MIN(COLLECT([SSS Training Date]@row:[DTMC & Trainer Training Date]@row, [SSS Training Date]@row:[DTMC & Trainer Training Date]@row, ISDATE(@cell))), [Current Date]@row + 1) >= DATE(YEAR([Current Date]@row) - 1, MONTH([Current Date]@row), DAY([Current Date]@row)), "Green", "Red")
-
Ok. Give this a try:
=IF(COUNTIFS([SSS Training Date]@row:[DTMC & Trainer Training Date]@row, ISDATE(@cell)) = 0, "output if all blanks", IF(IFERROR(MIN(COLLECT([SSS Training Date]@row:[DTMC & Trainer Training Date]@row, [SSS Training Date]@row:[DTMC & Trainer Training Date]@row, ISDATE(@cell))), [Current Date]@row + 1) >= DATE(YEAR([Current Date]@row) - 1, MONTH([Current Date]@row), DAY([Current Date]@row)), "Green", "Red"))
-
Thanks Paul, I tweeked it to give a yellow output for the all blanks
=IF(COUNTIFS([SSS Training Date]@row:[DTMC & Trainer Training Date]@row, ISDATE(@cell )) = 0, "Yellow", IF(IFERROR(MIN(COLLECT([SSS Training Date]@row:[DTMC & Trainer Training Date]@row, [SSS Training Date]@row:[DTMC & Trainer Training Date]@row, ISDATE(@cell ))), [Current Date]@row + 1) >= DATE(YEAR([Current Date]@row) - 1, MONTH([Current Date]@row), DAY([Current Date]@row)), "Green", "Red"))@cell
And for the comparison of the 2 symbol columns I used
=IF(OR(AND([Category Trained]@row = "Green", [Trained w/i Last Year]@row = "Green"), AND([Category Trained]@row = "Blue", [Trained w/i Last Year]@row = "Yellow")), "Yes", "No")
-
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 66.9K Get Help
- 441 Global Discussions
- 153 Industry Talk
- 501 Announcements
- 5.4K Ideas & Feature Requests
- 85 Brandfolder
- 155 Just for fun
- 79 Community Job Board
- 511 Show & Tell
- 34 Member Spotlight
- 2 SmartStories
- 308 Events
- 37 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!