Weighted Average

sparky2205

Well-known Member
Joined
Feb 6, 2013
Messages
507
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi folks,
I'm trying to calculate a weighted average for a set of data.
I've already used SUMPRODUCT successfully in another part of the spreadsheet but now my date is not in a continuous range so I'm struggling with it.
I have tried 2 approaches:

Attempt 1:
Breaking up the essence of the SUMPRODUCT formula into something like this:
=IF(G17=3,"N/A",((F7*C7)+(F10*C10)+(F13*C13))/(((C7*C7)+(C10*C10)+(C13*C13))/7.5))

Attempt 2:
Creating a separate list with links to the data so the data is in order and I can use SUMPRODUCT.
That creates its own issues. I'm having to use the VALUE function in order for SUMPRODUCT to return a value. Otherwise it returns 0.
The I'm having issues as it is possible to have N/A (text, not error) in the data which causes SUMPRODUCT to return #VALUE!

I'm posting my attempts here, there are a few so excuse the messy bits.

What I'm trying to achieve:
In G7 I want the weighted average of - F7, F10, F13 with the weights being in - C7, C10, C13 and the result expressed as a percent.

G7 currently relates to Attempt 1 above
R9 currently relates to Attempt 2 above

I appreciate any help.

Site Assessment Final.xlsx
ABCDEFGHIJKLMNOPQRSTUV
4Assessed By:UPDATE INFORMATIONWeightScoreWeightScore
5IF(G17=3,"N/A",((F7*C7)+(F10*C10)+(F13*C13))/(((C7*C7)+(C10*C10)+(C13*C13))/7.5))5N/A51
61Management / Quality Culture / Training (20)AssessmentWeightScoreSummarySection Score5100%51
71.1Quality Policy and Objectives (5)502N/A#VALUE!#VALUE!10100%51
81.1.1Quality PolicyN/AN/AN/A2#VALUE!#VALUE!71
91.1.2ObjectivesN/AN/AN/A0#VALUE!31
101.2Management Review (5)552100%125%
111.2.1Management Review Meeting531.50
121.2.2Management Review Action Items and Meeting Minutes5212.5#VALUE!
131.3Training (10)1062100%
141.3.1Quality System On Boarding531.50
151.3.2SME531.55
161.3.3Procedure training (Corp and Site)52120
171.3.4Manufacturing Training5211
Summary Sheet
Cell Formulas
RangeFormula
C4C4=MainSheet!C3:F3
C7,C10,C13C7=IF((LEN(B7)-LEN(SUBSTITUTE(B7,"(","")))>1,MID(B7,(FIND("~",SUBSTITUTE(B7,"(","~",2))+1),(FIND("~",SUBSTITUTE(B7,")","~",2))-FIND("~",SUBSTITUTE(B7,"(","~",2))-1)),MID(B7,FIND("(",B7)+1,(FIND(")",B7)-(FIND("(",B7)+1))))
D7,D10,D13D7=SUM(D8:D9)
E7,E10,E13E7=COUNTA(E8:E9)
F7,F10F7=IF(OR(D7=0,E7=F8),"N/A",SUMPRODUCT(D8:D9,E8:E9)/(SUMPRODUCT(D8:D9,D8:D9)/2))
C8:E9C8=MainSheet!H8
F8,F11F8=COUNTIF(E8:E9,"N/A")
F9,F12F9=SUM(E8:E9)
C11:E12C11=MainSheet!H13
F13F13=IF(OR(D13=0,E13=F14),"N/A",SUMPRODUCT(D14:D17,E14:E17)/(SUMPRODUCT(D14:D17,D14:D17)/2))
C14:E17C14=MainSheet!H18
F14F14=COUNTIF(E14:E17,"N/A")
F15F15=SUM(E14:E17)
S5S5=F7
S6S6=F10
S7S7=F13
I7I7=IF(G17=3,"N/A",((F7*C7)+(F10*C10)+(F13*C13))/(((C7*C7)+(C10*C10)+(C13*C13))/7.5))
I8I8=IF(G17=3,"N/A",((F7*C7)+(F10*C10)+(F13*C13))/(((C7*C7)+(C10*C10)+(C13*C13))/7.5))
R5R5=C7
R6R6=C10
R7R7=C13
R8R8=SUMPRODUCT(INT(R5:R7),INT(S5:S7))/20
R9R9=(SUMPRODUCT(VALUE(R5:R7)*(VALUE(S5:S7<>"N/A")))/((SUMPRODUCT(VALUE(R5:R7),VALUE(R5:R7)))/7.5))
V5V5=F34
V6V6=F37
V7V7=F43
V8V8=F49
V9V9=F53
U5U5=C34
U6U6=C37
U7U7=C43
U8U8=C49
U9U9=C53
U10U10=SUMPRODUCT(INT(U5:U9),INT(V5:V9))/20
S12S12=INT(S5)
G7G7=IF(G17=3,"N/A",((F7*C7)+(F10*C10)+(F13*C13))/(((C7*C7)+(C10*C10)+(C13*C13))/7.5))
G16G16=IF((LEN(B6)-LEN(SUBSTITUTE(B6,"(","")))>1,MID(B6,(FIND("~",SUBSTITUTE(B6,"(","~",2))+1),(FIND("~",SUBSTITUTE(B6,")","~",2))-FIND("~",SUBSTITUTE(B6,"(","~",2))-1)),MID(B6,FIND("(",B6)+1,(FIND(")",B6)-(FIND("(",B6)+1))))
G17G17=COUNTIF(F7,"N/A")+COUNTIF(F10,"N/A")+COUNTIF(F13,"N/A")
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
It looks like the weights are in column D not column C.

