
π This article includes 1 downloadable practice file β
In this article
YEARFRAC returns the fraction of a year between two dates β for pro-rata interest, depreciation and exact age.
Syntax
=YEARFRAC(start_date, end_date, [basis])
| Argument | What it means |
|---|---|
basis |
0 US 30/360 (default), 1 actual/actual, 3 actual/365. |
Examples
Example 1
=YEARFRAC(A2, B2, 1)
Exact fraction of a year.
Example 2
=C2*D2*YEARFRAC(A2, B2, 3)
Simple interest for a partial year on an actual/365 basis.
YEARFRAC in practice
Where you will use it
- Age in decimal years
- Interest for part of a year
- Service years for gratuity
Worked example
| Start | End | Formula | Result |
|---|---|---|---|
| 01-Apr-2026 | 01-Oct-2026 | =ROUND(YEARFRAC(A2,B2,1),3) | 0.501 |
| 15-Aug-1990 | 04-Oct-2026 | =ROUND(YEARFRAC(A3,B3,1),3) | 36.138 |
| 01-Jan-2026 | 31-Dec-2026 | =ROUND(YEARFRAC(A4,B4,1),3) | 0.997 |
Results calculated in Excel.
Mistakes people make
| Mistake | What to do instead |
|---|---|
| Basis choice | Basis 1 uses actual days; default 0 is 30/360 |
| Exact completed years | Use DATEDIF with "y" |
Related functions
DATEDIF Β· DAYS
π Part of the free Excel course: Beginner β Expert Β· Try it in the Formula Lab or ask the AI Helper.
Test formulas dynamically in our web formula laboratory or download the companion Excel workbook.
π Practice files for this article
- πPractice workbook: Dates & times22 tasks on realistic sales data β type your formula, the Check column turns green when it is right. Answers sheet included.β¬ XLSX Β· 34 KB
Free to use for learning. Files with macros (.bas) are plain text β import them with Alt+F11 β File β Import File, and always test on a copy.
Atul (AJ) builds office-automation and local-first AI tools as Atulya AI, and works with Excel, SAP and Oracle EPM every day. He writes about the shortcuts, macros and automations that actually save time β plus the occasional wacky fact. Videos on YouTube: Lazy Automator AI (@LazyAutomatorAI).
More posts by Atul βBuild this skill next
This page is a quick function reference. Use it for syntax, then practise the function in a broader workflow.
Stuck on a step? Ask a question and the AI answers using this article.