Multiple AND's in an IF Statement
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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).
I have no idea how to format this if statement to work the way I want it.
Solved! Go to Solution.
- Labels:
- Help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
When I try the formula, I get invalid operator error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@shaheer Can you check the data type of the fields you are using in this formula? all should be the same data type
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Yes, completely forgot we can change the data types from there. Thank you so much!
