Use data validation to select a cell in a formula

Memar

Board Regular
Joined
Sep 2, 2011
Messages
76
[FONT=&quot]I use a data validation to select YES or NO. When YES is selected, I want a number of product to be multiplied by the number in cell A1. When NO is selected, I want the number of product to be multiplied by the number in B1.
[/FONT]

[FONT=&quot]
[/FONT]

[FONT=&quot]
[/FONT]

[FONT=&quot]
[TABLE="class: Table TableWordWrap SCXW137062123, width: 0"]
<tbody class="SCXW137062123" style="margin: 0px; padding: 0px; user-select: text; -webkit-user-drag: none; -webkit-tap-highlight-color: transparent;">[TR="class: TableRow TableRowSelected"]
[TD="bgcolor: transparent"] 2 (number in cell A1)


[/TD]
[TD="bgcolor: transparent"] 3 (number in cell B1)


[/TD]
[/TR]
</tbody>[/TABLE]

[/FONT]

[FONT=&quot]
[/FONT]

[FONT=&quot]
[/FONT]

[FONT=&quot]
[TABLE="class: Table TableWordWrap SCXW137062123, width: 0"]
<tbody class="SCXW137062123" style="margin: 0px; padding: 0px; user-select: text; -webkit-user-drag: none; -webkit-tap-highlight-color: transparent;">[TR="class: TableRow TableRowSelected"]
[TD="bgcolor: transparent"]Products


[/TD]
[TD="bgcolor: transparent"]Select Yes or No from the drop down menu


[/TD]
[TD="bgcolor: transparent"]Quantity




[/TD]
[TD="bgcolor: transparent"]


[/TD]
[TD="bgcolor: transparent"]Desired result


[/TD]
[TD="bgcolor: transparent"]


[/TD]
[/TR]
[TR="class: TableRow TableRowSelected"]
[TD="bgcolor: transparent"]Computer


[/TD]
[TD="bgcolor: transparent"]YES


[/TD]
[TD="bgcolor: transparent"]10


[/TD]
[TD="bgcolor: transparent"]=10*A1


[/TD]
[TD="bgcolor: transparent"]20


[/TD]
[TD="bgcolor: transparent"]


[/TD]
[/TR]
[TR="class: TableRow TableRowSelected"]
[TD="bgcolor: transparent"]Mouse


[/TD]
[TD="bgcolor: transparent"]YES


[/TD]
[TD="bgcolor: transparent"]5


[/TD]
[TD="bgcolor: transparent"]=5*2


[/TD]
[TD="bgcolor: transparent"]10


[/TD]
[TD="bgcolor: transparent"]


[/TD]
[/TR]
[TR="class: TableRow TableRowSelected"]
[TD="bgcolor: transparent"]Keyboard




[/TD]
[TD="bgcolor: transparent"]NO


[/TD]
[TD="bgcolor: transparent"]13


[/TD]
[TD="bgcolor: transparent"]=13*3


[/TD]
[TD="bgcolor: transparent"]39


[/TD]
[TD="bgcolor: transparent"]


[/TD]
[/TR]
[TR="class: TableRow TableRowSelected"]
[TD="bgcolor: transparent"]Monitor


[/TD]
[TD="bgcolor: transparent"]YES


[/TD]
[TD="bgcolor: transparent"]20


[/TD]
[TD="bgcolor: transparent"]=20*2


[/TD]
[TD="bgcolor: transparent"]40


[/TD]
[TD="bgcolor: transparent"]


[/TD]
[/TR]
</tbody>[/TABLE]

[/FONT]

[FONT=&quot]
[/FONT]
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
With value to be multiplied in C2 and yes/no in B2
Code:
=(B2="Yes")*C2*$A$1+((B2)="No")*C2*$B$1

A1 and B1 are absolute references (use of $)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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