Forum

Notifications
Clear all

subtotal using Weighted Averages

6 Posts
2 Users
0 Reactions
259 Views
(@julie_w)
Posts: 3
Active Member
Topic starter
 

I need to create a summary of a Database and have it provide subtotals at specified changes.

Inserting subtotals is easy of course, but what I need is a weighted average so I need the SumProduct formula instead of the subtotal formula.

 

I would like to have it automated using an auto-open macro, that will update the information from the DB, then sort and insert the subtotals & totals

using the sumproduct formula instead of the subtotal.

 

I know how to do all of this except the substitution of the formula.

 

Hoping someone has a solution for this.

thank you

Julie

 
Posted : 29/06/2016 11:29 am
(@catalinb)
Posts: 1937
Member Admin
 

Hi Julie,

Please upload a sample file, we cannot help you without seeing and testing the formulas.

Thanks for understanding

Catalin

 
Posted : 30/06/2016 12:31 am
(@julie_w)
Posts: 3
Active Member
Topic starter
 

Hi Catalin,

I have uploaded a sample file of the summary data.

I inserted subtotals which of course is very easy - but then I had to manually add the weighted average lines below each subtotal line. 

I don't need the subtotal lines- just the weighted average lines. 

I am hoping for some VBA code that will insert these weighted average lines, but I will appreciate any method that will automate this.

Thank you

Julie

 
Posted : 06/07/2016 9:13 am
(@catalinb)
Posts: 1937
Member Admin
 

Hi Julie,

You have to start learning pivot tables, it will save you a lot of time.

See the attached file for a sample pivot table report. I added the calculated column only for Area 1, you have to do the same for your other columns. For the weighted average, I added a calculated field (you will find the field in Pivot Table tools Tab in ribbon, Analyze-Field,Items and Sets). You have to do the same to add this calculated field for the other columns you want to show in report.

Hope this is what you wanted.

Cheers,

Catalin

 
Posted : 06/07/2016 11:37 pm
(@julie_w)
Posts: 3
Active Member
Topic starter
 

Hi Catalin,

I do use pivot tables and slicers all the time, I did not however know how to add the calculated field so I didn't think it would work for me in this instance.

Thank you so much for your help!

Julie.

 
Posted : 07/07/2016 11:10 am
(@catalinb)
Posts: 1937
Member Admin
 

You're welcome 🙂

 
Posted : 07/07/2016 1:09 pm
Share: