Skip to content

YEARFRAC

YEARFRAC returns the decimal number of years between a start and end date, computed according to one of five day-count conventions used in finance (0=US 30/360, 1=actual/actual, 2=actual/360, 3=actual/365, 4=European 30/360). Use it for accrued interest calculations, prorating annual fees, or financial modelling.

Excel
=YEARFRAC(DATE(2024,1,1),DATE(2024,7,1),1)
Google Sheets
=YEARFRAC(DATE(2024,1,1),DATE(2024,7,1),1)

Verified example

Computed by a real spreadsheet engine on the sample data below.

StartDateEndDateBasisYearFrac
2024-01-012024-07-011
2024-03-012024-09-010
2024-06-152024-12-153
2023-11-012024-05-011

=YEARFRAC(DATE(2024,1,1),DATE(2024,7,1),1)0.4972677596

Try it with your data

Edit the grid or formula, then run it through a real spreadsheet engine — no signup.

Sample data — click any cell to edit

Runs server-side · free · no signup

How it works

  1. 1Put your start date in A2 and end date in B2.
  2. 2Decide on a day-count basis: 0 for US 30/360, 1 for actual/actual, 3 for actual/365.
  3. 3In C2 type =YEARFRAC(A2,B2,1) and multiply the result by an annual rate to get a prorated amount.

Need a version for your data?

Try: “Calculate what fraction of the year a bond was held between its purchase and sale dates

Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.

Last reviewed: