YEARFRAC Function in Excel: Fraction of a Year Between Dates

YEARFRAC Function in Excel: Fraction of a Year Between Dates featured illustration

πŸ“Ž This article includes 1 downloadable practice file ↓

⏱ 2 min readUpdated 28 September 2026

Date & TimeLevel: IntermediateAvailable in: Excel 2007+

In this article
  1. Syntax
  2. Examples
  3. Example 1
  4. Example 2
  5. YEARFRAC in practice
  6. Where you will use it
  7. Worked example
  8. Mistakes people make
  9. Related functions
  10. Continue learning

YEARFRAC returns the fraction of a year between two dates β€” for pro-rata interest, depreciation and exact age.

Advertisement

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

StartEndFormulaResult
01-Apr-202601-Oct-2026=ROUND(YEARFRAC(A2,B2,1),3)0.501
15-Aug-199004-Oct-2026=ROUND(YEARFRAC(A3,B3,1),3)36.138
01-Jan-202631-Dec-2026=ROUND(YEARFRAC(A4,B4,1),3)0.997

Results calculated in Excel.

Mistakes people make

MistakeWhat to do instead
Basis choiceBasis 1 uses actual days; default 0 is 30/360
Exact completed yearsUse DATEDIF with "y"

DATEDIF Β· DAYS

πŸ“š Part of the free Excel course: Beginner β†’ Expert Β· Try it in the Formula Lab or ask the AI Helper.

⚑ Interactive Practice Lab & Formula Tester:

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.

✨ Ask AI about this article

Stuck on a step? Ask a question and the AI answers using this article.

Free Β· AI can be wrong