Alteryx Designer Desktop Discussions

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

If And

max_hfr
8 - Asteroid

Hi guys,

 

i'm new to alteryx. I was wondering how i can write this formula:

 

if [Column] >6 and <10 then [Column2]= "blue" 

 

I am having a hard time understing how to place an "and" in order to have 2 conditions.

 

Thanks in advance! 

2 REPLIES 2
MarqueeCrew
20 - Arcturus
20 - Arcturus

@max_hfr

 

Thanks for the iffy question.

 

IF
     [Column] > 6 AND [Column] <10     THEN "Blue"
ELSE
     "Yellow"
ENDIF

I assume that you are creating a new field, Column 2 in the formula tool.  I also assume that for column 2 that if it isn't Blue that you want something else.

 

Cheers,


Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
danilang
19 - Altair
19 - Altair

hin @max_hfr

 

Welcome to the community.

 

In writing conditional formulas, you need to define 3 things

  1. the column you're writing to.  This is the value in the output column(red arrow), which corresponds to Column2 in your example
  2.  The condition you're checking (red oval).  it's always of the form column operator value, i.e. [column1] > 6.  Multiple condiitions, like your [Column] >6 and <10 have to have the column name repeated for each clause, so it becomes [column1] > 6 AND [column1] < 10
  3. The values your writing to the output column.  (Green arrows).  Import to note here:  Don't include the output column name here, i.e don't put  [Column2]= "blue"   what this does is compare the value of Column2 for the current record to "Blue" and write true or false.

so your final text in the formula box becomes

 

if [column1] >6 and [column1] < 10 then
  "blue"
else
  "not blue"
endif

If and.png

 

 Dan

Labels