I'm trying to get the difference of two date fields in terms of years. SP keeps giving syntax error. Any pointers where I'm wrong?
=DATE(YEAR([Awarded Project End Date])-YEAR([Awarded Project Start Date]))
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.
Sign up to join this communityIf you are returning a date then you need to pass a YEAR, MONTH and DAY. Right now you are subtracting two years and trying to return the result as a date which is not valid. Try something like this:
=YEAR([Awarded Project End Date])-YEAR([Awarded Project Start Date])
Year() returns an integer and you cannot convert that into a DATE(). Try this instead :
=DATEDIF([Awarded Project End Date], [Awarded Project Start Date],"y")
There is more info available on MSDN.