YEARFRAC Function

YEARFRAC Function

YEARFRAC Function

Returns the fraction of a year between two dates using a selectable day-count basis.

ExcelClash Team
PUBLISHED

Summary

The Excel YEARFRAC function returns the fraction of a year between two dates. Instead of giving you only a day count or a whole number of years, it gives you a decimal such as 0.5, 1.25, or 10.8.

YEARFRAC is especially useful for interest calculations, prorated payments, lease and contract timing, and age or tenure formulas where partial years matter. The optional basis argument lets you choose how the year fraction should be measured.

Purpose

Return part of a year as a decimal

Converts the time between two dates into a fractional year using a selected day-count method.

Return Value

A decimal number

Returns a value such as 0.25, 0.75, or 3.5 depending on the dates and basis used.

Syntax

=YEARFRAC(start_date, end_date, [basis])

start_date and end_date are required. The optional basis argument tells Excel which day-count convention to use. For best reliability, Microsoft recommends entering dates with DATE(...) or using valid Excel date values rather than ambiguous text dates.

Arguments

  • start_date - The first date in the period.
  • end_date - The ending date in the period.
  • basis - [optional] The day-count basis: 0 = US (NASD) 30/360, 1 = Actual/Actual, 2 = Actual/360, 3 = Actual/365, 4 = European 30/360.

YEARFRAC vs Other Date Methods

These tools all work with date gaps, but they answer different questions.

Method What It Returns Best For Example Use
YEARFRAC Fractional years Proration and accruals Interest, rent, service length, bonus allocation
DATEDIF(...,"Y") Whole years only Completed years Age thresholds, years of service
Date subtraction Total days Raw day counts Number of days between two dates
YEAR Calendar year number Extracting the year part Grouping dates by year

If you need a decimal portion of a year, YEARFRAC is the right tool. If you only need the number of days, simple subtraction is usually clearer. If you need completed whole years, DATEDIF is often a better fit.

Using YEARFRAC

The key decision in YEARFRAC is the basis. In some models, the exact rule matters because different industries count time differently. Basis 1 uses actual days and is often the easiest choice when you want a real calendar-based fraction. Basis 0 and 4 use 30/360 methods, which are common in finance because they standardize months and years.

Basis 2 and 3 are also useful when a model needs a fixed denominator of 360 or 365 days. This means the same date range can return slightly different results depending on the basis you choose.

One important Microsoft note: YEARFRAC can return an incorrect result with basis 0 when the start_date is the last day of February. If you are working with strict financial conventions, that detail is worth checking in your model.

Example 1 - Basic Actual/Actual Fraction

Use YEARFRAC with basis 1 when you want the fraction based on the actual calendar days in the period.

=YEARFRAC("2026-01-01", "2026-06-30", 1)

This returns a value just under 0.5, because the period is slightly less than half of a non-leap year. It is a good example of normal calendar-based behavior.

Check Answer
Challenge #1
Target: Sheet1!F1
Actual/Actual Fraction

In cell F1, calculate the year fraction between B1 and B2 using basis 1 (Actual/Actual).

Example 2 - Calculate Decimal Age or Tenure

YEARFRAC is useful when you need elapsed time in years with decimals, not just whole years.

=YEARFRAC("1995-10-15", TODAY(), 1)

This can be used for decimal age, length of service, or time since a contract start date. It is especially helpful when a report or calculation depends on partial years.

Check Answer
Challenge #2
Target: Sheet1!F2
Decimal Age

In cell F2, calculate the decimal age from B3 to today with YEARFRAC.

Example 3 - Compare Basis Results

The same date range can produce a different answer depending on the basis. That is why the third argument matters.

=YEARFRAC("2026-01-01", "2026-06-30", 1)   // Actual/Actual
=YEARFRAC("2026-01-01", "2026-06-30", 0)   // US 30/360

For this period, the Actual/Actual result is slightly below half a year, while the 30/360 result is exactly 0.5. This is a practical way to show how convention changes the output.

Check Answer
Challenge #3
Target: Sheet1!F3
30/360 Basis

In cell F3, calculate the same B1:B2 period using basis 0 (US 30/360).

Example 4 - Prorate an Annual Amount

Once you have a year fraction, you can multiply it by an annual amount to calculate the prorated share.

=YEARFRAC(A1, B1, 1) * 5000

This pattern is common for prorated salary, rent, interest, subscription value, or contract charges. YEARFRAC gives you the time portion, and multiplication converts that into money.

Check Answer
Challenge #4
Target: Sheet1!F4
Prorated Amount

In cell F4, multiply the Actual/Actual year fraction for B1:B2 by 5000.

Conclusion Recap

  • Summary: YEARFRAC returns the fraction of a year between two dates.
  • Core strength: It handles partial years directly, which makes it useful for prorated calculations.
  • Basis control: Different basis values can change the result, so choose the one that matches your model.
  • Common use cases: Interest, rent, bonus accruals, age, tenure, and contract timing.
  • Important caution: Basis 0 can be problematic when the start date is the last day of February.
  • Best practice: Use valid Excel dates or DATE(...) for reliable results.
Tactical Arena
Select Scenario:
Share YEARFRAC Function!

Tell your friends about this post

Discussion

ExcelClash is an interactive platform designed to level up your Excel skills through real-world exercises and challenges. Sharpen your logic, solve real spreadsheet problems, and learn faster.

© 2026 ExcelClash, Inc. All rights reserved.