community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
#SANTALYTICS

The highly anticipated Alteryx Community tradition is back! We hope you'll join us!

Learn More
SOLVED

How to change values in Column A, based on condition in Column B

Meteoroid

Hi I am trying to change values in Column B based on criteria met in Column A.

 

clipboard_image_2.png

 

For example, I want Column B to update each row B where the first 3 letters in Column A are read as "REC"

 

and I want Column B to update each row S where the first 3 letters are read as "Pay"

Asteroid

Hi @cambiukpytou 

 

Assuming you just want to populate the data from A into B you could try a formula tool using Column B as the output column:

 

if Left([Column A], 3) = "Rec" then [Column A]
elseif Left([Column A], 3) = "Pay" then [Column A]
else Null()
endif

Alteryx
Alteryx

I was about to post something but @AndrewS called it. As an alternative, you could use StartsWith([Column A], "Rec").

 

 

Asteroid

@TonyA  - I forgot about StartsWith. I tend to stick to the old excel style formulas and I need to go beyond these. 

 

@cambiukpytou  To avoid a truncate warning, if FieldB is read in as only a string length of 1 you might need to add a select tool and set the length a bit higher to accommodate the new data.

Meteoroid

Hi AndrewS

No i do not want to populate from A into B. I want data in B to be as
described based on conditions in Column A.

For example,

If Column A has the first 3 letters REC, then I want that same row item in
Column B to say "B".
If ColumnA has the first 3 letters Pay, then i want the same row item in
column B to say "S".


Meteoroid

So then the formula was have a expression as 

 

If StartsWith([Column A], "Rec"), then [Column B] = "B" ----?

 

Please imagine that Column B is actually blank. I left the B and S in there to show everyone what i want the output to look like.

 

Would this generate a B, for every Rec in column A?

Asteroid

Hi @cambiukpytou 

 

You just need to change the original formula to:

 

if Left([Column A], 3) = "Rec" then "B"
elseif Left([Column A], 3) = "Pay" then "S"
else Null()
endif

Meteoroid

hey @AndrewS 

 

With the output column set to Column B. Got it thanks!!

Labels