+ Reply to Thread
Results 1 to 4 of 4

how to bring all vlookup returns even with duplicate vlookup search keys

  1. #1
    Registered User
    Join Date
    12-20-2011
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    40

    how to bring all vlookup returns even with duplicate vlookup search keys

    Hello,

    I am doing a Vlookup search across data that contains several parameters. I have created a unique key to do the vlookup against, using the concatenation of say A1 and B1. However, the problem is that there are duplicate keys using this format, but the rest of the parameters can be different (cells C1 to ZZ1, etc). so when i do a vlookup on my cell, and search to pull in what column C has, only the first match is returned.

    Is there a way to differentiate that in the Vlookup so if my concatenation of A1B1 brings back C1, I want A2B2 to bring back C2, even if A1B1 = A2B2.

  2. #2
    Valued Forum Contributor Harribone's Avatar
    Join Date
    02-24-2013
    Location
    Midlands, UK
    MS-Off Ver
    Excel 2019/365
    Posts
    570

    Re: how to bring all vlookup returns even with duplicate vlookup search keys

    Say you have aCol A and Col B with your values. In Col C you have done your join =A2&B2 to create your key but as you say this will not be unique as it stands. In Col D you can then create a unique identifier by entering =C2&COUNTIF($C$1:C1,C2) and dragging down.

    So if you have "EXCEL" and "FORUM" in A2 and B2 for example and the same again in A3 and B3, C2 and C3 will display "EXCELFORUM". In col D though you will have "EXCELFORUM0" and "EXCELFORUM1".

    This will then be you unique identifier for a vlookup. Note you will need to set up your lookup table in a similar manner also so this works.
    Say thanks, click *

  3. #3
    Valued Forum Contributor
    Join Date
    07-27-2012
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2010
    Posts
    826

    Re: how to bring all vlookup returns even with duplicate vlookup search keys

    Quote Originally Posted by NYC4LIFE View Post
    ... I have created a unique key to do the vlookup against, using the concatenation of say A1 and B1. However, the problem is that there are duplicate keys using this format...
    ? So.... they're NOT unique? Can you concatenate other fields, in order to make keys which are actually unique?
    Brendan.


    __________________________________________________________________________________________________
    Things to consider:

    1) You can thank any poster by clicking the * at the left of a helpful post.
    2) You can help to keep the forum tidy by marking your thread as "Solved", if it has been answered to your satisfaction.
    3) Help us to help you, by uploading a sample workbook, showing the type of data you're dealing with, and clearly indicating what the results should be.

  4. #4
    Valued Forum Contributor Harribone's Avatar
    Join Date
    02-24-2013
    Location
    Midlands, UK
    MS-Off Ver
    Excel 2019/365
    Posts
    570

    Re: how to bring all vlookup returns even with duplicate vlookup search keys

    Or improving on my solution have your first join =A1&B1 then below in the next cell enter =A2&B2&COUNTIF($C$1:C1,A2&B2) and drag down so you don't need an extra column (this formula assumes you are in column C)

+ 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