Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start Free Trial

Alteryx Designer Desktop Discussions

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

IF THEN to change data

KatyGuarneri
5 - Atom

Hi

I am trying to use an IF Then formula to change the data, however when the condition is met, rather than return the text string, it returns a "0".  

 

Here is the formula I have written:

IF [SKU NUMBER]='126091' THEN [VINTAGE]='Y2020' ELSE [VINTAGE]ENDIF

 

The formula is looking at this data set:

KatyGuarneri_0-1592675860938.png

And when it finds the SKU NUMBER 126091 instead of changing the vintage to 'Y2020' it returns a '0'

KatyGuarneri_1-1592675955533.png

 

The data type for SKU NUMBER and VINTAGE are VW_String

 

Thank you to anyone who can help me with this.  

 

 

4 REPLIES 4
MarqueeCrew
20 - Arcturus
20 - Arcturus

@KatyGuarneri ,

 

a formula acts on either an existing variable or a new variable. So....

 

IF [SKU NUMBER] = "126091" THEN "Y2020"

ELSE [VINTAGE]
ENDIF

 

Cheers,

 

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
KatyGuarneri
5 - Atom

@MarqueeCrew Thank you SO MUCH!!  

KatyGuarneri
5 - Atom

One more question....

I have about 50 different SKU NUMBERS that I would like to follow the same rule. 

IF [SKU NUMBER] = XYZ THEN 'Y2020' ELSE [VINTAGE] ENDIF

Rather than create 50 individual if/then statements what would be a recommended formula to use?  

Thank you for any help you can provide.  

MarqueeCrew
20 - Arcturus
20 - Arcturus

@KatyGuarneri ,

 

IF [SKU NUMBER] IN ("12345","12353","12361")

THEN "Y2020"

ELSE [VINTAGE]
ENDIF

 

cheers,

 

mark

 

p.s.  It's okay to mark this as a solution too.

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Labels
Top Solution Authors