Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Assign One Value in Separate Column Based on Multiple Values

CS382
5 - Atom

Hello All,

 

I'm very new to Alteryx and I'm trying to assign a category to separate values. My table is below.

 

BUFlex 1
648 
BE 
CE 
TE 
645 

 

In column Flex 1, I'm trying to assign "US" to BE, CE, and TE and also assign "4N" to 648 and 645. This is just a sample so my BU column is significant.

 

I've tried the formula tool using the IF/ELSE (If [BU]="BE" or "CE" or "TE" then "US" else "4N" endif) statement but the entire BU column shows only as US or 4N depending on whether I use OR or AND.

 

I'd be grateful for any help.

 

Thanks!

2 REPLIES 2
phottovy
13 - Pulsar
13 - Pulsar

Hi @CS382,

 

Your syntax is off a little. You need to include the relevant column in each of your "Or" clauses. Try these alternatives: 

 

If [BU]="BE" or [BU]="CE" or [BU]="TE" then "US" else "4N" endif

Less code:
IIF([BU] in ('BE', 'CE', 'TE'), 'US', '4N')

 

 

CS382
5 - Atom

Thank you so much! It worked perfectly!

Labels