In this Article, I am going to explain you, how can you use DATEDIF() Function and also using this, how can you calculate Age in Excel.
Basically DATEDIF calculates difference between two dates. The most interesting part of this Function is that you can calculate the difference between two dates by a given intervals. If i say Intervals, what does it mean? Interval means, In what interval do you actually want the difference between two dates like total difference in Months, or Years or Days etc.
Syntax for the DATEDIF() Function:
=DATEDIF(StartDate, EndDate, Interval)
StartDate: is the First Date
EndDate: is the Second Date
Interval: This is the format or Type in which the difference you want
First Date should not be later than Second Date. If First Date is later than Second Date then the Formula will return an Error.
For Interval, we have few predefined Syntax, which you can use any one of them. Below is the list and Description for each of the Intervals
|d||Day||Returns Total Number of Days between Two Dates|
|m||Month||Returns Total Number of Months between Two Dates|
|y||year||Returns Total Number of Years between Two Dates|
|yd||Days Excluding Years||Total Number of Days considering they are from the Same year.|
|ym||Months Excluding Years||Total Number of Months considering they are from the Same year.|
|md||Number of Days Excluding Years and Month||Total Number of Days considering they are from the Same Months and Same year.|
1. If you are giving Dates and Interval Directly in your Formula then they both must be passed in DOUBLE QUOTES (“”) otherwise you can pass the reference directly.
How to Calculate Age using this Function:
Using this Function we can calculate Age of Some One just by Passing his/her Birth date. In A1 Cell the Date of Birth is Kept. Considering that you can use the following Formula.
=DATEDIF(A1,TODAY(),”y”)&” Years “&DATEDIF(A1,TODAY(),”ym”)&” Months and “&DATEDIF(A1,TODAY(),”md”)&” Days”