If #REF! then reference another part of pivot table - excel

I am using a PivotTable, and using the GETPIVOTDATA formula to populate
data on a separate worksheet. Some days there is no data for this particular pivot table column. Is there a way I can include with my GETPIVOTDATA statement, that if it shows an error
or #REF! it will reference another cell in that pivot table. I tried an If(And) statement and it did not work.
Here is the current formula=GETPIVOTDATA("Disposition",'ACD Service Levels Pivot'!$A$3)-GETPIVOTDATA("Disposition",'ACD Service Levels Pivot'!$A$3,"Application","CallbackQueue")
The reference cell I would like for error #REF! to go to is GETPIVOTDATA("Disposition",'ACD Service Levels Pivot'!$A$3)
Thank you

#usmanhaq Thank you for the comment. My goal was to make the formula logic dependent on the pivot table. However, I created a "helper table" using iferror. In which when the pivot table does not have the available data, the helper table will show "0". I can proceed with writing the formula to look at the helper tables "0" instead of the Pivot tables "#REF!" error it throws when no data is available using GETPIVOTDATA. Thanks for leading me down the path.

Related

Do not want to show null values in excel

I'm trying to filter some records by using Filter formula in Pivot Table, I'm getting the values which I want to be shown but I'm also getting VALUE! symbol in some cells also, I do not want to display 0 or anything else in the place of VALUE!. How can I don it? Below is the formula I've used in Pivot table.
=Filter(B1:B15,B1:B15>0)
I know the actual formula of filter but I want to show values which are greater than zero only so, now I'm confused that how I can do it with formula only.
Right-click on the table and select Pivot Table Options:
Please try this formula.
=FILTER(B1:B15,IF(ISERROR(B1:B15)=FALSE,B1:B15>0))

Excel GETPIVOTDATA formula how to drag across and change dates automatically?

I need to create a formula that takes data from pivot table and the data is automatically update when I drag the formula across in my table (picture 2).
My pivot table looks as below:
My table is as below:
My GETPIVOTDATA formula is as below:
=GETPIVOTDATA("Is it valid?",'Pivot Tables from Data 1'!$A$3,"SITE","London","Is it valid?",Yes","Credit Week",247)
I tried to amend my formula and add 247+COLUMN()-2) but it doesn't work. I think the problem is the format of date in pivot table but I'm unable to change it.
Thanks
Try this, it replaces the last argument (247 aka days in year thus far) with a formula to calculate the same:
=GETPIVOTDATA("Is it valid?",'Pivot Tables from Data 1'!$A$3,"SITE","London","Is it valid?",Yes","Credit Week",A1-DATE(YEAR(A1),1,0)+1)
Replace A1 with whatever cell the 3-Sep-18 is in and copy to the right.

Can I reference a pivot table name instead of a R1C1 style reference

I have 4 pivot tables that i want to aggregate in a regular table.
The table structure is as follows...
Columns B through E get the Grand Total from the Pivot tables referenced in Column A. So, the question is: can I replace the pivot table location in =GETPIVOTDATA("SP",$BE$2) with something like INDEX([pivotTableName])?
The resulting formula would then be: =GETPIVOTDATA("SP",INDEX([pivotTableName]))
The INDEX command returns #REF and I checked (Reference pivot table by name Excel 2010) and (Excel Pivot table range reference) but those solutions use VB.
Turning off the GETPIVOTDATA function
Go to Options, by holding Alt and hitting FT.
Click the Formulas tab.
Uncheck Use GetPivotData functions for PivotTable references.
Now you can refer to the pivot table with regular cell references:

Formula to select a range in a pivot table

I'd like to perform the standard deviation of a specific range in a pivot table.
I tried the following formula to get the SD of the range C8:C28:
=STDEV(GETPIVOTDATA("Sum of PL DIR & CAR",$A$4,"AssetClass2","Equity US"))
It returns #DIV/0!
Do you have the correct formula?
Here is the pivot table:
Based on your image, you might be able to use something like the below, assuming there is no data below the pivot table
This will work even if additional rows are added into the pivot, i.e making it a dynamic range with OFFSET etc.
=STDEV(OFFSET($C$8,0,0,COUNTA($C:$C)-2,1))
Or you can use INDEX which is a non-volatile function:
=STDEV(INDEX($C:$C,ROW(C8)):INDEX($C:$C,COUNTA($C:$C)+1))
You may need to tweak that COUNTA($C:$C)+1 to fit your criteria but this should give you the idea.

GetPivotData with a filter

I want to use several GetPivotData functions, retrieving data from the same Pivot table. I want each of them to retrieve different data based on a filter value.
For instance:
Get Pivot Data for Month:January
Get Pivot Data for Month:February
Where Month is a filter on the Pivot. Is this possible using a formula?
I hope this will solve your problem. Try this workaround from Microsoft:
https://support.microsoft.com/en-us/help/287736/getpivotdata-formula-is-automatically-created-when-you-try-to-create-s
When you change the month, the value changes too. But make sure that there are no hidden items (because if not, you won't get an accurate #/data).
see the screenshot below where the Month to choose is based on a cell reference as an argument in the GETPIVOTDATA formula:
Victor,
The Pivot tables won't work like you intend to. All data that your formula shall retrieve must be visible at the same time. I suggest that you arrange for some space on your worksheet and apply the solution proposed by Scott.
NB: If you want to deal with data added month by month, for example, there is an Pivot table option to automatically add new values to the filter. Then in your formula you can use IFERROR to show blank cells when there is still no data available.
Regards,
+Daniel+

Resources