+ Reply to Thread
Results 1 to 11 of 11

Implementing a row which "finds" rows which match it

  1. #1
    Registered User
    Join Date
    02-01-2008
    Posts
    1

    Implementing a row which "finds" rows which match it

    I'm looking to have a row at the top of a worksheet which I can type in, so that only the rows below which contain that information will show up. For example, say I have the following 3 rows, 2 columns each:

    Cat Feet
    Cat Head
    Dog Feet

    I'd like to have an additional row so that if I typed in "Cat" only the "Cat Feet" and "Cat Head" rows would show up. Likewise, if I typed in "Head" in the proper column only ""Cat Head" would show up. Is this possible?

  2. #2
    Forum Contributor
    Join Date
    08-10-2006
    Posts
    723
    hi Blechy,

    welcome to the forum

    suggest you just filter the data you require

    steve

  3. #3
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885
    Hi Blechy,

    You could filter your data manually as suggested above, or do it automatically whenever you modify a special filter cell in row 1 (see the attached spreadsheet).

    Use A1 and B1 as your field filters (e.g. type Cat in A1 and it will filter all cats. Delete A1 and all records show up again. Type Feet in B1 and it will filter for that value.)

    If you type in a value that doesn't exist, all values will be filtered (no results). You can simply delete or replace that value with a different one to get different results.

    This method could be expanded for additional columns. Be sure to change any range references to suit your data set.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243
    hi all,

    Blechy,
    Debra has some good explanations for the use of either Autofilter or Advanced Filter on her website:
    http://www.contextures.com/tiptech.html

    If you want detailed filter tool you could try Ron de Bruin's "Easy Filter" addin:
    http://www.rondebruin.nl/easyfilter.htm
    or for something with a little less grunt you can import the attached Quick Filter file into your "personal.xls" file so that is available whenever you open Excel.

    This Quick Filter code is something I've written and use every day using a shortcut combination of [ctrl + q]. It still has the occasional glitch when it doesn't always filter dates properly but on the whole it works well & is fast to use with the keyboard (no need to flick through the tabs which are on Ron's popup).

    Paul/Steve/others,
    It works for me almost all of the time so I feel if it ain't broke don't fix it ;-)However, if somthing jumps out at you, feel free to make suggestions on improvements to the Quick Filter coding - esp around the messy coding I have for checking for date values in the active cell. Also, I've had problems when trying to turn it into an addin (I'll read up on it one day...) which is why I just have it in my personal xls.


    Paul,
    Does this line of code always work for you?
    Please Login or Register  to view this content.
    I've had problems with this principle in the past & I had to Set an "IntersectionRange" & then use that in the If statement (see the attached file).

    hth
    Rob
    Attached Files Attached Files
    Rob Brockett
    Kiwi in the UK
    Always learning & the best way to learn is to experience...

  5. #5
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885
    Hi Rob, to date I've not experienced any problems using the 'If Not Intersect(Target,Range(..)) Is Nothing' code you mentioned, but that's not to say it couldn't be a problem in certain situations.

  6. #6
    Registered User
    Join Date
    10-14-2009
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Implementing a row which "finds" rows which match it

    I want to revive this thread with a new twist - hoping someone will take on the challenge.

    The code as posted is great, but it searches (i.e., autofilters) based on an exact (=) match.

    How could the code be modified to do a CONTAINS instead of equals for each of the search fields?


    For example, in the posted code, I would like to enter only a part of the criteria (e.g., "hai" instead of "hair").

    That would make a column much more searchable in cases where a cell has more information than you care about, but you're just interested in one piece of info within it.


    Thanks!

  7. #7
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243

    Re: Implementing a row which "finds" rows which match it

    hi Coltrane59,

    Welcome to the Forum

    Have a look at the code in my previously uploaded zip file which does allow for filtering on partial matches.
    If this is not sufficient, please start a new thread (as per Forum Rules) & include a link to this thread if it is suitable.

    hth
    Rob

  8. #8
    Registered User
    Join Date
    10-14-2009
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Implementing a row which "finds" rows which match it

    Rob, when I open the .zip, I find a .BAS file. I'm not sure what to do with that.

  9. #9
    Registered User
    Join Date
    10-14-2009
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Implementing a row which "finds" rows which match it

    Quote Originally Posted by Coltrane59 View Post
    Rob, when I open the .zip, I find a .BAS file. I'm not sure what to do with that.
    Wow, sorry about my ignorance...just figured out what to do with the .bas file!


  10. #10
    Registered User
    Join Date
    10-14-2009
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Implementing a row which "finds" rows which match it

    Rob, that's an amazing little filter tool I'll definitely use it!

    But, for this specific thing I'm working on at the moment, I think the idea of having a row just above the column headers where data could be input would be best.

    For example, if my Array is A6:K300, with row 6 being column headers, I want Row 5 to essentially be a filter terms row, where I can enter partial phrases in row 5 and have the columns directly beneath them autofilter if the phrase is contained in any of the array rows.

    I can start a new thread though, and I'll provide links.

    Thanks,

    Jeff

  11. #11
    Registered User
    Join Date
    10-14-2009
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Implementing a row which "finds" rows which match it

    Here is the new thread I've started to find an answer to my question above.

    Thanks,

    Jeff

+ Reply to 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