=YEARFRAC(start_date, end_date, [basis])
=YEARFRAC("1-Jan-2018","1-Jan-2019")
The YEARFRAC function can be used to calculate the number of years between two dates and, will return 1, which represents one full year.
=YEARFRAC(DATE(YEAR(TODAY()),1,1),TODAY())
The YEARFRAC function can also be used to calculate the number of years between a current date and the beginning of the year. For example, this formula returns the number of years between the beginning of the current year and the current date.
=YEARFRAC(A1,B1)
The YEARFRAC function can also be used to calculate the number of years between two arbitrary dates, and returns a decimal number representing the number of years between two dates stored in cells A1 and B1. The returned number can also be formatted as a percentage.
The YEARFRAC function is used to calculate the fraction of a year represented by a period of time. It can calculate the proportion of a year's benefits or obligations during a specified period.