View Single Post
  #37   Report Post  
Posted to microsoft.public.excel.misc
T. Valko T. Valko is offline
external usenet poster
 
Posts: 15,768
Default Days to next anniversary

I almost always go with what first pops into my head and after I've commited
myself is when I start thinking of alternatives.

Like:

=ISERR(--("2/29/"&YEAR(NOW())))

There seems to be almost no limit when it comes to "building" dates. We
discussed this a while back. I was playing around and discoverd that stuff
like this works but it shouldn't (at least you would think that it
shouldn't):

A1 = July

=MONTH(A1&1)

A1 = July1

=MONTH(A1)

A1 = July0

=MONTH(A1)

People started chimming in that they also never realized this sort of stuff
worked.

I finally understand what you mean about that 2/29 vs 3/1 deal. I think
adding 1 to the start date (if a leap day) is the way to go and be done with
it!

If someone was born on 2/29/2000 when do they *legally* become 1 year old?
2/28/2001 or 3/1/2001?

Damn those leap years! <g

--
Biff
Microsoft Excel MVP


"Rick Rothstein (MVP - VB)" wrote in
message ...
-AND(MONTH(A2)=2,DAY(A2)=29,ISERR(--TEXT("2/29/"&YEAR(NOW()),"m/d/yy")))


That non-leap year test of yours...

ISERR(--TEXT("2/29/"&YEAR(NOW()),"m/d/yy")))

Why so many characters?

ISERR(VALUE("2/29/"&YEAR(now())))

Savings? Eleven characters (sorry, couldn't resist). <g

Yes, I properly should be using DATEVALUE but, for the test being
performed, I am pretty sure VALUE will work fine.

Rick