复合IF公式

时间:2017-08-31 10:32:32

标签: excel if-statement error-handling

我试图建立一个基本上重复自己的公式,只有2个单元格在每个实例上改变值。

=IF(AND(J12<50,J12<>””,K12=”Z02”,Q12=”Z3”),”Repl. Type does not match Planner”,
IF(AND(J12<50,J12<>””,K12=”Z02”,Q12=”Z4”),”Repl. Type does not match Planner”,
IF(AND(J12<50,J12<>””,K12=”Z05”,Q12=”Z3”),”Repl. Type does not match Planner”,
IF(AND(J12<50,J12<>””,K12=”Z05”,Q12=”Z4”),”Repl. Type does not match Planner”,
IF(AND(J12<50,J12<>””,K12=”Z06”,Q12=”Z3”),”Repl. Type does not match Planner”,
IF(AND(J12<50,J12<>””,K12=”Z06”,Q12=”Z4”),”Repl. Type does not match Planner”,
IF(AND(J12<50,J12<>””,K12=”Z07”,Q12=”Z3”),”Repl. Type does not match Planner”,
IF(AND(J12<50,J12<>””,K12=”Z07”,Q12=”Z4”),”Repl. Type does not match Planner”,
IF(AND(J12<50,J12<>””,K12=”Z08”,Q12=”Z3”),”Repl. Type does not match Planner”,
IF(AND(J12<50,J12<>””,K12=”Z08”,Q12=”Z4”),”Repl. Type does not match Planner”,
""))))))))))

我收到#Name?错误。

有人可以帮忙吗?

2 个答案:

答案 0 :(得分:0)

=IF(AND(J12<50,J12<>"",K12="Z02",Q12="Z3"),"Repl. Type does not match Planner",IF(AND(J12<50,J12<>"",K12="Z02",Q12="Z4"),"Repl. Type does not match Planner",IF(AND(J12<50,J12<>"",K12="Z05",Q12="Z3"),"Repl. Type does not match Planner",IF(AND(J12<50,J12<>"",K12="Z05",Q12="Z4"),"Repl. Type does not match Planner",IF(AND(J12<50,J12<>"",K12="Z06",Q12="Z3"),"Repl. Type does not match Planner",IF(AND(J12<50,J12<>"",K12="Z06",Q12="Z4"),"Repl. Type does not match Planner",IF(AND(J12<50,J12<>"",K12="Z07",Q12="Z3"),"Repl. Type does not match Planner",IF(AND(J12<50,J12<>"",K12="Z07",Q12="Z4"),"Repl. Type does not match Planner",IF(AND(J12<50,J12<>"",K12="Z08",Q12="Z3"),"Repl. Type does not match Planner",IF(AND(J12<50,J12<>"",K12="Z08",Q12="Z4"),"Repl. Type does not match Planner",""))))))))))

答案 1 :(得分:0)

这个公式似乎对我来说太长了。为什么不这样做?

(我添加了几个换行符以提高可读性。)

= IF(AND(J12<50,J12<>"",
         OR(K12={"Z02","Z05","Z06","Z07","Z08"}),
         OR(Q12={"Z3","Z4"})),
         "Repl. Type does not match Planner","")