Multiple Choices Within IF Function


Posted by TEE Davis on March 24, 2001 7:29 AM

How can I use an OR Function inside IF Functions?
Example: If A1 = FB2037,FB2067,or FB5050 enter TPN-19 else enter GPN-22

Posted by STEVE on March 24, 2001 7:53 AM


TEE,
TRY THIS

=IF(OR(A1="FB2037",A1="FB2067",A1="FB5050"),"TPN-19","GPN-22")

STEVE

Posted by Mark W. on March 24, 2001 9:05 AM

Or...use an array constant...

{=IF(OR(A1={"FB2037","FB2067","FB5050"}),"TPN-19","GPN-22")}

Since this is an array formula it must be entered using the Contol+Shift+Enter key combination. The outer-most braces, {}, are not typed by you...they're supplied by Excel to indicate the nature of the formula.

Posted by Aladin Akyurek on March 24, 2001 10:33 AM

Re: Or...use an array constant...

Mark: Are you sure you need CSEing this?

Posted by Mark W. on March 24, 2001 5:14 PM

Re: Or...use an array constant...

: {=IF(OR(A1={"FB2037","FB2067","FB5050"}),"TPN-19","GPN-22")}


Yeah, I believe so because OR() doesn't ordinarily accept arrays. OR's augument list typically looks like: =OR(value1,value2,...).

Posted by Mark W. on March 26, 2001 7:31 AM

I was mistaken! Don't need to CSE.


> Mark: Are you sure you need CSEing this?

The OR worksheet function help topic explicitly
states that OR() will accept an array:

"The arguments must evaluate to logical values
such as TRUE or FALSE, or in arrays or references
that contain logical values."

...And, the help topic even provides an example with
an a cell reference that is an array:

"If A1:A3 contains the values TRUE, FALSE, and
TRUE, then:

OR(A1:A3) equals TRUE"

Posted by TEE Davis on April 02, 2001 9:51 AM

Re: Or...use an array constant...

Posted by TEE Davis on April 02, 2001 9:54 AM

Re: Or...use an array constant...


Mark,
I cant seem to get the statement to work. Each test evaluates false and returns the else answer. I also tried the other suggestions but I get the same results...any suggestions?



Posted by Aladin Akyurek on April 02, 2001 10:31 AM

Re: Or...use an array constant...

Hi

Aren't these FB2037,FB2067, FB5050, TPN-19, and GPN-22 constants (constant values)?

Do they have each a cell of its own?

Aladin