简体   繁体   中英

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. 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. 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.)

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. why not make another one that check if its 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)))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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