Date comparisons within AND() functions

S

Sambonator

I'm trying to compare dates within an =AND() function but having trouble.
I can get =IF() to work but not =AND().
E.g. Cell A1 = 6/15/2009
I can do =if(A1<6/30/2009,GOOD,BAD)
WOrks fine.
When I do =IF(AND(A1<6/30/2009,TRUE),GOOD,BAD)
it doesn't give the right answer. Is there something about formatting dates
within AND() that makes it fail, when it works within an IF function?
 
S

smartin

Sambonator said:
I'm trying to compare dates within an =AND() function but having trouble.
I can get =IF() to work but not =AND().
E.g. Cell A1 = 6/15/2009
I can do =if(A1<6/30/2009,GOOD,BAD)
WOrks fine.

That formula gives me "BAD", which does not seem like the correct
answer. According to the formula auditing | evaluate formula widget it
decomposes as

=if(A1<6/30/2009,GOOD,BAD)
=if(A1<0.2/2009,GOOD,BAD)
=if(A1<0.00009955...,GOOD,BAD)

IOW, it is just doing division on the "date" and comparing the result to A1.

These do seem to work:

=IF(A1<DATE(2009,6,30),"GOOD","BAD")
=IF(AND(A1<DATE(2009,6,30),TRUE),"GOOD","BAD")
 
B

Bernie Deitrick

=IF(A1<"6/30/2009","GOOD","BAD")
=IF(AND(A1<"6/30/2009",TRUE),"GOOD","BAD")
both worked for me.

HTH,
Bernie
MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top