# Thread: Combined AND and OR statement (Excel XP)

1. ## Combined AND and OR statement (Excel XP)

Hi all,

Perhaps someone can show me why I can't get this formula to work:

=IF(OR((AND(A1>0,A1<10),(AND(B1>0,B1<10)),"OKAY",0 )))

I've moved the parenthisis all over the place with no luck.

I think the formula is straight forward, but just to explain the situation:

If a number in EITHER a first or second cell is greater then 0 and less then 10, I want a response in a third cell informing me that has occurred.

The formula seems correct (to me at least!). Is it not possible to compine two AND statements within an OR statement?

Thanks,
BH Davis

2. ## Re: Combined AND and OR statement (Excel XP)

It is possible - you've just got your brackets muddled. The following works for me:

=IF(OR(AND(A1>0,A1<10),AND(B1>0,B1<10)),"OKAY",0)

3. ## Re: Combined AND and OR statement (Excel XP)

Is this what you need?

<code>
=IF(OR(AND(A1>0,A1<10),AND(B1>0,B1<10)),"OKAY",0)
</code>

4. ## Re: Combined AND and OR statement (Excel XP)

Thank you to both of you !

It was the bracket in front of the second AND that was getting me. I thought you had to have a bracket in front of every OR and AND statement.

Thanks again,
BH Davis

5. ## Re: Combined AND and OR statement (Excel XP)

You don't have to, but you can - as long as you put the matching right parenthesis in the correct place. Yours weren't.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•