Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.

The highly anticipated Alteryx Community tradition is back! We hope you'll join us!

Learn More

Question about OR Statement


Hi all,


I am new to Alteryx, so I am guessing this is something simple; but i cannot figure it out.  (I have tried several variations of iif and if-then, with parenthesis everywhere).  When I run these two statements independently, they each work, but when I try to run them together with an OR, everything comes back as "No".  Can someone give me some guidance?


Statement 1  -  iif (!Contains([Position], 'Center'), 'No', 'Yes')

Statement 2  -  iif (!Contains([Position], 'Operation'), 'No', 'Yes')


Combined Statement - iif (!Contains([Position], 'Center') || !Contains([Position], 'Operation'),'No', 'Yes')


Thank you in Advance!

Alteryx Certified Partner
Alteryx Certified Partner

The way the logic works here is that if either is true, then the condition is true. Try reversing your conditions like this:


IIF(Contains([Position], 'Center') || Contains([Position], 'Operation'),'Yes', 'No')




Combining logical negations is always tricky. The formula you have only works if your input contains both Operation and Center. Anything else causes one of the or clauses to be true so the entire statement is true returning 'No'


 Or Not.png


Is this the result you want?  If you actually want it to return yes, if it contains 'Operation' or if it contains 'Center'  follow @CharlieS




It gets a little tricky because this is only part of a larger formula that I have; where if a few other conditions aren't met either it will default to "Yes".  So ideally I could use a logic like this to exclude instead of include.  Does that makes sense?  But I am open to any suggestions; i am just starting to learn.  Thank you


Oh, that is very helpful.  Thank you!  I am not sure how to get around this, as this is part of a larger formula where ultimately the default condition is "Yes".  So I want to the result to be "Yes" if it contains either Center or Operation or if it contained Center&Operation.


If you continue using exclusionary logic, change the "||" to "&&"  meaning if it's not Operation AND it's not Center return 'No' else return 'Yes'



Alteryx Certified Partner
Alteryx Certified Partner
With an OR statement only one piece of the statement has to be TRUE for the
'no' to be returned.

The only way your statement will return yes is if the cell contained both
centre and operation.

Take a few examples...

Center operation FALSE FALSE = Yes

Center Bob FALSE TRUE = No

Operation Bob TRUE TRUE = No

I think you want to use the AND operator, or alternatively remove the ! And
continue to use OR.


Since we're replying almost real time the post are showing up out of order.  Check out my post 2 above this one about changing the '||' to '&&'




That makes sense, I had my mind on "doesn't have this OR that OR that".  


Thank you!


Thank you! That makes sense to me.  I switched over to &&.