+ Reply to Thread
Results 1 to 6 of 6

Filter Pivot Chart based on Cell Value

  1. #1
    Registered User
    Join Date
    09-18-2017
    Location
    San Francisco
    MS-Off Ver
    2013
    Posts
    39

    Filter Pivot Chart based on Cell Value

    Hi,
    I have a pivot table I would like to automatically filter on a specific cell value.
    I have an employee ID in the filter section, and in a separate cell i have the ID (pulling from a different tab).
    I want the pivot table to refresh and filter on that ID every time it changes.
    Is that possible to do?

    Thank you!
    Last edited by alisachsf; 11-14-2019 at 08:51 PM.

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,945

    Re: Filter Pivot Chart based on Cell Value

    An easy approach is to use a column of formulas that compare the ID to the desired ID, like

    =A2=Sheet1!$A$1

    where column A has the IDs, and the ID of interest is in cell A1 of Sheet1.

    Then just use TRUE as your page filter for that column of formulas.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    09-18-2017
    Location
    San Francisco
    MS-Off Ver
    2013
    Posts
    39

    Re: Filter Pivot Chart based on Cell Value

    Thanks Bernie, but I need to automatically filter the pivot based on that cell.
    I'm assuming I need a macro for that.
    I also need it to refresh every time the other cell changes and reapply the filter

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,945

    Re: Filter Pivot Chart based on Cell Value

    If you have that field in your pivot table, a recalc and a data refresh will update the table. You could use the worksheet calculate event to refresh the PT if you don't want to manually refresh the data:

    1) Copy this code.
    2) Right-Click the sheet tab of interest.
    3) Select "View Code"
    4) Paste the code into the window that appears.
    5) Save the file as a macro-enabled .xlsm file.
    6) Make changes as needed
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    09-18-2017
    Location
    San Francisco
    MS-Off Ver
    2013
    Posts
    39

    Re: Filter Pivot Chart based on Cell Value

    Hi Bernie,
    I understand the idea of filtering based on true, but what code would you use to do the filtering without touching it?
    I want to change the other cell and get the pivot to refresh
    I tried the following code:
    Please Login or Register  to view this content.

    That should've filtered the 6 column (F) based on cell D21 on the Dashboard sheet
    But i get an error with this code
    It worked for tables, but not for pivot or the added columns to the pivot (column F was not part of the pivot, pivot is columns A-E)
    Any suggestions?

  6. #6
    Registered User
    Join Date
    09-18-2017
    Location
    San Francisco
    MS-Off Ver
    2013
    Posts
    39

    Re: Filter Pivot Chart based on Cell Value

    Just solved it! I changed the range to the added column only

    Thanks!

+ 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. Filter Pivot Chart based on Cell Value
    By dmonni01 in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 10-25-2019, 10:54 AM
  2. Use vba to filter on Report AND row of a pivot chart based on cell input
    By BillsterUK in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-07-2016, 05:03 AM
  3. [SOLVED] filter a pivot table based a cell
    By marreco in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-12-2014, 10:50 AM
  4. How to filter PIVOT based on specific value in another cell?
    By donyc in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-10-2013, 10:12 AM
  5. Pivot filter based on cell value
    By Leszczur in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-18-2012, 11:18 AM
  6. Filter multiple pivot tables based on same cell value (OLAP based)
    By natsuki-hime in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-15-2012, 05:21 AM
  7. Change Pivot table Filter Based on Cell Value *Multiple Filter items* Possible?
    By Flydd in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-27-2012, 06:57 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