Features of !SEMTools

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.

Syntax

=YEARFRAC(start_date, end_date, [basis])
  • 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

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

  • If the start date is later than the end date, the result will be negative
  • When working with financial models, it’s important to specify the basis explicitly to avoid ambiguity

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 WEEKNUM.ISO, 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.

This post is also available in RU.