0

I have coded on C# before and know all of the basics to do with loops and statements. I have been trying to make a simple IF statement on excel but a very unhelpful error comes up every time I try and run it. I was wondering if anyone would be able to point out what I'm doing wrong here -

I'm just trying to output a "Yes" If cell h14 is greater than 250 OR less than 250 AND cell I14 is greater than 0.15 OR less than -0.15 else output "No"

This is what I came up with but it doesn't seem to work: IF((H14>=250 OR H14<=-250) AND (I14 >= 0.15 OR I14 <= -0.15),"Yes", "No")

Many Thanks

1 Answer 1

5

The AND and OR are in the wrong place:

IF(AND(OR(H14>=250,H14<=-250),OR(I14 >= 0.15,I14 <= -0.15)),"Yes", "No")

The AND() and OR() statements are set up the same:

AND(criteria1,criteria2,...)

So we nest each inside the other.

As per your comment to deal with errors, wrap the whole in IFERROR():

=IFERROR(IF(AND(OR(H14>=250,H14<=-250),OR(I14 >= 0.15,I14 <= -0.15)),"Yes", "No"),"")

Change the "" at the end to what ever you want. As it stands it will return an empty cell when there is an error.

Sign up to request clarification or add additional context in comments.

5 Comments

Saviour! Thank you very much works a treat, I think I understand how it works now!
@mot375 please come back in 10 minutes and mark as correct.
Would you be able to quickly explain to me how to embed an IF x= Error.Type(#DIV/0!) then output.... on Excel?
@mot375 not sure I understand what you are asking.
So if the contents of the cell displays #DIV/0! I can output something else?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.