In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests after December 31, 2025. Set up your security questions now so you can recover your account anytime, just log out and back in to get started. Learn more here
Start Free Trial

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
8 - Asteroid

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
Top Solution Authors