+ Reply to Thread
Results 1 to 7 of 7

Custom Auto filter for more than 2 and/or criteria

  1. #1
    Registered User
    Join Date
    12-12-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    27

    Custom Auto filter for more than 2 and/or criteria

    Hi Experts,

    As you are aware we cannot filter more than two and/or criteria using custom auto filter.

    I have a scenario where I have to filter entire data (kept in “Data” sheet) for column C “Country” based on 6 different and/or criteria. The attached file is my working template and has a fake data in it, my real data has long sentences in each cell (In Column C) and each time I have to filter data based on texts that “contains” (part of) in that sentence.

    I did some research and found out that if I create a criteria range and use advanced filter I could achieve the results. You would see that in the “Input” sheet I have created a bunch of combo box and option buttons to define a criteria range that advanced filter could use. So when you enter the texts in the combo boxes and choose and/or you would see that the criteria table on the right is prepared for advanced filter.

    I have also recorded a macro to apply advanced filter however the results are not coming right – If you run Macro1 nothing gets filtered. I am not sure what is the problem. I need help with a code that could filter the table in “Data” sheet (Or in the “Filtered Data”) with the criteria set in “Input” sheet. I had used the wildcards to catch a text that contains in the cell however it doesn’t seem to work.

    I apologize if this is silly question, I have very basic knowledge of VBA. I really appreciate your help and time.

    P.S – How do I make the tab order more efficient? So that user do not have to click on each box to enter the details.

    Best,
    Bunty
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Custom Auto filter for more than 2 and/or criteria

    the way you select the criteria isnt probably the best way of doing it
    it doesnt do AND/OR correctly and not knowing exactly what you want i cannot really "fix" it


    i have rejigged your workbook to show you how you can use advanced filter syntax works to get what you want out of it
    Attached Files Attached Files
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Registered User
    Join Date
    12-12-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: Custom Auto filter for more than 2 and/or criteria

    Hi Humdingaling,

    Thanks for your prompt response, really appreciate it!!

    I apologize if I wasn't clear in my post. I just need to filter my data based on 6 criteria. Specifically - Below is the image of "Custom Auto Filter" I use this to filter my data using "Contains", "AND/OR" however it has only 2 criteria/options, I need a code so that I could filter the same way but with additional 4 criteria.

    Untitled.png

    I am not sure how to do that

    Best,
    Bunty

  4. #4
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Custom Auto filter for more than 2 and/or criteria

    the problem i foresee is using AND/OR condition over 6 "potential" variables (with wildcards "contains")...
    i think its plausible i just dont have the time/brain power to do it at the moment

    ill ask experts to see if anyone can chime in

  5. #5
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Custom Auto filter for more than 2 and/or criteria

    How about using slicers in the table.

    Simillary as in other programs:
    - single click for one item
    - ctrl + click for more different items (OR scenario)
    - shift + click for range of items
    Attached Files Attached Files

  6. #6
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Custom Auto filter for more than 2 and/or criteria

    No table slicers in Excel 2010.



  7. #7
    Registered User
    Join Date
    12-12-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: Custom Auto filter for more than 2 and/or criteria

    Thanks Zbor for your time, really appreciate it.
    In your copy I believe the criteria set up in reverse way. For instance when I select "And" in the first criteria letter o goes beneath letter a which supposed to go in rows (next to a) in the criteria range.

    My working file is attached, when you look at the code you will have an idea what I am trying to achieve. In the macro first I just copy the criteria range to another range (as there are formulas in the first table) name that range as Table4 and use it as criteria range for advanced filter.

    But, the problem still resides How can I tweak the code so that I can filter data with 6 different And/Or criteria?

    Thank you so much for your time with this.

    Best,
    Bunty
    Attached Files Attached Files

+ 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. Auto Filter a custom Date
    By Lensmeister in forum Excel General
    Replies: 5
    Last Post: 12-07-2012, 03:46 PM
  2. Custom Auto Filter
    By raveepoojari in forum Excel General
    Replies: 5
    Last Post: 11-17-2010, 10:24 AM
  3. Formula that is like Custom Auto Filter
    By Smee in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-18-2008, 04:12 AM
  4. Custom Auto Filter for more than two cells
    By coopster in forum Excel General
    Replies: 2
    Last Post: 02-07-2007, 09:23 AM
  5. Custom Auto Filter default setting should be contains
    By dmc in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 07:05 AM
  6. Custom Auto Filter default setting should be contains
    By dmc in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM
  7. Custom Auto Filter default setting should be contains
    By dmc in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10:05 PM
  8. Custom Auto Filter VBA Code
    By balamus in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-19-2005, 07:52 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