View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Hutchins Tom Hutchins is offline
external usenet poster
 
Posts: 1,069
Default MS Excel If statement containing AND within an OR

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

"prog" wrote:

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))