title: Excel Pivot table range reference
body: <p>Hi I’m trying to make some calculation starting from data stored in an excel pivot table. </p>
  
  <p>I know there is a <code>GetPivotData</code> 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 <code>UDF</code> function to get the reference to the range of the table:</p>
  
  <pre><code> Function getPvRange(firstcell As Range) As Range
      Set getPvRange = firstcell.PivotTable.TableRange1
   End Function
  </code></pre>
  
  <p>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? </p>