Automatically inputting a zip code after entering a town name

dmar89

New Member
Joined
Sep 22, 2015
Messages
2
Hi,

I have a spreadsheet where I need to input people's basic data (e.g. name, address, town, zip code, etc.)

Is it possible for the "Zip code" cell to be automatically filled by referencing a list on another sheet of the Excel workbook once the "town" cell has been entered?

For example, if I enter the word "Greensborough" in the "Town" cell, I want the number "3088" to appear in the "Zip code" cell automatically. (I have a list of towns and their relevant zip codes on a separate sheet.)

I hope that's clear!

Thanks in advance,

Daniel
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Welcome to the board !!

Yes you can do that by using a Vlookup formula. Make sure the town is in the first column and the zip code is in the next column for your zip code table.

Use =VLOOKUP(A1,Sheet2!$A$1:$B$3,2,FALSE) in the cell you want the zip code to appear and copy down.

“A1” is the town you are looking up/inputting into the cell so this might be different on your sheet.

“Sheet2!$A$1:$B$3” is the table where you have all the towns and zip codes (Change the name of “Sheet2” to wherever your towns/zip codes table is named. Also your table will probably be bigger so use the syntax of the formula not this exact cell reference.

“2” is the column where you are pulling the zip code from.

“False” is the exact match.

Good Luck.
 
Upvote 0

Forum statistics

Threads
1,223,969
Messages
6,175,691
Members
452,667
Latest member
vanessavalentino83

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