We're excited to announce that we'll be partnering with Credly starting October 19th - see what this means and read the announcement blog here!

Alteryx Designer Discussions

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

IF and Contain Formula

DanGordon7
5 - Atom

Hi,

 

I have a scenario where I need to set a value range from 1 to 4 based on a name appearing in two columns and then if this contains a "-" sign.

 

In the below example, the focus is on Company A.

 

 

DanGordon7_1-1623838051515.png

 

If this company is showing in the In column and the value does not contain a "-" I need to automatically populate a 0. If there is a "-" sign within the value field the ID should be set to 2.

 

If Company A is showing in the Out column and the value does not contain a "-" sign within the value field I need to set a 3 and a 4 if this contains a "-" sign.

 

Many thanks,

2 REPLIES 2
mceleavey
16 - Nebula

Hi @DanGordon7 ,

 

Can you post the data rather than a screenshot so we can help?

 

Thanks,

 

M.

Maskell_Rascal
13 - Pulsar

Hi @DanGordon7 

 

This formula would work for the scenario you provided. 

IF [In]="Company A" AND !Contains(ToString([Value]),'-') 
THEN '0'
ELSEIF [In]="Company A" AND Contains(ToString([Value]),'-')
THEN '2'
ELSEIF [Out]="Company A" AND !Contains(ToString([Value]),'-')
THEN '3'
ELSEIF [Out]="Company A" AND Contains(ToString([Value]),'-')
THEN '4'
ELSE ''
ENDIF

 

Maskell_Rascal_0-1623859086184.png

Cheers!

Phil

 

Labels