+ Reply to Thread
Results 1 to 9 of 9

Compiling list using VLOOKUP?

  1. #1
    Registered User
    Join Date
    06-21-2009
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    3

    Compiling list using VLOOKUP?

    Hey guys,

    After endless searching I'll give it a shot here. What I have is an exported player file from a simulation basketball program. Each player is given a unique playerID ranging from 1:740. Each row contains a playerID and relevant data for that player.

    The task I'm trying to complete involves the player's teamID value. As up to 15 players will have the same teamID value (ranging 1:30), I'm trying to use a function to list all instances a particular teamID appears.

    Example: teamID=1
    I want to return a list of all 15 players which have this teamID.

    Using the VLOOKUP, I am able to return the first occurence. After some searching, I've come across suggestions of using the OFFSET, MATCH and INDEX functions, but I haven't had much luck.

    I have attached a trimmed-down version of the file I am working with. The data is on the 'Player' sheet, and I will be calling the info on Sheet1.

    Any help will be greatly appreciated!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    06-18-2004
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    1,474

    Re: Compiling list using VLOOKUP?

    For the first name, try...

    B2, confirmed with CONTROL+SHIFT+ENTER, and copied down:

    =IF(ROWS(B$2:B2)<=COUNTIF(Players!$B$2:$B$741,Sheet1!$A$2),INDEX(Players!$D$2:$D$741,SMALL(IF(Players!$B$2:$B$741=Sheet1!$A$2,ROW(Players!$B$2:$B$741)-ROW(Players!$B$2)+1),ROWS(B$2:B2))),"")

    For the last name, try...

    C2, confirmed with CONTROL+SHIFT+ENTER, and copied down:

    =IF(ROWS(B$2:B2)<=COUNTIF(Players!$B$2:$B$741,Sheet1!$A$2),INDEX(Players!$E$2:$E$741,SMALL(IF(Players!$B$2:$B$741=Sheet1!$A$2,ROW(Players!$B$2:$B$741)-ROW(Players!$B$2)+1),ROWS(B$2:B2))),"")

    Note that I replaced...

    Players!$D$2:$D$741

    with

    Players!$E$2:$E$741

    Change the formula, accordingly, for the other columns.

  3. #3
    Registered User
    Join Date
    06-21-2009
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Compiling list using VLOOKUP?

    Thanks for the quick reply. It didn't seem to work for me, but I'm not sure if it's got to do with a box asking me to Update Values appearing when I hit CTRL + SHIFT + ENTER...

  4. #4
    Forum Expert
    Join Date
    06-18-2004
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    1,474

    Re: Compiling list using VLOOKUP?

    Here's a sample file...
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    06-21-2009
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Compiling list using VLOOKUP?

    You're a legend! Thanks for the help.

  6. #6
    Registered User
    Join Date
    10-07-2008
    Location
    San Francisco
    Posts
    8

    Re: Compiling list using VLOOKUP?

    Hi Domenic,

    In your reply Post #2 and #4, I am in need of a similar table lookup. Using the example in this post, how can I modify the formula to automatically scan the column header to find the appropriate column instead of hardcoding. That is, the portion of INDEX(Players!$E$2:$E$741,SMALL(IF(Players!$B$2:$B$741... match the header of Sheet 1 to the larger table in Players. This way I can customize the data columns using drop downs without having to know which column the original data resides. I tried using INDEX(Players!$A1:$CD1,MATCH(C$1,0,0,0),SMALL(.... But it hasn't worked out.

    Thank you,


    David

  7. #7
    Forum Expert
    Join Date
    06-18-2004
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    1,474

    Re: Compiling list using VLOOKUP?

    Try something like..

    Please Login or Register  to view this content.
    ...confirmed with CONTROL+SHIFT+ENTER. Adjust the ranges, accordingly.
    Last edited by Domenic; 08-11-2009 at 03:07 PM.

  8. #8
    Registered User
    Join Date
    10-07-2008
    Location
    San Francisco
    Posts
    8

    Re: Compiling list using VLOOKUP?

    Tried your suggestion and it worked perfectly! Thank you. Would have posted sooner but was away on vacation. To get rid of the pesky #NUM errors, I wrapped the entire formula within an ISERROR function. Wish there was a prettier/less cumbersome way of doing this though (I'm using Excel 2003). I even made the Table with conditional format to create table lines if there is data in each row and column. Now when I add any column header via drop down validation list, the header is automatically shaded and the data pops into place with table lines.

    Again thanks for your help.

  9. #9
    Forum Expert
    Join Date
    06-18-2004
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    1,474

    Re: Compiling list using VLOOKUP?

    Assuming that the formula is entered in B2 and copied down, try...

    B2, confirmed with CONTROL+SHIFT+ENTER, and copied down:

    Please Login or Register  to view this content.

+ 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