+ Reply to Thread
Results 1 to 8 of 8

Dynamic Chart Type when Using a Multiple Consolidated Range Pivot Table

  1. #1
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Dynamic Chart Type when Using a Multiple Consolidated Range Pivot Table

    I have a PivotTable constructed using Multiple Consolidated Ranges (basic sample attached).

    Is there a way to dynamically (or otherwise) change the 'Chart Type' based on the 'Report Filter'? In the attached sample, I would like the Chart Type to be a 'Column Chart' when the 'Page 2' Report Filter says 'Monthly' but for the 'Chart Type' to automatically change to a line chart when the 'Page 2' Report Filter is changed to 'Cumulative'. Note: This will be Excel 2010 distribution.

    I will be using Pivot Slicers in the finished version and the actual graph will appear on a seperate worksheet to the data, so te user will only see the chart and the slicers (not the source data) but I assume the same logic applies? I'm assuming this would have to be done using VBA, but I have no ideas how this could be achieved?

    There will ultimately be four Report Filters, but for now the Chart Type will only need to be affected by one of the four.

    Many thanks

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,147

    Re: Dynamic Chart Type when Using a Multiple Consolidated Range Pivot Table

    I have little (no!) knowledge of Pivot Tables but by trial and error I managed to get the following to change chart types.

    What I don't know is whether the range defined as target ($B$41:$E$59) is constant or will vary with your Pivot tables. This is the range which is "invoked" when choosing your filter (C42)

    This code needs to be inserted on the "Dynamic Chart Type" sheet.

    Right click on the sheet tab, "view code" and insert the code below.


    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: Dynamic Chart Type when Using a Multiple Consolidated Range Pivot Table

    Hi John,

    Well, I'm very impressed, that actually works really well. I tried adding in

    Please Login or Register  to view this content.
    to see if I could stop the 'jump' between the chart type changes but it seems to make no difference. It lloks as though it is effectively unfiltering then filtering again or something, not sure, but I guess that is an Excel thing.

    I think the range defined as target ($B$41:$E$59) should remain constant, I can't see any need for it to change at the moment (though I may eat my word later)...

    I'll test a little more, but this looks like a perfect solution...

    Many thanks

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,147

    Re: Dynamic Chart Type when Using a Multiple Consolidated Range Pivot Table

    I "tested" on the assumption that the choice would be "Cumulative" or "Monthly": I did not check the "All" option if this likely (showing my ignorance!).

    If you are happy with the solution, can you mark the thread as SOLVED.

    Thank you.

  5. #5
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: Dynamic Chart Type when Using a Multiple Consolidated Range Pivot Table

    Logically it can't be 'All', though of course physically it can be as in the user can disable the filter. I don't think it is an issue though...

    Many thanks

  6. #6
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: Dynamic Chart Type when Using a Multiple Consolidated Range Pivot Table

    Many thanks once again :-)
    Last edited by HangMan; 09-16-2015 at 07:50 PM.

  7. #7
    Registered User
    Join Date
    07-14-2015
    Location
    Herndon, VA USA
    MS-Off Ver
    Half Life 3
    Posts
    7

    Dynamic Chart Type when Using a Multiple Consolidated Range Pivot Table

    Hi All,

    Please find the excel file in which you can filter your result in pivot table according to dropdown selection and find the code give below:

    Code:

  8. #8
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: Dynamic Chart Type when Using a Multiple Consolidated Range Pivot Table

    Hi GEGoodwill,

    I think maybe you forgot to include your code?

+ 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. Dynamic Named Range based on Pivot Table for MULTIPLE COLUMNS
    By Pho6 in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 08-29-2014, 02:04 PM
  2. Identify table, Get Pivot, Copy the pivot table to new consolidated Sheet
    By akhileshgs in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-27-2013, 04:09 AM
  3. Replies: 4
    Last Post: 06-25-2012, 03:25 PM
  4. Replies: 0
    Last Post: 07-23-2011, 04:35 PM
  5. Dynamic Chart Ranges without Pivot Table
    By edwoody in forum Excel General
    Replies: 1
    Last Post: 04-07-2011, 03:58 AM
  6. Dynamic Pivot Chart based on Pivot Table.
    By excelkeechak in forum Excel General
    Replies: 3
    Last Post: 12-01-2009, 09:23 PM
  7. Keep Pivot Table custom chart type
    By Jeff M in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 04-08-2005, 04:06 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