View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.worksheet.functions
T. Valko T. Valko is offline
external usenet poster
 
Posts: 15,768
Default Dates and If Function

If B12 is on a different sheet then you need to include the sheet name...

=IF(OR(Sheet1!$B$12=.........

That's going to make your formula *really* long!

I strongly suggest you enter the dates in a range of cells then use a much
easier formula like:

=IF(COUNTIF(A1:A10,Sheet1!B12),"Y","N")

But, if you insist on not listing the dates in a range of cells you can
reduce your current formula to this since the dates you're checking are in
sequences of 2 consecutive dates. Include the sheet name when referencing
B12 on a different sheet.

=IF(OR($B$12=DATE(2009,4,28)+{0,1},$B$12=DATE(2009 ,6,23)+{0,1},,$B$12=DATE(2009,8,11)+{0,1},$B$12=DA TE(2009,9,22)+{0,1},$B$12=DATE(2009,11,3)+{0,1},$B $12=DATE(2009,12,15)+{0,1}),"Y","N")

Note that in the formula you posted you repeated the date 12/15:

$B$12=DATE(2009,12,15),$B$12=DATE(2009,12,15)


I'm assuming the pattern continues and you really meant 12/15 and 12/16.

--
Biff
Microsoft Excel MVP


"Ginger" wrote in message
...
Okay, sorry . . .

The formula that works on one file is this and, yes, I guess i did it the
hard way, but it worked!

=IF(OR($B$12=DATE(2009,4,28),$B$12=DATE(2009,4,29) ,$B$12=
DATE(2009,6,23),$B$12=DATE(2009,6,24),$B$12=DATE(2 009,8,11),
$B$12=DATE(2009,8,12),$B$12=DATE(2009,9,22),$B$12=
DATE(2009,9,23),$B$12=DATE(2009,11,3),$B$12=DATE(2 009,11,4),
$B$12=DATE(2009,12,15),$B$12=DATE(2009,12,15)),"Y" ,"N")

But when I try to put this formula on another worksheet referencing the
same
B12 cell, it won't work.

Any ideas? Thanks.

Ginger




"Ginger" wrote:

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