Forum

Notifications
Clear all

GETPIVOT error when column has no data

8 Posts
3 Users
0 Reactions
754 Views
(@rneaul)
Posts: 3
Active Member
Topic starter
 

I am working with a pivot table that represents customer satisfaction. The answer options are 1-5 and DK. The table is formatted with the questions as rows and the responses as the columns. If all columns are present this GPD formula works fine: IF(GETPIVOTDATA("Unique Identifier",$A$3,"Attribute","Overall, how satisfied are you with the Army's Warrior Transition Unit Program?","Value","3.  NEITHER SATISFIED NOR DISSATISFIED")+GETPIVOTDATA("Unique Identifier",$A$3,"Attribute","Overall, how satisfied are you with the Army's Warrior Transition Unit Program?","Value","DK/ REFUSE to ANSWER")>0,GETPIVOTDATA("Unique Identifier",$A$3,"Attribute","Overall, how satisfied are you with the Army's Warrior Transition Unit Program?","Value","3.  NEITHER SATISFIED NOR DISSATISFIED")+GETPIVOTDATA("Unique Identifier",$A$3,"Attribute","Overall, how satisfied are you with the Army's Warrior Transition Unit Program?","Value","DK/ REFUSE to ANSWER"),0)   If there are no responses for DK/ Refuse to Answer the formula returns #ref!. Any ideas on how to get this to work correctly?

 
Posted : 13/06/2019 11:12 am
(@mynda)
Posts: 4761
Member Admin
 

Hi Roland,

The GETPIVOTDATA function can only return results if the data is present in the PivotTable, which is why it returns an error when you have no responses for a field.

You can try going into the row or column label 'Field Settings' (right-click the field in the PivotTable) and on the 'Layout & Print' tab of the dialog box choose 'Show items with no values'.

Mynda

 
Posted : 13/06/2019 6:32 pm
(@rneaul)
Posts: 3
Active Member
Topic starter
 

Thank you for the response. that option is grayed out for columns and rows

 
Posted : 13/06/2019 11:11 pm
(@mynda)
Posts: 4761
Member Admin
 

Hi Roland,

I worked for me, see file attached. Be sure to select a cell in the column labels area before right clicking > Field Settings (not 'Value Field Settings') > Layout & Print tab > 'Show items with no data'.

Mynda

 
Posted : 14/06/2019 1:11 am
(@debaser)
Posts: 836
Member Moderator
 

You can use IFERROR to return 0 for such cases. You can also use an array of criteria and SUMPRODUCT to test multiple options in the same field - for example:

=SUMPRODUCT(IFERROR(GETPIVOTDATA("Unique Identifier",$A$4,"Attribute","Overall, how satisfied are you with the program","Value",{"4. SOMEWHAT SATISFIED","5. COMPLETELY SATISFIED"}),0))

is equivalent to:

=IF(GETPIVOTDATA("Unique Identifier",$A$4,"Attribute","Overall, how satisfied are you with the program","Value","4. SOMEWHAT SATISFIED")+GETPIVOTDATA("Unique Identifier",$A$4,"Attribute","Overall, how satisfied are you with the program","Value","5. COMPLETELY SATISFIED")>0,GETPIVOTDATA("Unique Identifier",$A$4,"Attribute","Overall, how satisfied are you with the program","Value","5. COMPLETELY SATISFIED")+GETPIVOTDATA("Unique Identifier",$A$4,"Attribute","Overall, how satisfied are you with the program","Value","4. SOMEWHAT SATISFIED"),0)

but also handles missing data.

 
Posted : 14/06/2019 4:54 am
(@rneaul)
Posts: 3
Active Member
Topic starter
 

Thank you Mynda and Velouria, both solutions work. I will be using Velouria's suggested formula.

 
Posted : 14/06/2019 11:32 am
(@mynda)
Posts: 4761
Member Admin
 

Nice formula, Velouria!

 
Posted : 14/06/2019 6:21 pm
(@debaser)
Posts: 836
Member Moderator
 

Thanks. 🙂

 
Posted : 15/06/2019 3:58 am
Share: