View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Roger Govier[_3_] Roger Govier[_3_] is offline
external usenet poster
 
Posts: 2,480
Default Dates and If Function

Hi Ginger

If you are using 05 Apr 2009 in the cell, then the comparison should be
05-04-2009.
However, when you have the date within quotes, it is Text, whereas the dates
in your columns, although appearing like text, are stored internally as
serial numbers.
You need to coerce the Text values in your formula to numbers, by placing
the double unary minus in front of them

=IF(OR(B12<--"5-4-2009", B12<--"7-5-2009", "Y","N")

An alternative, which makes the Date quite explicit is to use the date
function Date(Year, Month, Day)
=IF(OR(B12<DATE(2009,4,5), B12<DATE(2009,5,7), "Y","N")


--
Regards
Roger Govier

"Ginger" wrote in message
...
I need to check a cell to see that it does not contain a certain date.
There
are 12 dates that the cell cannot be.

B12 = Date that I am testing to make sure that it isn't one of the dates
in
my formula.

I have tried =IF(OR(B12<"4-5-2009", B12<"5-7-2009", "Y","N")

I can't get this to work. The cell format for B12 is "5-Apr-2009.
That differs from what appears in the top box when I click on the cell.
It
shows as 4/5/2009. Could that make a difference? I have tried both ways,
and I can't get this to work. Any help would be greatly appreciated!

Thanks,

Ginger