简体   繁体   中英

Excel dynamic drop down linked to a cell reference

I have a problem that looks quite simple but is hard to find a solution. What I'm trying to do is the following

On a dropdown there are the options of the letters (they're actually codes):
C
P
R
S

Each of these options when chosen is to give a different value in an adjacent cell. But I want these values to be taken from specific cells in another table. The reference cells for these are B20, B31, B33, B34.

I can get this to work with numbers eg C returns 20, using the formula

=LOOKUP(A177,{"c","p","r","s"},{20,31,33,34})

What I need though is something like this:

=LOOKUP(A177,{"c","p","r","s"},{B20,B31,B33,B34})

So how do I get, say, the option C to match with a cell reference B20 (which in turn will return whatever value is in B20) and ditto for the other options?

Create a new sheet. Give the sheet a name like "lookuptable". Set it up like so:

    A    B    
1   C    =SheetName!B20
2   P    =SheetName!B31
3   R    =SheetName!B33
4   S    =SheetName!B34

Update the "SheetName!" in the formulas to match that of the name of the sheet where your {B20,B31,B33,B34} cells are.

Then use the following formula as appropriate:

=VLOOKUP(A177,lookuptable!$A$1:$B$4,2,FALSE)

I hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM