具有多个条件的Excel统计

时间:2019-06-26 22:43:43

标签: excel

我正在尝试计算excel文件中的所有人员,该文件在考试1中的得分低于75,但在考试2或3中的得分都超过900。我尝试使用countifs,但是如果考试2和考试3个超过900,则计算两次。有什么建议么?请帮忙!

我也尝试过sumproduct,但我不知道如何包含基于2个独立列的OR条件

=COUNTIFS($C:$C, "<75",$E:$E,">900",$F:$F,">900")

我希望对符合这一条件的所有学生进行计数。

5 个答案:

答案 0 :(得分:1)

=countifs("*Exam 1 cell*","<75","*Exam 2 cell*",">900","*Exam 3 cell*","<900")

+countifs("*Exam 1 cell*","<75","*Exam 3 cell*",">900","*Exam 2 cell*","<900")

+countifs("*Exam 1 cell*","<75","*Exam 2 cell*",">900","*Exam 3 cell*",">900")

我只是想在条件上具体说明我想要的公式:

1)考试1 <75,考试2> 900,考试3 <900

2)考试1 <75,考试3> 900,考试2 <900

3)考试1 <75,考试2> 900,考试3> 900

答案 1 :(得分:0)

作为数组公式(通过Ctrl + Shift + Enter输入)

def main():
    number = int(input("Please enter an integer between 0 and 127: "))
    if number > 127 or number < 0:
        print("I'm sorry, that is not an acceptable value. Please try again")
        main()
    elif number <= 127 and number >= 0:
        print("WIP")
    else:
        print("I'm sorry, something went wrong. Please try again and be sure to enter an integer between 0 and 127.")
        main()

答案 2 :(得分:0)

此公式可满足您的需求:

=SUM(COUNTIF($D:$D,"<75"),IF(SUM(COUNTIF($E:$E,">900"),COUNTIF($F:$F,">900"))>1,1,0))

enter image description here

答案 3 :(得分:0)

只要将两者都超过900的总和减去即可:

=COUNTIFS($C:$C, "<75",$E:$E,">900",$F:$F) + COUNTIFS($C:$C, "<75",$F:$F,">900") - COUNTIFS($C:$C, "<75",$E:$E,">900",$F:$F,">900")

为什么这样做?

Exam1 | Exam2 | Exam3 ::: CountIfs1 + CountIfs2 - CountIfs3 === Result
 100  |   75  |   75   :       0    +      0    -      0     =     0
  70  |   75  |   75   :       0    +      0    -      0     =     0
  70  |  901  |   75   :       1    +      0    -      0     =     1
  70  |   75  |  901   :       0    +      1    -      0     =     1
  70  |  901  |  901   :       1    +      1    -      1     =     1

答案 4 :(得分:0)

您可以使用SUMPRODUCT

公式:

=SUMPRODUCT((C:C<75)*(E:E>900)*(F:F>900))

结果:

enter image description here