Nov 05 2018 01:36 PM
Hi guys,
I have two fields on my Sharepoint list. One of them is called 'From Date' and another one called 'To Date'. How do I create a formula that validates if To Date is greater than From Date?
I have tried this formula =[From Date]<[To Date] but it didn't work.
I would be glad if someone could help me with this! Thanks!
Nov 06 2018 01:07 AM
Hi @Rafael Benicio if you're looking at doing something with a calculated column then you could use a formula like this:
IF([End Date]>[Start Date],"Date Greater Than","Date Less Than")
You could apply column formatting to this column to then show a visible difference between the TRUE and FALSE values.
If you're looking to do column level validation, then unfortunately you can't compare two columns.
Nov 06 2018 07:04 AM
Hi @Matt Weston,
Thank you for your reply. Unfortunately, The formula below didn't work.
IF([To Date]>[From Date],"Date Greater Than","Date Less Than")
Here is the error message:
Nov 06 2018 10:13 AM
@Matt Weston Never mind, I put the formula in the validation settings under list settings and it worked.
Thank you so much! Cheers!
Nov 06 2018 01:52 PM - edited Nov 06 2018 03:31 PM
SolutionHey @Matt Weston,
I thought it was working but it's not! Just noticed, the validation is not working properly.
The formula that works is this one =[To Date]>=[From Date].
Nov 07 2018 12:07 AM
Hi @Rafael Benicio, yes that is how the formula would be for list validation. Apologies, the original formula I gave you was for a calculated column.
May 27 2020 01:52 AM
Hi @Matt Weston
I am getting an error message for the same formula (different column names)
=[End Date of Action]>=[Start Date of Action]
Error:
Sorry, something went wrong
The formula cannot refer to another column. Check the formula for spelling mistakes or update the formula to reference only this column.
Do you have a suggestion as to what the solution is?
Many thanks!
May 27 2020 02:14 AM