GetPivotData for All Items without explicitly referencing them

ninaking

New Member
Joined
Jun 5, 2011
Messages
15
I have a company that has a list of accounts. I need to see how many lines were canceled and kept for each account as well as for the company as a whole. So for example, for Account 4, it canceled 33% and kept 67% and Company 1 canceled 8% and kept 92%==>8% = sum(0,0,0,.3333,.5,0,0,0,0,0,0)/11; 92% = sum(1,1,1,.67,.5,1,1,1,1,1,1)/11

So I want the output to be for each company:
Company 1: Canceled 8%, Kept 92%
Account 1: Canceled 0%, Kept 100%
Account 2: Canceled 0%, Kept 100%
Account 4: Canceled 33%, Kept 67%
...Account 11: Canceled 0, Kept 100%

The problem is that I don't know how to dynamically reference all of the items in the Pivot Table (i.e. all of the Accounts). I was able to get this to work by explicitly referencing the columns but I want to replace A3:A13 with all of the items the list and that can vary depending on how many accounts each company has:

{=SUM(GETPIVOTDATA("Sum of % Kept",$A$1,"Account",A3:A13,"Company","Company1"))}/{=count(GETPIVOTDATA("Sum of % Kept",$A$1,"Account",A3:A13,"Company","Company1"))}

(Sorry, it won't let me upload anything so this is the best I can do to post the data)
<Data>
Company and Account,Total Lines Canceled,Total Lines Kept,Total Lines,Sum of % Canceled,Sum of % Kept
Company1 1,2,14,16,0.125,0.875,
Account 1,,1,1,0,1,,,
Account 2,,1,1,0,1,,,
Account 3,,3,3,0,1,,,
Account 4,1,2,3,0.333333333,0.666666667,,,
Account 5,1,1,2,0.5,0.5,,,
Account 6,,1,1,0,1,,,
Account 7,,1,1,0,1,,,
Account 8,,1,1,0,1,,,
Account 9,,1,1,0,1,,,
Account 10,,1,1,0,1,,,
Account 11,,1,1,0,1,,,

</Data>
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

Forum statistics

Threads
1,215,471
Messages
6,124,999
Members
449,201
Latest member
Lunzwe73

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top