Please Note: This article is written for users of the following Microsoft Excel versions: 2007 and 2010. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Error in Linked PivotTable Value.

Error in Linked PivotTable Value

Written by Allen Wyatt (last updated November 2, 2022)
This tip applies to Excel 2007 and 2010


Adam has two workbooks; call them A and B. In workbook A he has a link to a value in a PivotTable that is in workbook B. When he opens workbook A and workbook B is not open, Adam gets a #REF! error for the link. He wonders if there is any way to avoid getting the error when linking to a PivotTable value in a workbook that is not open.

There are a couple of ways you can approach this problem. Both methods involve understanding how Excel references the PivotTable value in workbook A. When you create a link to the value and both workbook A and workbook B are open, the reference will look something like this:


One way to handle the problem is to envelope the reference within an IF statement, in this manner:

$H$15,"EName","Rac")),"Make sure Workbook B is Open", =GETPIVOTDATA(

The formula checks the result of the GETPIVOTDATA function, and if it returns an error value (like when workbook B is not open), it displays a message. Only if there is no error value will the value in workbook B be fetched.

Another way is to modify the original reference so that the GETPIVOTDATA function is not being used. (It is this particular function that is generating the error when workbook B is not open.) Here's the way you should redo the reference so that the value is referenced directly instead of through a function:


When the reference is rewritten in this manner, the error condition isn't returned.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (10650) applies to Microsoft Excel 2007 and 2010. You can find a version of this tip for the older menu interface of Excel here: Error in Linked PivotTable Value.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...


Turning Off Screen Updating

Want a quick way to speed up your macros? All you need to do is to stop Excel from updating the screen while the macro is ...

Discover More

Copying and Pasting Non-Contiguous Ranges of Cells

Excel makes it easy to copy and paste a range of cells. Easy, that is, unless the range isn't contiguous. If you have a ...

Discover More

Copying a Single Cell to Multiple Worksheets

If you need to copy a cell from one worksheet to a bunch of other worksheets, the work can quickly get tedious. Make the ...

Discover More

Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!

More ExcelTips (ribbon)

Updating a PivotChart Automatically

If you expect your PivotCharts to update automatically when you update a PivotTables, you may want to alter, slightly, ...

Discover More

PivotTable Aggregating Incorrect Data

PivotTables can be a great tool for analyzing large amounts of data. If you have a PivotTable that is pulling information ...

Discover More

Displaying a PivotTable's Name in the PivotTable

When you create a PivotTable, it can have a name. You may want this name to appear within the PivotTable itself. There is ...

Discover More

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.


If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 8 + 1?

2023-10-12 20:06:44

Debbie Cavanagh

I'm not that familiar with excel and pivot tables. I am using a template to assist met. I have entered in my data on a worksheet, created the pivot table then pasted it into a different worksheet in the same document. When I do this I get the #REF! error code. Clicking on it shows me the formula but I do not understand the formula. I don't know what I've done wrong. The pivot table I am pasting over the top of the original is the same size as the original.

2019-01-02 13:02:02

David Gray

I would rewrite the formula like so:

=IFERROR(GETPIVOTDATA("TotalValue",'C:\XLDocs\[MyData.xls]PTable'!$H$15,"EName","Rac"),"Make sure Workbook C:\XLDocs\[MyData.xls is Open")

Not only is this simplified by eliminating the duplicate external reference, but the error message identifies the other worksheet by name.

2015-01-12 01:01:31


I agree with Col's approach - iferror() instead of if(iserror()) and this should also help address Kathy's query. It is cleaner, easier to read and easier to edit or modify at a later stage.
The only problem with any of these approaches is that you get a #REF! error in the case that the workbook with the pivot table is closed (which will then be replaced with "Open workbook B" in the example). Unfortunately you get the same error if you try to reference an invalid value from the pivot table as well (e.g. no RAC in Ename as per above example), making it difficult to determine if you are referencing something that is not there or just not open.

Any suggestions on how to distinguish between these two?

2015-01-09 17:34:41


You also get ref errors when you have a complex link to a closed file eg sumifs, index or array formula in link. Does anyone have a solution for this?
Because pivots can change, I link with an index or other lookup. Excel needs the file open for this

2015-01-09 09:43:32

Col Delane

If using Excel 2007 or later, for the first method it is far better (shorter, cleaner, faster) to use:
=IFERROR( GETPIVOTDATA("TotalValue",'C:XLDocs[MyData.xls]PTable'!$H$15, "EName","Rac"),"Make sure Workbook B is Open")
=IF(ISERROR( =GETPIVOTDATA("TotalValue", 'C:XLDocs[MyData.xls]PTable'!$H$15,"EName","Rac")),"Make sure Workbook B is Open", =GETPIVOTDATA(

If Workbook B is open - being the desired situation - the former formula only executes the GETPIVOTDATA call once, whereas the latter will execute it twice (once to test if B is open, and then a second time to return the result)!

2015-01-09 07:29:33

Paul Whitaker

Will the following overcome this problem ?

When you refer to a cell in a Pivot Table Excel defaults to the GETPIVOTDATA formula instead of a normal R1C1-style cell reference (e.g. =D5). This can be turned off to use normal cell referencing:

1) Click on any cell in the PivotTable. From PivotTable Tools click the Options tab;

2) In the PivotTable group, click the small arrow on the right side of the Options command. You will see a checkmark next to the 'Generate GetPivotData' option;

3) Click the 'Generate GetPivotData' to turn the option off.

a) This is a global setting that remains off for all PivotTables until you turn it on again.
b) If the Pivot Table layout changes the R1C1-style cell reference will not adjust

If this hint works I should credit this Tip to THEEXCELADDICT.COM site

2015-01-09 07:23:48


Another solution is to change Calculation Mode to manual and refresh the Pivot Table when you want.

...Please don't do this. Really, it's annoying for everyone else involved.

2014-11-14 12:13:09


Can I have a nested IF statement within a GETPIVOTDATA formula?

I'm trying to subtract two numeric fields within one pivot table and return either a positive or negative value....all done within one GETPIVOTDATA formula.

I have two separate GETPIVOTDATA formulas that each return the correct (positive or negative) results.

However I am unable to find a way to combine the logic into one =IF(GETPIVOTDATA... formula.

This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.