Drop down list selection Excel VBA - excel

I want to populate a cell depending upon the drop down selection. How can i do it? The drop down list is created manually in the sheet.
EDIT: I have a column where every cell is a drop-drown. Depending upon what i select in the drop-down, the adjacent cell should get populated with a value.

Lets say you have a dropdown box in A1 allowing values 1,2, or 3, and you want B1 to show "A", "B", or "C" accordingly. Just type the formula
=IF(A1=1,"A",IF(A1=2,"B",IF(A1=3,"C","-")))
into B1. Of course, this works also when you have no dropdown box in A1.

Have a look on Vlookup and Index Match they are usually easier to create and mantain than nested If .
If you need examples let me know

Related

return entire column syntax, based on drop down box

Part of a complex formula that I am using refers to an entire column, (D:D). But I would like to be able to select that column based on a drop down box. So for instance if the drop down box has 3 choices, choice1 would input A:A into my formula, choice2 would input B:B into my formula and so on.
Any thoughts on how to do that? Thanks!

Auto populate Excel field based on Drop down value in another column

I have an excel sheet with few columns. One of the columns is a drop down based on a handful of values that I added. However, For each drop down value there is a matching account number which I would like auto populated once the drop down value is selected. Column D has the drop down and the drop down values and accounts are in BR5: BS38 and Would like the account to be populated in column E automatically everytime a drop down values is chosen.
Code I am using, however, it doesnt populate automatically, I have to copy the formula down and when I copy it down, if nothing is chosen in the drop down it will se #N/A.
=VLOOKUP(D5:D38,$BR$3:$BS$38,2,0)
Without VBA the formula will have to be copied down.
An easy work around would be to nest your vlookup in an iferror function and have it already populated in a set range of rows. So if you know the user will never type more than 1000 rows have the formula already there.
Your new formula would look like this. The only thing this does is remove the #N/A. Not sure why you specified a range in your vloopup lookup value, so this formula only picks the first cell in that range.
=IFERROR(VLOOKUP(D5,$BR$3:$BS$38,2,0), "")
If you would like some error checking, not sure if your drop down allows foreign values, you can use a formula like this
=IF(D5="","",IFERROR(VLOOKUP(D5,$BR$3:$BS$38,2,0),"Not Found"))

Excel, drop-down list changes contents of another cell, not formulaic

How do I make one cell display a value based on another cell choice that is a drop-down list selection? I don't know how to do macros, and I have tried researching. I think the question about displaying a custom state based on an sls file is close, but I don't know what and sls file is or how to code. Is there a simple way to tie two cell values together? eg. I want to be able to change the dollar value displayed in cell B (which represents a real cost of a subscription) based on what subscription choice I select from a drop-down list in cell A.
Say cell A1 has a Data Validation pull-down allowing you to select one of:
cat
dog
bird
snake
In another cell enter:
=LOOKUP(A1,{"cat","dog","bird","snake"},{10,20,30,40})
=LOOKUP(A1,{"bird","cat","dog","snake"},{10,20,30,40})
The list in the formula must be in alphabetic order.

Excel: Formulas and dropdown lists

I am trying to make a cell display the result of a VLOOKUP but allow the user to change the cells value to something from a dropdown list if they choose to.
I don't want the formula to be visible to the user.
The problem I'm having is when the user picks a different value from the list the formula is erased. When the criteria for the formula changes I want it to update to the new result.
I'm using Excel 2010. Any help is appreciated!
We can use an extra cell or two. In A3 we put a number and in A2 we can enter from a drop-down list. In A1 we have:
=IF(A2<>"",A2,VLOOKUP(A3,C1:D13,2,FALSE))
So if A2 is blank, we use the VLOOKUP(). If A2 has a value, we use that value.

Excel Style Combo Box in Google Sheets

I have an issue regarding Google Sheets.
I have a spreadsheet in Google docs that i have copied from an excel spreadsheet that I created. What I need to figure out how to do is make a combo box that that when I select an option in the list it changes the value of another cell from a 1 to 2 or 3 or 4 etc.
I have this working in excel but cant seem to figure out how to do it in sheets.
My question is, does any one know of a way to do this? Is it even possible?
Maybe I am misunderstanding your question, but it seems to me that what you want can be achieved without any scripting (though it IS possible to script the whole thing, too):
For the "combo box" cell, add Data Validation selecting "List
from a range" or "List of items" under 'Criteria' as appropriate,
and "Reject input" option in 'On invalid data' section. This will
make the cell show a drop-down selection of items when you click on
the little arrow now displayed in the cell.
In the other cell (the one that needs to change value), enter a
formula that changes the cell value based on selected "combo box"
cell value. Depending on how big your list of items in the "combo
box" cell is, you can use either a simple IF() formula, or go for
a VLOOKUP() (if data validation items are coming from a range in a
spreadsheet), or a combination of them.
For example, based on the sheet as in the screenshot below, cells C1:C6 have Data Validation rule set to range F1:F6, and cells D1:D6 have the formula =IF(NOT(C1=""), VLOOKUP(C1, $F$1:$G$6, 2, FALSE), "DEFAULT VALUE") (obviously references to C1 changed to corresponding row of column D). When a value is selected from a drop-down in cells C1:C6, corresponding cell in column D changes its value to the one in column G matching selected value from column F. If no value is selected in cells C1:C6, corresponding cell in column D show "Default value" (which can be whatever you need).

Resources