YES/NO with values assigned

dsrussell

New Member
Joined
Oct 14, 2010
Messages
1
Sorry that my first post should be so obvious, but I've tried searching the forum and can't find exactly what I'm looking for. Here goes:

I'm working in Excel 2007 and have a cell with a defined name, that I use elsewhere in a formula. All I want to be able to do is to have a YES/NO drop down in the same cell with YES = 1 and NO = 0, so that if the user selects YES, then the variable name is given the value 1 and 0 for NO.

I'm OK in setting up a drop down list using ranges etc, but I've seen in another spreadsheet somewhere that you can place a cute little bit of "code" in the Source field of the Data Validation window, so that the user sees YES and NO in the drop down, but in reality is selecting 1 or 0 (that they don't see). From memory it uses an INDEX command is something along the lines of INDEX({"YES";"NO"},1,0). However, this doesn't work - not least, as the arguments are probably inconsistent.

I'm aware I could get round this using a lookup function, and I've seen a clever way using an Eval function on this forum (which doesn't work for my later needs). Does anybody have any idea of how to do this in the way that I've seen before?:confused:

With many thanks!
Darren
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
What about having a defined name that calculates a value of 1 or 0 from the cell contents ( YES/NO ). Define a new name, menu command Insert/Name/Define ( or ribbon Formulas/Defined Names/Define Name ), with a reference of a formula of:
Code:
=MATCH($B$4,{"NO","YES"},0)-1
and use that elsewhere in formulas.
 
Upvote 0
Rather than set up your Name as just referencing the cell, what about using a formula like this one?

=IF(Sheet2!$K$7="Yes",1,0)

(assuming Sheet2!$K$7 has your Yes/No validation box in it)

Does this help?
 
Upvote 0
Hotpepper, quite right! :-)

But mine can be extended for longer lists than 2 options if required.
 
Upvote 0

Forum statistics

Threads
1,222,830
Messages
6,168,509
Members
452,194
Latest member
Lowie27

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