If = A or B or C then

Hi all! I currently understand how to use the if function, but is it possible to use it with the OR operator?

Here is a photo of what I currently have…it is very simple, IF it is equal to SILAC or ATHENE or NLG, then leave blank, if not equal then state the name of the carrier. Unfortunately I do not think the “or” operator works as I was hoping it would

I understand that I could build multiple if statements within each other, but I was really hoping to avoid that for simplicity purposes

1 Like

The “or” operator works on logical values - “true” or “false”. A comparison like:

1.request.q47_carrier1 = SILAC

will give a “true” or “false” value. The rest of your If statement is then treating ATHENE and NLG as logical values - because they’re non-null, they’re treated as “false”.

What you want is:

(1.request.q47_carrier1 = SILAC) or (1.request.q47_carrier1 = ATHENE) or (1.request.q47_carrier1 = NLG)

That way you’re doing an “or” operation on the results of all the comparisons. It’s also worth using the round brackets so you don’t have to worry about which operators take precedence (the “=” or the “or”).

6 Likes

Thank you! It has worked perfectly

Screen Shot 2022-11-12 at 10.24.08 AM

1 Like