Leading the way in Microsoft Office Development
 Home|Excel|Word|PowerPoint|Consultancy|Feedback|Contact 
 Microsoft Excel > Functions > Date and Time > DATEDIF

 

DATEDIF(start_date, end_date, unit)

 
 Returns the number of units between two dates.

 start_dateThe date that represents the starting date of the period.
 end_dateThe date that represents the finishing date of the period.
 unitThe type of information you want returned:
"Y" = number of complete years
"M" = number of complete months
"D" = number of days
"MD" = difference between days in "start_date" and "end_date"
"YM" = difference between the months in "start_date" and "end_date"
"YD" = difference between the days of "start_date" and "end_date"

 REMARKS
 
  • This function is only available if you have the Analysis ToolPak add-in installed.
     
  • This function does not appear in the (Insert > Function) dialog box, but it does exist.

     EXAMPLES
     
     A
    1=DATEDIF("2001/1/1","2003/1/1","Y") = 2
    2=DATEDIF("2001/1/1","2003/1/1","M") = 24
    3=DATEDIF("2001/6/1","2002/8/15","D") = 440
    4=DATEDIF("2001/6/1","2002/8/15","YD") = 75
    5=DATEDIF("2001/6/1","2002/8/15","MD") = 14
    6=DATEDIF("some text","2002/8/15","MD") = #VALUE!
     

     Functions - D | Index - D | Dates & Times 

     Copyright © 2004-2007 Better Solutions Limited. All Rights Reserved.Top