+ Reply to Thread
Results 1 to 4 of 4

VLOOK problem with multiple values in table array

  1. #1
    Forum Contributor
    Join Date
    04-23-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    107

    VLOOK problem with multiple values in table array

    Hi

    i was wondering if you could help me with a problem i have.

    I am trying to return multiple results against a value, when the table array has multiple entrys. if you look at the attached sheet you will see what im trying to explain.

    Sheet 2 cell B6 holds the first formula.

    You can see that the Lookup_value has THREE entrys in the Table_array. I am looking to return ALL THREE of the entry's in separate cells. But in the formulas in cells B7 & B8 in sheet 2, you can see that the first entry is always being returned. is there a way that i can alter the formulas so that they return the 2nd and 3rd entrys accordingly?

    Any help greatly appreciated.

    VLOOK example.xlsx

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: VLOOK problem with multiple values in table array

    In B6 and copy down this ARRAY(confirm using control+shift+enter-not just enter) formula.

    =IFERROR(INDEX(Sheet1!$C$2:$C$10,SMALL(IF(Sheet1!$B$2:$B$10=$A$2,ROW(Sheet1!$C$2:$C$10)-1),ROW(Sheet1!C1))),"")
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,769

    Re: VLOOK problem with multiple values in table array

    You need to give each record a unique reference. One way of doing this is to insert a new column C (which you can hide later on, so the sheet will look the same), and then you can use this formula in C2:

    =IF(B2="","-",B2&"_"&COUNTIF(B$2:B2,B2))

    Copy this down beyond your data - the hyphens will help you see where you have copied it to. Then you can change your lookup formula in B6 of Sheet2 to this:

    =VLOOKUP(A$2&"_"&ROWS($1:1),Sheet1!$C$2:$D$4,2,FALSE)

    then copy down.

    Hope this helps.

    Pete

  4. #4
    Forum Contributor
    Join Date
    04-23-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    107

    Re: VLOOK problem with multiple values in table array

    Many thanks Fotis

    This has worked perfectly.

+ 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