+ Reply to Thread
Results 1 to 8 of 8

Advanced filters with multiple criteria

  1. #1
    Registered User
    Join Date
    01-09-2011
    Location
    Santiago, Chile
    MS-Off Ver
    Excel 2003
    Posts
    51

    Advanced filters with multiple criteria

    Hello guys and gals Sorry in advance for the length of the post (and the bad spelling/grammar)

    The thing is this: I want to apply 3 different filters to a matrix (the example sheet is pretty self-explanatory) I wanted to filter once, twice and one final time (and voilá) but.. I didn't work, apparentely, excel deletes the previous filter. So yes, I want to keep the previous filters and keep adding others to them.

    By making the criteria range G2:I5 excel shows the results for (Blue and February and Monday) OR (Green AND Tuesday) OR (Red)

    But what I WANT:

    Results for (Blue OR Green OR Red) AND (February) AND (Monday OR Tuesday)

    I made two tabs, one with the results, and the other one with my desired results.

    I want it to program it with VBA of course I tried with dynamic named ranges, but it's not working for me, I also tried copying the filtered data from one filter (say, Blue OR Green OR Red) and apply the next and so on, but It doesn't really work either.

    Is there a way? Should I give up?
    Attached Files Attached Files
    Last edited by Alicita; 02-01-2011 at 09:25 AM.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Advanced filters with multiple criteria

    Hi Alicita,

    Don't give up. You simply don't have the statement of what you want agreeing with your Advanced Filter Criteria.

    You just have to get your ANDs and ORs correct in your Criteria range.
    see http://www.meadinkent.co.uk/xlfilter.htm

    See sheet 1 where the correct criteria filters out your desired results.
    Attached Files Attached Files
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    01-09-2011
    Location
    Santiago, Chile
    MS-Off Ver
    Excel 2003
    Posts
    51

    Re: Advanced filters with multiple criteria

    Thank you! so quick

    I actually tought of that too, but the criteria comes from another source, i.e. is dynamic (comes from an user defined list box) and I have no control over it. I know I should organize it accordingly (ANDs and ORs), but I don't really know how :S

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Advanced filters with multiple criteria

    This problem remindes me of Truth Tables back in Logic Class.
    http://en.wikipedia.org/wiki/Truth_table

    You have to create these in your Criteria Range to do the filters correctly.

  5. #5
    Registered User
    Join Date
    01-09-2011
    Location
    Santiago, Chile
    MS-Off Ver
    Excel 2003
    Posts
    51

    Re: Advanced filters with multiple criteria

    Oh dear.. I remember those too..

    Are you sure there isn't any other way? (I'm a mechanical engineer, I have no idea what I'm doing XD)

  6. #6
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Advanced filters with multiple criteria

    Hey... Mechanical Engineers are SMART!!

    The Criteria range simply has the ANDs on the same row and the ORs on different rows. When you get a combination of them you just need to build the table correctly.

    To see how Advanced Filters work in VBA, simply turn on the Macro Recorder and do a simple one. Turn off the recorder and go look at what was recorded. It will be pretty clear.

    I can't help much more without seeing the how the "user defined list box" interacts with the criteria range.

    You can put a validation list in the criteria range and simply change what is filtered using a dropdown. Also you can put a command button on the worksheet that will trigger the code to re do the advanced filter.

  7. #7
    Registered User
    Join Date
    01-09-2011
    Location
    Santiago, Chile
    MS-Off Ver
    Excel 2003
    Posts
    51

    Re: Advanced filters with multiple criteria

    I need multiple selected items, that's why I used a list box (from control toolbox)

    I'll figure out somehow Thank you for your help!

  8. #8
    Registered User
    Join Date
    01-09-2011
    Location
    Santiago, Chile
    MS-Off Ver
    Excel 2003
    Posts
    51

    Re: Advanced filters with multiple criteria

    At the end I managed to solve this!

    I did what you told me, I arranged the data in such way that all the possibilities of my critera where met (and right) It was quite simple

    Please Login or Register  to view this content.
    Thank you for the last time!

+ 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