Pivot table get weighted average with sumproduct

bullit_nl

Active Member
Joined
Jun 27, 2002
Messages
280
Hi,

I want to use the sumproduct formula to calculate weighted averages in my pivot table.

Prices are in column B and quantities are in column M.

The problem is that the range of columns B and M are changing every time i refresh the data form the pivot table and the total at the bottom of my pivot table witch i need to see.

How can i use the sumproduct formula without having to edit it all the time and not include the total? I know that it's possible to use a dynamic range but don't know how to use it.

Formula:
=SUMPRODUCT(M6:M14;B6:B14)/SUM(M6:M14)

Thanks
 
The quantity in the pivot table is only summed and the end. The quantity field fom the selected item contains data from many different dates and the same item also has different prices.
 
Upvote 0

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
In what way is your pivot table different from this?


Excel 2010
ABCDEFGHIJ
1DescriptionQuantityPriceValueRow LabelsSum of QuantitySum of PriceSum of ValueSum of Field1
2Product111010Product16248013.33
3Product221122Product282611214.00
4Product331236Product3102814814.80
5Product441352Product4123018815.67
6Product151470Grand Total3610852814.67
7Product261590
8Product3716112
9Product4817136
Sheet1 (2)
 
Upvote 0
there is one more column with different dates. My dates are in the column labels and i filter on product
 
Upvote 0
Like this?


Excel 2010
ABCDEFGHIJKLMN
1DescriptionDateQuantityPriceValueAve PriceColumn Labels
2Product1Aug-20141101013.33Aug-2014Sep-2014
3Product2Aug-20142112214Row LabelsSum of QuantitySum of ValueAverage of Ave PriceSum of QuantitySum of ValueAverage of Ave Price
4Product3Aug-20143123614.8Product111013.3357013.33
5Product4Aug-20144135215.67Product22221469014
6Product1Sep-20145147013.33Product333614.8711214.8
7Product2Sep-20146159014Product445215.67813615.67
8Product3Sep-201471611214.8Grand Total1012014.452640814.45
9Product4Sep-201481713615.67
Sheet1
Cell Formulas
RangeFormula
F2=ROUND(SUMIF(A:A,A2,E:E)/SUMIF(A:A,A2,C:C),2)
 
Upvote 0
I want to sumproduct based on the description name in column A.

So if for example a discription name in A is "red bal" or "green fish" then i want to sum the quantities in column F and the prices in column H or R.

Let's fix the formula first and then make it dynamic.

=SUMPRODUCT(--($A$2:$A$100="red bal"),$F$2:$F$100,$H$2:$H$100)

Is this what you are after?
 
Upvote 0

Forum statistics

Threads
1,215,471
Messages
6,125,002
Members
449,202
Latest member
Pertotal

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top