problem using sum for weighed averages

elitekatti

New Member
Joined
Feb 10, 2011
Messages
9
Hello,

My requirement is to add sum of multiple rows which have individual variable weights.
For example, row 1 cell has value 75 and its weight is 25%. Similarly row 2's cell has value say 100 and its weight is 40% and so on..
I need sum of all these rows.

I also need to keep in mind that a value 'N/A' (any combinations-uppercase or lowercase) can also be entered for any row values.
In that case, the value should NOT be ignored but value be considered as 1.

awaiting your suggestions here...
Thanks in advance!
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
@Aladin: Thanks for the input !
Well, the example would be as mentioned below:


English Maths Social-Science Drawing Crafts Total
Alex 80 60 75 80 90
Bob 75 95 92 72 80
Carl 80 85 95 65 85

English Maths Social-Science Drawing Crafts Total Percentage
Weights for each subject 20 30 30 10 10 100




Note: Sorry, I wanted to edit this in my question! But did not know how to do it.
So here is the change in the question - The first part is same. Only the part where I talk about N/A values needs to be changed.
In case of rows having N/A, the remaining rows percentage should be adjusted accordingly so that the final weight is still 100%.
Meaning: Assume in above example, for Bob - 'Drawing' row value is N/A, then for him remaining subjects' weights should be adjusted equally such that their weights still add up to 100%.
In this case for Bob subject weights would be : English=22.5; Maths=32.5;Social Science=32.5; Drawing=0; Crafts=12.5;


I hope the above example is understandable...


Thank you!
 
Upvote 0
@Aladin: Thanks for the input !
Well, the example would be as mentioned below:


English Maths Social-Science Drawing Crafts Total
Alex 80 60 75 80 90
Bob 75 95 92 72 80
Carl 80 85 95 65 85

English Maths Social-Science Drawing Crafts Total Percentage
Weights for each subject 20 30 30 10 10 100




Note: Sorry, I wanted to edit this in my question! But did not know how to do it.
So here is the change in the question - The first part is same. Only the part where I talk about N/A values needs to be changed.
In case of rows having N/A, the remaining rows percentage should be adjusted accordingly so that the final weight is still 100%.
Meaning: Assume in above example, for Bob - 'Drawing' row value is N/A, then for him remaining subjects' weights should be adjusted equally such that their weights still add up to 100%.
In this case for Bob subject weights would be : English=22.5; Maths=32.5;Social Science=32.5; Drawing=0; Crafts=12.5;


I hope the above example is understandable...


Thank you!


No, it's not...

Is this what you are expecting?

Row\Col
A​
B​
C​
D​
E​
F​
G​
H​
1​
EnglishMathsSocial-ScienceDrawingCraftsTotalPercentage
2​
Alex
80​
60​
75​
80​
90​
73.5​
3​
Bob
75​
95​
92​
72​
80​
86.3​
4​
Carl
80​
85​
95​
65​
85​
85​
 
Upvote 0
20%30%30%10%10%
EnglishMathsSocial-ScienceDrawingCraftsAverage
Alex806075809073.5
Bob759592728086.3
Carl808595N/A8587.125

<tbody>
</tbody>

Does this represent what you'd expect?

Assuming Row 1 contains the percentages and Column G contains the average, I would use:

Code:
=SUMPRODUCT($B3:$F3,$B$1:$F$1)+SUM($B3:$F3)*(1-SUMIF($B3:$F3,"<>N/A",$B$1:$F$1))/COUNTIF($B3:$F3,"<>N/A")
 
Upvote 0
sorry for the formatting issues...

geez.. I wasn't expecting such quick responses! :)

well, thank you @KyleUK... your solution works perfectly!
could you help me understand the logic here plz!
 
Upvote 0
sorry for the formatting issues...

geez.. I wasn't expecting such quick responses! :)

well, thank you @KyleUK... your solution works perfectly!
could you help me understand the logic here plz!

No worries - I'll run through the logic quickly:

Code:
=SUMPRODUCT($B3:$F3,$B$1:$F$1)

SUMPRODUCT is multiplying your scores by your weight and summing them - so all being well (no N/As), this does what you need for weighting.

Code:
[COLOR=#574123]+SUM($B3:$F3)*(SUMIF($B3:$F3,"N/A",$B$1:$F$1))/COUNTIF($B3:$F3,"<>N/A")[/COLOR]

This bit handles the N/As (I've rewritten this to be simpler but the idea is the same) - we're taking the total of the scores and multiplying them by whatever %s were N/A, then dividing it by the number of non-N/A scores to redistribute the un-allocated %s. We can do it on the total because you said you wanted to redistribute the un-allocated %s evenly.

Hope that makes sense.
 
Upvote 0

Forum statistics

Threads
1,217,408
Messages
6,136,447
Members
450,013
Latest member
k4kamal

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