View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Rick Rothstein \(MVP - VB\) Rick Rothstein \(MVP - VB\) is offline
external usenet poster
 
Posts: 2,202
Default Difference between dates

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.

Rick