if
我对我的数学测验总分和评论有 3 条陈述:
=IF(N12>=9, "That is an excellent score, well done")
=IF(N12<=8, "Not a bad score, good effort, but there is still room for improvement")
=IF(N12<=4, "That is a very disappointing score, revise more for next time")
我怎样才能将所有这些if
语句放入我想要注释的一个单元格中?是否有一个公式可以将这 3 个语句结合起来?
答案1
您可以使用:
=IF(N12<=4,"That is a very disappointing score, revise more for next time",if(N12<=8,"Not a bad score, good effort, but there is still room for improvement",if(N12>=9,"That is an excellent score, well done","error")))
但我会将评论放在单独的单元格中并引用它们,事实上,您可以使用索引和匹配更整洁地控制限制并返回文本......
编辑:添加了 1 的控件:
=IF(N12=1,"只答了一题",IF(N12<=4,"分数太令人失望了,下次多多修改",IF(N12<=8,"分数还不错,努力了,但仍有进步空间",IF(N12>=9,"分数非常优秀,做得好","错误"))))
答案2
你将一个 IF 嵌入另一个 IF。方法如下:
=IF(N12>=9, "That is an excellent score, well done", IF(N12<=4, "That is a very disappointing score, revise more for next time", "Not a bad score, good effort, but there is still room for improvement"))
您不需要检查 <=8,因为如果它不 >=9 且不 <=4,那么它介于 5 和 8 之间