+ Reply to Thread
Results 1 to 2 of 2

AdvancedFilter with no criteria

  1. #1
    Registered User
    Join Date
    07-03-2006
    Posts
    74

    AdvancedFilter with no criteria

    Hi guys,

    (Edit : made it a bit simpler)

    When using AdvancedFilter without criteria, AF returns all values in the range. How do I stop this from happening, i.e. no criteria should not return any values.

    Thanks for any feedback
    Last edited by opopanax666; 02-22-2007 at 04:49 AM.
    "Colors fade, but dumb is forever" - Sally Solomon

  2. #2
    Forum Contributor
    Join Date
    01-24-2007
    Location
    Southampton, UK
    Posts
    137
    If you prefer to return no rows when all the criteria are blank, one method is to set-up an additional criterion that tests for all blank criteria and returns a value that will force the filter to display no rows.

    Pick a field name to duplicate and add it to the end of your current criteria row. Then set-up something like the following formula under the duplicated field name....

    =IF(MAX(LEN(A2:B2))=0,NA(),A2)

    This must be entered as an array formula (using Ctrl Shift and Enter so that it has {} braces around it).

    You should change A2:B2 to wherever the current criteria values are, and A2 should be the criteria value of the field we are duplicating.

    You will have to adjust the criteria range in the AF dialog box to include the new duplicated field.

    The formula will return the #NA error value when all the other criteria values are blank and all the rows will be filtered out (assuming there are no #NA values in the chosen duplicated field - hopefully unlikely). Otherwise it will simply duplicate the criteria entered in the chosen field and the filter should work as normal.

    If you have criteria on multiple rows, you can copy the formula to these rows as well.
    Last edited by Loz; 02-26-2007 at 08:38 AM.

+ 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