Free Trial

Alteryx Designer Desktop Discussions

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

How can i write a IF statement that allows me to change Aliases for multiple items

ahsansalik
8 - Asteroid

How can i write a IF statement that allows me to change Aliases for multiple items in a column A as output in Column B also that all of the below names are from Electrical and Mechanical Department

DepartmentColumn A 

Column B

Electrical

Adrian

Adi

Mechanical

Jack

Jackers

Electrical

Shane

Sha

ElectricalJenny

Jeniffer

MechanicalJade

Ja

 

I have written a statement like this

 

IF [Department] ='Electrical' and [Column A] =' Adrian' then 'Adi' elseif [ Department ] = 'Electrical' and [Coloumn A] = ' Shane' and 'Sha' elseif [Department] ='Mechanical' and [Column A] = 'Jade' then 'Ja' else [NULL] endif 

its not working somehow i am using the formula tool for this purpose

5 REPLIES 5
atcodedog05
22 - Nova
22 - Nova

Hi @ahsansalik 

 

Find and replace would be best approach for this. You can look up from a table and replace.

 

https://help.alteryx.com/20212/designer/find-replace-tool

 

Hope this helps : )

Jean-Balteryx
16 - Nebula
16 - Nebula

Hi @ahsansalik ,

 

If you copy pasted your formula then there is a typo :

 

IF [Department] ='Electrical' and [Column A] =' Adrian' then 'Adi' elseif [ Department ] = 'Electrical' and [Coloumn A] = ' Shane' THEN 'Sha' elseif [Department] ='Mechanical' and [Column A] = 'Jade' then 'Ja' else [NULL] endif 

 

I replaced a "and" with "THEN".

 

Also, @atcodedog05's suggestion might be considered based on your need.

atcodedog05
22 - Nova
22 - Nova

Hi @ahsansalik 

 

You can do something like below. Best option if you have mutiple names. You can use join tool too. Just check which works best in your screanrio.

 

atcodedog05_0-1628062560804.png

 

 

Hope this helps : )

atcodedog05
22 - Nova
22 - Nova

And if you want to fix the same formula and get it working @Jean-Balteryx has suggested the fix for it. 🙂

 

I didnt look into the formula much directly went to the mapping approach 😅

ahsansalik
8 - Asteroid

Thanks Guys for your help as i learn new and new stuff from you all here 🙂

Labels
Top Solution Authors