Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Jan 2002
    Location
    CT
    Posts
    361
    Thanks
    0
    Thanked 1 Time in 1 Post

    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. #2
    5 Star Lounger
    Join Date
    Dec 2000
    Location
    Reading/Swindon, Berkshire, United Kingdom
    Posts
    664
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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. #3
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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>
    Legare Coleman

  4. #4
    3 Star Lounger
    Join Date
    Jan 2002
    Location
    CT
    Posts
    361
    Thanks
    0
    Thanked 1 Time in 1 Post

    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. #5
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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.
    Legare Coleman

Posting Permissions

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