+ Reply to Thread
Results 1 to 11 of 11

Dynamic VLOOKUP

  1. #1
    Registered User
    Join Date
    11-11-2010
    Location
    Telford UK
    MS-Off Ver
    Excel 2003
    Posts
    6

    Question Dynamic VLOOKUP

    I have an extract that contains one or more rows for a given ID and on a separate sheet I need to modify the VLOOKUP formulae to only pick up the first occurrence for each ID. On the next row I then need the first occurrence of the next ID and so on. I have played about with this formulae to ensure that subsequent VLOOKUPs start at the row below the last selected row, but this only picks up the next occurrence of the same ID.
    =VLOOKUP(Sheet2!$D$2,INDIRECT("JLSExtract!A"&P2&":Q"&Q2),2,FALSE)

    I use ROW() to return the last selected row in cell P2 and the bottom row in cell Q2

    In effect I need to remove duplicates from the extract but the reason fro the VLOOKUP formula is that the selection is dependant upon data in the second column.

    Hope someone can help
    Last edited by Scubades; 11-15-2010 at 04:46 AM. Reason: To update thread to solved

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    re: Dynamic VLOOKUP

    To best describe or illustrate your problem you would be better off attaching a dummy workbook, the workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    If needed supply a before and after sheet in the workbook so the person helping you can see what you are trying to achieve.

    Doing this will ensure you get the result you need!
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    11-11-2010
    Location
    Telford UK
    MS-Off Ver
    Excel 2003
    Posts
    6

    re: Dynamic VLOOKUP

    Sample spreadsheet attached with brief notes of how the anticipated data would be displayed.

    Thanks in anticipation - dissappearing to the gym now so won't pick up any responses for about 17 or so hours
    Attached Files Attached Files

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    re: Dynamic VLOOKUP

    Try this:

    In R3 of JLSExtract sheet enter formula:

    Please Login or Register  to view this content.
    and copy down all the way. This identifies the first records for the corresponding ID from B1 of Sheet1.

    In Sheet1,D1 enter:

    Please Login or Register  to view this content.
    this tells us how many records matched and is needed for the next formula.

    Change column headers in row 2 of Summary to match exactly to corresponding column headers in the other sheet.

    Then apply formula in A3 of Sheet1:

    Please Login or Register  to view this content.
    copy down as far as you want and across as far as needed.

  5. #5
    Registered User
    Join Date
    11-11-2010
    Location
    Telford UK
    MS-Off Ver
    Excel 2003
    Posts
    6

    Thumbs up re: Dynamic VLOOKUP

    That's great thanks, I'll try it tomorrow when I get in to work

  6. #6
    Registered User
    Join Date
    11-11-2010
    Location
    Telford UK
    MS-Off Ver
    Excel 2003
    Posts
    6

    Question Re: Dynamic VLOOKUP

    Thanks NBVC, that works a treat as shown in the attachment. Could I ask for a further modification please? In the attached file I have indicated the need for multiple services to appear in the modified extract (up to 30). So in place of the single service entry in Sheet1!B6 there could be a request for up to 30 services which should be listed in service sequence. So the sequence would be like the single service using your formulae, but the subsequent services would append one after the other. I envisage the code working through until (in this case) it comes to the last (21) entry for Service 1 and then somehow looping back to pick the next service number and so on. Is this possible or am I asking too much of worksheet formulae.

    Hope you can help me once again
    Attached Files Attached Files

  7. #7
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Dynamic VLOOKUP

    I would recommend that if you can sort the records in the JLSExtract sheet, then it would make life a lot easier, if you want to see the results grouped by Service.

    If you can do that, then assuming you list the services you want to find in say a vertical column A2:A31, then in JLSExtract, R3 use formula:

    Please Login or Register  to view this content.
    copied down.

    and in Sheet1, D1 keep formula:

    Please Login or Register  to view this content.
    and in Sheet1, B3 where the extractions begin, use similar formula:

    Please Login or Register  to view this content.
    copied down and across.

  8. #8
    Registered User
    Join Date
    11-14-2010
    Location
    Indonesia
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Dynamic VLOOKUP

    Please Login or Register  to view this content.
    What the meaning
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    11-11-2010
    Location
    Telford UK
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Dynamic VLOOKUP

    Thanks once again, I will try when I get into work tomorrow. Sorting will not pose any problems

  10. #10
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Dynamic VLOOKUP

    Quote Originally Posted by wawansur View Post
    Please Login or Register  to view this content.
    What the meaning
    Please Login or Register  to view this content.
    it is referencing the entire column R.. so looking for the Maximum in the whole column.

  11. #11
    Registered User
    Join Date
    11-11-2010
    Location
    Telford UK
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Dynamic VLOOKUP

    Thanks NBVC, this is working like a dream now and I am beginning to understand the logic behind it so enhancing my problem solving ability in the future. Thanks for all your time, much appreciated.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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