Cell to return value depending on item chosen from dropdown list

MAGGIE_12

New Member
Joined
Nov 23, 2017
Messages
6
Good Day, I am a first time poster, and I hope i am doing this right :(

I have an excel workbook which contains a separate tab with all the drop-down lists, which is used in the all the other tabs.

My Brain Boggle: I have City, Province in separate columns (in the drop-down list tab), So if I choose a City from the drop-down list, I want excel to automatically fill the Province in the cell next to it.

Can this be done? Any assistance will be appreciated so much. Thank you.

Maggie_12
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
build a table of all the cities and province

say new sheet
column a = city
column b = province

now you can use a vlookup()
to lookup the province
 
Upvote 0
Hi Etaf,

I have done the table and used the VLOOKUP function: =VLOOKUP(H5;Table5[Province];2;1)

But it keeps giving me a #N/A Error.

What am I doing wrong here?

Thanks a million.
 
Upvote 0
lets assume its in sheet1 range A1:B100

the vlookup would be

=vlookup(H5, Sheet1!$A$1:$B$100, 2, false)

i think a 1 at the end is TRUE - so nearest value
also not sure if

Table5[Province]

is actually the right name for the range - TRY using sheet and range with cells rather than a table
and 0 for false
=VLOOKUP(H5;RANGE;2;false)

also check that you dont have spaces in the dropdown and in the table

"london "
will return a n/a
if the table has
"london"

and not
"london "
 
Upvote 0
I have done the following and it tells me that there is a problem with the formula:

=VLOOKUP(H5,Drop_Lists!$f$2:$f$75,2,false)

I have also checked for spaces

Any further ideas?
 
Upvote 0
i guess i need to see a copy
can you put on dropbox or onedrive and share
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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