+ Reply to Thread
Results 1 to 10 of 10

Vlookups with multiple values for same ID

  1. #1
    Registered User
    Join Date
    06-13-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    5

    Vlookups with multiple values for same ID

    Hi all, are these possible? (Excel 2010)

    I want to return every value for the same ID, to get a full list of all the values possible for this ID.

    So far it is only returning the first value which it finds entered in the spreadsheet.

    I have attached the workbook - it is a basic practice version for the full one I want to construct.

    The original table is on the left and the Lookup table where I want to get the answer, is on the right.

    Thanks!

    Daniel
    Attached Files Attached Files

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

    Re: Vlookups with multiple values for same ID

    Take a look at this thread from earlier today:

    http://www.excelforum.com/excel-gene...show-data.html

    Hope this helps.

    Pete

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Vlookups with multiple values for same ID

    so do you want to count the number of times an ID is found, or give a list of them? if count is what you want, try using....
    =COUNTIFS($A$3:$A$121,F2,$B$3:$B$121,"<>0")

    if you want to add all the values, try...
    =SUMIF($A$3:$A$121,F2,$B$3:$B$121)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: Vlookups with multiple values for same ID

    Hi Daniel,

    Do you mean to get the Total of a department. If so SUMIF will do it.

    G2, then drag down.

    =SUMIF(A:A,F2,B:B)
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

  5. #5
    Forum Contributor bentleybob's Avatar
    Join Date
    02-27-2009
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    644

    Re: Vlookups with multiple values for same ID

    So, if I understand correctly, for Wine you want 1, 3, and 6 (perhaps in cells G2 through I2), for Commodities, 10, 40, and 60, and so forth? And, if correct, is there an upper limit to the number of values you want reported for a given ID?

  6. #6
    Registered User
    Join Date
    06-13-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Vlookups with multiple values for same ID

    Thanks to everyone for replying...I have been told by the employer not to use SUMIF or COUNTIF because they consider VLookup to be more efficient...so I need to do it this way as an example, in order to learn, so I can apply it to the real spreadsheet (which is much larger, here I just used a few days instead of the whole year)

    Quote Originally Posted by bentleybob View Post
    So, if I understand correctly, for Wine you want 1, 3, and 6 (perhaps in cells G2 through I2), for Commodities, 10, 40, and 60, and so forth? And, if correct, is there an upper limit to the number of values you want reported for a given ID?
    Hi, yes this is exactly correct. No upper limit necessarry. I have no idea how to do this because if I copy and paste down, it only gives me those same values (Wine=1, Commodities=10, Real Estate=5).

    Thanks...

  7. #7
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: Vlookups with multiple values for same ID

    Try this in G2 with CTRL+SHIFT+ENTER, rather than just ENTER

    Please Login or Register  to view this content.
    Then copy G2, then paste across & down.

  8. #8
    Registered User
    Join Date
    06-13-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Vlookups with multiple values for same ID

    Quote Originally Posted by Haseeb A View Post
    Try this in G2 with CTRL+SHIFT+ENTER, rather than just ENTER

    Please Login or Register  to view this content.
    Then copy G2, then paste across & down.
    Thanks for the effort man I appreciate it!

    I tried this but I got 0! :-s

    I changed it to include a larger table array, but still 0.

    Anyway, I now understand how I should have phrased my question: "Can we use VLookups with non-unique identifiers".

  9. #9
    Forum Expert icestationzbra's Avatar
    Join Date
    01-07-2004
    MS-Off Ver
    2007, 2010
    Posts
    1,421

    Re: Vlookups with multiple values for same ID

    you cannot use VLOOKUP for that purpose.

    see if attached satisfies your requirement.

    depending on whether you want your Summary laid out landscape or portrait, the formula is slightly different. both the versions are provided.
    - i.s.z -
    CSE, aka Array aka { }, formulae are confirmed with CONTROL+SHIFT+ENTER.
    Replace commas ( , ) with semicolons ( ; ) in formulae, if your locale setting demands.
    All good ideas are courtesy resources from this forum as well as others around the web.
    - e.o.m -

  10. #10
    Registered User
    Join Date
    06-13-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Vlookups with multiple values for same ID

    Quote Originally Posted by icestationzbra View Post
    you cannot use VLOOKUP for that purpose.

    see if attached satisfies your requirement.

    depending on whether you want your Summary laid out landscape or portrait, the formula is slightly different. both the versions are provided.
    This is great, thank you so much!

+ 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