Excel嵌套的IF AND公式

时间:2016-09-27 14:39:17

标签: excel excel-formula

我无法告诉我为什么我会收到以下公式的错误:

=IF(AND(AL=AM, AK=TRUE), "Unchanged, " ", IF(AND(AL>AM, AK=TRUE), "Downgrade", " ", IF(AND(AL<AM, AK=TRUE), "Upgrade, " ")))

列AL和AM包含值0-4。列AK包含True / false。如果满足条件,我想插入文本字符串。如果不满足,我想插入单个空格以将单元格留空。

谢谢!

2 个答案:

答案 0 :(得分:2)

您需要将嵌套的IF放在前一个的False中:

=IF(AND(AL1=AM1, AK1), "Unchanged", IF(AND(AL1>AM1, AK1), "Downgrade", IF(AND(AL1<AM1, AK), "Upgrade", " ")))

另一种没有AND()的方法:

IF(AK1,IF(L1=AM1,"Unchanged",IF(L1>AM1,"Downgrade",IF(L1<AM1,"Upgrade",""))),"")

答案 1 :(得分:1)

在每个文字字符串之后,您不需要" "。该公式不起作用,因为您试图在每个if语句中定义4个参数。删除," "应解决此问题。

=IF(AND(AL=AM, AK=TRUE), "Unchanged, IF(AND(AL>AM, AK=TRUE), "Downgrade", IF(AND(AL<AM, AK=TRUE), "Upgrade, " ")))