Contextures

Pivot Table Source Data

How to locate and change the source data for an Excel pivot table. For missing source data, steps to try to recreate it. Change options, to save source data with pivot table file.

NOTE: For macros that help manage the source data, go to the pivot table source data macros page. For a macro to unpivot the source data, go to the Unpivot Excel Data Macro page

Locate and Fix Source Data

In this video, you'll see how to locate the pivot table data source, then check the data source, to make sure it includes all the rows and columns that you need. If necessary, adjust the data source, to include new rows or columns.

NOTE: For a long term solution, use a named Excel table, as a data source. It will adjust automatically, if new rows are added.

The written instructions are below the video, and you can download the sample file to follow along with the video.

Locate the Source Data

After a pivot table has been created, you might want to add new records in the source data, or change the existing records. In a large workbook, it can be difficult to locate the exact source for the pivot table, if there are several tables or lists.

NOTE: If you've bought my Pivot Power Premium add-in, click Pivot Table Info, then click Go to Source Data.

Follow these steps, to find the source data for a pivot table:

  1. Select any cell in the pivot table.
  2. On the Ribbon, under the PivotTable Tools tab, click the Analyze tab (in Excel 2010, click the Options tab).
  3. In the Data group, click the top section of the Change Data Source command.

Change Data Source command on Excel Ribbon

The Change PivotTable Data Source dialog box opens, and you can see the the source table or range in the Table/Range box. This may be a reference to a sheet and range of cells, such as

  • Orders!$A$1:$H$9

or a table name, such as

  • Sales_East

Behind the dialog box, you can see the source range on the worksheet, surrounded by a moving border.

In the screen shot below, the source data range ends at row 9, and a new record has been added in row 10. That record will not appear in the pivot table, unless the Data Source is adjusted.

Static Data Source for pivot table

Adjust the Source Data Range

If a pivot table's source data is a static reference to a specific sheet and range, it does not adjust automatically when new data is added. In the screen shot above, the Data Source range refers to Orders!$A$1:$H$9, and it can be manually adjusted, to include row 10.

To manually adjust the static source range:

  1. In the Change PivotTable Data Source window, type the new ending row in the range reference -- in this example, change from Orders!$A$1:$H$9 to Orders!$A$1:$H$10
  2. Click OK, to close the window.

You can adjust the source range when necessary, so it includes any new data, but a better solution is to create a dynamic source, and base the pivot table on that. Instructions are below.

Change the Source Data

Occasionally, you might need to change a pivot table, so it uses a different data source. In this example, a new table has been created, with only data for the East region. The pivot table will be changed to use that source, and then it can be send to a manager in the East region, without revealing the West region's data.

NOTE: After changing to a different source table, you might need to rename some fields, or add different fields to the pivot table.

To change the source data for an Excel pivot table, follow these steps:

  1. Select any cell in the pivot table.
  2. On the Ribbon, under the PivotTable Tools tab, click the Analyze tab (in Excel 2010, click the Options tab).
  3. In the Data group, click the top section of the Change Data Source command.
  4. The Change PivotTable Data Source dialog box opens, and you can see the the source table or range in the Table/Range box. In this screen shot below, the current data source is the Sales_Data table, which contains data from both regions..

    Use dynamic source for pivot table

  5. Delete the existing data source, and type a new table name, or select a new data source range. The Table/Range is changed to Sales_East, where only the East data is listed.

    Use dynamic source for pivot table

  6. Click OK.

Dynamic Source for Pivot Table

Instead of using a static range as the pivot table's data source, a better solution is to create a dynamic range, that will adjust in size automatically.

Create Dynamic Source -- Excel Table

Dynamic Source -- Named Range

Use a Dynamic Source

Dynamic Source -- Excel Table

Instead of using a static range as the pivot table's data source, a better solution is to create a dynamic range, based on a named Excel table. There are written instructions here, or watch the video below.

Make note of the table name, so you can use it as the pivot table source

Dynamic Source -- Named Range

If you can't use an Excel Table as the source data, you create a dynamic named range, based on a an INDEX or OFFSET formula. There are written instructions here, or watch the video below.

The video shows how to create a dynamic range with the OFFSET function, in Excel 2007, and the steps are similar in later versions.

NOTE: Remember the range name, so you can use it as the pivot table source

Use Dynamic Source For Pivot Table

