Alteryx Designer Desktop Discussions

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

Fill an entire column if a value is found anywhere in a another column?

vamaya
5 - Atom

Hello!

 

Newbie here trying to learn the basic functions.

 

I am trying to fill a column based whether a specific value is found at all in another column (not just in that particular row of the data). 

 

My initial data looks like this. 

Column AColumn B
Canada 
Mexico 
Spain 
Germany 

 

I want the Column B filled with “Germany” if that word is present at all anywhere in Column A.

 

Something like

IF "Germany" is present anywhere in? Column A   (This is the line of code I don’t know)

THEN "Germany"

ELSE ""

ENDIF

 

The results would look like this

Column AColumn B
CanadaGermany
MexicoGermany
SpainGermany
GermanyGermany

 

Or like this if Germany isn't on the list

Column AColumn B 
Canada 
United States 
France 
Japan 

 

Is this something that can be done?

 

Thanks for the help.

3 REPLIES 3
ponraj
13 - Pulsar

Attaching a sample workflow...

Workflow.PNGResults1.PNGResults2.PNG

BenMoss
ACE Emeritus
ACE Emeritus

Hey!

Heres how i would come to the solution.

Filter column A for the phrase Germany.

Then use the count tool to understand how many records are coming through the T. This will be either 0 (i.e. Germany does not exist) or more than 0 in which case germany exists.

I would then use the append tool to bring this value in line with every row in your original data stream, before building a simple formula to convert thay count into the appropriate value, i.e.

If count = 0 then ‘Germany’ else ‘’ endif

I hope this helps.

Ben

vamaya
5 - Atom

Thanks!, Both options work well.

I have selected option 2 as solution because that one is easier for me to leverage to include additional conditions.  Thanks both!

Labels