Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Using If then string to assign codes

tpostlewate
7 - Meteor

I promise I will only have 3 or 4 more questions today...

What I am using: 
IF [New age] = "" THEN "0" ELSEIF [New age] > "44" THEN "2" ELSE "1" ENDIF

In English this is what I am trying to accomplish- If the [New age] field is blank, I either want to move a "0" to the new field [formula age] or just move the blank. Whichever is easier. If [New age] is greater than 44, move a 2 to the new field, and finally, if it is less than 44 move a 1.

 

The problem is it codes a 1 for all of the blanks. I think I understand why it is doing that, I just don't know how to fix it. It is doing great on those 2 codes, but the 1s are giving me fits.

2 REPLIES 2
Emil_Kos
17 - Castor
17 - Castor

Hi @tpostlewate,


Can you try this?

 

IF IsEmpty([New Age]) THEN "0" ELSEIF [New age] > "44" THEN "2" ELSE "1" ENDIF

 

I think this part might be problematic: [New age] = ""

tpostlewate
7 - Meteor

Brilliant! Worked perfectly! 🙂

Labels
Top Solution Authors