Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Help with IF THEN

J25607
6 - Meteoroid

New to Designer.  My field name is [AG/UG] and contains these numeric values (3000, 3100, 7000, and 7100).  Trying to write an IF THEN statement that would change the 3100 and 7100 to equal "AG" (just the letters) text string, and, to change the 3000 and 7000 to equal "UG".  Your help is greatly appreciated!

11 REPLIES 11
Luke_C
17 - Castor

Hi @J25607 

 

Assuming your field is numeric you could do the below. If it's text then put quotes around the numbers.

 

IF [AG/UG] IN (3100,7100) then 'AG'
ElseIf [AG/UG] IN (3000,7000) then 'UG'
Else Null()
Endif

 

Luke_C_0-1659544967986.png

 

 

ChrisTX
15 - Aurora

You'll need to create a new field, because the data type will be text

 

IF [my field] IN (3100, 7100) THEN "AG"

ELSEIF [my field] IN (3000, 7000) THEN "UG"

ELSE "<unknown>"

ENDIF

 

Chris

J25607
6 - Meteoroid

Luke, tried your suggestion.  Still get an error.

 

Chris, how/where would that new field be created?

 

Thanks!

Luke_C
17 - Castor

Hi @J25607 

 

You'll need to be more specific and include the error to get any meaningful help. My solution is the same as what @ChrisTX 's is. You'd do it by adding a new field in the formula tool - see attached.

 

 

J25607
6 - Meteoroid

Thank you both!!

Luke_C
17 - Castor

You're very welcome! Be sure to mark the solution(s)

ChrisTX
15 - Aurora

Create a new field: Use the Formula tool

 

Suggestion for just starting to use Alteryx:  at the top of this page, try Learn > Academy

  Learning Paths

  Interactive Lessons

  Videos

 

 

J25607
6 - Meteoroid

Luke, sorry but this is still returning the numeric values no the AG & UG.  I copied your formula as is. 

Luke_C
17 - Castor

@J25607 Provide a screenshot please, or your workflow.

Labels