Join the Alteryx Community’s Maveryx Summer Cup event! Compete, network with others, and earn your gold through a series of challenges from July 24th to August 11th. Learn more about the event here.

Alteryx Designer Desktop Discussions

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

Formula for valid building if then statement

lynettejackson
7 - Meteor

I am unable to get the valid building rooms with the Contain statement. I am looking for 48A,48B,48C,48U,77,87,87B,98A,98B is valid else invalid type statement.

 

Contains([OS: Building],48A,48B,48C,48U,77,87,87B,98A,98B)

2 REPLIES 2
apathetichell
19 - Altair

those are strings. try:

if [Building] in ("48A","48B","48C","48U","77","87","87B","98A","98B") then "valid" else "invalid" endif

 

In  your case the full logic is probably

formula tool - new column Valid

if [Building] in ("48A","48B","48C","48U","77","87","87B","98A","98B") then "valid" else "invalid" endif

 

Contains is also 1 argument compared to 1 argument. In - looks at a full list.

 

hellyars
13 - Pulsar

Here is a slightly different approach.  This uses an input table and a join to filter the valid buildings, etc.  @apathetichell 's approach is simpler and spot-on.  The approach depicted here might be useful if you expect the list to change or significantly expand. 

 

Screen Shot 2021-05-04 at 6.50.46 PM.png

Labels