AND Headache (with dates)!

  • Thread starter Thread starter Alan L. Wagoner
  • Start date Start date
A

Alan L. Wagoner

Greetings All,

I'm going crazy trying to figure out what's wrong.

In A1, I have the following:
01/30/2004

In B1, I have the following formula:
=And(A1< "02/01/2004")
which results in: TRUE (makes sense to me...)

In C1, I have the following formula:
=And(A1> "12/31/2003")
which results in: FALSE (huh?!?!)

In B2, I have the following:
=And(A1< 02/01/2004)
which results in FALSE (huh ?!?!)

In C2, I have the following:
=And(A1< 12/31/2003)
which results in TRUE (makes sense to me).

What is going on?

Thanks in advance!

--Alan
 
Alan,

A1 has a date, which is a serial number, 38,016 in this case. The values in
quotes are strings, and although it would be possible to work out the actual
values compared, I won't bother, but the results do not surprise.

Try this in B1 =A1<DATE(2004,2,1), and this in C1 =A1>DATE(2003,12,31, and
you will see they both resolve to True. Test like for like, and you can
predict the results.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Bob,

DUH!

Thanks for pointing out the <somewhat> obvious.

--Alan
...missing London
 
Back
Top