ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   AND Headache (with dates)! (https://www.excelbanter.com/excel-programming/291792-headache-dates.html)

Alan L. Wagoner

AND Headache (with dates)!
 
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



Bob Phillips[_6_]

AND Headache (with dates)!
 
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 =A1DATE(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)

"Alan L. Wagoner" wrote in message
...
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 L. Wagoner

AND Headache (with dates)!
 
Bob,

DUH!

Thanks for pointing out the <somewhat obvious.

--Alan
...missing London

"Bob Phillips" wrote in message
...
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 =A1DATE(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)





All times are GMT +1. The time now is 06:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com