View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Peo Sjoblom Peo Sjoblom is offline
external usenet poster
 
Posts: 3,268
Default Difference between dates


"Rick Rothstein (MVP - VB)" wrote in
message ...
The problem is that "months" is a squirrelly concept. For instance, is
28 February 2007 one month and zero days after 31 January 2007? If so,
then is it *also* one month and zero days after 29 January?


No, 28-February-2007 is 28 days after 31-January-2007 and it is 30 days
after 29-January-2007 in the same way 30-April-2007 is 30 days after
31-March-2007. And, just like 1-May-2007 is 1 month and 0 days after
31-March-2007, 1-March-2007 should be 1 month and 0 days after
31-January-2007.

DATEDIF bases month length on the length of the month in the first
argument. So

A1: 31 January 2007
A2: 1 March 2007
A3: 0 & 0 & -2


Minus 2 days? That is just a ridiculous way to handle it. If you are
counting with months, then whenever you skip over a month, that is 1
month, no matter how many days it has in it. DATEDIF has no trouble
starting on the last day of a 31-day month and skipping over a 30-day
month to get to the first of the following month, so why should the
shorter month of February be any different.




Did you try to your own formula with 01/31/07 in A1 and 03/01/07 in A2?
It returns

0 years & 1 months & -2 days

so are you saying that most people when asked how many months and days there
are between those dates would say 1 month and -2 days. Me thinks not and
that is the error in DATEDIF that John explained.


--

Regards,

Peo Sjoblom