Tuesday, June 21, 2011

Calculates the difference between two dates in excel

DATEDIF


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.



You can put this all together in one calculation, which creates a text version.

Age is 51 Years, 5 Months and 20 Days

="Age is "&DATEDIF(D34,TODAY(),"y")&" Years, "&DATEDIF(D34,TODAY(),"ym")&" Months and "&DATEDIF(D34,TODAY(),"md")&" Days"
Twitter Bird Gadget