Date Column Validation - Check if Date is less than 10 days from Today
Question
I have created a column named Departure Schedule and its type is `Date and Time.
However, I need to check that the Departure Schedule should not be less than 10 days from Today()
.
Is it possible to code under SharePoint's Column Validation to check if the Departure Schedule entry is not less than 10 days from Today()
, and if it is, a message will be shown "Departure Schedule should be more than 10 days from the date of request"?
I have tried entering this code (from this topic) under Column Validation
=[Departure Schedule] < DATE(YEAR(Today()),MONTH(Today()),DAY(Today())+10)
There were no Syntax error, but also there were no messages shown even if I entered a date that is less than 10 days from Today()
.
Example:
Date today is 9/25/2020 - No validation messages shown after entry
I'm new to SharePoint's Column Validation - any help would be highly appreciated.
Solution
Try using below formulas and check which one works best for your requirements:
=IF([Departure Schedule] < DATE(YEAR(Today()),MONTH(Today()),DAY(Today())+10), FALSE, TRUE)
OR
=IF([Departure Schedule] < (Today()+10), FALSE, TRUE)
OR
=[Departure Schedule] >= (Today()+10)
OTHER TIPS
As you are not considering things like working days and weekends, the simplest formula =([Departure Schdule]>=(TODAY()+10))
shall be enough for your list.