+ Reply to Thread
Results 1 to 4 of 4

Getpivotdata subtotal

  1. #1
    Forum Contributor
    Join Date
    06-26-2014
    Location
    Houston
    MS-Off Ver
    365
    Posts
    196

    Getpivotdata subtotal

    Hey,

    I am trying to use GETPIVOTDATA for a subtotal below a pivot table, but cant seem to get it correct. I don't want to use the standard subtotal feature of the pivot table, as it puts to the right of the table. I need it at the bottom, below the Grand Total.

    You can see there are two column fields, Station and Hauler. I am trying to get the total, or subtotal, of the Station column, regardless of the Hauler. Can I not do that? Do I have to choose a Station and Hauler? It seems to work on fields where there is only one Hauler under a Station, but if there is more than one Hauler, I get a #REF error. I am entering the formula in the orange row. You can see Station " Location 1" works in cell B9, but "Location 2" in E9 gives the error. I realize I can just =C8+D8+E8 and that will getpivot for those, but the problem is as I refresh this, Haulers within Stations change, and I have to redo that formula to include or exclude those Haulers.

    Help!

    Thanks!
    Attached Files Attached Files

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,912

    Re: Getpivotdata subtotal

    GETPIVOTDATA only works to return the value of a cell in the pivot table. You'd need to sum an array of cells using something like this:

    =SUM(GETPIVOTDATA("Net",$A$2,"Station","Location 2","Hauler",{"Hauler 1","Hauler 2","Hauler 3"}))
    Rory

  3. #3
    Forum Contributor
    Join Date
    06-26-2014
    Location
    Houston
    MS-Off Ver
    365
    Posts
    196

    Re: Getpivotdata subtotal

    Thanks.

    So if another hauler gets added to one of the locations, would I then have to add that hauler in the formula?

  4. #4
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,912

    Re: Getpivotdata subtotal

    Yes, in some form or other. You could have a separate list of haulers and apply that to the formula with an IFERROR to handle any that might be missing.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1