View Single Post
 
Old 02-22-2014, 04:40 PM
tomseeley tomseeley is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Jan 2014
Posts: 10
tomseeley is on a distinguished road
Default Help me with simple IF stmt to test date within a range

I'm embarrassed! I should know how to do this but I fergit!

I have a simple Excel database containing a column of dates. I want to test a date in any cell in that column and return "yes" in the adjacent cell if the date I'm testing is within a range of dates I'll input manually into the IF statement, and "no" if the date I'm testing is not within the range of dates I'll input manually into the IF statement.

Let's say cell A3 contains the date 2/21/2014. I want cell A4 to return "yes" if the date in A3 is >= 10/1/2013 and <= 12/31/2014, and I want cell A4 to return "no" if the date in A3 is either before 10/1/2013 or after 12/31/2014.

Since the AND argument does evaluate to "true" in this case, at least to my logical eye, I should get "yes" in cell A4, not "no".

When I type cell A4 =IF(AND(A3>=10/1/2013,<=12/31/2014),"yes","no") I get "no" in cell A4 regardless of what date values I type in manually in the IF and AND arguments.

If I simply enter dates 10/1/2013 and 12/31/2014 as dates in their own cells, and use those cell references in the argument for AND, it works. But I'd prefer not to do it that way. Is there a way to make Excel treat the character string 10/1/2013, for example, as a date in the AND argument, and not as text or numbers, which it appears to be doing?

Or must I simply enter the desired dates as dates in their own cells, etc.?
Reply With Quote