Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Multiple IFs & Ands

Hi Everyone   I am trying to create a conditional column that checks a number of criteria and, depending on the answer to those queries, gives a result.   To give some info, I have a table contai...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous ,

     

    You could use " in {1,2,3,4} " instead of using multiple equals.
    For example:

    column = IF(
    			([columnA] in {1,2,3,4}&&[columnB] in {"x","y"}) || ([columnA] not in {1,2,3,4}&&[columnB] not in {"x","y"}),
    				"OK",
    					if(
    						([columnA] in {1,2,3,4}&&[columnB] not in {"x","y"}) || ([columnA] not in {1,2,3,4}&&[columnB] in {"x","y"}),
    							"check") )

    Or you could use switch() function.

    Switch(true(), conditon, value, conditon, value)

    Best Regards,

    Jay