Weighted Averages ignoring blanks and unrelated columns. For Google Sheets

bluargent

New Member
Joined
May 13, 2022
Messages
7
Office Version
  1. 365
Platform
  1. MacOS
Hi!

I am having a lot of trouble calculating a weighted average and ignoring blank cells. I understand what to do if the data is in an array, but I am working on a scorecard that will be printed out. The odd formatting is making it very difficult for me to use the sumproduct function and redistribute the scores.

In essence, I am trying to average 1-3 stakeholder scores and come up with an average score for that particular row. I cannot figure out how to redistribute the score weights if there is a blank cell.
Screen Shot 2022-05-13 at 3.15.50 PM.png
Let me know what I can do!

Thanks,
R
 
Last edited by a moderator:

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
That's a little bit tricky since the scores need to maintain their positions in the array, so the corresponding weights need a logic check to ensure there is a score value. This seems to do the trick:
Book1
EFGHIJKLMN
1SH1 ScoreS1 WeightS1 CommSH2 ScoreS2 WeightS2 CommSH4 ScoreS4 WeightS4 CommWted Score
2235%430%335%2.95
3310%440%550%4.4
410%440%550%4.5555556
5310%40%550%4.6666667
6310%440%50%3.8
7510%40%50%5
810%540%50%5
910%40%550%5
Sheet3
Cell Formulas
RangeFormula
N2:N9N2=LET( scores, FILTER(IF($E2:$L2="","null",$E2:$L2),(ISNUMBER(SEARCH(" score",$E$1:$L$1) )),""), wts, FILTER(IF($E2:$L2="","null",$E2:$L2),(ISNUMBER(SEARCH(" weight",$E$1:$L$1) )),""), IFERROR(SUMPRODUCT(scores,wts)/SUM(wts*ISNUMBER(scores)),""))
 
Upvote 0
Amazing, thank you

The "Filter" function on the variables seems to induce an error. It says there are mismatched range sizes, which seems to be due to the constants $E$1:$L$1 being paired with the lists $E2:$L2 (it's expecting 1 & 8 and getting 1 &1)

I think it's because I am using google sheets, although I am not sure why the function differs
 
Upvote 0
In future when asking questions about Google Sheets, please make that clear in your post/title. Also such questions should be posted in the General Discussion & Other Applications section of the board.
I have done that for you this time.
 
Upvote 0
In future when asking questions about Google Sheets, please make that clear in your post/title. Also such questions should be posted in the General Discussion & Other Applications section of the board.
I have done that for you this time.
Appreciate that, my bad. it if I change the " " in the filter function to $E2:$L2=" " the error goes away, but then it says no matches are found with the filter
 
Upvote 0
I wish I had known you didn't intend to use Excel 365 (as suggested by the version showing in your profile and the original forum this was posted in). The problem goes deeper than just FILTER. Sheets requires ArrayFormula wrappers, and the Sheets FILTER doesn't seem to have an option for dealing with an empty array, but I'm not well versed in dealing with Sheets formulas. I'm not aware of a "LET" function in Sheets, so the formula becomes very long, redundant, and difficult to follow, but this works on my system...try this in N2 and copied down:
Excel Formula:
=SUMPRODUCT(FILTER(ArrayFormula(IF($E2:$L2="","null",$E2:$L2)),ARRAYFORMULA(ISNUMBER(SEARCH(" score",$E$1:$L$1) ))),FILTER(ArrayFormula(IF($E2:$L2="","null",$E2:$L2)),ARRAYFORMULA(ISNUMBER(SEARCH(" weight",$E$1:$L$1) )))) /SUM(Arrayformula( FILTER(ArrayFormula(IF($E2:$L2="","null",$E2:$L2)),ARRAYFORMULA(ISNUMBER(SEARCH(" weight",$E$1:$L$1) )) ) * ArrayFormula(ISNUMBER(FILTER(ArrayFormula(IF($E2:$L2="","null",$E2:$L2)),ARRAYFORMULA(ISNUMBER(SEARCH(" score",$E$1:$L$1) )) ))) ))
 
Upvote 0
Solution
I wish I had known you didn't intend to use Excel 365 (as suggested by the version showing in your profile and the original forum this was posted in). The problem goes deeper than just FILTER. Sheets requires ArrayFormula wrappers, and the Sheets FILTER doesn't seem to have an option for dealing with an empty array, but I'm not well versed in dealing with Sheets formulas. I'm not aware of a "LET" function in Sheets, so the formula becomes very long, redundant, and difficult to follow, but this works on my system...try this in N2 and copied down:
Excel Formula:
=SUMPRODUCT(FILTER(ArrayFormula(IF($E2:$L2="","null",$E2:$L2)),ARRAYFORMULA(ISNUMBER(SEARCH(" score",$E$1:$L$1) ))),FILTER(ArrayFormula(IF($E2:$L2="","null",$E2:$L2)),ARRAYFORMULA(ISNUMBER(SEARCH(" weight",$E$1:$L$1) )))) /SUM(Arrayformula( FILTER(ArrayFormula(IF($E2:$L2="","null",$E2:$L2)),ARRAYFORMULA(ISNUMBER(SEARCH(" weight",$E$1:$L$1) )) ) * ArrayFormula(ISNUMBER(FILTER(ArrayFormula(IF($E2:$L2="","null",$E2:$L2)),ARRAYFORMULA(ISNUMBER(SEARCH(" score",$E$1:$L$1) )) ))) ))
I apologize for not making that clear - this worked perfectly though, thank you very much!
 
Upvote 0

Forum statistics

Threads
1,224,810
Messages
6,181,079
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