Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Reference to Pivot Table returns #REF

Posted on 2013-12-17
2
Medium Priority
?
426 Views
Last Modified: 2013-12-18
I have Excel worksheets connected to Access tables, which create Pivot Tables.  The results are grouped by month, and I have a cover sheet which summarizes the data from multiple worksheets.

There is a summary line for each month, but if the pivot table does not have a line for that month, the it returns #REF, and messes up any calculation using that cell.

For example: if there is no month 10 (October) =GETPIVOTDATA("ChargeAmount",'camper charges'!$A$1,"ChargeDate",10) returns #REF

Is there anyway to use an IF THEN, so it returns 0 if row 10 does not exist?
0
Comment
Question by:pjfromny
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 17

Accepted Solution

by:
andrewssd3 earned 2000 total points
ID: 39725886
If you have Excel 2007 or later you can say
=IFERROR(GETPIVOTDATA("ChargeAmount",'camper charges'!$A$1,"ChargeDate",10),0)

Open in new window

If you are on 2003 or before you need to use the longer-winded
=IF(ISERROR(GETPIVOTDATA("ChargeAmount",'camper charges'!$A$1,"ChargeDate",10)),0,GETPIVOTDATA("ChargeAmount",'camper charges'!$A$1,"ChargeDate",10))

Open in new window

0
 

Author Closing Comment

by:pjfromny
ID: 39726828
Just what I needed!  Thanks!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
This article describes a serious pitfall that can happen when deleting shapes using VBA.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question