Forum Discussion

shotgun-68's avatar
shotgun-68
Copper Contributor
Apr 08, 2020
Solved

Sum 2 pivot table Fields where one may not exist

I have to sum in a pivot with sales at Status 1-5 the 4's and 5's .

 

However , in some peoples pivot maybe they don't have a value in both status's and in that case the sum returns 0

 

I cannot un-grey the show cells with no data (which was my first thought) and would of solved the issue, and I've spent an hour trying to figure out why on both Mac and PC 

 

So, is there a simple formula I can use that will allow them to Sum even if 4 or 5 is missing on the Pivot ?

 

 

To be clear if the pivot had a value of 100 in column of sales status 4 and Sales status 5 was missing completely (due to there being no status 5 sales) the sum would return 100 , not 0 as it currently does 

  • shotgun-68 

    You could construct a formula along the following lines:

    =IFERROR(GETPIVOTDATA("Value",$F$3,"Status",4),0)+IFERROR(GETPIVOTDATA("Value",$F$3,"Status",5),0)

    It sums data from the pivot table for the Value field where the Status is 4 and 5. If either of these statuses does not exist, the IFERROR returns a zero, rather than a #REF! error.

    The attached file has a small example demonstrating this.

     

2 Replies

  • Riny_van_Eekelen's avatar
    Riny_van_Eekelen
    Platinum Contributor

    shotgun-68 

    You could construct a formula along the following lines:

    =IFERROR(GETPIVOTDATA("Value",$F$3,"Status",4),0)+IFERROR(GETPIVOTDATA("Value",$F$3,"Status",5),0)

    It sums data from the pivot table for the Value field where the Status is 4 and 5. If either of these statuses does not exist, the IFERROR returns a zero, rather than a #REF! error.

    The attached file has a small example demonstrating this.

     

Resources