# DATEDIF

Formulas / DATEDIF
Calculate the number of days, months, or years between two dates.
`DATEDIF(start_date,end_date,unit)`
• start_date - required, date representing the starting date of the period
• end_date - required, date representing the ending date of the period
• unit - required, type of information that returns

## Examples

• `=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.

## Summary

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.

• The DATEDIF function is a "compatibility" function from Lotus 1-2-3 that is only documented in Excel 2000, but works in Sourcetable.
• The DATEDIF function does not help users with arguments, but it will work when configured correctly.