Selective weighted average

UndwaterExcelWeaver

New Member
Joined
Mar 2, 2019
Messages
38
Office Version
  1. 365
Platform
  1. Windows
In the table below I need to be able to calculate the weighted average of salt results using only the recipes that have a salt result present. While I have total recipe lbs for all recipes, I do not have salt results for all recipes. So, I need to be able to exclude those recipes that do not have salt results. Can someone help me with a formula to accomplish this? Thanks

Nancy Plant Mass Balance 1023.xlsm
EFGHIJK
144LbsMoistureFatSalt
145Nancy Water Packed Big Size4,83060.2816.950.88
146Nancy Marinade9,72061.3716.851.02
147Nancy Water Packed <2oz16,27261.0016.900.82
148Nancy Thermoform118,53860.6417.571.06
149Nancy Water Packed <2oz NT II66361.0016.90 
150Nancy Water Packed Big Size NT II00.000.00 
151Nancy Thermoform NT II31,91060.3017.280.76
152Nancy Marinade NT II00.000.00 
153Burrata00.000.00 
154FS Weighted av (065)181,93360.6517.400.98
19
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
what about::
Excel Formula:
=SUMPRODUCT(K2:K11,H2:H11)/((COUNT(K2:K11)*SUMIF(K2:K11,">0",H2:H11)))
 
Upvote 0
How can the weighted averge of salt ever be greater than any of the values of salt?, perhaps you need to explain what you mean by the weighted average you are expecting
Note I wasn't quite sure what range you were trying to "average" and I put in 2 to 11 check it with 2 to 10 and see if that is what you are expecting
try:
Excel Formula:
=SUMPRODUCT(K2:K11,H2:H11)/((SUMIF(K2:K11,">0",H2:H11)))
 
Last edited:
Upvote 0
How can the weighted averge of salt ever be greater than any of the values of salt?, perhaps you need to explain what you mean by the weighted average you are expecting
Note I wasn't quite sure what range you were trying to "average" and I put in 2 to 11 check it with 2 to 10 and see if that is what you are expecting
try:
Excel Formula:
=SUMPRODUCT(K2:K11,H2:H11)/((SUMIF(K2:K11,">0",H2:H11)))
I apologize, I went to a different tab to gather the actual results, so I calculated the weighted average for the wrong date. The actual weighted average for the example in this listing should be 0.9751. There is not a huge variance on this day because there is only one product without salt analysis and it is only 663 lbs, but there are days with much larger variances and multiple products without salt analysis.
 
Upvote 0
so how are you calculating 0.9751??
sumproduct of values in column K against all the inventories in column H except "Nancy Water Packed <2oz NT II" volume of 666 lbs because there is no salt associated with it. I used a different spreadsheet to copy and paste in just those rows with analysis.
 
Upvote 0
I believe I figured it out. Using this formula in cell K154. I believe this omits values in column H if there is no analysis in column K.

=SUMPRODUCT(K145:K153,$H$145:$H$153)/SUMIF(K145:K153,">0",H145:H153)
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,186
Members
452,615
Latest member
bogeys2birdies

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