using Or in an if statement

I want to have the same result in an if statement using 2 answers. =if a1 =1 then b1 = Yes. I also want if A1 = 3 then b1= Yes. But any other number in a1 puts No in b1.

Posted on Oct 29, 2023 2:32 PM

Reply
Question marked as Top-ranking reply

Posted on Oct 29, 2023 5:44 PM

The SWITCH function, a recent addition to Numbers, is ideal for this type of problem.




=SWITCH(A1,1,"Yes",3,"Yes","No")


You put the reference to the cell you are testing Into the first argument.


Then you simply list switch-value, if-match pairs after that, with an optional default value at the end.


Easy to read and you don't have to deal with nested ( ).


More here:


SWITCH - Apple Support


SG


7 replies
Question marked as Top-ranking reply

Oct 29, 2023 5:44 PM in response to feaco

The SWITCH function, a recent addition to Numbers, is ideal for this type of problem.




=SWITCH(A1,1,"Yes",3,"Yes","No")


You put the reference to the cell you are testing Into the first argument.


Then you simply list switch-value, if-match pairs after that, with an optional default value at the end.


Easy to read and you don't have to deal with nested ( ).


More here:


SWITCH - Apple Support


SG


Oct 29, 2023 7:57 PM in response to SGIII

I said it was a helpful answer. I will have to study it some. Thank you for the help. Apple , IMO does not do a good job of showing sample answers. I miss the old Lotus 123 and also the Quattro manuals that had an example of every situation. To be fair, those programs did not have the power of the new programs.


Thank you for your response.

Oct 30, 2023 2:37 PM in response to Recycleur

I have had very little luck using Apple's examples. I tried for 3 days to work this out and was unable to use thew or statement with the formula until badunit gave me a great easy example. I solved my problem in 5 minutes after looking at his example. Perhaps I am trying to read something into the examples apple gives, but they seem to complicate them. Thanks for the reply. I do find this is a great place to get help in a hurry and I appreciate all of the responses.

Nov 1, 2023 11:00 AM in response to SGIII

Hello SGIII


I have a spreadsheet that had a large lookup table with several columns to look up. I played with using switch and nesting them. It works. The upside is I can eliminate the lookup table, the downside is you get some long formulas. I can see where both have advantages.


I think if the table is not too large, switch might be a good alternative.


Thanks for the information.


Frank

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

using Or in an if statement

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.