Alteryx Designer Desktop Discussions

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

Using Formula Tool - How to compare 2 columns with condition?

ravikumar060987
8 - Asteroid

Dear All,

I have situation where need to compare 2 columns with conditions in both the columns, refer the below table. Please urge how I can write the formula in the Formula tool to get the output in simple way.

 

ABOutput
011X, 1YTRUE
022A, 2BTRUE
033D, 3ETRUE

 

Without using any mapping?

4 REPLIES 4
FinnCharlton
13 - Pulsar

Hi @ravikumar060987 , what logic are you using to get this output? What comparison are you doing? Can we have an example of when the output should be true and an example of when it should be false?

ravikumar060987
8 - Asteroid

Hi @FinnCharlton 

Am looking something like - IF ([COL A] = 1) = (COL B = 1X & 1Y) THEN 'TRUE' ELSE 'FALSE' ENDIF. Is that possible?

ShankerV
17 - Castor

Hi @ravikumar060987 

 

This formula will help you. Kindly check whether this you are looking for,

 

IF [A]="01" AND Contains([B],"1X") AND Contains([B],"1Y")
THEN "TRUE"
ELSE null()
ENDIF

 

ShankerV_0-1675967077635.png

Many thanks

Shanker V

ShankerV
17 - Castor

Hi @ravikumar060987 

 

I have amended the formula as you need the result as False if the condition is failed.

 

IF [A]="01" AND Contains([B],"1X") AND Contains([B],"1Y")
THEN "TRUE"
ELSE "FALSE"
ENDIF

 

ShankerV_0-1675967548157.png

 

Many thanks

Shanker V

Labels