Yearfrac
  • 18 May 2022
  • 1 Minute to read
  • Dark
    Light
  • PDF

Yearfrac

  • Dark
    Light
  • PDF

Article Summary

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

YEARFRAC(datestart: String, dateend: String, basis: String = us_nasd) => Number
ParameterDescription
Date startThe 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 endThe 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

FormulaReturn 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

Was this article helpful?

What's Next