# Archive of Mr Excel Message Board

Back to Forms in Excel VBA archive index
Back to archive home

## 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

 Check out our Excel Resources

## Huh?

Posted by Mark W. on February 27, 2001 10:54 AM
x can never be between both of these ranges.

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

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

## Re: if and - if or statements

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

## Re: if and - if or statements

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.

## Re: if and - if or statements

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

This archive is from the original message board at www.MrExcel.com.