Calculating age from date of birth and ignoring if blank

  • Thread starter Thread starter news.eternal-september.org
  • Start date Start date
N

news.eternal-september.org

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
 
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
 
Hi Gord
Strange, I replied only in Ms Public.Excel and it got posted in 3 different
area.
Maybe something new??
Regards
John
 
Thank you, that's exactly what I needed/

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

"Cimjet" wrote in message
Hi
Try this : =IF(P2="","",ROUNDDOWN(YEARFRAC(P2, TODAY(), 1), 0))
HTH
John
 
You're welcome, glad I could help.
John
news.eternal-september.org said:
Thank you, that's exactly what I needed/

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

"Cimjet" wrote in message
Hi
Try this : =IF(P2="","",ROUNDDOWN(YEARFRAC(P2, TODAY(), 1), 0))
HTH
John
 
Back
Top