I am trying to calculate elapsed years using the DateDiff function on Mac OS X with Office X. It is just looking at the year part of the date, not the whole date, to do its calculations.

Here is my code:


Private Function health_insurance_function(constants_array As Variant, grant_start_date As Date, grant_year_count As Integer) As Currency

Dim insurance_start_date As Date
insurance_start_date = constants_array.Cells(22, 2)

Dim elapsed_insurance_years As Integer

elapsed_insurance_years = Abs(DateDiff("yyyy", grant_start_date, insurance_start_date))


This gives the following results:
6/1/05 --> 12/31/05 results in 0 years. Correct
6/1/05 --> 1/1/06 results in 1 year. Incorrect
6/1/05 --> 5/31/06 results in 1 year. Incorrect
6/1/05 --> 6/1/06 results in 1 year. Correct
6/1/05 --> 12/31/06 results in 1 year. Correct
6/1/05 --> 1/1/07 results in 2 years. Incorrect

Am I missing something?

Thanks in advance,
Mike