Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Multiple AND's in an IF Statement

shaheer
8 - Asteroid

If these values A1, B1, C1 and so on are equal to their counterparts A2, B2, C2 and so on, I want to output "TRUE" in the new To Be Removed column. So I have a formula that looks like this (please note I have changed the variable names to A1, A2 for simplicity).

 

shaheer_0-1670537518163.png

 

I have no idea how to format this if statement to work the way I want it. 

 

8 REPLIES 8
PanPP
Alteryx Alumni (Retired)

Hi @shaheer 

 

Try the following expression below:

 

If [A1] = [A2] then "True" elseif [B1] = [B2] then "True" elseif [C1] = [C2] then "True" elseif [D1] = [D2] then "True" elseif [E1] = [E2] then "True" else "False" endif

 

 

Hope this helps, if it does please like this post and if it helps resolve your problem, mark it as a solution. If you have any other questions, please let us know.

binuacs
21 - Polaris

@shaheer Your formula should work

 

binuacs_0-1670538209331.png

 

shaheer
8 - Asteroid

When I try the formula, I get invalid operator error. 

shaheer_0-1670538530142.png

 

binuacs
21 - Polaris

@shaheer Can you check the data type of the fields you are using in this formula? all should be the same data type

shaheer
8 - Asteroid

I just checked and it turns out A1, A2, E1, E2 are Booleans. I assumed Alteryx would count them as strings since their values say either TRUE or FALSE. How can I modify the formula?

PanPP
Alteryx Alumni (Retired)

You can use a select tool before the formula tool to convert the data types before using the columns in the expression within the formula tool.

 

Hope this helps.

binuacs
21 - Polaris

@shaheer Boolean and Strings are different data types. you need to convert them into strings then try again with your formula. One way of changing alll in to string type is with the Multi-Field formula

binuacs_1-1670539076897.png

 

 

shaheer
8 - Asteroid

Yes, completely forgot we can change the data types from there. Thank you so much!

Labels