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]
2 (number in cell A1)


3 (number in cell B1)



<tbody class="SCXW137062123" style="margin: 0px; padding: 0px; user-select: text; -webkit-user-drag: none; -webkit-tap-highlight-color: transparent;">
</tbody>

[/FONT]

[FONT=&quot]
[/FONT]

[FONT=&quot]
[/FONT]

[FONT=&quot]
Products


Select Yes or No from the drop down menu


Quantity







Desired result





Computer


YES


10


=10*A1


20





Mouse


YES


5


=5*2


10





Keyboard




NO


13


=13*3


39





Monitor


YES


20


=20*2


40






<tbody class="SCXW137062123" style="margin: 0px; padding: 0px; user-select: text; -webkit-user-drag: none; -webkit-tap-highlight-color: transparent;">
</tbody>

[/FONT]

[FONT=&quot]
[/FONT]
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
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,215,886
Messages
6,127,575
Members
449,385
Latest member
KMGLarson

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