+ Reply to Thread
Results 1 to 8 of 8

Vlookup with duplicate values

  1. #1
    Registered User
    Join Date
    04-29-2013
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    4

    Vlookup with duplicate values

    Need a little help trying to develop a simple shipping/tracking schedule. Basically what I have below in the first column are ship set sequences, 2nd column are dates and 3rd column is ship set sequences again. So it reads set 4808 ships on 11/21/2013 along with 4809. Then the truck returns later that day with previous shipments in the 3rd column. On the return trip set 4788, which was sent out 2 weeks prior, will come back along with 4789. I wanted to use a simple Vlookup to search for date 11/21/2013 and return the corrisponding ship set that went out on that date. Since 2 sets shipped on the same date, have duplicate dates on 2 ship sets and the Vlookup is ignoring the 2nd set. I partially solved the problem by creating a column that looks for duplicate entries and adds +1 to the ship set which works 95% of the time. I need something that will return only 1 4788 and then a 4789 as the table array reads.


    What I have...

    4808 11/21/2013 4788
    4809 11/21/2013 4788
    4810 11/22/2013 4790
    4811 11/26/2013 4793
    4812 11/26/2013 4793
    4814 11/27/2013 4796
    4815 11/27/2013 4796
    4816 12/2/2013 4798
    4817 12/2/2013 4798
    4818 12/3/2013 4800
    4819 12/3/2013 4800
    4820 12/4/2013 4802
    4821 12/4/2013 4802

    What I need...


    4808 11/21/2013 4788
    4809 11/21/2013 4789
    4810 11/22/2013 4790
    4811 11/26/2013 4793
    4812 11/26/2013 4794
    4814 11/27/2013 4796
    4815 11/27/2013 4797
    4816 12/2/2013 4798
    4817 12/2/2013 4799
    4818 12/3/2013 4800
    4819 12/3/2013 4801
    4820 12/4/2013 4802
    4821 12/4/2013 4803
    Last edited by bperkins; 04-29-2013 at 12:11 PM.

  2. #2
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Vlookup with duplicate values

    On the return trip set 4788, which was sent out 2 weeks prior, will come back along with 4789.
    How did you got that ?
    Is it 4788+1 ?

    Also, it would be helpful if you could upload a sample workbook? thanks.

    Regards,
    DILIPandey
    <click on below * if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), [email protected]

  3. #3
    Registered User
    Join Date
    04-29-2013
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Vlookup with duplicate values

    I am trying to work this from a different angle now.

    =IF(X11=O:O,VLOOKUP(W11,J:L,3,FALSE), "")

    What I want the above simplified formula to do is look at the value in X11 (which is a date) and find it within a list of dates in column O. If the date exists then I want to do a Vlookup of an indexed value specific for each date and use that value to match up a ship set in the 3rd column of the array. So for instance ship set "1" is "4550" so if the date exists then I want to return "4550". If the date in the next cell, X12, does not exist in column O then it will return no value. The formula doesn't work right... I don't know why. Can you help with this?

  4. #4
    Registered User
    Join Date
    04-29-2013
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Vlookup with duplicate values

    Anybody? I know this can be done but I just don't understand how

  5. #5
    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,926

    Re: Vlookup with duplicate values

    not sure if this is what you want...

    =IF(iserror(vlookup(X11,O:O,1,false)),"",VLOOKUP(W11,J:L,3,FALSE))
    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

  6. #6
    Registered User
    Join Date
    04-29-2013
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Vlookup with duplicate values

    That did work but ended up with the same original problem. We ship 2 sets on the same day and I need to use the date to look up a ship set. Since 2 ship on the same day, I get a returned value for today's shipment as ship set 100 & 100 (because they use the same date) instead of 100 & 101 as the actual shipment stated.

  7. #7
    Valued Forum Contributor Lemice's Avatar
    Join Date
    04-13-2013
    Location
    Somewhere.
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: Vlookup with duplicate values

    Hello,

    Vlookup and all other lookup will only return the first result they encounter.

    You can bypass the duplicated result, and jump to the next, you will need to use an Array formula with INDEX, SMALL and COUNTIF.

    As dilipandey suggested, can you provide a small sample file with dummy data? It will be much easier for other to help you also.
    (copy pasta from Ford)
    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

    Regards,
    Lem

  8. #8
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Vlookup with duplicate values

    Thanks Lemice for seconding my opinion.

    bperkins, awaiting your response thanks.


    Regards,
    DILIPandey
    <click on below * if this helps>

+ 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