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.
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.
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:
SG
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:
SG
Formula in cell B1 =IF(OR(A1=1, A1=3), "Yes", "No")
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.
feaco wrote:
... does not do a good job of showing sample answers.
Open the Format sidebar with the paintbrush in the toolbar. Type = in a cell and the list of functions will fill the sidebar. Plenty of examples for each function there.
Oh! and try to not give the Best answer mark to your own answer.
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.
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 does exactly what I asked for. Thank you for your response. I like the comment below, but this clarifies what I need to do.
using Or in an if statement