Home > Pivot > Create > Source Data Pivot Table Source DataHow 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 |
Locate and Fix Source DataIn 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. Video Timeline
|
Locate the Source DataAfter a pivot table has been created in your Excel file, 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 Microsoft Excel pivot table:
|
Change PivotTable Data Source Dialog BoxThe 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. |
Dynamic Source for Pivot TableInstead 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 Dynamic Source -- Excel TableInstead 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 RangeIf 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 |
Dynamic Source - Dynamic ArrayIf 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. |
Fix the Extracted DataIf you recover the source data, you might need to make some additional changes, to restore it to its original condition.
Connect to the Extracted DataIf 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. |
Video Transcript - Locate and Change Excel Pivot Table Data SourceHere is the full transcript for the video shown above, Locate and Change Excel Pivot Table Data Source. ---------------------------- Orders Pivot TableIn 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. Find the Source DataTo 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. Change PivotTable Data Source WindowIt'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. |
Create a Dynamic SourceYou 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. Create a Named TableTo 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. |
Use Dynamic Source for Pivot TableI'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. Test the Dynamic SourceClick 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. ConclusionSo 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 ======END OF TRANSCRIPT====== |
Download the Sample FilePivot 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. |
More Tutorials |
Last updated: April 10, 2023 11:15 AM