Link to home
Start Free TrialLog in
Avatar of kvrogers
kvrogers

asked on

formula for age

How do you change a column containing the birthdate to the age of the person.
Avatar of jimyX
jimyX

=INT((TODAY()-E6)/365.25)
Or,
=DATEDIF(E6,TODAY(),"y")

Where E6 is the Date of birth.
Are you looking for something like this?

    [A]        [B]
[1] DOB	       Age
[2] 4/28/1968  =FLOOR(YEARFRAC(TODAY(),A2),1)

Open in new window

Avatar of kvrogers

ASKER

i used the formula:  =DATEDIF(E6,TODAY(),"y")

The date of birth for each person starts in B6 so I changed the formula to:
=DATEIF(B6,TODAY(),"y") but this is returning :  1/0/1900.  

Not sure what was wrong.
Do I replace the date of birth in a new column?
Do I replace the date of birth with the entry above?
Sorry, NOVICE for sure at this.  

1/0/1900 is actually just zero formatted as a date.

If you change the format of the cell with the formula to general do you see any ages? (obviously zero is a valid age, but only if the date in B6 is in the last year)

regards, barry
Does this example help?

regards, barry
26834720.xls
Be aware that the DateDiff() function only subtracts the year component of two dates.  This will not produce accurate AGE values, since it doesn't include a comparison of the month and day components.

AGE is a step function that increases on a person's birthdate anniversary.
The correct formula to calculate age is below (I revised the formula from my first post):

=FLOOR(YEARFRAC(A2,TODAY(),1),1)

Open in new window


More here:

How to Calculate a Person's Current Age in Microsoft Excel
http://www.brighthub.com/computing/windows-platform/articles/26696.aspx
Hello aikimark,

Note that the suggestion here from JimyX, followed up by me, is to use DATEDIF worksheet function which is not the same as DateDiff VBA function.

DATEDIF will accurately give an age in years as most people understand it, so if you use this formula today

=DATEDIF(DATE(1981,2,10),TODAY(),"y")

then that gives a result of 30 because Feb 10th has passed this year, but if the month is one later, i.e.

=DATEDIF(DATE(1981,3,10),TODAY(),"y")

That gives a result of 29 because we haven't yet reached 10th March

DATEDIF isn't very well documented, not in the function list and not in the help files for most Excel versions but Chip Pearson, MSMVP, describes how it functions here

regards, barry
Thanks for the link, Barry.  Pearson always writes deeply informative articles.

I guess my brain added the second "F" when I read DATEDIF().  That's my VB-centric experience at work -- only this time it worked against me.
Hello wdosanjos,

I think that using the formula

=FLOOR(YEARFRAC(A2,TODAY(),1),1)

will give the correct result in most circumstances but I still see some anomalies around birthdays, probably caused by leap years, for example, rather than a static TODAY() function if you use a variable date in place of that, i.e.

=FLOOR(YEARFRAC(A2,B2,1),1)

then if I use 12-Jun-1991 as the birthdate in A2 and "today's" date in B2 as 12-Jun-2011 then that formula gives me a result of 20, as expected because B2 is the date of 20th birthday....but if I change A2 to a year later, i.e. 12-Jun-1991 with b2 unchanged then I get 18 rather than 19 as I would expect.

regards, barry
@barryhoudini. Yes, you are correct.  DATEDIF is the better option in this case.
Barry:
I tried using your formula as =DATEDIF(B6,TODAY(),"y")  and used it exactly as your example, thanks for the example.  But this is the result I got.  See Attached

Kate
example.xlsx
ASKER CERTIFIED SOLUTION
Avatar of jimyX
jimyX

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
that worked.  Thank you very, very much.

Kate