PC Review


Reply
Thread Tools Rate Thread

Calculating age from date of birth and ignoring if blank

 
 
news.eternal-september.org
Guest
Posts: n/a
 
      24th Nov 2010
I've used the following formula to calculate a person's current age in years
based on a previously entered date of birth:

=ROUNDDOWN(YEARFRAC(P2, TODAY(), 1), 0)

However, if I haven't entered any data in the date of birth column, the
result cell shows the age "110", which throws out other calculations. Is
there any way to tell Excel not to enter any data if the date of birth is
blank?
Many thanks

 
Reply With Quote
 
 
 
 
Cimjet
Guest
Posts: n/a
 
      24th Nov 2010
Hi
Try this : =IF(P2="","",ROUNDDOWN(YEARFRAC(P2, TODAY(), 1), 0))
HTH
John
"news.eternal-september.org" <(E-Mail Removed)> wrote in message
news:icjadq$vts$(E-Mail Removed)...
> I've used the following formula to calculate a person's current age in years
> based on a previously entered date of birth:
>
> =ROUNDDOWN(YEARFRAC(P2, TODAY(), 1), 0)
>
> However, if I haven't entered any data in the date of birth column, the result
> cell shows the age "110", which throws out other calculations. Is there any
> way to tell Excel not to enter any data if the date of birth is blank?
> Many thanks


 
Reply With Quote
 
Gord Dibben
Guest
Posts: n/a
 
      24th Nov 2010
Please do not multipost.

=IF(P2="","",(ROUNDDOWN(YEARFRAC(P2,TODAY(),1),0)))

Your formula is OK for just years but if you wanted a bit more precision the
undocumented DATEDIF function might be used.

See Chip Pearson's site for more on that.

http://www.cpearson.com/excel/datedif.aspx


Gord Dibben MS Excel MVP


On Wed, 24 Nov 2010 15:19:22 -0000, "news.eternal-september.org"
<(E-Mail Removed)> wrote:

>I've used the following formula to calculate a person's current age in years
>based on a previously entered date of birth:
>
>=ROUNDDOWN(YEARFRAC(P2, TODAY(), 1), 0)
>
>However, if I haven't entered any data in the date of birth column, the
>result cell shows the age "110", which throws out other calculations. Is
>there any way to tell Excel not to enter any data if the date of birth is
>blank?
>Many thanks

 
Reply With Quote
 
Cimjet
Guest
Posts: n/a
 
      24th Nov 2010
Hi Gord
Strange, I replied only in Ms Public.Excel and it got posted in 3 different
area.
Maybe something new??
Regards
John


"Gord Dibben" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Please do not multipost.
>
> =IF(P2="","",(ROUNDDOWN(YEARFRAC(P2,TODAY(),1),0)))
>
> Your formula is OK for just years but if you wanted a bit more precision the
> undocumented DATEDIF function might be used.
>
> See Chip Pearson's site for more on that.
>
> http://www.cpearson.com/excel/datedif.aspx
>
>
> Gord Dibben MS Excel MVP
>
>
> On Wed, 24 Nov 2010 15:19:22 -0000, "news.eternal-september.org"
> <(E-Mail Removed)> wrote:
>
>>I've used the following formula to calculate a person's current age in years
>>based on a previously entered date of birth:
>>
>>=ROUNDDOWN(YEARFRAC(P2, TODAY(), 1), 0)
>>
>>However, if I haven't entered any data in the date of birth column, the
>>result cell shows the age "110", which throws out other calculations. Is
>>there any way to tell Excel not to enter any data if the date of birth is
>>blank?
>>Many thanks


 
Reply With Quote
 
news.eternal-september.org
Guest
Posts: n/a
 
      24th Nov 2010
Thank you, that's exactly what I needed/

As you may have guessed, I'm fairly new to this!

"Cimjet" wrote in message news:icjcci$k8u$(E-Mail Removed)...

Hi
Try this : =IF(P2="","",ROUNDDOWN(YEARFRAC(P2, TODAY(), 1), 0))
HTH
John
"news.eternal-september.org" <(E-Mail Removed)> wrote in message
news:icjadq$vts$(E-Mail Removed)...
> I've used the following formula to calculate a person's current age in
> years based on a previously entered date of birth:
>
> =ROUNDDOWN(YEARFRAC(P2, TODAY(), 1), 0)
>
> However, if I haven't entered any data in the date of birth column, the
> result cell shows the age "110", which throws out other calculations. Is
> there any way to tell Excel not to enter any data if the date of birth is
> blank?
> Many thanks


 
Reply With Quote
 
Cimjet
Guest
Posts: n/a
 
      24th Nov 2010
You're welcome, glad I could help.
John
"news.eternal-september.org" <(E-Mail Removed)> wrote in message
news:icje4m$65u$(E-Mail Removed)...
> Thank you, that's exactly what I needed/
>
> As you may have guessed, I'm fairly new to this!
>
> "Cimjet" wrote in message news:icjcci$k8u$(E-Mail Removed)...
>
> Hi
> Try this : =IF(P2="","",ROUNDDOWN(YEARFRAC(P2, TODAY(), 1), 0))
> HTH
> John
> "news.eternal-september.org" <(E-Mail Removed)> wrote in message
> news:icjadq$vts$(E-Mail Removed)...
>> I've used the following formula to calculate a person's current age in years
>> based on a previously entered date of birth:
>>
>> =ROUNDDOWN(YEARFRAC(P2, TODAY(), 1), 0)
>>
>> However, if I haven't entered any data in the date of birth column, the
>> result cell shows the age "110", which throws out other calculations. Is
>> there any way to tell Excel not to enter any data if the date of birth is
>> blank?
>> Many thanks

>


 
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
Calculating age from date of birth and ignoring if blank news.eternal-september.org Microsoft Excel Discussion 3 24th Nov 2010 04:40 PM
Calculating age from date of birth and ignoring if blank news.eternal-september.org Microsoft Excel Misc 3 24th Nov 2010 04:40 PM
Calculating YMD from a date of birth DubboPete Microsoft Access Form Coding 6 16th Mar 2006 12:19 AM
Calculating Age from Date of Birth =?Utf-8?B?U3VlIE1pbG5lcg==?= Microsoft Access Getting Started 1 10th Sep 2004 12:20 AM
calculating age from date of birth Tim Microsoft Excel Programming 2 30th Jan 2004 08:09 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:45 PM.