SOLVED

# Sharepoint calculated column if date greater than another column

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

# Re: Sharepoint calculated column if date greater than another column

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.

# Re: Sharepoint calculated column if date greater than another column

Hi @Matt Weston

IF([To Date]>[From Date],"Date Greater Than","Date Less Than")

Here is the error message: # Re: Sharepoint calculated column if date greater than another column

@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 (Contributor)
Solution

# Re: Sharepoint calculated column if date greater than another column

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

# Re: Sharepoint calculated column if date greater than another column

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.

# Re: Sharepoint calculated column if date greater than another column

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!

# Re: Sharepoint calculated column if date greater than another column

Fixed my error - this has to be a list validation, not a column validation!
https://social.msdn.microsoft.com/Forums/sharepoint/en-US/4e4659a7-fced-47e3-8005-2943d390099e/share...