Share via

How to create a dynamic Pivot Table to auto refresh expanding data in Excel?

Anonymous
2021-12-19T17:46:22+00:00

Hello Everyone,

Is there a way in Excel to dynamically change the data source when the data contracts or expands and then refresh it?

Many thanks,

John

Microsoft 365 and Office | Excel | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

  1. Anonymous
    2021-12-23T20:38:42+00:00

    Hi,

    Thanks for your response. Greatly appreciated. I've tried this on several worksheets with no luck. Unless I'm doing something wrong when I insert the table it has never worked upon refreshing the pivot table or pivot chart. With both I get Blank as part of the Pivot chart and table. The quick fix is to go into the pivot table or chart and deselect Blank. Also, I can delete the blank rows which will give me the correct data source range. Too manual. I would rather be able to reference just the data source when it expands or collapses automatically. In my research I have found two ways to do this.

    Method 1:

    1. I create a name in Name Manager and then paste the following formula in the Refers to: box:

    =OFFSET('dynamic pivot with table'!$A$1,0,0,COUNTA('dynamic pivot with table'!$A:$A),COUNTA('dynamic pivot with table'!$1:$1))

    1. Then I create my Pivot Table and in the Table/Range box I type the name of the named range that I created in step 1. It works great!

    Following is the URL with the complete instructions on how to do this:

    https://www.extendoffice.com/documents/excel/5873-excel-create-dynamic-pivot-table.html


    Method 2:

    (Is something I came up with that also works well):

    1. I create a macro that first selects the current region of the Pivot table data source minus the blank rows.
    2. Give the selected data source a range name.
    3. Refresh the Pivot table or chart.

    Hope this helps anyone else with this issue.

    John

    1 person found this answer helpful.
    0 comments No comments

5 additional answers

Sort by: Most helpful
  1. Anonymous
    2021-12-22T05:18:41+00:00

    Hi John,

    Thank you for the reply.

    To hide the collapse a row which has a blank value in Pivot table automatically, you can try to use Value Filters like below:

    Below are the screenshots of my test:

    Original:

    After filtering:

    Best regards,

    Jazlyn

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2021-12-22T06:54:30+00:00

    How do you "delete" the data from your data table?

    Do you just blank it out and leave the blank row, or do you actually delete the table row?

    .

    When you refresh the pivot table it should recognize the data has been deleted and adjust the values appropriately.

    0 comments No comments
  3. Anonymous
    2021-12-21T18:28:13+00:00

    Hi,

    Thanks for the reply and sorry for the slow response. I'm setting up my data as a table and yes it works when adding data. My problem is when I delete some or all of the data. When I create a pivot chart, the blank cells are reflected in the chart and or the pivot table. I'd like to table to expand or collapse automatically as data is added or deleted so blanks won't show in the pivot table or chart. Is this possible? Thanks again.

    John

    0 comments No comments
  4. triptotokyo-5840 36,681 Reputation points Volunteer Moderator
    2021-12-19T18:09:15+00:00

    Hello Everyone,

    Is there a way in Excel to dynamically change the data source when the data contracts or expands and then refresh it?

    Many thanks,

    John

    If you set up your underlying data as a Table:-

    https://support.microsoft.com/en-us/office/create-a-table-in-excel-bf0ce08b-d012-42ec-8ecf-a2259c9faf3f

     - and then add data to that Table when you refresh the Pivot Table it’ll pull in the new rows that have been added to said Table.

    PS You'll need, of course, to base your Pivot Table upon the Table.

    0 comments No comments