YEARFRAC Function

Excel Functions › Date & Time

All versions Date & Time

The Excel YEARFRAC function returns the fraction of a year between two dates — for interest accrual, prorated fees, and precise ages — using your choice of day-count convention.


Quick answer: exact age in whole years:
=INT(YEARFRAC(A2, TODAY(), 1)) // basis 1 = actual/actual

Syntax

=YEARFRAC(start_date, end_date, [basis])
ArgumentDescription
start_dateRequiredStart date.
end_dateRequiredEnd date.
basisOptionalDay-count: 0 = US 30/360 (default), 1 = actual/actual, 2 = actual/360, 3 = actual/365, 4 = European 30/360.

How to use it

The big gotcha: the default basis is 0 (US 30/360), an accounting convention that assumes 30-day months — not real calendar days. For accurate elapsed time use basis 1 (actual/actual):

=YEARFRAC(A2, B2, 1) // true calendar fraction

For age in whole years, DATEDIF with "Y" is often clearer.

Try it: interactive demo

Live demo

Adjust the input and watch the formula and result update.

Result:

Tips & gotchas

Fraction of a year between two dates - interest accrual, prorating, precise age. Format result cells as Date or Time so they don’t display raw serial numbers.

Practice workbook

📊
Download the free YEARFRAC practice workbook
Every example on this page, ready to open in Excel — plus practice challenges with answers on a separate tab. No sign-up required.

Frequently asked questions

Why is YEARFRAC slightly off for real dates?
The default basis (0) uses 30/360 accounting math. Switch to basis 1 (actual/actual) for true calendar fractions.
YEARFRAC or DATEDIF for age?
DATEDIF(birth,TODAY(),"Y") gives whole years directly. INT(YEARFRAC(birth,TODAY(),1)) also works; use whichever reads clearer.
What are the bases for?
Different finance conventions: 30/360 (US and EU), actual/actual, actual/360, actual/365. Bonds and loans specify which to use.
Can the result exceed 1?
Yes — spans over a year return values greater than 1.0.

Master functions like this in one day

This page covers one function. Our Excel Formulas and Functions class covers the 30 that matter most — live, hands-on, taught by professionals in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.

See the Formulas & Functions Class

Related functions: DATE · TODAY · DATEDIF · EOMONTH · TEXT