Features of !SEMTools
↑ Navigate Excel tasks and !SEMTools add-in features ↑

YEARFRAC

YEARFRAC function in Excel - year fraction calculation examples
Function categoryDate and time functions
VolatilityNon-volatile

What does YEARFRAC do?

The YEARFRAC function in Excel returns the fraction of a year between two dates. This is especially useful in financial calculations where you need to account for how much time has passed between two events as a portion of a year: for example, when calculating interest, depreciation, or return rates.

Unlike simply counting days between dates, YEARFRAC allows you to accurately account for how days in a year are calculated — using actual days, a 360-day year, or other methods.

YEARFRAC function syntax

=YEARFRAC(start_date, end_date, [basis])
One period, five bases: 01/01/2024 – 07/01/2024
C2=YEARFRAC(DATE(2024,1,1),DATE(2024,7,1),A2)
ABC
1BasisMethodYEARFRAC
20US 30/360 (default)0.5=YEARFRAC(DATE(2024,1,1),DATE(2024,7,1),A2)
31Actual / actual0.4972678=YEARFRAC(DATE(2024,1,1),DATE(2024,7,1),A3)
42Actual / 3600.5055556=YEARFRAC(DATE(2024,1,1),DATE(2024,7,1),A4)
53Actual / 3650.4986301=YEARFRAC(DATE(2024,1,1),DATE(2024,7,1),A5)
64European 30/3600.5=YEARFRAC(DATE(2024,1,1),DATE(2024,7,1),A6)

The period has 182 actual days. 30/360 counts it as 6 × 30 = 180 days of 360 → exactly 0.5. Actual/actual divides by 366 (2024 is a leap year), Actual/360 by 360, Actual/365 by 365.

  • start_date — period start date
  • end_date — period end date
  • [basis] — (optional) method for calculating days in a year. Can take values from 0 to 4:
BasisDescription
0US (NASD) 30/360
1Actual days / actual year
2Actual days / 360
3Actual days / 365
4European 30/360

YEARFRAC formula examples

  • =YEARFRAC("01/01/2024", "07/01/2024") — returns 0.5 if using default basis
  • =YEARFRAC("01/01/2024", "07/01/2024", 3) — returns 0.4986, since the year is considered 365 days

Good to know

  • The order of the dates doesn’t matter: if the start date is later than the end date, YEARFRAC swaps them and still returns a positive number
  • When working with financial models, it's important to specify the basis explicitly to avoid ambiguity
Age, length of service, interest
C2=YEARFRAC(A2,B2)
ABCDE
1StartEndYears (fraction)Full yearsInterest on $10,000 at 6%
201/15/202410/22/20262.7694444=YEARFRAC(A2,B2)2=INT(YEARFRAC(A2,B2))1661.67=10000*6%*C2
310/22/202601/15/20242.7694444=YEARFRAC(A3,B3)2=INT(YEARFRAC(A3,B3))1661.67=10000*6%*C3
403/01/202609/01/20260.5=YEARFRAC(A4,B4)0=INT(YEARFRAC(A4,B4))300.00=10000*6%*C4

Rows 2 and 3 are the same dates in reverse order — the result is the same positive number. INT gives full years (like DATEDIF with "Y"); multiplying the annual rate by the fraction gives the interest for the part of a year.

Applications

  • Calculating interest on loans and credits when the rate is specified in annual percentage
  • Determining the portion of depreciation for an asset used for less than a full year
  • Financial modeling in investment projects

Other Date and Time functions in Excel

TIMEVALUE, TIME, YEAR, DATE, DATEVALUE, EDATE, DAY, WEEKDAY, EOMONTH, MONTH, MINUTE, WEEKNUM and ISOWEEKNUM, WORKDAY, DATEDIF, TODAY, SECOND, NOW, HOUR, NETWORKDAYS

Like the article? Help its author! Buy !SEMTools, it has lots of useful instruments to process text data.