Start Free Trial

Alteryx Designer Desktop Discussions

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

IF statement to change data in one column depending on a second column

MarkGi
7 - Meteor

Hi

I think this should work but I guess I am missing something fairly basic in the syntax.

 

I have two columns with dept codes ie

Column 1:  Column 2:

TDD             111

TDA             123

TDB             133     

TDD             111

 

What I am trying to do is change the code in column 1 to a new code depending on the data in column2 .  So I have in the formula node -
Output Column set as Column1

IF [Column2] == '111' THEN [Column1] == 'TDX' ELSE [Column1] ENDIF 

 

So I should end up with 

Column 1:  Column 2:

TDX             111

TDA             123

TDB             133    

TDX             111

 

When I run it, instead of TDX I have a 0 returned for the 111 rows

 

Any suggestions would be very appreciated

3 REPLIES 3
ed_hayter
13 - Pulsar

IF [Column2] = '111' THEN 'TDX' ELSE [Column1] ENDIF

 

I think should work assuming your column 2 is a string

 

image.png

 

JamesCharnley
13 - Pulsar

@MarkGi 

 

When you're updating a column, you don't need to reference it again in the formula. The following should work if it's numerical, you just need to wrap the 111 in '' if it's a string.

 

image.png

MarkGi
7 - Meteor

Thanks - I thought it might be syntax.

Labels
Top Solution Authors