Closed Thread
Results 1 to 4 of 4

lookup multiple instances

  1. #1
    Registered User
    Join Date
    05-12-2007
    Posts
    2

    lookup multiple instances

    I have a range say A1:B20. I can find the value of Bx for the First instance where Ax = 'string'.

    However I have a case where I want to generate a list of all instances. While i appreciate its not good practice, in my case there will only be 2 or 3 instances, so it wouldn't be too cumbersome to have =[forumala to get instance 1] & ", " & [forumala to get instance 2] & ", " & [forumala to get instance 3].

    My problem then is how do i find the second and 3rd instances?

    Any pointers appreciated.

    Regards

    Nathan

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

    Please Login or Register  to view this content.
    Formula must be confirmed with CTRL+SHIFT+ENTER not just ENTER...
    then drag formula to the right as far as necessary to retrieve all possible matches.

    You can replace "string" with an reference to a cell housing the string to look up (make sure the you place a $ in front of the column letter, though to "Freeze" the column when copying the formula over.

    You can copy the formula(s) down to retrieve other "strings"

    Note: any changes to the formula requires reconfirmation with the CSE key combo.
    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
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211
    Quote Originally Posted by NathanR
    I have a range say A1:B20. I can find the value of Bx for the First instance where Ax = 'string'.

    However I have a case where I want to generate a list of all instances. While i appreciate its not good practice, in my case there will only be 2 or 3 instances, so it wouldn't be too cumbersome to have =[forumala to get instance 1] & ", " & [forumala to get instance 2] & ", " & [forumala to get instance 3].

    My problem then is how do i find the second and 3rd instances?

    Any pointers appreciated.

    Regards

    Nathan
    Try this:

    =IF(ISERR(SMALL(IF($A$1:$A$20="string",ROW(INDIRECT("1:"&ROWS($A$1:$A$20)))),COLUMNS($A:A))),"",INDEX($B$1:$B$20,SMALL(IF($A$1:$A$20="string",ROW(INDIRECT("1:"&ROWS($A$1:$A$20)))),COLUMNS($A:A))))

    ctrl+shift+enter, not just enter
    copy across until you see blank

  4. #4
    Registered User
    Join Date
    05-12-2007
    Posts
    2

    Thanks

    Thanks very much - excellent. Dare I admit i didn't think it was going to be possible, but this works perfectly. It should save hours of cross checking!

    Regards

    Nathan

Closed 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