Question : Excel 2007: Use SUMPRODUCT in a pivot table

Hi, how do I add a calculated field to a pivot table using sumproduct of 2 arrays?  I tried SUMPRODUCT(Field1,Field2) but it produces incorrect total.  It multiply the sum of Field1 and sum of Field2.  Thanks.

Answer : Excel 2007: Use SUMPRODUCT in a pivot table

Calculated fields in a Pivot Table are evaluated at the aggregate level, not the record or item level. This means that some calculation formulas such as those that rely on conditional logic will probably not provide the desired results. The workaround is to add additional columns to the souce data table that ensures the field is calculated at the record level.

For example, to add a field to a Pivot Table that displays a sum of records meeting a certain criteria, adding a Pivot Table calculated field such as:

   =IF(SalesStatus="Active",Revenue,0)

will be evaluated as:

   =IF(SUM(SalesStatus)="Active",SUM(Revenue),0)

versus:

   =SUM(IF(SalesStatus="Active",Revenue,0))

Kevin
Random Solutions  
 
programming4us programming4us