Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Leyland
 
Posts: n/a
Default DATEDIF and leap years

I am using this formula to get the age of someone in years and days. It
works well execpt I cannot find a way of adjusting for leap years. Any ideas

=DATEDIF(A1,B1,"Y")&"YEARS"&DATEDIF(A1,B1."YD")&"D AYS"
  #2   Report Post  
JE McGimpsey
 
Posts: n/a
Default

What isn't adjusting for you?

A1: 2/28/2001
B1: 3/1/2004 <== Leap year
C1: 3 YEARS 2 DAYS


A1: 2/28/2002
B1: 3/1/2005 <== Non leap-year
C1: 3 YEARS 1 DAYS

Years are insensitive to leap-days (except for those born on 29
February, I suppose), so only the last partial year matters. It appears
to me that this adjusts fine.



In article ,
"Leyland" wrote:

I am using this formula to get the age of someone in years and days. It
works well execpt I cannot find a way of adjusting for leap years. Any ideas

=DATEDIF(A1,B1,"Y")&"YEARS"&DATEDIF(A1,B1."YD")&"D AYS"

  #3   Report Post  
Leyland
 
Posts: n/a
Default

Sorry, my bad maths! I have run it again with no problems. Many thanks.

"JE McGimpsey" wrote:

What isn't adjusting for you?

A1: 2/28/2001
B1: 3/1/2004 <== Leap year
C1: 3 YEARS 2 DAYS


A1: 2/28/2002
B1: 3/1/2005 <== Non leap-year
C1: 3 YEARS 1 DAYS

Years are insensitive to leap-days (except for those born on 29
February, I suppose), so only the last partial year matters. It appears
to me that this adjusts fine.



In article ,
"Leyland" wrote:

I am using this formula to get the age of someone in years and days. It
works well execpt I cannot find a way of adjusting for leap years. Any ideas

=DATEDIF(A1,B1,"Y")&"YEARS"&DATEDIF(A1,B1."YD")&"D AYS"


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



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

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

About Us

"It's about Microsoft Excel"