简体   繁体   English

试图计算评级系统的平均分数

[英]Trying to calculate the average score for a rating system

I am trying to calculate an average score. 我想计算平均分数。 I have a rating system set up from 1-5 and they are divided by colors. 我有一个1-5的评级系统,它们按颜色划分。
I have a few columns that are days in one month and for some ratings/colors I have some random data which acts as votes for each rating. 我有一些列是一个月内的日子,对于某些评级/颜色,我有一些随机数据,作为每个评级的投票。
Is there a way to calculate the average score? 有没有办法计算平均分数?

The data is set like this: 数据设置如下:

Score   07/01/2019  08/01/2019  09/01/2019  
1        1           0           2  
2        0           0           1  
3        1           0           0  
4        0           0           0  
5        0           0           0  

If I understand your question correctly, you want to calculate an average for all, ignoring the 0 entries, which presumably are not scores given your 1-5 scoring methodology. 如果我正确理解你的问题,你想要计算所有人的平均值,忽略0个条目,根据你的1-5评分方法,这可能不是分数。 If so, try this (assuming "Score" is in cell A1): 如果是这样,试试这个(假设“得分”在单元格A1中):

=SUM(B2:D6)/COUNT(B2:D6)

Per your comment above you want the average score per day. 根据您的评论,您需要每天平均分数。 So you need to multiple the score (column A) against the number of votes for that score (column B, C, D depending on date. 因此,您需要将得分(A列)与该得分的投票数相加(B,C,D列取决于日期)。

If your table above goes from A1:D6, then put this in B7 如果您的上表来自A1:D6,那么请将其放入B7

=SUMPRODUCT($A$2:$A$6,B2:B6)/SUM(B2:B6)

This gives you an average of 2 for 7/1 Because (1*1 +3*1)/2 =2. 这为7/1提供了平均2,因为(1 * 1 + 3 * 1)/ 2 = 2。

You can copy the formula across to C7, D7 etc. 您可以将公式复制到C7,D7等。

You will get a "DIV/0" error if you have no votes. 如果您没有投票,您将收到“DIV / 0”错误。 This can be made more pretty as follows: 这可以做得更漂亮如下:

=IFERROR(SUMPRODUCT($A$2:$A$6,B2:B6)/SUM(B2:B6),"No votes")

All this does is say "No Votes" instead of returning an error. 所有这一切都是说“没有投票”而不是返回错误。 You could change the text to anything, or leave it "" for a blank cell if you want. 您可以将文本更改为任何内容,或者如果需要,将其保留为“”以表示空白单元格。

If you wanted the score for the whole lot, you can use this (eg put it in A10 or wherever using an array formula . You will need to enter the forumale then press ctrl-shift-enter otherwise it will not work. 如果你想要整个乐谱的分数,你可以使用它(例如把它放在A10或任何地方使用数组公式 。你需要输入forumale然后按ctrl-shift-enter否则它将无法工作。

=SUM(A2:A6*B2:D6)/SUM(B2:D6)

if it works, you should get the answer 1.6 and you will see { } in the formula bar after you press ctrl-shift-enter. 如果它有效,你应该得到答案1.6,按ctrl-shift-enter后你会在公式栏中看到{}。

PS I don't think that the accepted answer will give you average score. PS我不认为接受的答案会给你平均分。 It will give you average number of votes. 它会给你平均票数。 You can test this by putting all the votes in row 6 and seeing that the average score won't increase. 您可以通过将所有投票放在第6行并且看到平均分数不会增加来测试这一点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM