Alteryx Designer Desktop Discussions

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

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

cambiukpytou_dup_420
6 - 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"

7 REPLIES 7
AndrewS
11 - Bolide

Hi @cambiukpytou_dup_420 

 

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

TonyA
Alteryx Alumni (Retired)

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

 

 

AndrewS
11 - Bolide

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

 

@cambiukpytou_dup_420  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.

cambiukpytou_dup_420
6 - 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".


cambiukpytou_dup_420
6 - 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?

AndrewS
11 - Bolide

Hi @cambiukpytou_dup_420 

 

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

cambiukpytou_dup_420
6 - Meteoroid

hey @AndrewS 

 

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

Labels