Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

IF Contains

summarizer
9 - Comet

I've read several posts, but haven't found my exact question/answer.  I have strings of several words in my SENDER column.  I am creating a second column IF one of those words is Mickey or Minnie.  I need to add about 5 more names and I have tried wording this different ways with IIF and with ELSEIF, etc, but I'm not quite getting it.  Any thoughts on how to properly form this?  Or is there an easier way?  Thanks!

 

 Alteryx if.jpg

4 REPLIES 4
Kenda
16 - Nebula
16 - Nebula

Hey @summarizer! You will want to try something like this:

 

IF CONTAINS([Sender],"MICKEY") THEN "MICKEY" ELSEIF CONTAINS([Sender],"MINNIE") THEN "MINNIE" ELSE NULL() ENDIF

This uses elseif statements of the ||. You can extend it to include your other names as well. Hope this helps!

StephenR
Alteryx
Alteryx

You will need an IF ELSEIF ELSE statement

 

IF Contains([Sender], "MICKEY") THEN

"MICKEY"

ELSEIF Contains([Sender], "MINNIE") THEN

"MINNIE"

ELSE

Null()

ENDIF

Regards,
Stephen Ruhl
Principal Customer Support Engineer

summarizer
9 - Comet

Thank you both! 

cyeager
7 - Meteor

Thanks for your post, how do we write the script if we're using an In Database formula?  Do we have to write three separate scripts, different wording, or can it only be written in a out of Database formula?  Thank you, Chuck

Labels