IF and using dates question

M

MikeB

Can anyone advise why this formula would not return OK.

Cell H188 = 1/3/2008

The formula is:
=IF(AND(H188>12/31/2007,H188< 2/1/2008), "OK", "Not OK")

The result = Not OK

Seems to me that formula is checking the cell for dates between 12/31/2007
and 2/1/2008 and therefore 1/3/2008 would result in OK.
 
J

JulieS

MikeB said:
Can anyone advise why this formula would not return OK.

Cell H188 = 1/3/2008

The formula is:
=IF(AND(H188>12/31/2007,H188< 2/1/2008), "OK", "Not OK")

The result = Not OK

Seems to me that formula is checking the cell for dates between
12/31/2007
and 2/1/2008 and therefore 1/3/2008 would result in OK.

Mike,

It appears from your reference to "h188" that you are using Excel and
not Access. Access in the name of this newsgroup refers to the Access
database program. If my answer below doesn't work, please repost
your question to a newsgroup for Excel.

I believe the reason why your formula doesn't work is that it is not
interpreting 12/31/2007 and 2/1/2008 as dates.
Try:

=IF(AND(H188 > DATEVALUE("12/31/07"), H188<DATEVALUE("2/1/2008")),
"OK", "Not okay")

An alternative would be to enter your date values (12/31/07) into
other cells in the spreadsheet and refer to those cell addresses
directly.

I hope this helps.
Julie
 
Top