多个嵌套的IF(AND(OR)语句

时间:2018-08-16 17:51:38

标签: google-sheets formulas

我想为多个IF条件编写一个公式,该公式将显示在单元格S23中。

  • 如果:H23 =“ X”或“已删除”
  • THEN:S23 =“ X”

  • IF:I23 =“ EWS”或“已移除”
  • 那时:S23 =“ EWS”

  • IF:H23 =“ X”或“已删除” AND I23 =“ EWS”或“已删除”
  • 那时:S23 =“ X + EWS”

我的公式:

=if(H23="chex", "chex", IF(I23="EWS", "EWS", IF(H23="removed", "chex", (IF(I23="removed", "EWS", ""))))))))

它可以正常工作,但不能捕获最后的AND条件。我没有使用=IF(OR(H23, ">0" etc,因为此单元格还可以包含“ NA”。我只希望它捕获“ X”或“已删除”条件。

任何想法如何添加最后一个条件:如果H23和I23都分别包含“ removed”或“ X” /“ EWS”,那么结果是“ X + EWS”?

1 个答案:

答案 0 :(得分:0)

此方法有效:=IF(AND(OR(H23="x",H23="removed"),OR(I23="EWS",I23="removed")),"x+EWS",IF(OR(H23="x",H23="removed"),"x",IF(OR(I23="EWS",I23="removed"),"EWS","")))

我修改了@pnuts原始公式:=IF(AND(OR(H23="X",H23="removed"),OR(I23="EWS",I23="removed")),"X+EWS",IF(OR(H23="X",AND(H23="removed",I23<>"removed")),"X",IF(OR(I23="EWS",I23="removed"),"EWS","TBD")))

已删除的部分以粗体显示: AND( AND H23 =“ removed” ,I23 <>“ removed”)

具体来说,该参数:

来自IF(OR(H23="X",AND(H23="removed",I23<>"removed")),"X",

IF(OR(H23="X",H23="removed"),"X",


是团队的努力。谢谢@pnuts和@ user0的帮助! :)