+ Reply to Thread
Results 1 to 7 of 7

Vlookup duplicate values

  1. #1
    Registered User
    Join Date
    03-05-2014
    Location
    Scotland
    MS-Off Ver
    Excel 2013
    Posts
    28

    Vlookup duplicate values

    Hi all,

    I have a mental block here, hence the need for some help.

    In the attached example, when you search for 'hard' it returns the search string result in ListBox1 but what I want is to then be able to click the values shown in ListBox1 and have ListBox2, 3 and 4 update showing the differing data present in sheet2. What currently happens is that it works for the first but not for the rest.

    Any help is appreciated.

    Thanks.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: Vlookup duplicate values

    Hello
    I amended your List Box code to the following:

    Please Login or Register  to view this content.
    Does this do as you require? It now scrolls through the 'Hard Drive' list for each selection.

    DBY

  3. #3
    Registered User
    Join Date
    03-05-2014
    Location
    Scotland
    MS-Off Ver
    Excel 2013
    Posts
    28

    Re: Vlookup duplicate values

    Brilliant, exactly what I was struggling to do. Many thanks DBY

  4. #4
    Registered User
    Join Date
    03-05-2014
    Location
    Scotland
    MS-Off Ver
    Excel 2013
    Posts
    28

    Re: Vlookup duplicate values

    Sorry about this, I appear to be stupidly stumped.

    The real spread sheet is similar except Column A is 10,000 rows containing various text only (there are duplicates) with Column B having a value of 1,2,3 or 4.

    When I try my previous code line or your suggestion, the search string works fine, so for example if there are 3 duplicates within those 10,000 rows, they are shown within the form. But when I click any of them, the value to be read in the adjacent Column B for all 3 is showing the same value so instead of 2,3,1 - they all return 2,2,2. It appears to be stuck on the first value and not refreshing between mouse clicks on the other duplicates.

    I have attached a sample again to demonstrate. If you search for 'wee' it returns 3 results but each when clicked return 1. It should be 1,4,2.


    Much appreciated if someone can shed light into my mind.
    Attached Files Attached Files
    Last edited by JumpyJim; 04-22-2016 at 12:48 PM.

  5. #5
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: Vlookup duplicate values

    Hello
    I was working on this before I saw your second sample file. If the search items are not grouped together then it won't bring back the correct values. I had created a sample file to show one method around this. I'm no VBA expert so there may be a better way but I've created as second list box (hidden) containing all the row numbers of the found items and used that to return the second column value. Take a look and see if it can be applied to your data.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    03-05-2014
    Location
    Scotland
    MS-Off Ver
    Excel 2013
    Posts
    28

    Re: Vlookup duplicate values

    In my eyes, you most certainly are an expert as with that code and some fiddling, I've managed to get it display the results I expected. Awesome

    DBY, thank you.

  7. #7
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: Vlookup duplicate values

    Glad to have helped. I've put your sample data into my file and it seems to work ok. As you say it needs a bit of fiddling to make it all nice but the principle seems to work.

    DBY

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] VLOOKUP and Duplicate Values
    By marshak in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-03-2015, 01:43 AM
  2. [SOLVED] using vlookup on duplicate values to get the sum of both
    By 4rch@ng3l in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-23-2014, 01:35 PM
  3. Vlookup with duplicate values
    By bperkins in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 04-30-2013, 03:31 AM
  4. Need help with vlookup in duplicate values
    By vivshan in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-09-2013, 05:54 AM
  5. vlookup with multiple duplicate values
    By bnasty in forum Outlook Programming / VBA / Macros
    Replies: 1
    Last Post: 10-27-2012, 06:06 PM
  6. VLookup Duplicate Values
    By markd87 in forum Excel General
    Replies: 0
    Last Post: 07-20-2011, 11:54 AM
  7. Vlookup - Duplicate Values
    By sraju in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 11-28-2010, 09:09 AM

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