Tuesday, November 23, 2010

Excel Tip, Difference of Days,Months,Years in Two Dates

Friends,  If anyone  wants to know difference of Days, Months and Years between two Dates.  Excel makes easy it with a single command which can be viewed in below screen.  I mean to say Excel Command "Datedif" calculate difference between two days in easy way.  Some abbreviations are given as under which are used in below screen:-
A1= 05-04-1999
A2 = 31-05-2010
"y"= Years
"m" = Months
"d" = Days. 

Datedif command not only works in office 2003 but it also works in office 2007 or in office 2010. 


Easy and Simple Calculations with the Microsoft Excel 


DATEDIF







FirstDate
SecondDate
Interval
Difference
01-Jan-60
10-May-70
days
3782
 =DATEDIF(C4,D4,"d")
01-Jan-60
10-May-70
months
124
 =DATEDIF(C5,D5,"m")
01-Jan-60
10-May-70
years
10
 =DATEDIF(C6,D6,"y")
01-Jan-60
10-May-70
yeardays
130
 =DATEDIF(C7,D7,"yd")
01-Jan-60
10-May-70
yearmonths
4
 =DATEDIF(C8,D8,"ym")
01-Jan-60
10-May-70
monthdays
9
 =DATEDIF(C9,D9,"md")
What Does It Do?





This function calculates the difference between two dates.
It can show the result in weeks, months or years.
Syntax






 =DATEDIF(FirstDate,SecondDate,"Interval")
FirstDate : This is the earliest of the two dates.
SecondDate : This is the most recent of the two dates.
"Interval" : This indicates what you want to calculate.
These are the available intervals.
"d"
Days between the two dates.
"m"
Months between the two dates.
"y"
Years between the two dates.
"yd"
Days between the dates, as if the dates were in the same year.
"ym"
Months between the dates, as if the dates were in the same year.
"md"
Days between the two dates, as if the dates were in the same month and year.
Formatting





No special formatting is needed.
Birth date :
01-Jan-60
Years lived :
51
 =DATEDIF(C8,TODAY(),"y")
and the months :
0
 =DATEDIF(C8,TODAY(),"ym")
and the days :
6
 =DATEDIF(C8,TODAY(),"md")
You can put this all together in one calculation, which creates a text version.
Age is 51 Years, 0 Months and 6 Days
 ="Age is "&DATEDIF(C8,TODAY(),"y")&" Years, "&DATEDIF(C8,TODAY(),"ym")&" Months and "&DATEDIF(C8,TODAY(),"md")&" Days"

Intense Debate Comments