[英]Nested If AND statement - google sheets
The nested if
statement I've tried writing keeps returning an error but I can't see where. 我尝试编写的嵌套
if
语句不断返回错误,但我看不到哪里。 I've seen similar threads but none with a workable syntax. 我见过类似的线程,但没有一个具有可行的语法。 I've tried with and without the
and
statement. 我尝试过使用和不使用
and
语句。 Very simply looking at the value in a cell (C5) and returning a corresponding value-based what the number in C5 is. 非常简单地查看单元格(C5)中的值,并基于C5中的数字返回相应的基于值的值。
=if(C5>84.5,1,if(and(C5<=84.5,C5>79.5,1.3,if(and(C5<=79.5,C5>74.5,1.7,if(and(C5<=74.5,C5>69.5,2,if(and(C5<=69.5,C5>64.5,2.3,if(and(C5<=64.5,C5>59.5,2.7,if(and(C5<=59.5,C5>54.5,3,if(and(C5<=54.5,C5>49.5,3.3,if(and(C5<=49.5,C5>44.5,3.7,if(and(C5<=44.5,C5>=40,4,if(C5<40,5))))))))))))))))))))
I expect the output to range from 1 to 5 depending on what the value in cell C5 is but I keep getting the following error 我期望输出范围为1到5,具体取决于单元格C5中的值,但我不断收到以下错误
Wrong number of arguments to IF.
IF参数个数错误。 Expected between 2 and 3 arguments, but got 1 argument
预期2到3个参数,但有1个参数
You systematically forgot to close the parentheses of your and()
functions. 您系统地忘记了关闭
and()
函数的括号。 Try this: 尝试这个:
=if(C5>84.5,1,if(and(C5<=84.5,C5>79.5),1.3,if(and(C5<=79.5,C5>74.5),1.7,if(and(C5<=74.5,C5>69.5),2,if(and(C5<=69.5,C5>64.5),2.3,if(and(C5<=64.5,C5>59.5),2.7,if(and(C5<=59.5,C5>54.5),3,if(and(C5<=54.5,C5>49.5),3.3,if(and(C5<=49.5,C5>44.5),3.7,if(and(C5<=44.5,C5>=40),4,if(C5<40,5)))))))))))
if you need ArrayFormula use: 如果需要ArrayFormula,请使用:
=ARRAYFORMULA(
IF( C5:C > 84.5, 1,
IF((C5:C <= 84.5) * (C5:C > 79.5), 1.3,
IF((C5:C <= 79.5) * (C5:C > 74.5), 1.7,
IF((C5:C <= 74.5) * (C5:C > 69.5), 2,
IF((C5:C <= 69.5) * (C5:C > 64.5), 2.3,
IF((C5:C <= 64.5) * (C5:C > 59.5), 2.7,
IF((C5:C <= 59.5) * (C5:C > 54.5), 3,
IF((C5:C <= 54.5) * (C5:C > 49.5), 3.3,
IF((C5:C <= 49.5) * (C5:C > 44.5), 3.7,
IF((C5:C <= 44.5) * (C5:C >= 40), 4,
IF( C5:C < 40, 5))))))))))))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.