+ Reply to Thread
Results 1 to 4 of 4

Can Autofilter Ignore Blank Criteria?

  1. #1
    Registered User
    Join Date
    02-14-2012
    Location
    Rochester, NY
    MS-Off Ver
    Excel 2010
    Posts
    20

    Can Autofilter Ignore Blank Criteria?

    Hello!

    I'm hoping one of you can come to my rescue again

    I have a data table of printers that have different attributes, each with subtypes (color/mono; Media - A3/A4; Type - Printer/MFD/MFP; etc.). I want the user to be able to specify subtypes for up to seven different attributes, and have the code filter the data according to which devices meet all seven criteria.

    So far I have no troubles getting it to filter correctly as long as all seven attributes are speficied. However, I want the user to be able to specify as few attributes as they want, and still see results. Perhaps they might want to see all Color MFDs, and they don't care about print speed or media size.

    This is where I run into trouble. Is there any way to get autofilter to assume that a criteria left blank is one that should NOT be filtered out?

    I've tried the following variations:

    Please Login or Register  to view this content.
    None of them work. If I leave a criteria blank, the filter returns no results.

    Can anyone tell me what I'm doing wrong?

    Thanks so much!

    RA

  2. #2
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Can Autofilter Ignore Blank Criteria?

    Hi RA,

    For me best approach would be not to use that field.. for example if column B should not be included then I'll have codes only for Field 1 and Field 3 and onwards.. thanks.

    the "field :=1" which you have used in your code is the first column / (A)..

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), [email protected]

  3. #3
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Can Autofilter Ignore Blank Criteria?

    Hard to say without seeing the rest of the code or an example file, but I think this is what you're looking for:
    Please Login or Register  to view this content.
    So if there was no colorchoice, it doesn't filter, and if there was a colorchoice, then it performs the filter
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  4. #4
    Registered User
    Join Date
    02-14-2012
    Location
    Rochester, NY
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Can Autofilter Ignore Blank Criteria?

    Tigeravatar:

    That seems to have done the trick! Thank you very much

    RA

+ 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