Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Current Age by years and months

I need a formula for current age in years and months. I.E.
DOB Current AGe
10/09/08 = 4 mo.
11/05/03 = 5 yr.s 5 mo.s
04/05/09 = -2 mo.

For Excell 2003
--
Dot
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Current Age by years and months

There are quite a few ways to do this, here's one:

=CONCATENATE(DATEDIF(A1,A2,"y"), " yr.s ", DATEDIF(A1,A2,"ym"), " mo.s")

where A1 contains DOB and A2 a subsequent date.

For an explanation of datedif function (only documented in XL 2000)
http://www.cpearson.com/Excel/datedif.aspx

Paul


"Dorothy A. Skenandore" wrote
in message ...
I need a formula for current age in years and months. I.E.
DOB Current AGe
10/09/08 = 4 mo.
11/05/03 = 5 yr.s 5 mo.s
04/05/09 = -2 mo.

For Excell 2003
--
Dot



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Current Age by years and months

This may get close:

=IF(A1=TODAY(), "", IF(DATEDIF(A1, TODAY(),"y")0, TEXT(DATEDIF(A1,
TODAY(),"y"), "0 \yr. "),"")) & TEXT(SIGN(TODAY()-A1) * DATEDIF(MIN(A1,
TODAY()),MAX(A1,TODAY()),"ym"),"0 \mo.")

Note that 4/05/09 will return -1 mo. If you need it to be -2 mo.,
please explain how *exactly* months should be calculated.

Also, I can't figure how you get 5 yrs 5 months in your second example -
seems to me it should be either 3 (which the formula above returns) or
perhaps 4.


In article ,
Dorothy A. Skenandore
wrote:

I need a formula for current age in years and months. I.E.
DOB Current AGe
10/09/08 = 4 mo.
11/05/03 = 5 yr.s 5 mo.s
04/05/09 = -2 mo.

For Excell 2003

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Current Age by years and months

Note that this will reutrn #NUM! for the third example...

Also, though it's certainly not wrong, there's no reason to use the
CONCANTENATE() function rather than the more efficient concatenate
operator (&).

In article ,
"Paul" wrote:

There are quite a few ways to do this, here's one:

=CONCATENATE(DATEDIF(A1,A2,"y"), " yr.s ", DATEDIF(A1,A2,"ym"), " mo.s")

where A1 contains DOB and A2 a subsequent date.

For an explanation of datedif function (only documented in XL 2000)
http://www.cpearson.com/Excel/datedif.aspx

Paul


"Dorothy A. Skenandore" wrote
in message ...
I need a formula for current age in years and months. I.E.
DOB Current AGe
10/09/08 = 4 mo.
11/05/03 = 5 yr.s 5 mo.s
04/05/09 = -2 mo.

For Excell 2003
--
Dot

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 222
Default Current Age by years and months

My take on it:

=IF(A1TODAY(),-MONTH(A1)-MONTH(TODAY())&" mo.s",
IF(DATEDIF(A1,TODAY(),"y")1,DATEDIF(A1,TODAY(),"y ")&" yr.s & "
&DATEDIF(A1,TODAY(),"ym")&" mo.s",DATEDIF(A1,TODAY(),"ym")&" mo.s"))

--
"Actually, I *am* a rocket scientist." -- JB

Your feedback is appreciated, click YES if this post helped you.


"JE McGimpsey" wrote:

This may get close:

=IF(A1=TODAY(), "", IF(DATEDIF(A1, TODAY(),"y")0, TEXT(DATEDIF(A1,
TODAY(),"y"), "0 \yr. "),"")) & TEXT(SIGN(TODAY()-A1) * DATEDIF(MIN(A1,
TODAY()),MAX(A1,TODAY()),"ym"),"0 \mo.")

Note that 4/05/09 will return -1 mo. If you need it to be -2 mo.,
please explain how *exactly* months should be calculated.

Also, I can't figure how you get 5 yrs 5 months in your second example -
seems to me it should be either 3 (which the formula above returns) or
perhaps 4.


In article ,
Dorothy A. Skenandore
wrote:

I need a formula for current age in years and months. I.E.
DOB Current AGe
10/09/08 = 4 mo.
11/05/03 = 5 yr.s 5 mo.s
04/05/09 = -2 mo.

For Excell 2003




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 222
Default Current Age by years and months

Apologies....*tiny* correction to get the -2 mo.s to show properly:

=IF(A2TODAY(),(MONTH(A2)-MONTH(TODAY()))*-1&" mo.s",
IF(DATEDIF(A2,TODAY(),"y")1,DATEDIF(A2,TODAY(),"y ")&" yr.s & "
&DATEDIF(A2,TODAY(),"ym")&" mo.s",DATEDIF(A2,TODAY(),"ym")&" mo.s"))

--
"Actually, I *am* a rocket scientist." -- JB

Your feedback is appreciated, click YES if this post helped you.


"JBeaucaire" wrote:

My take on it:

=IF(A1TODAY(),-MONTH(A1)-MONTH(TODAY())&" mo.s",
IF(DATEDIF(A1,TODAY(),"y")1,DATEDIF(A1,TODAY(),"y ")&" yr.s & "
&DATEDIF(A1,TODAY(),"ym")&" mo.s",DATEDIF(A1,TODAY(),"ym")&" mo.s"))

--
"Actually, I *am* a rocket scientist." -- JB

Your feedback is appreciated, click YES if this post helped you.


wrote:

I need a formula for current age in years and months. I.E.
DOB Current AGe
10/09/08 = 4 mo.
11/05/03 = 5 yr.s 5 mo.s
04/05/09 = -2 mo.

For Excell 2003


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default Current Age by years and months

I posted this formula a while back:

For trivia's sake, this formula will calculate age to the nearest day ($A2
holds the birthdate):

=IF(DATEDIF($A2,NOW(),"y")<10," ","") & DATEDIF($A2,NOW(),"y") & " years, "
& IF(DATEDIF($A2,NOW(),"ym")<10," ","") & DATEDIF($A2,NOW(),"ym") & " months,
" & IF(DATEDIF($A2,NOW(),"md")<10," ","") & DATEDIF($A2,NOW(),"md") & " days"

HTH,

Eric


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Current Age by years and months

Subject to the usual caveats with DATEDIF, e.g.:

A2: 1/31/1980

Result on 3/1/2009:

29 years, 1 months, -2 days


In article ,
egun wrote:

I posted this formula a while back:

For trivia's sake, this formula will calculate age to the nearest day ($A2
holds the birthdate):

=IF(DATEDIF($A2,NOW(),"y")<10," ","") & DATEDIF($A2,NOW(),"y") & " years, "
& IF(DATEDIF($A2,NOW(),"ym")<10," ","") & DATEDIF($A2,NOW(),"ym") & " months,
" & IF(DATEDIF($A2,NOW(),"md")<10," ","") & DATEDIF($A2,NOW(),"md") & " days"

HTH,

Eric

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
SUM Days (to 30), Months (to 12) and Years an Excel Worksheet Functions 5 November 23rd 05 02:20 PM
converting months to years and months??? Marty Excel Discussion (Misc queries) 1 February 18th 05 02:38 AM
Converting months to years kevin Excel Worksheet Functions 1 January 20th 05 01:28 PM
years and months [email protected] Excel Worksheet Functions 5 January 8th 05 02:53 PM
function years:months Brock Excel Worksheet Functions 1 December 3rd 04 05:02 PM


All times are GMT +1. The time now is 10:38 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"