How to write this code If @br != 'X' OR 'Y' OR 'Z' AND @PROF=='N'

1 Answer 1


This question is honestly pretty bad and likely should be closed due to lack of details/efforts displayed, but as its a fairly simple answer, I thought I would put something up for those that face the same issue.

You would want to write this utilizing parenthesis to group together the nested logic statements.

So This would be what you want:

IF (@BR != 'X' OR @BR != 'Y' OR @BR != 'Z') AND @PROF == 'N' THEN

Or if you want to get fancy, you can fake an 'INCLUDES' in AMPscript using IndexOf, like below and limit it to just the two logic statements/conditionals.

IF INDEXOF("|X|Y|Z|",CONCAT("|",@BR,"|")) < 1 AND @PROF = 'N'

This will compare your @BR var (using the bars to help contain it to do a hard match and not a soft match) to the string with your specific excluded values (again use bars on either side to force a hard match). Meaning it will return 1+ if BR value is in that string, negating the condition.

Not the answer you're looking for? Browse other questions tagged .