YEARFRAC
Number of years between dates

Description

Returns the difference in years between the given two datetimes. Fractional year differences are represented as a decimal number.
Optionally, you can change the convention for how the number of days in a year is counted.

Function signature

1
YEARFRAC(datestart: String, dateend: String, basis: String = us_nasd) => Number
Copied!
Parameter
Description
Date start
The start date to consider in the calculation. Must be a reference to a cell containing a date, a function returning a date type, or a number.
Date end
The end date to consider in the calculation. Must be a reference to a cell containing a date, a function returning a date type, or a number.
Basis
Method to use for counting days per month/year:
  • `us_nasd` (default): 30-day month, 360-day year, i.e. US (NASD).
  • `actual`: Actual number of days per month/year.
  • `actual_360`: 360 day year, actual number of days per month.
  • `actual_365`: 365 day year, actual number of days per month. This means leap years are not taken into account.
  • `european`: Like `us_nasd`, but for months that are not 30 days long, European standards are used.

Examples

Formula
Return value
YEARFRAC("2010-01-22T13:06:15+03:00", "2000-01-01T13:06:15+03:00")
10.05833333
YEARFRAC("2013-01-23T13:06:15+03:00", "2004-02-03T13:06:15+03:00", "actual_360")
9.10277778
YEARFRAC("2016-01-25T13:06:15+03:00", "2008-03-07T13:06:15+03:00", "actual_365")
7.89041096
YEARFRAC("2019-01-26T13:06:15+03:00", "2012-04-09T13:06:15+03:00", "european")
6.79722222
Last modified 1yr ago
Export as PDF
Copy link