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.
Syntax
| Argument | Description | |
|---|---|---|
start_date | Required | Start date. |
end_date | Required | End date. |
basis | Optional | Day-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):
For age in whole years, DATEDIF with "Y" is often clearer.
Try it: interactive demo
Adjust the input and watch the formula and result update.
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
Frequently asked questions
Why is YEARFRAC slightly off for real dates?
YEARFRAC or DATEDIF for age?
What are the bases for?
Can the result exceed 1?
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