Drop down with value lookup

uttamsaxena

Board Regular
Joined
Apr 22, 2003
Messages
182
I want to make a sheet with following details

Cell A1 has a category e.g. fruits.
Cell B1 should have a dropdown list like Apple, Mango, Bananas etc.
Cell C1 should display rate of the fruit which has been selected by the user in cell B1 dropdown by looking up the rates stored in Sheet 2 of this workbook.

This book has another sheet 2 which should be used to store rates in column B and name of fruit in column A. This is for easy editing of the rates.

I think you have got my problem. Please help me how to do this easily. Suggeting a link or tut will also be helpful. Thanks.
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Use a combination of data validation (for cells 1 & 2) and a LOOKUP for cell 3 (using INDEX/MATCH), (assumes cell 123 are A1,B1 & C1)

First create your list if criteria for cell1 (i.e. fruit, veg, meat) say in F1:F3
in cell 1 goto menu|Data|Validation - select allow list & specify the 1st list range above...

Now create 3 lists containing your fruit, veg & meat values (plus their prices in the column to the right) H1:I6) name each list Fruit, Veg & Meat (using INSERT|NAME|DEFINE)

In cell 2, use Data Validation, but place the formula =INDIRECT(A1) in the list range box

In cell 3 - formula =INDEX(H1:I6,MATCH(B1,H1:H6,0),2)

See below
Book1
ABCDEFGHIJ
1fruitapple1fruitapple1
2vegpear2
3meatbrocilli3
4NAMEScabbage4
5H1:H2fruitsteak5
6H3:H4vegpork6
7H5:H6meat
8
9
10
Sheet3


Hope this helps
 
Upvote 0
Hi Uttam Saxena:

Using essentially the same idea as WillR's, but catering to your two sheet setup, here is Sheet1 ...
Book1
ABCDE
1FruitMango2.1
2cellB1usesDATA|Validation List>Fruit
Sheet1


and here is Sheet2 ...
Book1
ABCD
1Apple1.1Fruit
2Mango2.1
3Banana3.1
4pear4.1
Sheet2


So, refering back to Sheet1 for cell B1 DATA|Validation , I used range named Fruit (Sheet2!A1:A4);

and the formula in Sheet1 cell C1 is ... =VLOOKUP(B1,Sheet2!A1:B4,2,0)

I sumise as WillR has suggested that you would want to go beyond just the category of Fruit, and add other categories, such as Vegetables, and so on. However, this should get you started.
 
Upvote 0
Hello
What I need to add to the formula in Sheet1 cell C1 to be able to display data from other cells, now it displays data only from column B I would like to be able to have data from columns C, D, E for the same item
Thank you
John
 
Upvote 0
Parsec....

Is your question to do with this thread? If so, I do not understand what you want help with. Can you explain further?

Will
 
Upvote 0
parsec said:
Hello
What I need to add to the formula in Sheet1 cell C1 to be able to display data from other cells, now it displays data only from column B I would like to be able to have data from columns C, D, E for the same item
Thank you
John

Lets suppose the following lookup table...
Book8
ABCD
1ItemsDescLocPrice
2Item01Desc01Loc0112.8
3Item02Desc02Loc029.93
4Item03Desc03Loc0321.93
5Item04Desc04Loc0414.1
6Item05Desc05Loc0522.44
7Item06Desc06Loc0616.88
8Item07Desc07Loc0714.92
9Item08Desc08Loc0823.59
10Item09Desc09Loc098.87
11Item10Desc10Loc1016.39
12Item11Desc11Loc1120.5
13Item12Desc12Loc1213.98
14Item13Desc13Loc1322
15Item14Desc14Loc1412.06
Sheet1


Select A2:D15.
Go to the Name Box on the Formula Bar, type LTable (from lookup table), and hit enter.

Now you can set up a data validation dropdown box anywhere in your workbook using LTable and retrieve values associated with a choice from the dropdown box...
Book8
ABCDEF
1
2Item02Desc02Loc0112.82
3
4
Sheet2


Select A2.
Activate Data|Validation.
Choose List for Allow.
Enter the following in the Source box:

=INDEX(LTable,0,1)

which gives you the items from the 1st column of LTable.

You can now retrieve values associated with a choice in A2 from LTable efficiently:

In F2 enter:

=MATCH(A2,INDEX(LTable,0,1),0)

In C2 enter & copy across to E2...

=INDEX(LTable,F2,COLUMN()-COLUMN($C$2)+2)
 
Upvote 0
Aladin's contrib works great and is neat.
Just add $ sign before the F2 in last formula when you paste.
 
Upvote 0
Thank you Aladin

The formula is working very well and I am very thankful for the time that you took to help up

Thank you
John
 
Upvote 0
Hi Aladin I tried to it as below and it is working with Vlookup. Pl check & tell me whether it is OK to do it like this or not?
Combo_example2.xls
ABCD
1
2Fruit1rate1Stock1dealer1
3Fruit2rate2stock2dealer2
4Fruit3rate3Stock3dealer3
5Fruit4rate4Stock4dealer4
6Fruit5rate5Stock5dealer5
7Fruit6rate6Stock6dealer6
8Fruit7rate7Stock7dealer7
9Fruit8rate8Stock8dealer8
10Fruit9rate9Stock9dealer9
11Fruit10rate10Stock10dealer10
12
Sheet2
Combo_example2.xls
ABCD
1Fruit10rate10Stock10dealer10
2
3ORasbelow
4
5Fruit8rate8Stock8dealer8
6
7
Sheet1
 
Upvote 0
uttamsaxena said:
Hi Aladin I tried to it as below and it is working with Vlookup. Pl check & tell me whether it is OK to do it like this or not?...

The formulas do not show, not all anyway.

I have the impression that you want to avoid the additional column. The reason for that is sheer efficiency. Something not be neglected.
 
Upvote 0

Forum statistics

Threads
1,226,218
Messages
6,189,693
Members
453,563
Latest member
Aswathimsanil

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