Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to enter a formula to display text according to an IF condition. The best I can manage is something like...

=IF(myval>=minval & myval <= maxval, "OK", "Not OK")

But this appears to work exactly wrongly, displaying OK when myval is out of range and Not OK when it is in range. How do I specify the logical AND correctly? I have tried && as I have seen in questions here, and inner brackets, but these result in errors.

share|improve this question

1 Answer 1

up vote 16 down vote accepted

The logical operations are represented by formulae:

 AND( condition1 , condition2 , ... )

 OR( condition1 , condition2 , ... )

 NOT( condition )

Each condition can be pretty much anything with a logical evaluation, meaning you can nest logical operations by nesting the formulae as required.

So in your case you need:

 =IF( AND( myval>=minval , myval <= maxval ), "OK", "Not OK")
share|improve this answer
    
Thank you. –  Brian Hooper Jan 7 '11 at 13:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.