+ Reply to Thread
Results 1 to 24 of 24

vlook up return more than one match

  1. #1
    Registered User
    Join Date
    08-26-2007
    Posts
    12

    vlook up return more than one match

    please help

    i have a customer work book for outstanding orders of which there are hunderds of rows with there name order number and the items that are outstanding

    when i have progressed all my purchased orders i take all the items and run it throught my work book using vlookup to return who wanted what items if any

    but what if there are more then one customer wanting the same item how can i get vlookup to know that and return the next match


    i'm still very new at excel so can someone please help me

    attached is a small test of my work book

    if you see item 3182Y/1.0/BLK
    you can see it is wanted by both a.f switchgear and amg

    but it will only return a.f switchgear
    Attached Files Attached Files
    Last edited by dphair1979; 08-26-2007 at 01:53 PM.

  2. #2
    Forum Contributor
    Join Date
    07-05-2007
    Location
    Lexington, MA
    Posts
    302

    Sort rather than VLookup

    It seems that you are entering (pasting?) a list of items ordered in Col G, and you want to know who ordered that item. The problem is, what do you do when 2+ customers order the same item?

    I suggest this different approach.
    Sort your worksheet into order by item ordered, and you will automatically see when multiple customers have ordered it.

    There may be other considerations that you haven't posted. So, if this doesn't work for you, say why.
    FrankBoston is the pen name for Andrew Garland, Lexington MA

  3. #3
    Registered User
    Join Date
    08-26-2007
    Posts
    12
    i could do that but i have other fields that i pull through using vlook up like
    customer
    order number
    qty wanted for each item
    and date placed

    and there are hundreds of orders and i may have only chase a few of the items

    so vlookup pulls out the info that matches for the items i have chased


    when it has returned the info i want i then copy the list created by vlookup and paste the values in a orders chased book for the sales staff

    only having the items that have been chased with answers

    vlookup works great but it's just this little hiccup
    Last edited by dphair1979; 08-26-2007 at 02:43 PM.

  4. #4
    Forum Contributor
    Join Date
    07-05-2007
    Location
    Lexington, MA
    Posts
    302

    Still in favor of sorting

    I still like sorting because you don't have to copy all of your row information to another place, and it avoids the problem of many customers for each part.

    I have uploaded an approach based on added columns Lookup and Chased. They tag each row according to whether that row has a product that is being chased. You can then sort the rows to bring the desired ones to the top, for examination and copy.

    Tell me if this helps.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    08-26-2007
    Posts
    12
    I See How That Works But The Outstanding Work Book Runs Queries That Are Linked To My Sales Systems Program

    So The Order There In Can Not Be Messed With
    Thats Why Using Vlook Up Has Worked So Well

    I Know I Can Use Countif
    To See If There Are More That One Match But Can That Be Worked Into Vlookup

  6. #6
    Forum Contributor
    Join Date
    07-05-2007
    Location
    Lexington, MA
    Posts
    302

    Work on a copy?

    I suggest that you do your analysis on a copy of the original workbook, leaving the original as part of your current system.

    If you approach the problem by copying data and duplicates to another sheet, I predict a lot of complications. In a way, you will be copying the original workbook anyway, but as individual cells and rows, and using more complicated worksheet and macro functions.

  7. #7
    Forum Contributor
    Join Date
    07-05-2007
    Location
    Lexington, MA
    Posts
    302
    I admit that those formulas make me dizzy as well. I'll leave it to someone else to analyze them. Good luck.

  8. #8
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    Have a look at sheet2 in the attached. Does this get you there....


    rylo
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    08-26-2007
    Posts
    12
    yes it does but i don't know how to break that code down to get it the work in my work book

    there is a sample above

    book 1 it's a sample of my work book


    many thanks for you help
    Last edited by dphair1979; 08-27-2007 at 04:10 AM.

  10. #10
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    I based it on your book1!sheet1 data, but extended the data.

    Do you want it to work for you sheet1 structure exactly? Do you need to have the counts in row 4? Are you only ever going to bring in 2 items?

    Can you give some more detail on exactly what you want your structure to be, and where you want the formula to be active, and any constraints you will be applying.


    rylo

  11. #11
    Registered User
    Join Date
    08-26-2007
    Posts
    12
    my work book looks like this

    this is only a stripped down version i have it pull through more vlookup but they work on the order number which does not kick up a problem. it's just when matching the customer with their items

    there can current 368 items outstanding and there are 23 duplicates
    some more then twice

    so i would like it to look through the list if there is only one then fine.
    but if it finds one that has already returned a match to then look for the next

    on the book 1

    you will see item 3182Y/1.0/BLK
    comes up twice
    and it's wanted by both a.f switchgear and amg
    but it only returns the first match a.f switchgear
    Attached Files Attached Files
    Last edited by dphair1979; 08-28-2007 at 03:46 AM.

  12. #12
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    F2: =IF(COUNTIF($G$2:G2,G2)>COUNTIF($C$2:$C$18,G2),"",INDEX(D:D,SMALL(IF($C$2:$C$18=G2,ROW($D$2:$D$18),""),COUNTIF($G$2:G2,G2))))

    This formula is array entered using the ctrl, shift and enter keys.

    Adjust the ranges as necessary, then copy down as required.


    HTH

    rylo

  13. #13
    Forum Contributor corinereyes's Avatar
    Join Date
    12-02-2003
    Location
    Philippines
    MS-Off Ver
    MS Excel 2016
    Posts
    520
    Hi,

    I dont know if this is what you exactly need however i gave it a try. I've notice that there are the same lookup values in column f like -> (3182Y/1.0/BLK) and i think that the VLOOKUP function is not capable of doing that. (please correct me if im wrong).

    Try this formula on cell E2

    combined IF, COUNTIF, INDEX & MATCH function.

    Please Login or Register  to view this content.
    I've attached a file.
    Attached Files Attached Files
    Corine

  14. #14
    Registered User
    Join Date
    08-26-2007
    Posts
    12
    That Works Great But How Do I Change It If There Are More Then 2 Matches

    i being able to to take a copy of my work book


    this is the template i use (taking out our info replacing it with a dummy customers)

    its the order number i want to be the advanced lookup
    as everything else works great


    thank you for your help so far

    BELOW IS THE CORRECT BOOK AS I POSTED THE WRONG ONE LAST TIME
    Attached Files Attached Files
    Last edited by dphair1979; 08-28-2007 at 07:46 AM.

  15. #15
    Forum Contributor corinereyes's Avatar
    Join Date
    12-02-2003
    Location
    Philippines
    MS-Off Ver
    MS Excel 2016
    Posts
    520
    Hi dphair1979,

    Are you reffering your question to rylo or me?

  16. #16
    Registered User
    Join Date
    08-26-2007
    Posts
    12
    Quote Originally Posted by corinereyes
    Hi dphair1979,

    Are you reffering your question to rylo or me?

    sorry
    to yourself

    i attached the wrong work book please have a look at the outstanding work book
    Last edited by dphair1979; 08-28-2007 at 07:34 AM.

  17. #17
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243
    hi all,

    I tried solving this yesterday when there were fewer replies in the thread but I couldn't solve it using a formula only approach (& my head got dizzy too!) so I started trying different approaches (a macro could probably do it reasonably quickly but I'm not sure if that is wanted?).
    A completely different approach to what has been considered so far is the use of a Pivot Table...
    Does the attached file do what you are after?
    Or can you change it to suit by dragging & dropping the fields?


    btw, Debra has a great site for Pivot Table questions which are linked under P on the below page:
    HTML Code: 

    hth,
    Rob
    Attached Files Attached Files
    Rob Brockett
    Kiwi in the UK
    Always learning & the best way to learn is to experience...

  18. #18
    Forum Contributor corinereyes's Avatar
    Join Date
    12-02-2003
    Location
    Philippines
    MS-Off Ver
    MS Excel 2016
    Posts
    520
    Hi dphair1979,

    Are there any other unique ID in your database that can identify a particular Customer? If you dont mind can you attach a complete example of the data generated by your system.

    Kindly look at the attached file. I've added a column for customer ID to correctly identify the Order No.

    I will be glad to hear your feedback.

  19. #19
    Registered User
    Join Date
    08-26-2007
    Posts
    12
    Quote Originally Posted by rylo
    Hi

    F2: =IF(COUNTIF($G$2:G2,G2)>COUNTIF($C$2:$C$18,G2),"",INDEX(D:D,SMALL(IF($C$2:$C$18=G2,ROW($D$2:$D$18),""),COUNTIF($G$2:G2,G2))))

    This formula is array entered using the ctrl, shift and enter keys.

    Adjust the ranges as necessary, then copy down as required.


    HTH

    rylo

    ITS WORK ON THE TEST BOOK BUT WHEN I ENTER IT ON MY WORK BOOK IF IT FINDS A SECOND MATCH IT BRINGS UP #NUM

    WHAT AM I DOING WRONG

  20. #20
    Forum Contributor corinereyes's Avatar
    Join Date
    12-02-2003
    Location
    Philippines
    MS-Off Ver
    MS Excel 2016
    Posts
    520
    Hi dphair1979,

    Here is the attachment.

    I will be glad to have your feedback.
    Attached Files Attached Files

  21. #21
    Forum Contributor
    Join Date
    08-28-2006
    Posts
    280

    Maybe this will help

    I used this lookup in one of my projects. It appears to work for yours. See the attachment. See if it works for you. The formulas, if altered, must be confimed with CTRL-Shift-Enter.

    Hope it helps,

    Dean
    Attached Files Attached Files

  22. #22
    Registered User
    Join Date
    08-26-2007
    Posts
    12
    Thanks Dean England

    If You Look At The Chased Tab It's Pulling Data From The Outstanding Orders Tab

  23. #23
    Registered User
    Join Date
    08-26-2007
    Posts
    12
    Quote Originally Posted by corinereyes
    Hi dphair1979,

    Here is the attachment.

    I will be glad to have your feedback.

    BUT I CAN NOT MESS WITH THE OUSTANDING BOOK LAYOUT
    I CAN ONLY PULL INFORMATION FROM IT

  24. #24
    Registered User
    Join Date
    08-26-2007
    Posts
    12

    Smile

    Quote Originally Posted by rylo
    Hi

    F2: =IF(COUNTIF($G$2:G2,G2)>COUNTIF($C$2:$C$18,G2),"",INDEX(D:D,SMALL(IF($C$2:$C$18=G2,ROW($D$2:$D$18),""),COUNTIF($G$2:G2,G2))))

    This formula is array entered using the ctrl, shift and enter keys.

    Adjust the ranges as necessary, then copy down as required.


    HTH

    rylo

    THANK YOU IT WORKS


    THANK YOU FOR EVERYONE THAT HAS HELPED ME WITH THIS PROBLEM

    ATTACHED IS THE WORKING BOOK

    AGAIN THANK YOU
    Attached Files Attached Files
    Last edited by dphair1979; 08-28-2007 at 11:20 AM.

+ 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