+ Reply to Thread
Results 1 to 6 of 6

Exclude one Value from a Filter

  1. #1
    Forum Contributor
    Join Date
    08-08-2015
    Location
    NJ
    MS-Off Ver
    2013
    Posts
    205

    Exclude one Value from a Filter

    Hello, assuming this is a very quick one, although I am not finding the appropriate code. I have a report with several pivot tables where in certain instances, will need to exclude an option from the filters within each pivot table.

    The attached shows three basic pivot tables where I am trying to set up code that will ensure "NJ" is Not selected. When I use code using the "<>" expression, I receive a compile error. Is there a better way to code for Not selecting a value that will populate all pivot tables?

    Thanks!
    Sheryl
    Attached Files Attached Files

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Exclude one Value from a Filter

    Hi,

    We don't allow duplicates normally. Since it's Christmas I'll allow this new thread and will close the old one, I'd normally have closed this one but please note for the future.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Exclude one Value from a Filter

    Does the attached help.

    I've added some slicers to help you filter the PT. You can of course use separate PTs but the idea of PTs is that you dice and slice a common data set by dragging and droppong field names around the Field List window.

    The attached has color as the first ite, but if you want other main totals drag the relevant field to the top. Use the State slicer to ignore NJ
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    08-08-2015
    Location
    NJ
    MS-Off Ver
    2013
    Posts
    205

    Re: Exclude one Value from a Filter

    Thanks again for the response. Unfortunately, and as much as I love slicers, they do not work. The 'actual' report I have contains about 30+ pivot tables from a few different sources, reason I am looking to set up a quick way to use VBA and de-select, if possible, the one value from each pivot table filter.

    Is there code that is (something like) .Criteria1 = "<>=NJ" ? I tried playing around with that, but it is not taking.

    Sheryl

  5. #5
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Exclude one Value from a Filter

    OK,

    Here's a macro

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    08-08-2015
    Location
    NJ
    MS-Off Ver
    2013
    Posts
    205

    Re: Exclude one Value from a Filter

    Thank you. Interesting way to make it work, appreciate it. Unfortunately still does not work as I need the "state" option to remain within the filter. So if possible, am trying to find a way to keep "State" in the filter, so that All options are selected, with the exception of (in this case) "NJ." Wondering if doing this a long way and setting up the filter to include all options, except the one I need, would be better. There are about 100+ options in my real report, so hoping to avoid that, but it could work for the one time build, I suppose, using the Criteria1:=Array( "ABC", "XYZ", "123") type option?

    Thanks again.
    Sheryl

+ 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] Exclude one Value from a Filter
    By sherylt13 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-24-2018, 12:44 PM
  2. exclude from filter pivot table
    By stephme55 in forum Excel General
    Replies: 1
    Last Post: 05-21-2016, 08:41 AM
  3. [SOLVED] How to exclude a cell value from a table filter ?
    By SlavOK400 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-16-2016, 01:20 AM
  4. Auto Filter Exclude items
    By exclusiveicon in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-03-2014, 12:16 PM
  5. Filter to exclude
    By tuesbien in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-23-2014, 05:35 PM
  6. [SOLVED] how to exclude a criteria using auto filter
    By kadasanis in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-21-2013, 02:12 PM
  7. Set filter to EXCLUDE values rather than include them
    By Uther_d_dragon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-21-2013, 10:54 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