View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Mike H[_4_] Mike H[_4_] is offline
external usenet poster
 
Posts: 19
Default Dates and If Function

Roger apologies I appear to have replied to you, this place is all
screwed up --- again ---.

Mike

On Sun, 24 May 2009 09:26:20 +0100, Mike H < wrote:


Hi,

If you want to exclude both dates you need AND and not OR, Try this

=IF(AND(B12<DATEVALUE("4/5/2009"), B12<DATEVALUE("5/7/2009")),
"Y","N")

If you have a long list of non contiguous dates to exclude then it may
be best to put them in a column abd do a vlookup.

Mike




On Sun, 24 May 2009 09:18:36 +0100, "Roger Govier"
<roger@technology4unospamdotcodotuk wrote:

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")