XL: Undocumented Worksheet Function DATEDIF

Last reviewed: February 2, 1998
Article ID: Q129277
The information in this article applies to:
  • Microsoft Excel 98 Macintosh Edition
  • Microsoft Excel 97 for Windows
  • Microsoft Excel for Windows 95, version 7.0
  • Microsoft Excel for Windows, versions 5.0, 5.0c
  • Microsoft Excel for the Macintosh, versions 5.0, 5.0a

SUMMARY

In Microsoft Excel, there is an undocumented worksheet function, DATEDIF, which calculates the difference between two dates in days, months, or years. The following information describes this function, its parameters, and how to obtain the same information using documented functions in Microsoft Excel.

For information about using documented functions instead of the DATEDIF function to calculate the difference between two dates, in days, months, or years, please see the following articles in the Microsoft Knowledge Base:

   ARTICLE-ID: Q67093
   TITLE     : How to Calculate the Number of Months Between Two Given
               Dates

   ARTICLE-ID: Q27089
   TITLE     : XL: Calculating the Number of Days Between Two Dates

   ARTICLE-ID: Q81694
   TITLE     : XL: Formula to Calculate Number of Days in Month

MORE INFORMATION

The DATEDIF function uses the following parameters:

   DATEDIF(start_date,end_date,units_text)

NOTES:

start_date: The starting date of the period that you are calculating.

end_date: The ending date of the period that you are calculating.

(If you are calculating an age to today's date, you can use the TODAY function for the end_date argument.)

units_text: Specifies units to measure the difference in:

   "Y"   returns the number of full years in the period
   "M"   returns the number of full months in the period
   "D"   returns the number of full days in the period
   "md"  returns the number of full days in excess of the last full month
   "ym"  returns the number of full months in excess of the last full year
   "yd"  returns the number of full days in excess of the last full year

In the following example

   A1: 11/11/69
   A2: 04/05/95
   A3: =DATEDIF(A1,A2,"Y")

cell A3 returns the value 25 for 25 full years difference between the date in cell A1, and the date in cell A2.

Note that the DATEDIF function is also available in Lotus 1-2-3.


Additional query words: 5.00 5.00a 5.00c 7.00 8.00 97 XL97 98 XL98
Keywords : xlformula xlhelp
Version : WINDOWS:5.0,5.0c,7.0,97; MACINTOSH: 5.0,5.0a,98
Platform : MACINTOSH WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 2, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.