+ Reply to Thread
Results 1 to 7 of 7

Like a VLOOKUP, but returning multiple values (for multiple matches)

Hybrid View

  1. #1
    Registered User
    Join Date
    04-09-2008
    Posts
    22

    Like a VLOOKUP, but returning multiple values (for multiple matches)

    Hi,
    I'm undertaking a matching excercise, matching employee preferences for new roles to available roles.

    I need a formula that effectively generates a shortlist of candidates, finding matches in an array.

    I have manually returned the values I would want returned to provide an example (see row 20) , but obviously I need a forumla or macro that c an do this.

    If you have any suggestions or advice, it would be much appreciated.

    Thanks,

    Ben
    Attached Files Attached Files

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Like a VLOOKUP, but returning multiple values (for multiple matches)

    Hello Ben,

    It may just be on my end, but when I open the file nothing happens. No errors, no Excel application, nothing happens. Check that the file is not damaged. It has had 4 downloads and no responses.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Like a VLOOKUP, but returning multiple values (for multiple matches)

    It opened with me, but I had to use the three finger salute to close excel, best check it out.

  4. #4
    Forum Contributor
    Join Date
    03-08-2007
    Location
    St. Augustine, Fl
    MS-Off Ver
    Excel 2021 for Mac
    Posts
    399

    Re: Like a VLOOKUP, but returning multiple values (for multiple matches)


  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Like a VLOOKUP, but returning multiple values (for multiple matches)

    works ok for me try something like attached
    Attached Files Attached Files
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  6. #6
    Registered User
    Join Date
    04-09-2008
    Posts
    22

    Re: Like a VLOOKUP, but returning multiple values (for multiple matches)

    Quote Originally Posted by martindwilson View Post
    works ok for me try something like attached
    Thanks Martin, it seems to have done the trick. Could you just give a brief explanation of how it works and why you needed to insert a new worksheet?

    Many thanks for your help.

    Ben

  7. #7
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Like a VLOOKUP, but returning multiple values (for multiple matches)

    i just listed the three preferences on below the other and used an index match to return the choice of each candidate so third choice for example will be in the bottom 10 of the list on sheet2 colb
    then i used a count in column c COUNTIF($B$1:B1,B1) give each instance of role1,etc its own number then added column b to it =B1&"-"&COUNTIF($B$1:B1,B1) this value can now be looked for from sheet 1
    INDEX(Sheet2!$A$1:$A$30,MATCH(Sheet1!$A20&"-"&COLUMN(A1),Sheet2!$C$1:$C$30,0)))
    the match part MATCH(Sheet1!$A20&"-"&COLUMN(A1),Sheet2!$C$1:$C$30,0)
    resolves to MATCH("role 1"&"-"&1,Sheet2!$C$1:$C$30,0)
    MATCH("role 1-1",Sheet2!$C$1:$C$30,0)
    so it finds role 1-1 and returns employe from column a of sheet2 which happens to be employee 1

    the rest is just to hide errors when no match is found
    this bit
    IF(COLUMN(A1)>COUNTIF($D$2:$F$11,$A20)
    counts the number of times "role 1" appears in the range $D$2:$F$11 which is 3
    so as the formula is dragged across COLUMN(A1) changes to column b1 then c1 then d1...
    COLUMN(A1) =1 ,COLUMN(b1)=2 so when it gets to column d1 ,column (d1)=4 ,which is greater than
    3 so blank.
    as to why its on another sheet ,why not ?,its out of the way and reduces clutter you could put it on sheet 1 if you wanted.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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