Discussion Locked

Excel 2000 Lookup

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
G'day all, I have a file (PostCodes) in which column A has the postcode and column B the city. I a different spreadsheet (customers) I want to enter the postcode and have the city value entered directly into the adjacent cell. Thankyou Harry.

6 replies

by jimbb

G'day mate,
Just supposing:
-postcodes.xls has postcodes in column A and cities in B, the first 50 rows, on sheet1.
-customers.xls has an input cell for the postcode in A1, and the city should end up in B1.
B1 could contain:
=VLOOKUP(A1;[postcodes.xls]Sheet1!$a$1:$b$50;2;TRUE)

-A1 refers to which cell's contents you want to use to look up the correct city.
-[postcodes.xls]Sheet1! refers to the tab "Sheet1" in the file "postcodes.xls".
-$a$1:$b$50 refer to the range in which you are looking for a city. The $ signs are not required, but they're easy for copying the formula around.
-2 refers to "the data I retrieve comes from the second column from my range"
-TRUE (not obliged to use this) indicates if you want "the nearest value" or not if a posctode is entered that is not in your list.

One more thing: your table should be sorted on the postcode.

Jim

by jimbb

Forgot: the semicolons in my formula could be commas for you, they depend on your regional settings in Windows.

Jim

by dklippert

Answer 1 is correct, but I would use FALSE as the last argument. This will cause the VLOOKUP formula to return NA if it cannot find an exact match. You don't want the next closest code if it's going to send your parcel to Alice Springs instead of Adelaide!
Another thing to consider is that the Postal codes need to be sorted in ascending order.

This discussion is closed to new replies.