+ Reply to Thread
Results 1 to 16 of 16

Filter By Any Or All Criteria

Hybrid View

  1. #1
    Registered User
    Join Date
    12-14-2020
    Location
    Delaware
    MS-Off Ver
    Office 365
    Posts
    44

    Filter By Any Or All Criteria

    I have a spreadsheet with multiple columns. I want to be able to filter by any or all selected criteria from a set of drop down lists.

    The filter I currently have at A25 is an all or nothing. If all drop downs aren't matched (including blanks) it returns nothing.

    I want to be able to select as few or as many of the drop downs as I desire and have the filter only apply to the drop downs I've selected.

    If a drop down is left blank, that would be ignored from the filter allowing any data in that column through if the other selected criteria matches.

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

    Re: Filter By Any Or All Criteria

    See the yellow banner at the top of the screen.

    What you say you want (at least how I interpret it) is exactly how advanced filters work.
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Registered User
    Join Date
    12-14-2020
    Location
    Delaware
    MS-Off Ver
    Office 365
    Posts
    44

    Re: Filter By Any Or All Criteria

    Tried uploading a sample spreadsheet. Doesn't look like it's working.

    I can see the file in 'Manage Attachments' but can't seem to get it attached to the post. When I click the attachment drop down, it is blank.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    12-14-2020
    Location
    Delaware
    MS-Off Ver
    Office 365
    Posts
    44

    Re: Filter By Any Or All Criteria

    That time it worked.

  5. #5
    Registered User
    Join Date
    12-14-2020
    Location
    Delaware
    MS-Off Ver
    Office 365
    Posts
    44

    Re: Filter By Any Or All Criteria

    I mean the upload worked. I'm still lost on the initial question.

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

    Re: Filter By Any Or All Criteria

    The headers in your criteria range and output range need to match the headers of your data range.

  7. #7
    Registered User
    Join Date
    12-14-2020
    Location
    Delaware
    MS-Off Ver
    Office 365
    Posts
    44

    Re: Filter By Any Or All Criteria

    Quote Originally Posted by rorya View Post
    The headers in your criteria range and output range need to match the headers of your data range.
    Not sure I understand.

    I'm referencing selected ranges.

    So in the example sheet, if I select E as the company in A22 and leave the other 3 drop downs blank. It is not going to return me any results because there are no entries in the raw data above where that is the case.

    That is where my hang up is. I want to select as many or as few criteria as needed and return results only based on selected criteria.

  8. #8
    Registered User
    Join Date
    12-14-2020
    Location
    Delaware
    MS-Off Ver
    Office 365
    Posts
    44

    Re: Filter By Any Or All Criteria

    So let's say I want to see all the jobs Bob did. I should be able to leave the drop downs for Company, Location and Job Number blank. Just select Bob in the Tech drop down and see all the jobs Bob did.

  9. #9
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,966

    Re: Filter By Any Or All Criteria

    An advanced filter will do that, but the headers all need to match up. Then you do an advanced filter with the 'copy to another location' option, use A2:D9 as the source range, A21:D22 as the criteria range and A25:D25 (that's where I copied your column headers) as the destination. The results are as in the attached copy of your workbook.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    12-14-2020
    Location
    Delaware
    MS-Off Ver
    Office 365
    Posts
    44

    Re: Filter By Any Or All Criteria

    Thanks for the replies.

    Okay. I see what you did, but that seems to be a one and done proposition. After the advanced filter is executed, it does not stay active. So in order to change the filtered results, I have to select my drop downs and then rerun the advanced filter. That is too complicated for the people who are going to use this. I need this to be an active filter. Each time a drop down is changed, the filter automatically updates as they are going.

  11. #11
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,966

    Re: Filter By Any Or All Criteria

    Sorry, my fault, I didn't even see your FILTER formula as I had assumed a manual filter operation. Since you have the FILTER function, you can use:

    =FILTER(A3:D9,((A3:A9=A22)+(A22=""))*((B3:B9=B22)+(B22=""))*((C3:C9=C22)+(C22=""))*((D3:D9=D22)+(D22="")),"")

  12. #12
    Registered User
    Join Date
    12-14-2020
    Location
    Delaware
    MS-Off Ver
    Office 365
    Posts
    44

    Re: Filter By Any Or All Criteria

    I suppose I could run a macro on a push button that would execute the advanced filter.
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    12-14-2020
    Location
    Delaware
    MS-Off Ver
    Office 365
    Posts
    44

    Re: Filter By Any Or All Criteria

    That's it! Outstanding. So the plus generally acts as an "or" between the criteria or blank just as the * acts as "and" between the statements? Is that right?

  14. #14
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,966

    Re: Filter By Any Or All Criteria

    Yes, that's correct.

  15. #15
    Registered User
    Join Date
    12-14-2020
    Location
    Delaware
    MS-Off Ver
    Office 365
    Posts
    44

    Re: Filter By Any Or All Criteria

    I appreciate the help. I have been racking my brain on this for 3 days. Thanks a million!

  16. #16
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,966

    Re: Filter By Any Or All Criteria

    Glad to help. (next time you'll know to come here sooner. )

+ 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. [SOLVED] Advanced Filter Code : Criteria Range More Than 1 Row Breaks Filter
    By PaulGW in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-10-2021, 04:30 PM
  2. Replies: 0
    Last Post: 08-04-2017, 02:39 AM
  3. Macro to filter a pivot whilst looping through filter criteria in a variable list.
    By Alistairm88 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-29-2015, 04:25 AM
  4. Replies: 1
    Last Post: 12-12-2014, 06:46 AM
  5. Replies: 6
    Last Post: 10-16-2014, 08:42 AM
  6. Advanced Filter : One Criteria Cell Breaks the Filter - Returns Only Headers
    By PaulGW in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-28-2014, 10:06 AM
  7. Need to filter multiple criteria in Label Filter
    By brassellc7994 in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 04-04-2013, 12:54 PM

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