MS Excel If statement containing AND within an OR

P

prog

Hi,

I have a quick question on how to add a AND statement within an OR. Like
the below:

if(OR(x=1, y=2, b=3,( j=5 AND t=9 AND p=4))
 
T

Tom Hutchins

From your use of variables in the statement, it looks like you are asking
about combining OR with AND in an IF statement in VBA. That could be done
like this:

If (x = 1) Or (y = 2) Or (b = 3) Or (j = 5 And t = 9 And p = 4) Then

If you mean how to combine OR with AND in a worksheet IF function, that
could be done like this (I have replaced the variables with cell references):

=IF(OR(H1=1,H2=2,H3=3,AND( J1=5,J2=9,J3=4)),TRUE,FALSE)

Hope this helps,

Hutch
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top