View Single Post
  #13   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Epinn Epinn is offline
external usenet poster
 
Posts: 605
Default My discovery on DATEDIF and leap year

...... misleading when it says the years are ignored - because they
are obviously not completely ignored.<<

I have found more evidence....... When we specify "y" the month is actually taken into consideration as well.

A1:A3

12/25/1923
11/11/2006
10/25/1923


=DATEDIF(A1,A2,"y") yields 82
=YEAR(A2)-YEAR(A1) yields 83

=DATEDIF(A3,A2,"y") yields 83
=YEAR(A2)-YEAR(A3) yields 83

I guess depending on the users' need, sometimes we may want to use YEAR( ) while other times DATEDIF( ). But for calculating age, I will definitely go with DATEDIF( ).

Epinn

"JMB" wrote in message ...
Although using Datedif on the following
2/1/2008
1/31/2010

yields 365, but would give #NUM! if Date2 was 1/31/2008 (as Chip stated). I
think XL help is misleading when it says the years are ignored - because they
are obviously not completely ignored.



"Jim Thomlinson" wrote:

Give the bottom of this a quick look see...

http://www.cpearson.com/excel/datedif.htm
--
HTH...

Jim Thomlinson


"Epinn" wrote:

My discovery on DATEDIF ("yd") and leap year

A1:A4

2/1/2007
3/1/2008
2/1/2008
3/1/2009


formula (1) =DATEDIF(A1,A2,"yd") yields 28

formula (2) =DATEDIF(A3,A4,"yd") yields 29

I understand why this is happening - the year for the first argument is used.

I find DATEDIF and "yd" and leap year "interesting," "temperamental," "confusing," ...... <g

I am curious if "yd" is used often.

Welcome comments to this and my discovery.

Epinn