Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Upgrade Alteryx Designer in 10 Steps

Debating whether or not to upgrade to the latest version of Alteryx Designer?

Alteryx Gallery is experiencing a problem in which system emails are not being sent out. As a result, if you are attempting to sign up for a new account, you may be unable to verify your email address. We are working to solve this as soon as possible and will remove this notice once resolved.

Using Contains In a IF Statement



When I use Contains in an IF statement do I need to include  =-1 to ensure I only get entries where the statement is true?  I know that if I'm looking for anything that is false I would need =0.   However, I don't know if the  =-1 is just overkill or if it is really needed.  Would the 2 examples below yield the same results?


Here is an example of what I'm talking about


IF Contains("ABC123", [letters]) = -1 THEN "Awesome" ELSE "Shucks" ENDIF

IF Contains("ABC123", [letters])  THEN "Awesome" ELSE "Shucks" ENDIF


Alteryx Certified Partner
Alteryx Certified Partner

The Contains function returns True and False values, so, you basically don't need to make It explicit like you're saying.

Another way to force a false statement would be using the exclamation (!) sign.

For example,

IF !Contains([letters], "ABC123") THEN "Awesome" ELSE "Shucks" ENDIF

This basically means "If the field letters does not contain ABC123, then return Awesome.

Another thing you should consider is that the field comes First, your target comes Second. So switch positions in your contains expression to make It work properly.