SOLVED

Sharepoint calculated column if date greater than another column

Brass Contributor

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!

7 Replies

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.

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:

 

Screen Shot 2018-11-06 at 8.03.32 AM.png

@Matt Weston Never mind, I put the formula in the validation settings under list settings and it worked. 

 

Thank you so much! Cheers! 

best response confirmed by Rafael Benicio (Brass Contributor)
Solution

Hey @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]. 

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.

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!

1 best response

Accepted Solutions
best response confirmed by Rafael Benicio (Brass Contributor)
Solution

Hey @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]. 

View solution in original post