+ Reply to Thread
Results 1 to 4 of 4

Looking up multiple occurrences of lookup value, returning corresponding data

  1. #1
    Registered User
    Join Date
    08-26-2014
    Location
    A Sea Container
    MS-Off Ver
    2016
    Posts
    14

    Looking up multiple occurrences of lookup value, returning corresponding data

    Hi all,

    Please bear with me as I'm having difficulty getting my head around this one, let alone explaining my problem clearly (I'm a novice!)

    I have two 'active databases' (separate excel workbooks), the first is an information register where rows of data are always being added, but never removed/deleted.

    The second database (I'll call this one 'tracker') will basically be a duplicate of the data in the register but will only include 'active' items (i.e. items that have not been 'closed out' in the register), so there will always be data being added and removed from this workbook. I hope that makes sense.

    Essentially what I need to do is lookup multiple occurrences of the lookup value (located in 'tracker') from my register database. The problem is, I will have multiple, varying lookup values and multiple, varying corresponding results...

    Hopefully you're still with me at this point!

    To elaborate (here's where it will get really messy, haha), what I'm trying to do on the 'tracker' workbook, is set up a column (let's say Column M) next to my data table (which encompasses columns A:L) with formulas that will lookup a value in Column L that may (or may not) occur multiple times, i.e. L7='HELP1', L8='HELP1', L9='HELP1', L10='HELP2', and then return the corresponding data (which is a date) from a column in the register workbook. I managed to use an array formula to achieve this for the first occurrence of the lookup value;

    {=INDEX('[Register'!$U:$U,SMALL(IF($L$7='Register'!$O$2:$O$1000000,ROW('Register'!$O$2:$O$1000000)-ROW('Register'!$U$2)+2), ROW('Register'!2:2)))}

    I want to be able to just drag this formula down to lookup the value beside it in column 'M', but I know I'm not using the formula correctly, as the lookup value has to be a constant....

    This is what I mean, obviously it didn't work;

    M7 = {=INDEX('[Register'!$U:$U,SMALL(IF($L$7='Register'!$O$2:$O$1000000,ROW('Register'!$O$2:$O$1000000)-ROW('Register'!$U$2)+2), ROW('Register'!2:2)))}

    M8 = {=INDEX('[Register'!$U:$U,SMALL(IF($L$8.....

    M9 = {=INDEX('[Register'!$U:$U,SMALL(IF($L$9.....

    Is there any way I can achieve what I'm trying to do with VBA? I'm sorry, I can't share my workbooks but I can provide more information if need be.

    If it helps to visualise it, this is what the results should look like on the tracker database;

    L7 = HELP1, M7 = 02/10/2015 (date returned from register database)
    L8 = HELP1, M8 = 15/10/2015
    L9 = HELP2, M8 = 20/10/2015

    Eternally grateful to anybody who can point me in the right direction, or just let me know if I'm trying to achieve the impossible here.

    Cheers!

  2. #2
    Registered User
    Join Date
    08-26-2014
    Location
    A Sea Container
    MS-Off Ver
    2016
    Posts
    14

    Re: Looking up multiple occurrences of lookup value, returning corresponding data

    Perhaps to simplify, what I could say is I'm trying to lookup multiple occurrences based on multiple criteria by having my lookup formula referring to corresponding cells in a table as opposed to having a constant lookup value.....? sorry if this is just as unclear as the rest of my post!

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Looking up multiple occurrences of lookup value, returning corresponding data

    I think this is what you want...

    M7
    =INDEX(Register!$U:$U,SMALL(IF($L7=Register!$O$1:$O$1000000,ROW($1:$1000000)), COUNTIF($L$1:$L7,L7)))

    The COUNTIF function will return the occurrence number from your column L list and the rest of the formula will return the same occurrence in the Register e.g.; CountIf will count L8 as the 2nd occurrence of HELP1 in column L and return the 2nd occurrence from the Register.


    On another note, array formulas can be inefficient. Especially if you have a lot of them and they encompass a large data range. In your case, each formula is making 1,000,000 comparisons in column O. It would be best to minimize the column O range as much as reasonable.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  4. #4
    Registered User
    Join Date
    08-26-2014
    Location
    A Sea Container
    MS-Off Ver
    2016
    Posts
    14

    Re: Looking up multiple occurrences of lookup value, returning corresponding data

    Thank you AlphaFrog!! Thank you very much, that is exactly what I wanted! You are right however, it is extremely inefficient to process...and as the O range/register workbook is a large and ever-expanding range, I can only minimise it so much... I don't mean to be a pain, but can you offer any advice as to whether there is a VBA workaround to speed up the process? Thanks again

+ 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. Replies: 4
    Last Post: 07-28-2015, 01:33 PM
  2. [SOLVED] lookup and list matches of a ref no with multiple occurrences
    By SKooLZ in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-04-2015, 04:46 PM
  3. [SOLVED] Lookup to find multiple occurrences
    By y_not in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-13-2013, 01:40 PM
  4. Replies: 6
    Last Post: 05-12-2012, 11:40 AM
  5. Replies: 3
    Last Post: 12-10-2009, 06:21 PM
  6. Replies: 3
    Last Post: 10-10-2005, 01:05 PM
  7. [SOLVED] lookup multiple occurrences of a value excel
    By ckl in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-03-2005, 02:06 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