How old are you?

T

teeb

I'm trying to work out the age of someone, based on the current date an
their date of birth. I've used the YEAR [Year(A1)-Year(B1)] function bu
it rounds up?

Can anyone help?

Thank
 
G

Gary''s Student

Try DATEDIF:


=DATEDIF(A1,NOW(),"y") & " years, " & DATEDIF(A1,NOW(),"ym") & " months, " &
DATEDIF(A1,NOW(),"md") & " days"


if the date of birth is in A1
 
D

David McRitchie

Hi Roberto,
what's that, an attempt at precision, without accuracy?
Look at the replies involving DATEDIF. Please don't post incorrect
answers, people are very particular about birthdates.
 
D

David McRitchie

The original formula was incorrect so this is also incorrect,
see the replies involving DATEDIF for a correct answers.
You might want to test your answers.
 
D

David McRitchie

There are several things wrong with your answer.
The poster did not ask for decimal fractions of age, you only have an approximation.
The function NOW() includes both a date and time component.
There are not 365.25 days in a year, there are leap years, ages aren't based on averages.
You did not test your answer, people are very particular about birthdays.


1990-04-01 2006-03-31 16.000 <-- incorrect, s/b 15.000
1990-04-01 2006-04-01 16.003 <-- 16th birthday, s/b 16.000
1990-04-01 2006-04-02 16.005 <-- incorrect
1991-04-01 2006-03-31 15.001 <-- incorrect
1991-04-01 2006-04-01 15.003 <-- 15th birthday, s/b 15.000
1991-04-01 2006-04-02 15.006 <-- incorrect
1992-04-01 2006-03-31 13.999 <-- incorrect
1992-04-01 2006-04-01 14.001 <-- 14th birthday , s/b 14.000
1992-04-01 2006-04-02 14.004 <-- incorrect
1993-03-31 2006-03-31 13.002 <-- incorrect
1993-04-01 2006-04-01 13.002 <-- 13th birthday, s/b 13.000
1993-04-02 2006-04-02 13.002 <-- incorrect
1990-04-01 2006-10-01 16.504 <-- incorrect

---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

Hernandez said:
Hi,
I´d like to ask: what's incorrect in my answer?
I use this formula very often to calculate employees payments that are
directly related to their hiring date.
Of course I know DATEDIF function, but in this case I need age in decimal
format.
And of course I do not think I'm giving 'incorrect' posts: We all try to
cooperate, I supose.
Kind Regards.


David McRitchie said:
Hi Roberto,
what's that, an attempt at precision, without accuracy?
Look at the replies involving DATEDIF. Please don't post incorrect
answers, people are very particular about birthdates.

Hernandez said:
Try this one[with Birth Date on A1]
=(NOW()-A1+1)/365.25
 
D

David McRitchie

Hi Roberto,

So you think that you should not be told that an answer is incorrect,
and that the person who is asking the question should not be warned,
and the people who read archived postings should not be warned.

Much of learning is from improving on previous solutions and
mistakes. While you can learn a lot by making lots of mistakes and
correcting them, you will not always recognize your own mistakes, and
it is also helpful and faster to learn from interaction
with others so that you don't make the same mistakes in the future.

To me I'd be more concerned with applying something incorrectly
over several years at work than by learning that is incorrect in a
newsgroup, or that even if correct would be the wrong answer for
the poster looking for an age (no fractions).
 
B

bigfatdummy

I don't know about the rest of you but this post sounds like it is an
assignment from a beginning programming class. You trying to get others
to do your school work?
 
Top