YEARFRAC function
Returns the fraction of a year between two dates, using one of five day-count conventions (30/360, actual/actual, actual/360…).
Available in Excel 2007 and later (earlier versions needed the Analysis ToolPak add-in), Excel for the web
Excel 2007 and laterWorks in Google Sheets
Syntax
YEARFRAC(start_date, end_date, [basis])| Argument | What it means | |
|---|---|---|
start_date | Required | The first date. |
end_date | Required | The second date. The order does not matter; the result is always positive. |
basis | Optional | Day-count basis: 0 or omitted = US 30/360, 1 = actual/actual, 2 = actual/360, 3 = actual/365, 4 = European 30/360. |
Returns: A decimal number of years, e.g. 0.75 for nine months.
How YEARFRAC works
YEARFRAC turns the gap between two dates into a decimal number of years. That is what you need to pro-rate an annual amount — a bonus for someone who joined in April, interest for part of a year, or depreciation in the first year of an asset. It is also a precise way to show ages or tenure with decimals.
The basis argument decides how days are counted. Basis 0 (the default) and 4 assume 30-day months and a 360-day year, so whole months give tidy fractions. Basis 1 uses real calendar days and the real length of the year (365 or 366). Basis 2 and 3 count real days but divide by a fixed 360 or 365. Pick the basis your contract or policy specifies — results can differ in the third decimal place, which matters on large amounts.
Examples
1Pro-rate an annual bonus for a mid-year start
| A | B | C | |
|---|---|---|---|
| 1 | Start | Year end | Fraction |
| 2 | 2026-04-01 | 2026-12-31 | 0.75 |
Result: 0.75
Basis 0 counts 1 Apr to 31 Dec as 9 × 30 = 270 days of a 360-day year: 0.75. A €6,000 bonus would be pro-rated to €4,500.
2Exact age with decimals
| A | B | C | |
|---|---|---|---|
| 1 | Birth date | Today | Age |
| 2 | 1990-05-20 | 2026-12-02 | 36.54 |
Result: 36.54
Basis 1 uses actual days and actual year lengths, giving about 36.54 years (cell formatted with 2 decimals). INT of this value gives the age in whole years, 36.
3Interest for part of a year (actual/365)
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Principal | Rate | From | To | Interest |
| 2 | 10000 | 5.00% | 2026-02-10 | 2026-11-20 | 387.67 |
Result: 387.67
There are 283 days between the dates; 283/365 = 0.7753. Interest = 10,000 × 5% × 0.7753 = 387.67 (2 decimals).
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
#NUM! | basis is below 0 or above 4. | Use 0–4. |
#VALUE! | A date argument is not a valid date. | Use date cells or DATE. |
Tips
- Basis 0 can give surprising results around the end of February; use basis 1 for exact elapsed time.
- For whole years of age or service use DATEDIF with "Y" — YEARFRAC with INT gives the same answer in most but not all leap-year edge cases.
- The bond functions (ACCRINT, PRICE, YIELD) use the same five bases.
Google Sheets
YEARFRAC also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.
YEARFRAC in other languages
In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.
| Language | Function name |
|---|---|
| Danish | ÅR.BRØK |
| Dutch | JAAR.DEEL |
| Finnish | VUOSI.OSA |
| French | FRACTION.ANNEE |
| German | BRTEILJAHRE |
| Hungarian | TÖRTÉV |
| Italian | FRAZIONE.ANNO |
| Norwegian (Bokmål) | ÅRDEL |
| Polish | CZĘŚĆ.ROKU |
| Portuguese (Brazil) | FRAÇÃOANO |
| Portuguese (Portugal) | FRAÇÃOANO |
| Russian | ДОЛЯГОДА |
| Spanish | FRAC.AÑO |
| Swedish | ÅRDEL |
| Turkish | YILORAN |