+ Reply to Thread
Results 1 to 7 of 7

Compare values in two columns and return text from adjacent cell

  1. #1
    Registered User
    Join Date
    07-04-2009
    Location
    Richland, Washington
    MS-Off Ver
    Excel 2003
    Posts
    3

    Smile Compare values in two columns and return text from adjacent cell

    Hoping somebody can assist me in solving the below problem - my XLSX file can be downloaded at: http://www.faithfold.com/download/zipcode_database.xlsx

    I'm dealing with 4 columns of data (there are more in the file but only the first four are pertinent to the function). The columns, left to right, are: my zips, my cities, us zips, us cities.

    Here is the scenario: I have a list (Column A) of zip codes that I need to match up with their corresponding cities. Column C is a much longer list of every zip code in the country, along with the corresponding city name adjacent to it, in Column D.

    What I need Excel to do is look at the Zips in Column A, find the match in Column C, and then take the adjacent city name in Column D, and place that city name back in Column B... I hope that makes sense. In short, I just need to gather the correct city names that match my zips, and the data is there I just don't know how to manipulate it.

    Thank you!

  2. #2
    Registered User
    Join Date
    05-20-2009
    Location
    NY
    MS-Off Ver
    Excel 2003
    Posts
    57

    Re: Compare values in two columns and return text from adjacent cell

    MrBorders,

    You don't really need to use excel programming for this. There is a function(s) that can simply accomplish this task. For example, column A is your LOOKUP zipcodes, column C is a larger subset of zipcodes, column D is your corresponding city names, and column B is where you would like the city names to appear for each LOOKUP zipcodes.

    In column B:
    Please Login or Register  to view this content.
    What does this mean? C1:D2 can be expanded to cover all your larger subset of zipcodes and corresponding city names. MATCH will return the position, and the range will be your column C, and specify 0 as you would want to have an exact match. To finish off, specify 2 at the end to retrieve the corresponding city name. Give this a twirl, and if you have any questions, let me know.

    Cheers,
    Jimmie D

  3. #3
    Registered User
    Join Date
    07-04-2009
    Location
    Richland, Washington
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Compare values in two columns and return text from adjacent cell

    Jimmie D,

    I appreciate the response, thank you. I pasted this function into Column B and I'm getting #N/A. Any ideas? Would you mind downloading my XLS from the above link and seeing how it goes on your end? Again, thank you!

    Tyler

  4. #4
    Registered User
    Join Date
    07-04-2009
    Location
    Richland, Washington
    MS-Off Ver
    Excel 2003
    Posts
    3

    Got it!

    Jimmie,

    Got it to go, here's the mod: =INDEX(C:D,MATCH(A10,$C$1:$C$50000,0),2)

    Thanks for your help. You loosened the lid, and I stole the credit for getting it off

    Thanks brother!

    Tyler

  5. #5
    Registered User
    Join Date
    05-20-2009
    Location
    NY
    MS-Off Ver
    Excel 2003
    Posts
    57

    Re: Compare values in two columns and return text from adjacent cell

    MrBorders,

    We're both using 2003 - Do you have a 2003 version saved by chance? In the meantime, try the above formula create a sample worksheet to test it out.

    Column A
    11368
    14228

    Column B
    Corona // should be returned from column D based on column A matching column C
    Amherst // should be returned from column D based on column A matching column C

    Column C
    14228
    11368

    Column D
    Amherst
    Corona

  6. #6
    Registered User
    Join Date
    05-20-2009
    Location
    NY
    MS-Off Ver
    Excel 2003
    Posts
    57

    Re: Compare values in two columns and return text from adjacent cell

    Awesome! Have a Happy 4th and mark this post as solved

  7. #7
    Registered User
    Join Date
    06-09-2009
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    88

    Re: Compare values in two columns and return text from adjacent cell

    ^ You can mark it as solved by editing our first post, click go advanced and then click the drop down where it says "(no prefix)"

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1