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.


Frequently Asked Questions

What is the DATEDIF function?
The DATEDIF function is a Sourcetable function that calculates the number of days, months, or years between two dates.
Are there any issues with using the DATEDIF function?
Yes, the "MD" argument may result in a negative number, a zero, or an inaccurate result, and when using the "YD" argument the DATEDIF function ignores the years.
What can the DATEDIF function be used for?
The DATEDIF function is useful for formulas that need to calculate an age.
Is the DATEDIF function compatible with older Lotus 1-2-3 workbooks?
Yes, the DATEDIF function is compatible with older Lotus 1-2-3 workbooks.

Make Better Decisions
With Data

Analyze data, automate reports and create live dashboards
for all your business applications, without code. Get unlimited access free for 14 days.