Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Using data in a formula

From: Excel 2008 for Mac: Pivot Tables for Data Analysis

Video: Using data in a formula

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.

Using data in a formula

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.

Show transcript

This video is part of

Image for Excel 2008 for Mac: Pivot Tables for Data Analysis
Excel 2008 for Mac: Pivot Tables for Data Analysis

26 video lessons · 5343 viewers

Curt Frye
Author

 

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now "Already a member? Log in

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Excel 2008 for Mac: Pivot Tables for Data Analysis.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

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.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.