PC Review


Reply
Thread Tools Rate Thread

Age calculator

 
 
Marc D
Guest
Posts: n/a
 
      17th Feb 2011
Hello,

I hope someone can help me with this.

I need to calculate someone's current age based on DOB and indicate if
someone is closer to their last birthday or next birthday.

Thank you

MD

 
Reply With Quote
 
 
 
 
joeu2004
Guest
Posts: n/a
 
      17th Feb 2011
On Feb 16, 8:50*pm, "Marc D" <some...@yahoo.com> wrote:
> I need to calculate someone's current age based on DOB


First, what you don't want to do: some arithmetic involving either
365 or 365.25. Whether you use one or the other with ROUND or INT, we
can find an example with an off-by-one error.

Second, ostensibly, you want to use DATEDIF(A1,A2,"y"), where A1 is
the DOB and A2 is "today's" date. A2 might be =TODAY(); but more
generally, it is a "valuation" date -- a date of your choosing.

However, DATEDIF does not do the "right" thing with DOBs on Feb 29.
Usually, the "right" thing is: use Feb 28 in non-leap years. DATEDIF
will effectively use Mar 1. Compare with EDATE; for example, if A1 is
2/28/1948, EDATE(A1,12*63) is 2/28/2011. But if A2 is 2/28/2011,
DATEDIF(A1,A2,"y") returns 62 instead of 63.

So if you use DATEDIF, I suggest:

=DATEDIF(A1,A2,"y")+(EDATE(A1,12+12*DATEDIF(A1,A2,"y"))<=A2)

formatted as General or Number.

Note: EDATE is a built-in function in XL2007 and later. If you have
XL2003 or earlier and you get a #NAME error, see the EDATE Help page
for instructions on installing the ATP.


> and indicate if someone is closer to their last birthday
> or next birthday.


If the above formula (age) is in A3, then the closer BD is:

=EDATE(A1,12*A3+12*(A2-EDATE(A1,12*A3)>=183))

formatted as Date.

PS: If you cannot or do not want to use EDATE in XL2003 or earlier,
the alternative can get very messy unless you use some helper cells.
Let us know if you need help with that.
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: calculator Daave Windows XP General 2 13th Oct 2008 03:00 AM
Integrated calculator in excel 07 instead of separate calculator =?Utf-8?B?V2F5bmU=?= Microsoft Excel Programming 1 26th Jul 2006 04:16 PM
Difference Between MS Power Calculator and MS Calculator Plus Sam Windows XP General 5 12th Jul 2005 12:52 AM
GPA Calculator, problem - GPA Calculator.xls (0/1) bentley_rhodes Microsoft Excel Discussion 2 10th Oct 2004 07:20 PM
calculator =?Utf-8?B?c2Nvb290?= Windows XP New Users 3 23rd Mar 2004 05:49 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:48 AM.