2

I have a PivotTable where the rows are values from a field called ID, which is a number, two columns: Light and Humidity, and a set of values Temp. I want to find the max value for Temp over a grouping of IDs. I grouped the IDs from number 1- 100, which encompasses all IDs in the PivotTable, leaving me a PivotTable with a single row of data. In each column I now have the maximum Temp value at a given Light and Humidity value. This is all looking good, until I try to use these max values.

I am trying to use a function like so:

=GETPIVOTDATA("Temp", Controls!$A$15, "Light", 50, "Humidity", 10)

As well as:

=GETPIVOTDATA("Temp", Controls!$A$15, "Light", 50, "Humidity", 10, "ID", "1-100")

But this gives a #REF error.

Prior to grouping the IDs into a single group, I could use a function like:

=GETPIVOTDATA("Temp", Controls!$A$15, "Light", 50, "Humidity", 10, "ID", 1)

And this would correctly return the "Temp" value for ID 1 where the column values match those given in the function.

How can I modify this query to successfully get the value by a grouping of numbers?

0

1 Answer 1

1

In my test it seems that the first number of the group can be used in the GetPivotTable formula, so if the group starts with 4, this formula will return the correct result:

=GETPIVOTDATA("temp",$H$3,"light",50,"humidity",10,"id",4)

As an alternative, you could add a helper column to your source data and use a formula that returns the group for each respective ID.

In the screenshot the upper pivot table uses the "Group" functionality and it is not possible to get a GetPivotData of that. The lower pivot table, however, uses the same grouping, which is achieved by the helper formula in column F.

="group "&CEILING([@id]/3,1)

This allows a single value to cover the group and that single value can be used in GetPivotData.

=GETPIVOTDATA("temp",$H$10,"light",50,"humidity",10,"group","group 2")

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .