Thursday, 19 February 2015

Age Calculation in MS Excel

Age-Calculation-in-MS-Excel

I have to tell you about a hidden function of Microsoft Excel, by using this function you can easily calculate the age in days, months & years.

You can calculate a persons age based on their birthday and date of today.
The calculation uses the DATEDIF() function.
The function of DATEDIF() is not documented/covered in Excel versions i.e. (5, 7, 97), but it is available in version 2000.
It is a wonder that what Microsoft forgot to tell their users!
Birth date : 29-Apr-73
Years lived :       41 = DATEDIF(C8,TODAY(),"y")
and the months : 9 = DATEDIF(C8,TODAY(),"ym")
and the days :      18 = DATEDIF(C8,TODAY(),"md")
These all calculation can be calculated in a line, which makes a text version.
Age is 41 Years, 9 Months and 18 Days
 ="Age is "&DATEDIF(C8,TODAY(),"y")&" Years, "&DATEDIF(C8,TODAY(),"ym")&" Months and "&DATEDIF(C8,TODAY(),"md")&" Days"
Another way to calculate age
This method gives you an age which may potentially have decimal places personify the months.
If the age is 20.5, the .5 personify 6 months.
Birth date : 1-Jan-60

More examples:
If you want to calculate a age between two dates like:

Assume cell (columns) names
         A1                    B1
05-Feb-1983 to 20-Feb-2015
You need to type a formula like this:
= DATEDIF(A1,B1,"y")
The result is = 32

Syntax of this calculation is
= Formula(cell ref of date from, cell ref of date to, type of calculation age)
You can calculate age in three types
"y"    = for calculating years
"ym" = for calculating months
"md" = for calculating days


More material in this blog which can help you

0 comments:

Post a Comment