cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

How to use IF / AND condition with logical OR formula

DanM
Deputy Chef I
Deputy Chef I

Hi, I'd like to test IF variable a is equal to something AND variable b is either equal to value 1 OR value 2.

I've set up the IF condition similar to below, but can't seem to get the IF condition to evaluate true when variable b is equal to value 2. I can use a more drawn-out set of nested IFs, but I wondered if anyone can help me work out what I'm doing wrong?

IF condition:

Screenshot 2024-05-20 131349.png 

IF evaluates false when variable b is equal value 2:

Screenshot 2024-05-20 131034.png

Cheers,

Dan.

1 ACCEPTED SOLUTION

gary1
Executive Chef III
Executive Chef III

You can do it all in a single conditional like this:

 

##IF variable a is equal to something AND variable b is either equal to value 1 OR value 2

variable_a == something && (variable_b == value1 || variable_b == value2)

 

 

View solution in original post

2 REPLIES 2

gary1
Executive Chef III
Executive Chef III

You can do it all in a single conditional like this:

 

##IF variable a is equal to something AND variable b is either equal to value 1 OR value 2

variable_a == something && (variable_b == value1 || variable_b == value2)

 

 

DanM
Deputy Chef I
Deputy Chef I

Thanks Gary, that works perfectly!