ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

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

IF AND Contains Statement

jenki07
5 - Atom

hello - 

 

I am trying to write a formula given the following: if column [A] contains 'bottle' and column [B] contains 'blister' then 1 else 0. 

 

 

4 REPLIES 4
Felipe_Ribeir0
16 - Nebula

Hi @jenki07 

 

Try like this:

 

if CONTAINS([ColumnA], 'bottle') and CONTAINS([columnB], 'blister') then 1 else 0 endif

 

Felipe_Ribeir0_0-1669059102393.png

 

DataNath
17 - Castor
17 - Castor

Hey @jenki07, the syntax here just needs cleaning up a little and you'll also need to add 'endif' to close out the statement:

 

if Contains([A], 'bottle') and Contains([B],'blister') then 1 else 0 endif

 

DataNath_0-1669059089522.png

DenisZ
11 - Bolide

Try this in the formula tool

 

IF [A] = "bottle" AND [B] = "blister" THEN 1 ELSE 0 ENDIF

 

Should hopefully work. 

KrishnaChithrathil
11 - Bolide

@jenki07 

another way of doing the same.

KrishnaChithrathil_0-1669102879178.png

I hope this is your real scenario. 

Labels
Top Solution Authors