View Single Post
  #23   Report Post  
JE McGimpsey
 
Posts: n/a
Default

Hmmm... no longer self-consistent:


A B C
1 1/28/2005 2/28/2005 0 1 0
2 1/29/2005 2/28/2005 0 0 30
3 1/30/2005 2/28/2005 0 0 29
4 1/31/2005 2/28/2005 0 1 0
5 2/01/2005 2/28/2005 0 0 27


In article ,
"Mangesh" wrote:

Thanks for pointing out the bug yet again. This should sort it out again.

=(YEAR(B1)-YEAR(A1))-IF(AND(YEAR(A1)<YEAR(B1),OR(MONTH(A1)MONTH(B1),AN D(MON
TH(A1)=MONTH(B1),DAY(A1)DAY(B1)))),1,0) & " " &
(MONTH(B1)-MONTH(A1))-IF(AND(MONTH(A1)<MONTH(B1),DAY(A1)DAY(B1)),1,0)+I F(AN
D(YEAR(A1)<YEAR(B1),MONTH(A1)MONTH(B1),DAY(A1)<=D AY(B1)),12,0)+IF(AND(YEAR(
A1)<YEAR(B1),MONTH(A1)=MONTH(B1),DAY(A1)DAY(B1)) ,11,0)+IF(AND(MONTH(A1)<M
ONTH(A1+1),MONTH(B1)<MONTH(B1+1),DAY(A1)DAY(B1)) ,1,0) & " " &
IF(DAY(B1)=DAY(A1),DAY(B1)-DAY(A1),IF(DAY(DATE(YEAR(B1),MONTH(B1),1)-1)-DAY
(A1)<0,0,DAY(DATE(YEAR(B1),MONTH(B1),1)-1)-DAY(A1))+DAY(B1))-IF(AND(MONTH(A1
)<MONTH(A1+1),MONTH(B1)<MONTH(B1+1),DAY(A1)DAY( B1)),DAY(B1),0)


A1 = start date
B1 = end date

I agree with the first one and it should have been 0 1 0 and not 0 0 28.
(Atleast thats my intention). As for the second one, I consider a month to
get over on the same date next month, so it is as intended.

Just saw the post by JE.

<QUOTE
This seems to be self-consistent.

However, it's strange to me that one can't get a result of of 0 1 0, 0 3
0, 0 5 0, 0 8 0, or 0 10 0 from the date 1/31/2005. How do you go from
2/28/2005 being less than a month to 3/1/2005 being 1 day more than a
month, when one never had a date that was a month later?
</QUOTE

There was a bug and this one should sort it out.