Row(n:m) not evaluating to an array when placed inside GetPivotData() array formula

Richie_P

New Member
Joined
Mar 3, 2010
Messages
2
Hi all,

I couldn't figure out the syntax to use to specify that all the keywords must be present in search results, so I may have missed a past topic dealing with this. If so, sorry about that.

My problem is as follows:

When I use (for instance) Row(1:5) inside a Sum array formula:
Code:
{=SUM(Row(1:5))}
I get a result of 15.

However, when I try using Row(1:5) inside a GetPivotData array formula:
Code:
{=GETPIVOTDATA("Supporters",$A$4,"PaymentCount",ROW(1:5))}
(intending to get the total number of Supporters with a PaymentCount between 1 and 5), Row(1:5) evaluates to 1 instead of {1,2,3,4,5} and all I get is the total number of Supporters with a PaymentCount of 1.

I've slightly simplified this - in the full version I'm using Indirect within Row() to dynamically generate the range, but I've tested when reduced to the case stated above and the problem persists. What I'm actually after is the total number of Supporters with a PaymentCount > X, where X varies with the row of the table I'm building, so the Indirect changes the array I want out from {1,2,3,4,5} to {2,3,4,5} to {3,4,5}, etc.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Without knowing the finer points of your setup you should find that:

Code:
=SUM(GETPIVOTDATA("Supporters",$A$4,"PaymentCount",ROW(1:5)))
confirmed with Enter as normal

should work... note it is not an Array.

the use of INDIRECT to build the ROW array will make the above volatile - I would say if you can you might consider using INDEX instead, eg:

Code:
ROW(A$1:INDEX(A:A,number))
 
Upvote 0
Thanks, DonkeyOte - that seems to work perfectly. From the quick test I've done, both INDIRECT and INDEX seem to provide the correct result when the entire formula (your SUM version) is entered as an array formula.

I'll try a more robust test when I'm back at work tomorrow.

Your help was much appreciated.
 
Upvote 0

Forum statistics

Threads
1,223,632
Messages
6,173,467
Members
452,516
Latest member
archcalx

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