Hi I’m trying to make some calculation starting from data stored in an excel pivot table.
I know there is a GetPivotData
function, which is very useful, but it only allows retrieving single values. I’d like to use worksheets function to “query” my data (for example, sum some values in a column, without filtering the pivot table), but I can’t find a way to easily reference the range of the pivot table.
The “structure” of the table may be assumed to be fixed, but not the data in it: the best solution I found is to write a UDF
function to get the reference to the range of the table:
Function getPvRange(firstcell As Range) As Range
Set getPvRange = firstcell.PivotTable.TableRange1
End Function
I can use this function in my formulas. I was wondering if there is a simple (I mean without defining dynamic range names) direct way (I mean, not using VBA), to reference the Pivot Table range?