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
Author: Debra Dalgleish
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. Also, the full video transcript is further down on this page - go to video transcript.
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.
Follow these steps, to find the data source of a pivot table:
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
or a table name, such as
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.
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:
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.
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:
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 -- Dynamic Array
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
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
If you have an Excel version that supports the new functions, such as SORT, or UNIQUE, you can use those functions to create dynamic arrays. This technique uses formulas only - no macros.
In the Download section, get the Filtered Source Data sample file. It shows how to set up a named range with only the visible rows from a named Excel table.
Here is the filtered data, on a different sheet, with only the 2 reps, and 3 categories from the visible rows.
Then, you can create a pivot table based on that filtered data only.
After you create a dynamic source that contains the pivot table data, follow these steps, to use that source data:
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:
To turn the Save the Source Data setting on or off:
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.
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.
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:
If you recover the source data, you might need to make some additional changes, to restore it to its original condition.
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.
Here is the full transcript for the video shown above, Locate and Change Excel Pivot Table Data Source.
----------------------------
In this video, you'll see how to find the source data for a pivot table and fix that source data, if there's a problem getting the new or changed data that you've entered. In this pivot table, I'm showing orders. One of the products we sell is paper, and I entered a new order, with 200 as the quantity, and it's not showing up here.
If I right click and refresh, it keeps showing 20 and 10 so it's not picking up that new record. I'm going to find the source data and see if there's a problem.
To find the source data, I have the cell selected in the pivot table. Up on the Ribbon, I can see Pivot Table Tools, and I'm going to click Analyze. If you're using Excel 2010, this would say Options.
I'll click here, and here's the Change Data Source. There's also a drop down list, but it's quicker to just click at the top of this.
That opens up the Change PivotTable Data Source window.
It's showing that there's a range selected, and I can see those little moving lines in the background, and we can see that one row is not included here.
It stops at row 9 and the new record that I put in is row 10. That's where my 200 is, and it's not being picked up.
To change this and fix the problem, I can adjust the range that's included here. So I could click, just back space, and type 10, instead of 9.
Or I can select all of this and delete it.
Then on the worksheet, select the exact range that I want to use. Then click OK, and when I go back to the pivot table, instead of 20, it's now showing 220, so it's picking up the new data.
You could continue to adjust that range as you add new rows to the data source.
But a better solution is to create a dynamic source for your pivot table, which will adjust automatically, if you add new records.
It's easy to do that, if you've got Excel 2007 or later. I'm going back to the Orders sheet.
This is just a list that's typed on the worksheet. We've got column headings and a row for each order, but if I look up on the ribbon, there's no extra tab at the top.
We're going to create a named table. It will be a special feature, and when I select a cell, if it's a named table, I'll see another toolbar that I can use, to work with that table.
To create the table, it's quick and easy. Just select a cell in your list and on the Ribbon click Insert, Table.
It does a very good job of detecting the range, but if it didn't select all the cells, you can adjust what's typed in here.
Make sure that the check mark is here for My Table Has Headers, and then click OK.
You'll get a formatted table. I'll just click on one cell.
I don't usually like the formatting that it puts on the table at first, but you can go up to the Design tab, there's that Table tab that is appeared now, and select something that's simpler and easier to read.
The next thing you should do right away is change the name of the table. It will give a default name that ends with a number.
Just select that and I'm going to call this tbl, for table, tblOrders, and press Enter.
So now we have a table name, and I can see that name,
if I go to the Formulas tab, Name Manager.
And there's a list of all the names in this workbook. So it makes it easy to spot this, if you have several tables in your workbook.
I'll close this, and the next step will be to use our name, so going back to the Table Tools, we're going to use this name, tblOrders, as our source for the pivot table.
I'm going to just click in here, and then Ctrl+ C to copy that name.
I'll go back to my pivot table now. And then with a cell selected in the pivot table, I'll go back to the Analyze tab, click Change Data Source, and here's the current data source.
I'm going to use Ctrl+ V to paste what I copied as the table name. So it's now going to use this dynamic range which will adjust as we add new records.
Click OK, and nothing looks different here, but I'm going to go and add another order.
Just copy what we have above, by using Ctrl and the double quote. I'll put in 100, so now we should see 320, where we had 220 before.
Going back to Pivot Sales, it still says 220. I'll refresh, and now we've got 320.
So I didn't have to adjust the range of the pivot table source data. That adjusted automatically, because it's a named table.
So if your pivot table data will change frequently, make sure you use a dynamic source, like a named Excel table, and it will adjust as you add or delete records.
For more Excel tips and tutorials, and to download the sample file for this video, please visit my Contextures website, at www.contextures.com
-------------------
Pivot Source Example: 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.
Filtered Source Data Example: This example is for Excel versions that have the new functions, such as SORT and UNIQUE. Download this sample file to see a pivot table is created from the visible rows only, in a filtreed Excel table. The zipped file is in xlsx format, and does not contain macros.
Last updated: November 10, 2022 3:11 PM