Date & Time

YEARFRAC Formula

YEARFRAC returns the fraction of a year between two dates, taking into account different day-count conventions. It is primarily used in financial calculations for bond pricing, interest accrual, and prorating annual amounts across partial periods.

Syntax

YEARFRAC(start_date, end_date, [basis])
ParameterDescription
start_date Parameter of the YEARFRAC function.
end_date Parameter of the YEARFRAC function.
[basis] (Optional.) Parameter of the YEARFRAC function.
Try YEARFRAC in Viztab — free, no signup

Examples

Fraction of year

Formula
=YEARFRAC("2026-01-01", "2026-07-01")
Returns 0.5 — exactly half a year between January 1 and July 1 using the default US (NASD) 30/360 basis.

Prorate annual salary

Formula
=75000 * YEARFRAC("2026-03-15", "2026-12-31")
Calculates the prorated portion of a $75,000 annual salary from March 15 through year end. Returns approximately $59,375.

Actual/actual basis

Formula
=YEARFRAC("2026-01-01", "2026-07-01", 1)
Returns 0.4959... using actual/actual day count (basis 1), which accounts for the actual number of days and whether it's a leap year.

Common Errors

#VALUE!

Occurs when dates are invalid or the basis argument is not 0-4.

#NUM!

Occurs when the basis argument is outside the range 0-4 or dates are out of valid range.

Tips

Basis options

0=US 30/360 (default), 1=Actual/actual, 2=Actual/360, 3=Actual/365, 4=European 30/360. Finance professionals know which their instrument requires.

Prorating amounts

Multiply any annual figure by YEARFRAC to get the partial-year amount: annual_rent * YEARFRAC(move_in, move_out) = prorated rent.

Age in years with decimals

=YEARFRAC(birth_date, TODAY()) returns age as a decimal. More precise than DATEDIF for partial-year age calculations.

Try YEARFRAC in Viztab

Import your data and use YEARFRAC with 370+ other formulas. No signup required.

Open Viztab

Related Formulas