Excel嵌套的IF将FALSE值连接在一起并呈现#VALUE

时间:2018-08-02 15:40:10

标签: excel excel-formula

我有以下嵌套的IF(我知道注释不是Excel注释,但是在文本编辑器中使用它们可以帮助我理解逻辑)

// start by seeing if there is an order date
=IF(    
    $C46<>"",
    //there is an order date. have the parts begun to arrive @ P2?
    IF( 
        $D46<>"",
        //parts have begun to arrive @ P2. Have they finished transferring to Brevard?
        IF(
            $F46<>"",
            // product has finished transferring to warehouse. has it begun to ship?
            IF(
                $G46<>"",
                // product has begun to ship. Has it shipped completely?
                IF(
                    $H46<>"",
                    // has shipped completely. this ends the cycle
                    IF( 
                        AND(J$5>=$G46,J$5<=$H46),
                        "S",
                        "error - shipped completely"
                    ),
                    // has NOT shipped completely. Here's where to TODAY() formula comes in
                    IF(
                        AND(J$5>=$G46,J$5<=TODAY()),
                        "S",
                        "error - began shipping, but not complete"
                    )
                )
                // product has NOT begun to ship; HAS completely transferred to Brevard. It's in inventory until shipping begins
                IF(
                    AND(J$5>$F46,J$5<=TODAY()),
                    "I",
                    "error - finished transferring to Brevard. in Inventory. Not begun to ship"
                )
            ),
            // product has begun assembly, but has not finished transferring to Brevard.
            IF(
                AND(J$5<=$D46,J$5<=TODAY()),
                "A",
                "error - assembly has begun, has not finished transferring"
            )
        ),
        //there is an order date, but parts have not arrived at P2
        IF(
            AND(J$5<=C46,J$5<=TODAY()),
            "O",
            "error - order has been taken, assembly has not begun"
        )
    ),
    // there is no order date
    ""
)

呈现所有这些内容时,Excel将FALSE值串在一起,结果将它们变成#VALUE,这破坏了整个公式。

我在做什么错?如果我删除FALSE值,它仍然呈现#VALUE。我不明白如何告诉它完全不执行任何操作,尤其是在一种算法中多次执行该操作。

1 个答案:

答案 0 :(得分:1)

公式中的ELSE过多。因此,经过一些调试后,您将得到:

enter image description here

在某个时候。因此,#VALUE出现。通常,Excel中的嵌套if语法是这样的:

enter image description here

因此,每个新的=IF都位于ELSE处。因此,只写入了一个ELSE(上面的屏幕截图中的数字5)

IF function – nested formulas and avoiding pitfalls


F9 是评估一个大公式的好朋友。选择公式后,请选择整个内部公式,然后按 F9 查看结果。