MrExcel Consulting
Your One Stop for Excel Tips & Solutions

if and - if or statements


Posted by wheatear1 on February 27, 2001 10:38 AM

If I want to set up an if statement that returns the following, how di I do it?

if x is between 0 and 70 AND x is between 310-360,
then convert it to .1

Thanks in advance!

Posted by Mark W. on February 27, 2001 10:54 AM

Huh?

x can never be between both of these ranges.

Posted by Aladin Akyurek on February 27, 2001 11:03 AM

Re: Huh? AND what is to be modified: x or something else? *NT*

Posted by David Hawley on February 27, 2001 8:46 PM


Hi wheatear1

I'm guessing meant X and Y if so this formula below will do it.

=IF(AND(A1>0,A1<70,B1>310,B1<360),"Yes","No")


Where A1 is the X and B1 is the Y.


Dave

OzGrid Business Applications

Posted by Aladin Akyurek on February 27, 2001 11:53 PM

Also why not:

=IF(OR(AND(A1>0,A1<70),AND(A1>310,A1<360)),0.1,""),

where x in A1.

It would be nice if wheatear1 would like to reformulate the question.

Posted by Carl B on February 28, 2001 12:00 AM


As stated elsewhere, x can not be both, therefore I will assume that it should be between 0 and 70 OR betweeb 310 and 360, if so use a Select Case statement.
Select Case x
Case 0 to 70, 310 to 360
x = .1
End Select