当第一个条件变为FALSE时,如何在excel中嵌套更多IF条件?

时间:2016-11-22 10:45:02

标签: excel excel-formula excel-2010 excel-2007

excel不接受公式

=IF(AND(Sheet1!BZ2<>"",Sheet1!CB2<>"",Sheet1!CD2<>"",Sheet1!CF2<>"",Sheet1!CH2<>"",Sheet1!CA2="",Sheet1!BC2="B"), IF(Sheet1!CA2="","",TODAY()-1),
    IF(
        IF(AND(Sheet1!BZ2<>"",Sheet1!CA2="",Sheet1!BC2="A"),IF(Sheet1!CA2="","",TODAY()-1),
            IF(
                IF(AND(OR(Sheet1!DB2="Completed - Knowledge Transfer"),AND(Sheet1!BC2<>"")),IF(Sheet1!CA2="","",TODAY()-1),
                IF(Sheet1!CA2="","",Sheet1!CA2)
                  )
       )
  )

我遵循IF的以下语法。

=IF (logical_test, [value_if_true], [value_if_false])

我试图在语句得到FALSE时嵌套其他条件 请帮忙。

有人可以找到我在这个

中做的语法错误

4 个答案:

答案 0 :(得分:1)

If语句未正确嵌套,并且您正在使用一些再次未正确使用的AND或语句。

简化您的公式我们得到了这个

=IF(a,b,IF(IF(c,d,IF(IF(e,f,g)))

其中,

 a = AND(Sheet1!BZ2<>"",Sheet1!CB2<>"",Sheet1!CD2<>"",Sheet1!CF2<>"",Sheet1!CH2<>"",Sheet1!CA2="",Sheet1!BC2="B") 

 b = IF(Sheet1!CA2="","",TODAY()-1)

 c = AND(Sheet1!BZ2<>"",Sheet1!CA2="",Sheet1!BC2="A")

 d = IF(Sheet1!CA2="","",TODAY()-1)

 e = AND(OR(Sheet1!DB2="Completed - Knowledge Transfer"),AND(Sheet1!BC2<>""))This does not make sense

 f = IF(Sheet1!CA2="","",TODAY()-1)

 g = IF(Sheet1!CA2="","",Sheet1!CA2)

适当的嵌套IF格式为

=IF(a,b,IF(c,d,IF(e,f,g)))

答案 1 :(得分:1)

您的公式也可以写成:

=IF(Sheet1!CA2="","",
IF(OR(
AND(Sheet1!BZ2<>"",Sheet1!CB2<>"",Sheet1!CD2<>"",Sheet1!CF2<>"",Sheet1!CH2<>"",Sheet1!BC2="B"),
AND(Sheet1!BZ2<>"",Sheet1!BC2="A"),
AND(Sheet1!DB2="Completed - Knowledge Transfer",Sheet1!BC2<>"")),
TODAY()-1,Sheet1!CA2))

答案 2 :(得分:0)

语法是嵌套语法(假设a1 = 12且b2 = 15:)

=IF(A1<13,IF(B1>13,"B1","Not Found"),"Not Found")

答案 3 :(得分:0)

您过度使用IF()公式。我试图简化你的公式,检查一下:

=IF(AND(Sheet1!BZ2<>"",Sheet1!CB2<>"",Sheet1!CD2<>"",Sheet1!CF2<>"",Sheet1!CH2<>"",Sheet1!CA2="",Sheet1!BC2="B"),IF(Sheet1!CA2="","",TODAY()-1),IF(AND(Sheet1!BZ2<>"",Sheet1!CA2="",Sheet1!BC2="A"),IF(Sheet1!CA2="","",TODAY()-1),IF(OR(Sheet1!DB2="Completed - Knowledge Transfer",Sheet1!BC2<>""),IF(Sheet1!CA2="","",TODAY()-1),IF(Sheet1!CA2="","",TODAY()-1))))

以上公式的嵌套视图:

=IF(AND(Sheet1!BZ2<>"",Sheet1!CB2<>"",Sheet1!CD2<>"",Sheet1!CF2<>"",Sheet1!CH2<>"",Sheet1!CA2="",Sheet1!BC2="B"), 
    IF(Sheet1!CA2="","",TODAY()-1),IF(AND(Sheet1!BZ2<>"",Sheet1!CA2="",Sheet1!BC2="A"),
        IF(Sheet1!CA2="","",TODAY()-1),
        IF(OR(Sheet1!DB2="Completed - Knowledge Transfer",Sheet1!BC2<>""),    
              IF(Sheet1!CA2="","",TODAY()-1),
              IF(Sheet1!CA2="","",TODAY()-1)
        )
     )
  )