Also, why are you multiplying the values in column C by themselves (squaring them) in the denominator of the formula in column G?
 
Upvote 0
Hi Jon,
apologies, the column headings are misleading. Values in the hashed cells are being used as interim calculation steps and will be hidden in the final worksheet to the user.
Column D (white cells) contains the weights used in the calculation of the values in F7, F10 & F13. I have used SUMPRODUCT for this and it works.
I am now trying to move on a level and get the weighted average of the values in F7, F10 & F13. This value will be displayed in G7.
The weights for this calculation will be in C7, C10 & C13. These are stripped from the text strings in B7, B10 & B13 respectively.
I cannot get SUMPRODUCT to work with this data as it is separated by other rows.
The formula currently in G7 is my attempt to use a deconstructed SUMPRODUCT to effectively attain the same result. This works fine except when either F7, F10 or F13 evaluates to N/A, which is a valid result for those cells. To account for this using my current formula I would have to write a monster nested IF statement. At least that's as far as my knowledge goes.
As an alternative I decided to bring that data together so that I could again use SUMPRODUCT. That is what is attempted in columns R & S above.
Using SUMPRODUCT on this data returned a value of 0. So I used the VALUE function to get SUMPRODUCT to recognise the values.
But introducing N/A as a value has the same impact here, SUMPRODUCT doesn't like it and I get an error.

Also, why are you multiplying the values in column C by themselves (squaring them) in the denominator of the formula in column G?
I had problems converting my SUMPRODUCT results into a percentage. I was trying to obtain a standard formula that I could use to achieve this. In a previous iteration of the spreadsheet I had used this and it worked so I was reluctant to mess with it. But then the parameters were changed and I had to do further manipulation. As you can see there is also a /7.5 in the denominator.

I hope it's clear what I'm trying to achieve but just in case I'm posting the full spreadsheet below and a recap.
I appreciate any help you can provide on this Jon.

What I'm trying to achieve:

In section - Management / Quality Culture / Training (20)
Level 1:
F7 should contain the weighted average of the Score in E8:E9 with the weights being in D8:D9
F10 shold contain the weighted average of the Score in E11:E12 with the weights being in D11:D12
F13 shold contain the weighted average of the Score in E14:E15 with the weights being in D14:D15
Level 2:
G7 should contain the weighted average of the Summary in F7, F10, F13 with the weights being in C7, C10, C13 respectively

In section - Improvements (20)
Level 1:
F20 should contain the weighted average of the Score in E21:E24 with the weights being in D21:D24
F25 should contain the weighted average of the Score in E26:E28 with the weights being in D26:D58
F29 should contain the weighted average of the Score in E30:E31 with the weights being in D30:D31
Level 2:
G20 should contain the weighted average of the Summary in F20, F25, F29 with the weights being in C20, C25, C29 respectively