After you create a dynamic source that contains the pivot table data, follow these steps, to use that source data:

  1. Select any cell in the pivot table.
  2. On the Ribbon, under the PivotTable Tools tab, click the Analyze tab (in Excel 2010, click the Options tab).
  3. In the Data group, click the top section of the Change Data Source command.
  4. In the Change PivotTable Data Source dialog box, clear the Table/Range box
  5. In the Table/Range box, type the name of the table or named range that you created. In this example, the dynamic source is a named table -- tblOrders.
  6. Click OK

Use dynamic source for pivot table

Save Source Data With Pivot Table

When you create a pivot table in your workbook, the source data records are saved in a special memory area -- a pivot cache. Then, when you close the file, Excel can save the source data in this pivot cache, or clear that memory.

There are advantages and disadvantages to both options:

If you save the Source Data:
  • File will be larger
  • File may open more quickly
If you do not save the Source Data:
  • Fill will be smaller
  • File may open slowly while the pivot cache is rebuilt
  • Pivot Table must be refreshed after opening the file

How To Change the Setting

To turn the Save the Source Data setting on or off:

  • Right-click a cell in the pivot table, and click PivotTable Options.
  • On the Data tab, in the PivotTable Data section, add or remove the check mark from Save Source Data with File
  • Click OK.

Refresh Data When Opening

If you choose to turn off the Save Source Data with File option, you should turn on the Refresh Data When Opening the File option. That setting is just below the Save Source Data check box.

Otherwise, you'll see a message when you try to filter the data, or make any other layout changes.

  • "The PivotTable report was saved without the underlying data. Use the Refresh Data command to update the report."

If you see that message, click OK, then manually refresh the pivot table.

And to avoid the annoying message, turn on the Refresh Data When Opening the File option.

Recreate Pivot Table Source Data

If you accidentally delete the worksheet that has the source data for your pivot table, or if you received a file without the pivot table's data, you might be able to use the pivot table's Show Details feature to recreate it.

NOTE: This will not work for all pivot tables, but is worth trying, to recover the source data.

To try to recreate the source data for a pivot table, follow these steps to use the Show Details feature:

  1. Make sure that none of the items in the pivot table fields are hidden -- clear all the filters and Slicers that have been applied.
  2. The pivot table does not need to contain all the fields -- just make sure that there is at least one field in the Values area.
  3. Show the grand totals for rows and columns. If the totals aren't visible, select a cell in the pivot table, and on the Ribbon, under PivotTable Tools, click the Analyze tab. In the Layout group, click Grand totals, then click On for Rows and Columns.
  4. Double-click the grand total cell at the bottom right of the pivot table. This should create a new sheet with the related records from the original source data.

Fix the Extracted Data

If you recover the source data, you might need to make some additional changes, to restore it to its original condition.

  • Rename the table, using the original source data's name, if known.
  • If the original source data contained formulas, you will have to re-create them, because the Show Details feature exports the data only.
  • The columns in the extracted data will be in the same order as they were in the original source data.
  • The extracted data will be formatted with the workbook's default Table format. You can apply a different Table format, or apply your own formatting.
  • Note: If you had made changes to the source data and not updated the pivot table, those changes won't be in the extracted data.

Connect to the Extracted Data

If you rename the table that was created during the Show Details process, and use the same name as the table that originally held the source data, the pivot table might automatically connect to the new source data.

If not, you can connect to the recreated source data -- follow the steps in the section above: Use Dynamic Source For Pivot Table -- use the table name that you gave to the new table.

Download the Sample File

To follow along with the tutorials, you can download the DateAmt.zip file. The zipped file is in xlsx format, and does not contain macros.

Get All the Excel News

For regular Excel news, tips and videos, please sign up for the Contextures Excel newsletter. Your email address will never be shared with anyone else.

Search Contextures

Search Contextures Sites

More Tutorials

Fix Pivot Table Source Data

Unpivot Excel Data Macro

Pivot Table Layout VBA

FAQs - Pivot Tables

Pivot Table Intro

Summary Functions

Clear Old Items in Pivot Table

Search Contextures Sites

 

Pivot Power Free

 

 

Excel Data Entry Popup List

 

Pivot Power Premium

 

 

 

Pivot Power Free

 

Last updated: August 10, 2016 7:39 PM
Contextures RSS Feed