+ Reply to Thread
Results 1 to 7 of 7

Find all lookup values and return address

  1. #1
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Find all lookup values and return address

    In this article (https://excelribbon.tips.net/T010083...F4X&dn=2)there are two functions, both called "FindMe". The second one, by Peter Atherton, at the bottom of this post, I renamed FindAllMes, as the purpose of it is to return the address of all Lookup values in your range. You use it like
    Please Login or Register  to view this content.
    It works, but has one issue, and there's one thing I'd like to add, but don't know how.
    The issue is that it returns the Address twice. For instance, I tried it on two values that exist at:
    A28, A29, A52, and A53.
    However the function returned this:
    $A$28, $A$28, $A$29, $A$29, $A$52, $A$52, $A$53, $A$53.
    I'd like to know how to fix that.

    What I'd like to Add: Right now the function requires a typed string, like "Fred,Apple". I'd like to be able to put in a range reference, like F23:F24. Trying that with the function as it is produces a VALUE error.

    The article is from 2016 so I didn't see any use in commenting there, and I'm hoping someone here can help me get this guy running good. I appreciate any help I can get.

    Please Login or Register  to view this content.
    I know I'm not stupid, but I suspect I'm a lot stupider than I think I am

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,256

    Re: Find all lookup values and return address

    Based on the code you posted, that would have to be called using:

    =FindAllMes(A2:A11,"Fred,Apple")

    and not:

    =FindAllMes("Fred,Apple",A2:A11)

    It would only return the address twice if both items were found in the same cell.
    Remember what the dormouse said
    Feed your head

  3. #3
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Find all lookup values and return address

    You're right, I had it backwards (due to trying to resolve the issue). See the attached, with doubled results.
    Attached Files Attached Files

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,256

    Re: Find all lookup values and return address

    As I said, you get the double addresses because both values are in the same cell - your function is coded to use a comma as a separator and your lookup values contain commas, so it matches twice. You should really use something else as the separator, such as a pipe symbol or ampersand.

    If you add Exit For after this line:

    Please Login or Register  to view this content.
    you shouldn't get the same address repeated for any reason.
    Last edited by romperstomper; 04-26-2019 at 10:11 AM.

  5. #5
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Find all lookup values and return address

    Thanks for pointing out the comma problem; I never would have spotted that. I've changed the macro as shown below, and now it's working, just need to remember to use the pipe symbol to separate my lookup values. I also can now use the Cell range like this:
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,256

    Re: Find all lookup values and return address

    You can also do this:

    Please Login or Register  to view this content.
    then use:

    =FindAllMes(A3:A46,F3:F4)

  7. #7
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Find all lookup values and return address

    Whoops, missed the "Exit For" comment. Doing that, I can go back to my comma, like this:
    Please Login or Register  to view this content.
    Thanks so much!

    EDIT: Sorry, posted this before I saw your last post.

+ 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: 1
    Last Post: 09-26-2017, 12:05 PM
  2. Replies: 5
    Last Post: 06-19-2017, 03:37 PM
  3. Find Lookup Values Cell Address In a 2D array
    By chullan88 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-11-2017, 02:40 AM
  4. Using V-Lookup to find a list of Values and return a Sum
    By Dynamo418 in forum Excel General
    Replies: 3
    Last Post: 05-28-2012, 09:10 PM
  5. Replies: 4
    Last Post: 11-03-2010, 02:33 PM
  6. [SOLVED] LOOKUP & RETURN CELL ADDRESS
    By Carolan in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM
  7. LOOKUP & RETURN CELL ADDRESS
    By Carolan in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-06-2005, 12:05 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