Sunday, 18 September 2011

Calculating the number of years between two dates

Calculating the number of years between two dates

The following formula calculates the number of years between two dates. This formula assumes
that cells A1 and B1 both contain dates:

  =YEAR(A1)-YEAR(B1)

This formula uses the YEAR function to extract the year from each date and then subtracts one
year from the other. If cell B1 contains a more recent date than the date in cell A1, then the result
is negative.
You can also use the YEARFRAC function to calculate the number of years between two dates.
This function returns the number of years, including partial years. For example

  =YEARFRAC(A1,B1,1)

Because the YEARFRAC function is often used for financial applications, it uses an optional third
argument that represents the “basis” for the year (for example, a 360-day year). A third argu-
ment of 1 indicates an actual year.

No comments:

Post a Comment