+ Reply to Thread
Results 1 to 13 of 13

Macro to Search in list for matches

  1. #1
    Forum Contributor
    Join Date
    05-09-2012
    Location
    Florida
    MS-Off Ver
    Excel 2013
    Posts
    136

    Macro to Search in list for matches

    Hi All - I tried doing this yesterday but am doing a different spin on this today to hopefully get an answer...

    I would appreciate it if someone could help me with a macro that would search for an inputted state in $h$2 and automatically output all the chains that are in that state in k:k


    Please help!

    Thank you

    LookUp Macro Help 8.13.13.xlsx

  2. #2
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: Macro to Search in list for matches

    Hi mrr2,

    You can do this simply without a macro - just put a filter across C1 and D1 and filter by State (i.e Col. D).

    HTH

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  3. #3
    Forum Contributor
    Join Date
    05-09-2012
    Location
    Florida
    MS-Off Ver
    Excel 2013
    Posts
    136

    Re: Macro to Search in list for matches

    Trebor76 - I am pressed to make this easy as possible for sales people to use i.e. inputting a state and getting a response...

    would a variant of this Macro help? (found doing searches)

    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to Search in list for matches

    Attached is an event driven code. If you change the value of H2, the code will copy all rows related to H2.
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    05-09-2012
    Location
    Florida
    MS-Off Ver
    Excel 2013
    Posts
    136

    Re: Macro to Search in list for matches

    Thanks AB33 thats kind of what I am looking for - I appreciate your help with this...

    What I am looking for is if I enter a State, to get a all the stores chains (unique names only) that are in that state....

    How can we modify the code you graciously wrote for that:

    Please Login or Register  to view this content.

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to Search in list for matches

    stores chains (unique names only).
    You need completely different code if you want to copy unique values only. Not filter, but you need advance filer.
    So if I enter FL in H2, there is a single unique value ONLY.
    I am probably missing something.
    Change this line of the code(Main code) and see the outcome.
    Please Login or Register  to view this content.
    The code copies both the chain and state, but not unique. Which of the two columns need to be unique?

  7. #7
    Forum Contributor
    Join Date
    05-09-2012
    Location
    Florida
    MS-Off Ver
    Excel 2013
    Posts
    136

    Re: Macro to Search in list for matches

    Sorry if I'm confusing you....

    If I enter the State FL in H2, I would like to see all of the unique chains that we have in FL, if there are multiple Dollar Generals for instance, I would only need to know that Dollar General is there, so I would only need it to return Dollar General and any other unique values of stores that are in FL.

    I sincerely hope that helps, let me know if not...

    Thank you AB33

  8. #8
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to Search in list for matches

    If do filter by FL, I get 5 (7- Eleven),3 (Arco) and so on. So, I suspect you just want to 1(7- Eleven) and 1 Acro.

  9. #9
    Forum Contributor
    Join Date
    05-09-2012
    Location
    Florida
    MS-Off Ver
    Excel 2013
    Posts
    136

    Re: Macro to Search in list for matches

    Yes! you got it!
    And, I hope that what you help me with, I will be able to translate that template to be able to enter a chain, and then getting all the unique states that chain is in
    Thanks AB33!

  10. #10
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to Search in list for matches

    Try the attached.
    I am not sure if the unique values comes from column K or L, but can easily tweak it.
    Attached Files Attached Files

  11. #11
    Forum Contributor
    Join Date
    05-09-2012
    Location
    Florida
    MS-Off Ver
    Excel 2013
    Posts
    136

    Re: Macro to Search in list for matches

    Fantastic, thanks so much AB33!

    I was (cautiously, so as to not break your code) able to play around with it and also do the reverse, i.e. look up states based on a Store input...

    This case is most definetly solved, and I will mark it as such. I have only one question, how can I can use that code if the data is on a different sheet, and the macro input/output is on the Summary sheet, like in the attatched file.

    Again, I can thank you enough for your help AB33 - if you can help further then great, but nonetheless you were nothing short of awesome!

    LookUp Macro Help 8.13.13 answer2.xlsm

  12. #12
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to Search in list for matches

    Amended code.
    Attached Files Attached Files

  13. #13
    Forum Contributor
    Join Date
    05-09-2012
    Location
    Florida
    MS-Off Ver
    Excel 2013
    Posts
    136

    Re: Macro to Search in list for matches

    ROCK ON! this made my day!

+ 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. Macro to multiply a series of numbers by -1 if target cell matches a list
    By ameinfrank in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-26-2013, 04:25 PM
  2. Search two columns for identical matches on button press macro
    By RainbowLettering in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-03-2013, 03:03 PM
  3. Help with Macro/formula - Lookup that returns Dropdown List of matches
    By alfykunable in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-27-2012, 12:43 AM
  4. Replies: 0
    Last Post: 08-11-2012, 03:25 PM
  5. Search Col.A for words that contain charactrs in Col.B & list all matches adjacently
    By macemegane in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-13-2010, 11:17 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