我们讲述了IF的基本用法和IF的多重嵌套,如果第一次使用,或者不熟练会觉得IF的多重嵌套比较麻烦,或者不够清晰,IF的多重嵌套可以用IFS实现。

上节的IF嵌套案例:

比如一个班级的数学成绩,满分为100分,我们给学生的成绩进行评级,评级分3个

1.大于等于90的为优秀

2.大于等于80,小于90的为良好

3.大于等于60,小于80的为及格

3.小于60,为不及格

Excel函数必备知识之逻辑函数IF的多重嵌套替代函数IFS-趣帮office教程网

姓名 数学分数 评价(函数返回值) 函数(通过字符比较)
赵丽颖 90 优秀 =IF(B90>=90,"优秀",IF(B90>=80,"良好",IF(B90>=60,"及格","不及格")))
杨幂 80 良好 =IF(B91>=90,"优秀",IF(B91>=80,"良好",IF(B91>=60,"及格","不及格")))
迪丽热巴 67 及格 =IF(B92>=90,"优秀",IF(B92>=80,"良好",IF(B92>=60,"及格","不及格")))
古力娜扎 89 良好 =IF(B93>=90,"优秀",IF(B93>=80,"良好",IF(B93>=60,"及格","不及格")))
欧阳娜娜 86 良好 =IF(B94>=90,"优秀",IF(B94>=80,"良好",IF(B94>=60,"及格","不及格")))
热依扎 55 不及格 =IF(B95>=90,"优秀",IF(B95>=80,"良好",IF(B95>=60,"及格","不及格")))
姓名 数学分数 评价(函数返回值) 函数(通过字符比较)
赵丽颖 90 优秀 =IFS(B98>=90,"优秀",B98>=80,"良好",B98>=60,"及格",B98<60,"不及格")
杨幂 80 良好 =IFS(B99>=90,"优秀",B99>=80,"良好",B99>=60,"及格",B99<60,"不及格")
迪丽热巴 67 及格 =IFS(B100>=90,"优秀",B100>=80,"良好",B100>=60,"及格",B100<60,"不及格")
古力娜扎 89 良好 =IFS(B101>=90,"优秀",B101>=80,"良好",B101>=60,"及格",B101<60,"不及格")
欧阳娜娜 86 良好 =IFS(B102>=90,"优秀",B102>=80,"良好",B102>=60,"及格",B102<60,"不及格")
热依扎 55 不及格 =IFS(B103>=90,"优秀",B103>=80,"良好",B103>=60,"及格",B103<60,"不及格")

IFS(logical_test1,value_if_true,logical_test1,value_if_true,....)

IFS(表达式1,满足1的返回值,表达式2,满足2的返回值,表达式3,满足3的返回值,....)