Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,651
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 123
Default 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


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 123
Default 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


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default 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!
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
formula for calculating wt gain or loss cumulative in excel Yaka Setting up and Configuration of Excel 4 April 22nd 23 08:13 AM
Entering a Formula; Remains a Formula Instead of Calculating billbrandi Excel Discussion (Misc queries) 1 April 3rd 08 12:50 AM
How keep Excel from counting empty cells when calculating formula Excel Noob Excel Worksheet Functions 6 November 8th 07 11:18 PM
Excel displaying formulae as constant and not calculating formula gpbell Excel Worksheet Functions 2 February 16th 06 08:26 AM
Formula for calculating a rolling 12 month average in excel? Jeff Excel Discussion (Misc queries) 1 December 9th 05 09:11 PM


All times are GMT +1. The time now is 11:56 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"