Description
YearFrac returns the fraction of a year spanned by the interval of time between the two dates.
Overloads
YearFrac (startDate, endDate)
YearFrac (startDate, endDate, basis)
Arguments
startDate is a Date or DateTime for the start of an interval of time.
endDate is a Date or DateTime for the end of an interval of time.
basis is an optional number specifying the day basis system to use. The following types are supported:
0 - American 30/360 (default)
Action
YearFrac returns the fraction of a year spanned by the interval of time between the two dates.
Examples
YearFrac(DateValue(2000,1,1),DateValue(2000,4,1))
Returns 0.25 since three months between the start of January and the start of April.
Suppose a retroactive pay increase needs to be calculated for all employees, from their first day of work to January 1, 2000. If the database table contains a field called 'StartDate', containing the date the employee started work, then the following formula can be used to determine how many years and partial years each employee is eligible for.
yearFrac({StartDate},DateValue(2000,1,1));
Comments
This function is similar to the Excel function of the same name.