YEARFRAC Function
The YEARFRAC function is one of the date and time functions. It is used to return the fraction of a year represented by the number of whole days from start-date to end-date calculated on the specified basis.
The YEARFRAC function syntax is:
YEARFRAC(start-date, end-date [,basis])
where
start-date is a number representing the first date of the period, entered using the Date function or other date and time function.
end-date is a number representing the last date of the period, entered using the Date function or other date and time function.
basis is the day count basis to use, a numeric value greater than or equal to 0, but less than or equal to 4. It can be one of the following:
Numeric value | Count basis |
0 | US (NASD) 30/360 |
1 | Actual/actual |
2 | Actual/360 |
3 | Actual/365 |
4 | European 30/360 |
Note: if the start-date, end-date or basis is a decimal value, the function will ignore the numbers to the right of the decimal point.
To apply the YEARFRAC function,
- select the cell where you wish to display the result,
- click the Insert Function icon situated at the top toolbar,
or right-click within a selected cell and select the Insert Function option from the menu,
or click the icon situated at the formula bar, - select the Date and time function group from the list,
- click the YEARFRAC function,
- enter the required arguments separating them by commas,
- press the Enter button.
The result will be displayed in the selected cell.