ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Excel formula calculating age (https://www.excelbanter.com/excel-worksheet-functions/185422-excel-formula-calculating-age.html)

[email protected]

Excel formula calculating age
 
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

David Biddulph[_2_]

Excel formula calculating age
 
=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

wrote in message
...
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




Reitanos

Excel formula calculating age
 
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"

On Apr 28, 1:24 pm, wrote:
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



Reitanos

Excel formula calculating age
 
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.

On Apr 28, 1:24 pm, wrote:
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



[email protected]

Excel formula calculating age
 
On Apr 28, 12:52*pm, "David Biddulph" <groups [at] biddulph.org.uk
wrote:
=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

wrote in message

...



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- Hide quoted text -


- Show quoted text -


Thanks!


All times are GMT +1. The time now is 04:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com