Excel formula calculating age

C

Cis4cupcake

I'm currently using the formula =INT((TODAY()-B2/365.25) to calculate
age in years. Is there a formula that will show age in months only,
if under 1 year, and age in days only, if under 1 month? I used
=DATEDIF(birthdate, TODAY(),"y")&"years"&DATEDIF(birthdate,
TODAY(),"ym")&"months"&DATEDIF(birthdate, TODAY(),"md")&"days" but I
only want years or months or days to show.

Thanks
 
D

David Biddulph

=IF(DATEDIF(B2, TODAY(),"y")>=1,DATEDIF(B2, TODAY(),"y")&" years
",IF(DATEDIF(B2,TODAY(),"m")>=1,DATEDIF(B2,TODAY(),"m")&" months
",TODAY()-B2&" days"))
 
R

Reitanos

I don't think I have any typos in there :p

Here's your code modified:
=IF(DATEDIF(B2, TODAY(),"y")=0,"",DATEDIF(B2, TODAY(),"y")&" years,
")&IF(AND(DATEDIF(B2, TODAY(),"y")=0,DATEDIF(B2,
TODAY(),"m")=0),"",DATEDIF(B2,
TODAY(),"ym")&" months, ")&DATEDIF(B2, TODAY(),"md")&" days"
 
R

Reitanos

I THINK this is typo free:
=IF(DATEDIF(B2, TODAY(),"y")=0,"",DATEDIF(B2, TODAY(),"y")&" years,
")&IF(AND(DATEDIF(B2, TODAY(),"y")=0,DATEDIF(B2,
TODAY(),"m")=0),"",DATEDIF(B2,
TODAY(),"ym")&" months, ")&DATEDIF(B2, TODAY(),"md")&" days"

I used your formula and put in B2 instead of the range name.
 
C

Cis4cupcake

=IF(DATEDIF(B2, TODAY(),"y")>=1,DATEDIF(B2, TODAY(),"y")&" years
",IF(DATEDIF(B2,TODAY(),"m")>=1,DATEDIF(B2,TODAY(),"m")&" months
",TODAY()-B2&" days"))
--
David Biddulph







- Show quoted text -

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Expanding Date Formula 0
Age based on birthdate 2
Add/Sum up months, years, dates 6
Expanding Date formula 2
Birthday stuff 25
A mathematical formula question??? 3
Age computation 1
date of birth age formula 8

Top