This is the same for sections: Feedback (25), Facility (15) & Manufacturing (20)

Level 3: (Total Score):
G87 should contain the weighted average of the Section Score in G7, G20, G34, G58, G70 with the weights being in G16, G30, G53, G66, G83 respectively

Site Assessment Final.xlsx
ABCDEFG
61Management / Quality Culture / Training (20)AssessmentWeightScoreSummarySection Score
71.1Quality Policy and Objectives (5)55220%20%
81.1.1Quality Policy120.20
91.1.2Objectives130.30.5
101.2Management Review (5)55220%
111.2.1Management Review Meeting130.30
121.2.2Management Review Action Items and Meeting Minutes120.20.5
131.3Training (10)106220%
141.3.1Quality System On Boarding130.30
151.3.2SME130.31
161.3.3Procedure training (Corp and Site)120.220
171.3.4Manufacturing Training120.20
18
192Improvements (20)AssessmentWeightScoreSummarySection Score
202.1Corrective Action(10)10104100%100%
212.1.1System Utilized5210
222.1.2Investigation / Root Cause Documentation5215
232.1.3Action Plan Developed Time542
242.1.4Completion Rate521
252.2Preventive Action (5)553100%
262.2.1System Utilized531.50
272.2.2Investigation / Root Cause Documentation510.52.5
282.2.3Completion rate510.5
292.3Internal Audit program (5)552100%
302.3.1Schedule531.5020
312.3.2Training5212.50
32
333Feedback (25)AssessmentWeightScoreSummarySection Score
343.1Recalls (5)551100%100%
353.1.1Recalls552.50
362.5
373.2Customer Complaints Z7 (5)555100%
383.2.1Patient Confidentiality510.50
393.2.2System Utilized510.52.5
403.2.3Investigation / Root Cause Documentation510.5
413.2.4Corrective Action Plan Developed510.5
423.2.5Completion Rate510.5
433.3Product Complaints Z8 (Device) (5)555100%
443.3.1Patient Confidentiality510.50
453.3.2System Utilized510.52.5
463.3.3Investigation / Root Cause Documentation510.5
473.3.4Corrective Action Plan Developed510.5
483.3.5Completion Rate510.5
493.4External Assessment (7)773100%
503.4.1Customers531.50
513.4.2FDA5213.5
523.4.3ISO & MDSAP521
533.5Customer Feedback (3)331100%25
543.5.1Customer Feedback Activities531.500
551.5
56
574Facility (15)AssessmentWeightScoreSummarySection Score
584.1Overall Facility Appearance (6)663100%100%
594.1.1Outside5210
604.1.2Inside5213
614.1.3Warehouse and material management521
624.2Controlled Area(s) Manufacturing(9)995100%
634.2.1Appearance5210
644.2.2Cleanroom Environmental Controls5214.5
654.2.3Cleaning - Controlled Environment521
664.2.4Cleaning - equipment510.515
674.2.5Gowning Area and Material Entry5210
68
695Manufacturing (20)AssessmentWeightScoreSummarySection Score
705.1Product Nonconformance (5)554100%100%
715.1.1System Utilized510.50
725.1.2Containment Action & Material Disposition510.52.5
735.1.3Investigation / Root Cause Documentation521
745.1.4Completion Rate510.5
755.2Production Controls (5)554100%
765.2.1Monitoring5210
775.2.2Sanctioned Countries Check510.52.5
785.2.3Material Compliance (Assent Compliance)510.5
795.2.4Export Controls510.5
805.3Process Yields (5)551100%
815.3.1Yields552.50
822.5
835.4ERP Utilization (5)551100%20
845.4.1ERP System552.500
852.5
86
87Total Score84%
Summary Sheet
Cell Formulas
RangeFormula
C7,C10,C13,C83,C80,C75,C70,C62,C58,C53,C49,C43,C37,C34,C29,C25,C20C7=IF((LEN(B7)-LEN(SUBSTITUTE(B7,"(","")))>1,MID(B7,(FIND("~",SUBSTITUTE(B7,"(","~",2))+1),(FIND("~",SUBSTITUTE(B7,")","~",2))-FIND("~",SUBSTITUTE(B7,"(","~",2))-1)),MID(B7,FIND("(",B7)+1,(FIND(")",B7)-(FIND("(",B7)+1))))
D7,D10,D13,D29D7=SUM(D8:D9)
E7,E10,E13,E29E7=COUNTA(E8:E9)
F7,F10,F29F7=IF(OR(D7=0,E7=F8),"N/A",SUMPRODUCT(D8:D9,E8:E9)/(SUMPRODUCT(D8:D9,D8:D9)/2))
C8:E9C8=MainSheet!H8
F8,F11,F30F8=COUNTIF(E8:E9,"N/A")
F9,F12,F31F9=SUM(E8:E9)
C11:E12C11=MainSheet!H13
F13,F75,F70,F20F13=IF(OR(D13=0,E13=F14),"N/A",SUMPRODUCT(D14:D17,E14:E17)/(SUMPRODUCT(D14:D17,D14:D17)/2))
C14:E17C14=MainSheet!H18
F14,F76,F71,F21F14=COUNTIF(E14:E17,"N/A")
F15,F77,F72,F22F15=SUM(E14:E17)
G7G7=IF(G17=3,"N/A",((F7*C7)+(F10*C10)+(F13*C13))/(((C7*C7)+(C10*C10)+(C13*C13))/7.5))
G16G16=IF((LEN(B6)-LEN(SUBSTITUTE(B6,"(","")))>1,MID(B6,(FIND("~",SUBSTITUTE(B6,"(","~",2))+1),(FIND("~",SUBSTITUTE(B6,")","~",2))-FIND("~",SUBSTITUTE(B6,"(","~",2))-1)),MID(B6,FIND("(",B6)+1,(FIND(")",B6)-(FIND("(",B6)+1))))
G17G17=COUNTIF(F7,"N/A")+COUNTIF(F10,"N/A")+COUNTIF(F13,"N/A")
D20,D75,D70D20=SUM(D21:D24)
E20,E75,E70E20=COUNTA(E21:E24)
C21:E24C21=MainSheet!H27
G20G20=IF(G31=3,"N/A",((F20*C20)+(F25*C25)+(F29*C29))/(((C20*C20)+(C25*C25)+(C29*C29))/7.5))
D25,D58,D49D25=SUM(D26:D28)
E25,E58,E49E25=COUNTA(E26:E28)
F25,F58,F49F25=IF(OR(D25=0,E25=F26),"N/A",SUMPRODUCT(D26:D28,E26:E28)/(SUMPRODUCT(D26:D28,D26:D28)/2))
C26:E28C26=MainSheet!H34
F26,F59,F50F26=COUNTIF(E26:E28,"N/A")
F27,F60,F51F27=SUM(E26:E28)
C30:E31C30=MainSheet!H40
G30G30=IF((LEN(B19)-LEN(SUBSTITUTE(B19,"(","")))>1,MID(B19,(FIND("~",SUBSTITUTE(B19,"(","~",2))+1),(FIND("~",SUBSTITUTE(B19,")","~",2))-FIND("~",SUBSTITUTE(B19,"(","~",2))-1)),MID(B19,FIND("(",B19)+1,(FIND(")",B19)-(FIND("(",B19)+1))))
G31,G54G31=COUNTIF(F20,"N/A")+COUNTIF(F25,"N/A")+COUNTIF(F29,"N/A")
D34D34=SUM(D35:D35)
E34,E83,E80,E53E34=COUNTA(E35:E35)
C35:E35C35=MainSheet!H47
F34,F80,F83,F53F34=IF(OR(D34=0,E34=F35),"N/A",SUMPRODUCT(D35:D35,E35:E35)/(SUMPRODUCT(D35:D35,D35:D35)/2))
F35,F81,F84,F54F35=COUNTIF(E35,"N/A")
F36,F82,F85,F55F36=SUM(E35)
D37,D62,D43D37=SUM(D38:D42)
E37,E62,E43E37=COUNTA(E38:E42)
F37,F62,F43F37=IF(OR(D37=0,E37=F38),"N/A",SUMPRODUCT(D38:D42,E38:E42)/(SUMPRODUCT(D38:D42,D38:D42)/2))
C38:E42C38=MainSheet!H51
F38,F63,F44F38=COUNTIF(E38:E42,"N/A")
F39,F64,F45F39=SUM(E38:E42)
C44:E48C44=MainSheet!H59
C50:E52C50=MainSheet!H67
D53,D83,D80D53=SUM(D54)
C54:E54C54=MainSheet!H73
G34G34=IF(G54=5,"N/A",((F34*C34)+(F37*C37)+(F43*C43)+(F49*C49)+(F53*C53))/(((C34*C34)+(C37*C37)+(C43*C43)+(C49*C49)+(C53*C53))/5.32))
G53G53=IF((LEN(B33)-LEN(SUBSTITUTE(B33,"(","")))>1,MID(B33,(FIND("~",SUBSTITUTE(B33,"(","~",2))+1),(FIND("~",SUBSTITUTE(B33,")","~",2))-FIND("~",SUBSTITUTE(B33,"(","~",2))-1)),MID(B33,FIND("(",B33)+1,(FIND(")",B33)-(FIND("(",B33)+1))))
C59:E61C59=MainSheet!H79
C63:E67C63=MainSheet!H85
G58G58=IF(G67=2,"N/A",((F58*C58)+(F62*C62))/(((C58*C58)+(C62*C62))/7.8))
G66G66=IF((LEN(B57)-LEN(SUBSTITUTE(B57,"(","")))>1,MID(B57,(FIND("~",SUBSTITUTE(B57,"(","~",2))+1),(FIND("~",SUBSTITUTE(B57,")","~",2))-FIND("~",SUBSTITUTE(B57,"(","~",2))-1)),MID(B57,FIND("(",B57)+1,(FIND(")",B57)-(FIND("(",B57)+1))))
G67G67=COUNTIF(F58,"N/A")+COUNTIF(F62,"N/A")
C71:E74C71=MainSheet!H95
C76:E79C76=MainSheet!H102
C81:E81C81=MainSheet!H109
C84:E84C84=MainSheet!H113
G70G70=IF(G84=4,"N/A",((F70*C70)+(F75*C75)+(F80*C80)+(F83*C83))/(((C70*C70)+(C75*C75)+(C80*C80)+(C83*C83))/5))
G83G83=IF((LEN(B69)-LEN(SUBSTITUTE(B69,"(","")))>1,MID(B69,(FIND("~",SUBSTITUTE(B69,"(","~",2))+1),(FIND("~",SUBSTITUTE(B69,")","~",2))-FIND("~",SUBSTITUTE(B69,"(","~",2))-1)),MID(B69,FIND("(",B69)+1,(FIND(")",B69)-(FIND("(",B69)+1))))
G84G84=COUNTIF(F70,"N/A")+COUNTIF(F75,"N/A")+COUNTIF(F80,"N/A")+COUNTIF(F83,"N/A")
G87G87=((G16*G7)+(G30*G20)+(G53*G34)+(G66*G58)+(G83*G70))/(((G16*G16)+(G30*G30)+(G53*G53)+(G66*G66)+(G83*G83))/20.5)
 
