Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
When you create a formula, it's usually a good idea to draw the formula's values from the original data source. That way, if the source changes, your formula's result will update the next time Excel recalculates your workbook. But what do you do if your Pivot Table contains data drawn from an outside source and you can't get out the original tables? In that case, you can refer to a cell within the Pivot Table using a GetPivotData formula. I will work my first example on the same worksheet as the Pivot Table so you can follow along more easily, and then I will create a more realistic example on another worksheet. A GetPivotData formula uses two arguments.
First I will type in the function name and left parenthesis, and the two arguments that the GetPivotData function takes are Pivot_Table and the name. Pivot Table refers to any cell within the Pivot Table. I always use the cell at the top left corner of the Pivot Table, in this case cell A3, because I know it's not going to change. Regardless of how I pivot and rearrange the body of the Pivot Table, cell A3 will remain constant, and will always be within the area of the Pivot Table. So that's what I type: A3.
Name is a little more complicated, so I will just walk you through it. Name is a string, which you identify by enclosing in double quotation marks. The Name argument contains the values in the row and column areas that Excel uses to identify a particular cell within the Pivot Table. So say, for example, that I wanted to find the value in C5, which has 2008, January, and FirmA, as the values that you used to hone in on it. So, I type in 2008, a space - no comma just a space - January, FirmA, Double quotes. Close the parentheses. Return. And there you have the value, 67 and 67.
You are not limited to creating GetPivotData functions that point to cells at the lowest level of organization within a Pivot Table. Say, for example, that I wanted to find the total for 2008 in January for both FirmA and FirmB. To do that, I can edit my formula to remove the reference to FirmA. And I am left with 2008 January, which corresponds to this row here, with a Grand Total of 197. When I hit Return, the same value appears as the formula's result. And just to conclude the example string, if I wanted to find the total for 2008, I can just create a function that looks like that. Hit Return.
And I have the value of 1887, which is the 2008 total, also found here in cell E17. One nice thing about creating GetPivotData functions is that you don't need to have the fields in the same order in which they appear in the body of the Pivot Table. So, let's say, for example, that I wanted to find the value for 2008, January, FirmA, but I want to put them in a different order. I can do that, just so long as Excel is able to identify which columns and which rows point to the cell that I am interested in.
So for example, if I put in "FirmA January 2008", hit Return, I get the same result, 67. Just like it's supposed to be. You can also use GetPivotData functions to provide arguments for formulas. As an example, let's look at the summary worksheet that I have created here called Dashboard. On the summary Dashboard, I have created functions that find the total sales for FirmA in 2008, and the same for FirmB in 2008, and FirmA and FirmB in 2009.
One thing I would like to point out, in this formula, is that because the Pivot Table that contains the data I am using in this function comes from another worksheet, I had to put Sheet1 at the front of the cell identifier. So I have Sheet1, which is the name of the worksheet where the Pivot Table resides, an exclamation mark indicating that I have stopped typing in the name of the worksheet. I am about to type the name of the cell, and then A3, which is the name of the cell. And then the second argument gives me FirmA 2008, which reflects the data that I want to use in this cell.
Hit Escape to stop editing the function. If I wanted to create a function that used more than one Pivot Table data point, I can do so by separating the values with commas. So let's say that I wanted to find the average in 2009 of the sales for FirmA and FirmB. To do that, I would type = to start the formula, type in Average, left parenthesis. And then as the first argument I will type in GetPivotData, left parenthesis, and then Pivot Table identifier: Sheet1, exclamation mark, A3, the cell at the top-left corner.
And then I am looking for FirmA 2009. Close the parenthesis, but this is just for the first value used in the average formula. Type a comma, now I have GetPivotData, left parenthesis, Sheet1, A3, FirmB 2009, double quotes. Close the parenthesis. Close the parenthesis again, so that now I've created an average formula with two arguments. Hit Return.
And I get the correct answer of 898. The GetPivotData function makes it easy to summarize Pivot Table data in your worksheets. If it's not practical to draw the data from the original source, you can always use the Pivot Table reference instead.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 74539 Viewers
80 Video lessons · 129748 Viewers
52 Video lessons · 63980 Viewers
59 Video lessons · 49751 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.