ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Validation List/Formula Question (https://www.excelbanter.com/excel-discussion-misc-queries/175565-validation-list-formula-question.html)

JWNJ

Validation List/Formula Question
 
My goal seems to be fairly basic, but I have not been able to figure out an
easy formula. I would appreciate your thoughts/suggestions.

Lets say I have a validation list of the 50 US States in cells A1. In B1 I
want an output based on the state selected in A1. Lets say if A1 = NY or NJ
or MA or FL the output is 1, for all other states the output is 0. I know I
can write a formula such as
=if(a1="NJ",1,if(a1="NY",1,if(a1="MA",1,if(a1="FL" ,1,0)))). My question is,
can I use some sort of "OR" statement in place of all the IFs?

I need to avoid all of the IFs because this is actually the lead question in
a series of nested if/then questions in a much longer formula.

Thanks in advance for any suggestions.

JWNJ

Validation List/Formula Question
 
I just figured out the magic of the "OR" statement. No replies needed.
Thanks.

"JWNJ" wrote:

My goal seems to be fairly basic, but I have not been able to figure out an
easy formula. I would appreciate your thoughts/suggestions.

Lets say I have a validation list of the 50 US States in cells A1. In B1 I
want an output based on the state selected in A1. Lets say if A1 = NY or NJ
or MA or FL the output is 1, for all other states the output is 0. I know I
can write a formula such as
=if(a1="NJ",1,if(a1="NY",1,if(a1="MA",1,if(a1="FL" ,1,0)))). My question is,
can I use some sort of "OR" statement in place of all the IFs?

I need to avoid all of the IFs because this is actually the lead question in
a series of nested if/then questions in a much longer formula.

Thanks in advance for any suggestions.


T. Valko

Validation List/Formula Question
 
One way:

=IF(OR(A1={"NY","NJ","MA","FL"}),1,0)

--
Biff
Microsoft Excel MVP


"JWNJ" wrote in message
...
My goal seems to be fairly basic, but I have not been able to figure out
an
easy formula. I would appreciate your thoughts/suggestions.

Lets say I have a validation list of the 50 US States in cells A1. In B1
I
want an output based on the state selected in A1. Lets say if A1 = NY or
NJ
or MA or FL the output is 1, for all other states the output is 0. I know
I
can write a formula such as
=if(a1="NJ",1,if(a1="NY",1,if(a1="MA",1,if(a1="FL" ,1,0)))). My question
is,
can I use some sort of "OR" statement in place of all the IFs?

I need to avoid all of the IFs because this is actually the lead question
in
a series of nested if/then questions in a much longer formula.

Thanks in advance for any suggestions.





All times are GMT +1. The time now is 09:43 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com