1

In excel or google sheets, is there an 'if' function equivalent to the sql 'when A in (X,Y,Z). Currently I use: if(and(A=X, A=Y, A=Z), then, else). Wondering if there is an: if(in(X,Y,Z)=A, then, else).

Thanks

3
  • Are a b and c constant or cell references? Commented Jan 24, 2015 at 20:03
  • 1
    Something along the line of If(IsError(Match(A, {X,Y,Z},0)), else, then) Commented Jan 24, 2015 at 20:07
  • Or have a look at these answers stackoverflow.com/questions/8618168/… Commented Jan 25, 2015 at 10:54

1 Answer 1

2

Just updating the answers Here slightly, for Excel and Google Sheets

=IF(OR(A1={1,2,3,4,5}),"Yes","No")

or

=IF(ISNUMBER(MATCH(A1,{1,2,3,4,5},0)),"Yes","No")

For Open Office

=IF(OR(A1={1;2;3;4;5});"Yes";"No")

or

=IF(ISNUMBER(MATCH(A1;{1;2;3;4;5};0));"Yes";"No")
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.