SOLVED

Can I Use the VLOOKUP Formula to Return a Data Validation Drop Down List?

Copper Contributor

I'm wondering if it's possible to use the VLOOKUP formula to return an entire Data Validation List (with all possible options), not just the value that is currently selected.

 

In the attached example I'm using VLOOKUP to automatically fill in the instructor names of various courses by reading the entered course name (Column F) and returning the corresponding instructor (column G) based on the course/instructor list (Table 1). This works for all courses with only 1 possible instructor, but not with the "Math" course which has three possible instructors, which I've captured using a Data Validation List. Is it possible to use VLOOKUP to copy the whole list of the three possible instructors so that I could choose which one taught the course on a particular day?

11 Replies

@NeilBost 

VLOOKUP only returns the first instance in the match. A better alternative is to create a new column in Table 1 that can be used a reference for future lookups. This can be a Unique ID for the courses.

 

Now when referencing Courses in Table 2, the Unique ID will always return the respective instructor even if the course list is repeated, since the Unique ID is unique. That is the essence of working with relational databases in Excel.

@adversi 

Thank you for your reply. I don't think your suggestion solves my problem, but what I'm hearing is VLOOKUP can't be used to return a whole data validation list. I'll just have to change each entry that had multiple possible instructors manually. Thank you again for your time.

best response confirmed by NeilBost (Copper Contributor)
Solution

@NeilBost 

 

No, you can't use VLookup, but you could still add data validation. The caveat is that you can't have user input and a lookup formula in the same cell, so you would need to add a column for user selection from the data validation list. Then, using an IF formula in the instructor field, you can perform a lookup when there is only one instructor, or pull from the user's selection from the data validation when there is more than one. 

 

 

Thank you! This seems like a great alternative.

It can help you Hàm vlookup trong excel

@JMB17   Greetings,  I am trying to do something similar.  However, I don't need the vlookup column, because I always want the user to select an entry. But I want that data validation drop-down list to change based on a selection in the previous column as this one seems to do. I have changed the named formula (VersionList) to reflect the table and field names in my example, but I only get a message that the "Source currently evaluates to an error" I think it has something to do with my lack of understanding of how the $F12 reference in your named formula works. Can you tell what I am doing wrong?

@dholcombpa 

Why don't you use reference on spill?

image.png

 

I think the issue is just an incorrect cell reference in the match formula - it's referring to cell $F1048574. Try this for your VersionList formula:

=INDEX(TableBudgetVersions[BudgetVersion],MATCH(TableVersionProductions[@SeasonNo],TableBudgetVersions[SeasonNo],0)):INDEX(TableBudgetVersions[BudgetVersion],MATCH(TableVersionProductions[@SeasonNo],TableBudgetVersions[SeasonNo],1))
Oh. That's a new one on me. Thanks. I think I'll go with @JMB17's response below because it doesn't require the use of a "helper range," like B23. But it's good to know how to make this kind of reference. I kind of migrated all of my work that needed to manipulate ranges to Sheets a bit ago, because their methods seemed more straightforward to me at the time. Now I have fallen behind on how to do that in excel. Thanks to both of you for the pointers.

I feel like I have a similar question. I have inherited a spreadsheet with lots of formulas and macros. It's effectively a new employee form that auto populates as soon as a position is selected from a drop down.

 

I am grabbing it from a step before and using MS forms and Power query to get 5 basic bits of info and want them to then fill the form and autopopulate from that step. 

 

My first most basic observation seems to be that putting "=othersheet$A$2" in the dropdown controlled cell creates an issue, even if what it displays is in the dropdown parameters.

 

 

1 best response

Accepted Solutions
best response confirmed by NeilBost (Copper Contributor)
Solution

@NeilBost 

 

No, you can't use VLookup, but you could still add data validation. The caveat is that you can't have user input and a lookup formula in the same cell, so you would need to add a column for user selection from the data validation list. Then, using an IF formula in the instructor field, you can perform a lookup when there is only one instructor, or pull from the user's selection from the data validation when there is more than one. 

 

 

View solution in original post