Quantunet.com

My Account

Joins Us
Excel QuickSkills
The DATEDIF() Function Knowledgebase  

 

The DATEDIF function returns difference between two dates.

  • The syntax for the function is DATEDIF(date_1, date_2 ,interval).

The "date_1" must be a string or a recognizable date format in Excel. "interval" is the interval code that determins the the calendar time interval of the resulting difference, "y" for years, "m" months, "d" days, "ym" months in the same year, "yd" days in the same year ,"md" days in the same month.

For example: DATEDIF("10/19/1980", "6/2/2007", y) = 26 as there are a total of 26 years difference between the two dates or DATEDIF("10/19/1980", "6/2/2007", "ym") = 7 as there are 7 months difference within the year.


How to use the DATEDIF() function:

  • Type " =DATEDIF( "
  • Enter the coordinate for the "Date_1" data cell "A2"
  • Type a comma.
  • Enter the coordinate for the "Date_2" data cell "B2"
  • Enter an interval code surrounded by quotation marks.
  • Type ")" then press the "Enter" key.


 


Note: It is better to enter the dates into this function using the DATE() function as dates in the form of text strings can cause problems to occur which is part of the reason this function does not appear in the function wizzard or help section. If date_1 or date_2 are not recognized as dates the DATEDIF function will return a #value error.



© 2007 Quantunet LLC All Rights Reserved | Intellectual Property | Terms of Use | Privacy
Home | About Quantunet | FAQ's | Contact Us