The YEARFRAC function in Excel returns a decimal value that represents fractional years between two specified dates.
Syntax:
=YEARFRAC(start_date, end_date, [basis])
Arguments:
- start_date – The start date.
- end_date – The end date.
- basis – [optional] The type of day count basis to use (see image below).
YEARFRAC Function Example
As mentioned above, Excel calculates a decimal number that represents the fraction of a year between two dates. Excel also uses whole days when calculating the fractional data. Let’s look at the example below. Pay attention to how the optional argument changes the result.