简体   繁体   English

Excel:值为零时出现公式错误

[英]Excel: Formula error when value is zero

I have used a formula to create a point system for my class. 我已经使用公式为班级创建一个分数系统。 My formula is below, and it works great except that when C2 is zero, the score still shows "10" when I'd like it to be zero as well. 我的公式如下,它的工作原理非常好,除了当C2为零时,当我也希望它也为零时,分数仍显示为“ 10”。 I realize that this is an error in my formula but I can't seem to fix it without excel giving me an error message. 我意识到这是我的公式中的错误,但是如果没有excel给我一条错误消息,我似乎无法解决它。 Could anyone help me edit this formula to fix it? 有人可以帮我编辑此公式以解决此问题吗?

(I'm a teacher and I'm just trying to make my life a little easier with excel.) (我是一名老师,我只是想借助excel使我的生活更轻松。)

IF(TRIM(C2)="","",IF(C2<6.99,10,IF(AND(C2<=7.99,C2>=7),9,IF(AND(C2<=8.99,C2>=8),8,IF(AND(C2<=9.99,C2>=9),7,IF(AND(C2<=10.99,C2>=10),6,IF(AND(C2<=11.99,C2>=11),5,IF(AND(C2<=12.99,C2>=12),4,IF(AND(C2<=13.99,C2>=13),3,IF(AND(C2<=14.99,C2>=14),2,IF(AND(C2<=15.99,C2>=15),1,IF(AND(C2>=16,C2<=100),0))))))))))))

your first if statement says if c2 is nothing then its blank. 您的第一个if语句表明c2是否为空,则其为空白。 why not make another one that check if its 0 为什么不让另一个检查它的0

This is untested but try 这未经测试,但是尝试

IF(TRIM(C2)="","",IF(TRIM(C2)=0,0,IF(AND(C2<6.99,10,IF(AND(C2<=7.99,C2>=7),9,IF(AND(C2<=8.99,C2>=8),8,IF(AND(C2<=9.99,C2>=9),7,IF(AND(C2<=10.99,C2>=10),6,IF(AND(C2<=11.99,C2>=11),5,IF(AND(C2<=12.99,C2>=12),4,IF(AND(C2<=13.99,C2>=13),3,IF(AND(C2<=14.99,C2>=14),2,IF(AND(C2<=15.99,C2>=15),1,IF(AND(C2>=16,C2<=100),0))))))))))))))

Again this is untested but hopefully you see what I am trying to do. 同样,这未经测试,但希望您能看到我正在尝试做的事情。

Perhaps: 也许:

=IF(C2="","",IF(C2=0,0,MAX(ROUNDUP(MIN(16-C2,10),0),0))) = IF(C2 =“”,“”,IF(C2 = 0,0,MAX(ROUNDUP(MIN(16-C2,10),0),0))))

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

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