View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.worksheet.functions
David F Cox David F Cox is offline
external usenet poster
 
Posts: 37
Default My discovery on DATEDIF and leap year

typing DATEDIF into 2007 Beta help gets you a nice pop-up that explains how
to use various other functions to achieve standard date calculations. It
makes no mention of DATEDIF. However typing your examples in gives the same
results, so backward compatability seems to rule.

"Epinn" wrote in message
...
JMB,

Thank you for your discovery.

Looks like Excel takes "year" but just *ONE* into consideration when the
second argument (month and day) is less than the first.

I took your experiment further and played with 2/1/2007 and 1/31/2009. It
yields 364. Therefore, I think the leap year is taken into consideration.
The following comment in Chip's writeup still holds true.

Excel will use the year of the first date......to determine whether to
include 29-February in the calculation.


You wrote: "I think XL help is misleading when it says the years are
ignored."

Maybe this is why DATEDIF is no longer found using F1 after version 2000.
Anyone knows if DATEDIF still exists in 2007?

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