Formula Help - Need to Return A "1" Or "0" With Exceptions

milwphil

Board Regular
Joined
Aug 1, 2010
Messages
120
I'm trying to come up with a formula that will return a "1" or a "0" based on the selection of a state and person(with a few exceptions).

Currently I have:
Code:
=IF(AND(U1="Peter Griffin", OR(R63="AZ", R63="MA",R63="CA", R63=
"UT")),0,IF(U1="Quagmire",0,1))
Basically, the intent is to have if someone picks Peter Griffin return a "1". If Quagmire return a "0".

The problem I'm having is that I want any time someone selects the state AZ, MA, CA or UT to return a "0" regardless of the selection of Peter Griffin or Quagmire.

The code above gives me a 1 on Peter Griffin and 0 on Quagmire, but I can't get the exceptions to be recognized.

Hope this makes sense!

Thanks in advance!
Phil
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Haseeb thanks for the quick response!

Unfortunately, I'm still getting a "1" when I select Peter Griffin and "AZ"(same for CA, MA, or UT).

If AZ, CA, MA or UT are selected regardless of the name(Peter Griffin or Quagmire), I'm hoping to get a "0".

If any state and Peter Griffin are selected with AZ, CA, MA, or UT the number returned should be a 1. All states that are under Quagmire should be a "0"

Any other suggestions? Sorry for being a pain! And thanks for your help!

Phil
 
Upvote 0
Since your state tests take precedence, put them first as in the untested
=IF(OR(R63="AZ", R63="MA",R63="CA", R63=
"UT"),0,if(U1="Peter Griffin",1,IF(U1="Quagmire",0,"undefined")))

I'm trying to come up with a formula that will return a "1" or a "0" based on the selection of a state and person(with a few exceptions).

Currently I have:
Code:
=IF(AND(U1="Peter Griffin", OR(R63="AZ", R63="MA",R63="CA", R63=
"UT")),0,IF(U1="Quagmire",0,1))
Basically, the intent is to have if someone picks Peter Griffin return a "1". If Quagmire return a "0".

The problem I'm having is that I want any time someone selects the state AZ, MA, CA or UT to return a "0" regardless of the selection of Peter Griffin or Quagmire.

The code above gives me a 1 on Peter Griffin and 0 on Quagmire, but I can't get the exceptions to be recognized.

Hope this makes sense!

Thanks in advance!
Phil
 
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,259
Members
452,901
Latest member
LisaGo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top