1

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

2 Answers 2

1

If 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])
1
  • This worked. I needed this to define number of fields to be shown using jquery
    – SP_Days
    May 23, 2012 at 4:04
1

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.

1
  • I used this formula before, I was passing the answer as a number. Good to know. Thanks!
    – SP_Days
    May 23, 2012 at 4:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.