Upvote 0
Column F formulas are SUMPRODUCT. For example, F7:

Excel Formula:
=SUMPRODUCT(E8:E9,D8:D9)/SUM(D8:D9)

Column G formulas are sums of products. For example, G7:

Excel Formula:
=(F7*C7+F10*C10+F13*C13)/(C7+C10+C13)
 
Upvote 0
Hi Jon,
the SUMPRODUCT formula works fine.
I had started off with something like your second formula: =(F7*C7+F10*C10+F13*C13)/(C7+C10+C13)
This works fine as long as either F7, F10 or F13 are not N/A. Then it returns an error.
 
Upvote 0
That's giving me a result Jon, but not the correct result.
In my data, if one subsection e.g. F7 is N/A, then the other two subsections i.e. F10 and F13 now make up 100%.
So with F7 = N/A and F10 and F13 both = 100%, G7 should return 100%. Your formula returns 75%.
 
Upvote 0
Excel Formula:
=(N(F7)*C7+N(F10)*C10+N(F13)*C13)/(ISNUMBER(F7)*C7+ISNUMBER(F10)*C10+ISNUMBER(F13)*C13)
 
Upvote 0
Solution

Forum statistics

Threads
1,224,814
Messages
6,181,130
Members
453,021
Latest member
Justyna P

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