weighted avg question...please help ASAP!

anantathaker

Board Regular
Joined
Jan 7, 2005
Messages
71
Hi guys,

So I have a dataset with columns structured like this:

Category Subcategory # of entries avg. price

Basically, within each category there are 5 or so subcategories. And for each subcategory, I have the number of entries and the average price.

I want to calculate the weighted avg price for a category, so the way I am doing that right now is by doing a weighted avg. Basically, I take each subcategory avg price and multiply by (subcategory # of entries / category # of entries). I then sum up these weighted subcategory avg prices to get a category avg price.

But there are lots of categories, and each has a different number of subcategories. So doing the manually takes a long time, in that I have to continually change ranges, etc. Is there a way to have a more automated formula? Can I use IF statements somehow? Anything would be helpful
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Could this work

Code:
=SUMIF($B$2:$B$500, "SubCatName", $D$2:$D$500)/COUNTIF($B$2:$B$500, "SubCatName")

HTH


Dave

EDIT: You said you had lots of sub cats so make a table of unique values then reference the cell containing Sub Category name instead of the sub category
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,868
Members
449,053
Latest member
Mesh

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