=DATEDIF(start_date,end_date,unit)
=DATEDIF(B5,C5,"y")
Using the DATEDIF function, you can calculate the difference between two dates. For example, this formula returns 2, if the B column has the date January 1, 2016 and the C column has the date March 1, 2018. This means that there are 2 years between the two dates.
=DATEDIF(B6,C6,"m")
The DATEDIF function can also be used to calculate the difference between two dates in months. For example, the preceding formula returns 26, if the B column has the date January 1, 2016 and the C column has the date March 1, 2018. This means that there are 26 months between the two dates.
=DATEDIF(B7,C7,"d")
In addition to years and months, the DATEDIF function can also be used to calculate the difference between two dates in days. For example, the formula above returns 790, if the B column has the date January 1, 2016 and the C column has the date March 1, 2018. This means that there are 790 days between the two dates.
The DATEDIF function calculates the number of days, months, or years between two dates, but can produce incorrect results under certain circumstances, such as when calculating the remaining days after the last completed month.