# Formula based on choice

#### RandyD123

##### Active Member
I have this in a cell:

=IF(Y16<>"Y",0,Z16-H16

MY default is "N" and if I don't change the Y/N cell to Y I want the formula to just subtract Z16-H16

N is in all the cells in the Y/N column by default.

How do I write the formula to just minus H16 from Z16 as a default and still have the formula work if I select "Y"?

I'm not sure if I need to provide more info or not?

Last edited:

### Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
This should do it:

=(Z16-H16)*(Y16="N")

I get a "name" error?

Just copy and paste the formula from this thread. Maybe you left the " " out from around the "N"?

Yep, but now I lose my value when Y is selected!!!

I'm not sure why my original formula is not doing what is supposed to do and that is minus Z16 from H16 if Y is a N

Perhaps I misunderstand. What is supposed to happen for each of the two options?

Y = ?
N = ?

Y means I'm turning something on
N means I'm turning something off.

When Y is entered, what should happen?

When N is entered, what should happen?

jbeaucaire....thanks for taking time to help. The more I look at the formula, it works as intended. As it turns out I just needed the Z16-H16!!! At least that's what I'm thinking at this point. I am going to try this for a few days and see if I'm all set.

Replies
3
Views
184
Replies
1
Views
64
Replies
1
Views
102
Replies
3
Views
303
Replies
7
Views
327

1,219,035
Messages
6,145,902
Members
450,654
Latest member
lorento

### 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.

### Which adblocker are you using?

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

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