Thursday, 2 February 2017

Excel DATEDIF Function | Excel DATEDIF |

FirstDate
SecondDate
Interval
Difference
1-Jan-60
10-May-70
days
3782
 =DATEDIF(C4,D4,"d")
1-Jan-60
10-May-70
months
124
 =DATEDIF(C5,D5,"m")
1-Jan-60
10-May-70
years
10
 =DATEDIF(C6,D6,"y")
1-Jan-60
10-May-70
yeardays
130
 =DATEDIF(C7,D7,"yd")
1-Jan-60
10-May-70
yearmonths
4
 =DATEDIF(C8,D8,"ym")
1-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 :
1-Jan-60
Years lived :
57
 =DATEDIF(C8,TODAY(),"y")
and the months :
1
 =DATEDIF(C8,TODAY(),"ym")
and the days :
1
 =DATEDIF(C8,TODAY(),"md")
You can put this all together in one calculation, which creates a text version.
Age is 57 Years, 1 Months and 1 Days
 ="Age is "&DATEDIF(C8,TODAY(),"y")&" Years, "&DATEDIF(C8,TODAY(),"ym")&" Months and "&DATEDIF(C8,TODAY(),"md")&" Days"

No comments:

Post a Comment