Linking Zip codes and Cities

  • Thread starter Thread starter Lycean
  • Start date Start date
L

Lycean

I'm trying to create a customer database. I want to be able to type the city
and have it auto-fill the next cell with the ZIP code. I don't know much
about how to use macros, and I don't understand the directions in help. Can
someone help me and explain it with an example? I'd appreciate it. I'll
include a sample of what my document looks like:

(a) Last name (b) First name (c) Address (d) ZIP (e) Phone

I know people have told others to use VLOOKUP but I'm not sure I understand
how the terms are relating to what I need it to do. Hence the need for an
example! Any help is greatly appreciated!!
 
Hi,
you need to create a table with the cities and the zip codes let's assume
you create it in sheet2 column A = city and column B zip, then let's assume
you want to enter the city in sheet 1 row B2 and get the zip in cell C2, so
in C2 enter

=vlookup(B2,sheet2!$A$1:$B$1000,2,false)
 
Lycean said:
I'm trying to create a customer database. I want to be able to type the city
and have it auto-fill the next cell with the ZIP code. I don't know much
about how to use macros, and I don't understand the directions in help. Can
someone help me and explain it with an example? I'd appreciate it. I'll
include a sample of what my document looks like:

(a) Last name (b) First name (c) Address (d) ZIP (e) Phone

I know people have told others to use VLOOKUP but I'm not sure I understand
how the terms are relating to what I need it to do. Hence the need for an
example! Any help is greatly appreciated!!

Most cities have more than one zip code. My city has five and the
population is 90,000. So in most cases you won't get the right zip code
from just the city name.

Bill
 
Eduardo's example of VLOOKUP is correct but.................

Most cities have multiple zip codes.

What will you do in that case?

If you have no mutiple zip codes in your list, ignore this post.


Gord Dibben MS Excel MVP
 
Gord wrote on Mon, 26 Oct 2009 12:13:25 -0700:
Most cities have multiple zip codes.
What will you do in that case?
If you have no mutiple zip codes in your list, ignore this
post.
Gord Dibben MS Excel MVP

Some caution is indicated. While a Zip code with a wrong city name may
be delivered, you may also succeed in annoying the recipient. My own
post office has a zip code but it is often attached to the Rockville, MD
Post Office. Charities that do that sometimes fail to receive donations.

--

James Silverton
Potomac, Maryland

Email, with obvious alterations: not.jim.silverton.at.verizon.not
 
Back
Top