+ Reply to Thread
Results 1 to 12 of 12

vlookup formula pulling duplicates until it comes across start in columb

  1. #1
    Registered User
    Join Date
    06-27-2013
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    94

    vlookup formula pulling duplicates until it comes across start in columb

    I'm trying to create a sheet that generates a report based off of a date typed into a cell. i'm using a vlookup formula which works great except for it duplicates the first match until it scrolls down enough to get to the spot in the data where the matches are located.

    =VLOOKUP($B$2,'Sheet1'!C29:L$500,2,FALSE)

    b2 is the cell which the date is typed, c29:l500 is the area which i want the data to pull from.

    so what it's doing is say the date 2/2/13 is first listed in c50, it will pull that first match and list it 21 times until it gets to the match in c51. how do i fix this??

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: vlookup formula pulling duplicates until it comes across start in columb

    It sounds like you want the last match, as opposed to the first.

    In this case, you can use old school LOOKUP(lookup variable, lookup vector, return vector)

    We use some fanciness, and come up with:

    =LOOKUP(2,1/($B$2='Sheet1'!C29:C$500),'Sheet1'!D29:D$500)
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  3. #3
    Registered User
    Join Date
    06-27-2013
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    94

    Re: vlookup formula pulling duplicates until it comes across start in columb

    well, i want all the matches but i don't need 30 duplicates of the 1st match. so if there are 20 matches for 2/2/13, i want them to list, which it does after it duplicates all the way until that spot in the original data.

    right now that formula will find 2/2/13 and then list a time, which for each of the 20 matches will be different.

  4. #4
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: vlookup formula pulling duplicates until it comes across start in columb

    So you need the Nth vlookup?

  5. #5
    Registered User
    Join Date
    06-27-2013
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    94

    Re: vlookup formula pulling duplicates until it comes across start in columb

    yea. i don't want to mess with the array because the user won't know to change it. so i need the first vlookup match to be what's in d50 and the second to be in d51 and so on by vlookup starting c29.. make sense?

  6. #6
    Registered User
    Join Date
    06-27-2013
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    94

    Re: vlookup formula pulling duplicates until it comes across start in columb

    heres an example. put in 1/2/13 and see what i mean.
    Attached Files Attached Files

  7. #7
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: vlookup formula pulling duplicates until it comes across start in columb

    Here's how I would do it.
    In G3 of sheet1 copied down

    =C3&"_"&COUNTIF($C$3:C3,C3)
    You can hide this column after you create it. This is a key column giving unique ID's to each entry

    In sheet2, in C3 (copied across and down)
    =IFERROR(INDEX(Sheet1!D$3:D$49,MATCH(Sheet2!$B$2&"_"&ROWS($A$1:$A1),Sheet1!$G$3:$G$49,0)),"")
    See attachment.
    Does that work for you?
    Attached Files Attached Files
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  8. #8
    Registered User
    Join Date
    06-27-2013
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    94

    Re: vlookup formula pulling duplicates until it comes across start in columb

    yes that could work. thanks ChemistB

  9. #9
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: vlookup formula pulling duplicates until it comes across start in columb

    No problem. Thanks for the Rep.

  10. #10
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: vlookup formula pulling duplicates until it comes across start in columb

    Another way if you don't want to use the helper column, this regular formula will return all the records that matches with the date in B2...
    Please Login or Register  to view this content.
    and then drag down.
    See if you get the desired output with the above formula.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  11. #11
    Registered User
    Join Date
    06-27-2013
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    94

    Re: vlookup formula pulling duplicates until it comes across start in columb

    that worked excellent sktneer. Thanks!

  12. #12
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: vlookup formula pulling duplicates until it comes across start in columb

    Glad, I could help. Thanks for the feedback.

+ 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] Duplicates Pulling through from "Index" formula
    By AK262007 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-11-2014, 04:09 AM
  2. How not to effect all duplicates while using vlookup formula
    By odyseus8 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-09-2013, 06:03 AM
  3. Replies: 2
    Last Post: 01-16-2013, 05:11 PM
  4. Vlookup Formula Help For Pulling Data From a Tab
    By donnydorko in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-10-2009, 10:02 PM
  5. RTD, how do you stop/start it from pulling in data?
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-23-2005, 04:06 PM

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