YEARFRAC

Scripting Formulas Time & Date

TIME.YEARFRAC

TIME.YEARFRAC(start_date, end_date, day_count_convention = 0)

Returns the number of years, including fractional years, between two dates using a specified day count convention.

While day_count_convention defaults to 0, if you're using this function for non-financial calculations you'll likely want to use the convention 1 for actual counts.

  • start_date: The start date of the calculation.
  • end_date: The end date of the calculation.
  • day_count_convention: The day count method which should be used.
    • Method 0 (US (NASD) 30/360) — Calculate based on 30-day months and 360-day years.
    • Method 1 (Actual/Actual) — Calculate based on actual time passed.
    • Method 2 (Actual/360) — Calculate based on actual days between specified dates, but assume a 360-day year.
    • Method 3 (Actual/365) — Calculate based on actual days between specified dates, but assume a 365-day year.
    • Method 4 (European 30/360) — Calculate based on 30-day months and 360-day years, and adjust end-of-month according to European conventions.