Free Trial

Alteryx Designer Desktop Discussions

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

Formula for IF

JingYih_Herbalife
8 - Asteroid

Hi,

 

I would like to do a formula where if column Country 1 is "Hong", then "Country 1 + Country 2 + Country 3" 

 

 

Country 1Country 2Country 3
Cambodia  
HongKong 
HongKongRO

 

End result would be as below;

 

Country 1
Cambodia
Hong Kong
Hong Kong RO

 

Appreciate some guidance on using formula.


Thanks in advance.

3 REPLIES 3
ShankerV
17 - Castor

Hi @JingYih_Herbalife 

 

IF [Country 1] = "Hong"

THEN [Country 1]+[Country 2]+[Country 3]
ELSE [Country 1]
ENDIF

 

Many thanks

Shanker V

caltang
17 - Castor
17 - Castor

Let me add on to @ShankerV 's quick one to account for trailing whitespace:

 

IF [Country 1] = "Hong"

THEN [Country 1]+[Country 2]+
 (IF IsEmpty([Country 3]) 
 THEN NULL()
 ELSE [Country 3]
 ENDIF)

ELSE [Country 1]

ENDIF

 

Otherwise, you can use Shanker's formula provided your data cells are not empty - make them Null() to be sure to avoid trailing whitespace OR you can use a Data Cleanse tool thereafter the formula to clear whitespace as well.

 

Hope this helps!

 

-Cal

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
ChrisWaspe
9 - Comet

Hi @JingYih_Herbalife . I see this is already resolved so dont bother replying. You can create a dynamic process which combines all columns, whether there are 2 or 20, depending on if the first column is Hong. Please see the workflow attached, as a completely overcomplicated solution to a simple question.

Labels
Top Solution Authors