我漏掉了什么?您为此函数输入了太多参数 - 嵌套 IF 语句

我漏掉了什么?您为此函数输入了太多参数 - 嵌套 IF 语句

我遇到了“您为该函数输入了太多参数”错误,但无法找出原因。我已经为我需要的必要场景准备好了嵌套的 IF 语句和 AND 语句。但我无论如何也想不出我遗漏了什么。有人知道吗?

=IF(
    HOUSING_PROVIDED = "Yes",
    0,
     IF(
        AND(
            HOUSING_PROVIDED = "No",
            HOUSING_RECALC_YN = "No",
            PRIOR_EXCESS_HOUSING <= 0
        ),
        0,
         IF(
            AND(
                HOUSING_PROVIDED = "No",
                HOUSING_RECALC_YN = "No",
                PRIOR_EXCESS_HOUSING > 0
            ),
            PRIOR_EXCESS_HOUSING,
             IF(
                AND(
                    HOUSING_PROVIDED = "No",
                    HOUSING_RECALC_YN = "Yes",
                    DUAL_CAREER_YN = "No",
                    EXCESS_HOUSING = "Yes"
                ),
                EXCESS_HOUSING,
                 IF(
                    AND(
                        HOUSING_PROVIDED = "No",
                        HOUSING_RECALC_YN = "Yes",
                        DUAL_CAREER_YN = "No",
                        EXCESS_HOUSING = "No",
                        HOUSING_RENTAL_LIMIT > 0
                    ),
                    HOUSING_RENTAL_LIMIT,
                     IF(
                        AND(
                            HOUSING_PROVIDED = "No",
                            HOUSING_RECALC_YN = "Yes",
                            DUAL_CAREER_YN = "No",
                            EXCESS_HOUSING = "No",
                            HOUSING_RENTAL_LIMIT <= 0
                        ),
                        "Run Data Calc",
                         IF(
                            AND(
                                HOUSING_PROVIDED = "No",
                                HOUSING_RECALC_YN = "Yes",
                                DUAL_CAREER_YN = "Yes",
                                SPOUSE_POLICY <> "Core",
                                EXCESS_HOUSING = "Yes"
                            ),
                            EXCESS_HOUSING,
                             IF(
                                AND(
                                    HOUSING_PROVIDED = "No",
                                    HOUSING_RECALC_YN = "Yes",
                                    DUAL_CAREER_YN = "Yes",
                                    SPOUSE_POLICY <> "Core",
                                    EXCESS_HOUSING = "Yes"
                                ),
                                HOUSING_RENTAL_LIMIT > 0,
                                HOUSING_RENTAL_LIMIT,
                                 IF(
                                    AND(
                                        HOUSING_PROVIDED = "No",
                                        HOUSING_RECALC_YN = "Yes",
                                        DUAL_CAREER_YN = "Yes",
                                        SPOUSE_POLICY <> "Core",
                                        EXCESS_HOUSING = "Yes"
                                    ),
                                    HOUSING_RENTAL_LIMIT <= 0,
                                    "Run Data Calc",
                                     IF(
                                        AND(
                                            HOUSING_PROVIDED = "No",
                                            HOUSING_RECALC_YN = "Yes",
                                            DUAL_CAREER_YN = "Yes",
                                            SPOUSE_POLICY = "Core",
                                            DUAL_CAREER_LOWER_YN = "Yes"
                                        ),
                                        0,
                                         IF(
                                            AND(
                                                HOUSING_PROVIDED = "No",
                                                HOUSING_RECALC_YN = "Yes",
                                                DUAL_CAREER_YN = "Yes",
                                                SPOUSE_POLICY = "Core",
                                                DUAL_CAREER_LOWER_YN = "No",
                                                EXCESS_HOUSING = "Yes"
                                            ),
                                            EXCESS_HOUSING,
                                             IF(
                                                AND(
                                                    HOUSING_PROVIDED = "No",
                                                    HOUSING_RECALC_YN = "Yes",
                                                    DUAL_CAREER_YN = "Yes",
                                                    SPOUSE_POLICY = "Core",
                                                    DUAL_CAREER_LOWER_YN = "No",
                                                    HOUSING_RENTAL_LIMIT > 0
                                                ),
                                                HOUSING_RENTAL_LIMIT,
                                                 IF(
                                                    AND(
                                                        HOUSING_PROVIDED = "No",
                                                        HOUSING_RECALC_YN = "Yes",
                                                        DUAL_CAREER_YN = "Yes",
                                                        SPOUSE_POLICY = "Core",
                                                        DUAL_CAREER_LOWER_YN = "No",
                                                        HOUSING_RENTAL_LIMIT <= 0
                                                    ),
                                                    "Run Data Calc",
                                                    "Dont Run Data Calc"
                                                )
                                            )
                                        )
                                    )
                                )
                            )
                        )
                    )
                )
            )
        )
    )
)

答案1

如果我理解正确的话,以下IF()调用有 4 个参数:

 IF(
    AND(
        HOUSING_PROVIDED = "No",
        HOUSING_RECALC_YN = "Yes",
        DUAL_CAREER_YN = "Yes",
        SPOUSE_POLICY <> "Core",
        EXCESS_HOUSING = "Yes"
    ),
    HOUSING_RENTAL_LIMIT > 0,
    HOUSING_RENTAL_LIMIT,
     IF(
        ...
    )
)

它从扩展代码的第 53 行开始。

从第 63 行开始还有另一个语句,它也有 4 个参数:

 IF(
    AND(
        HOUSING_PROVIDED = "No",
        HOUSING_RECALC_YN = "Yes",
        DUAL_CAREER_YN = "Yes",
        SPOUSE_POLICY <> "Core",
        EXCESS_HOUSING = "Yes"
    ),
    HOUSING_RENTAL_LIMIT <= 0,
    "Run Data Calc",
     IF(
        ...
    )
)

但说真的,别这么做。你永远都无法修改它,最早从后天开始。因为你无法理解你为什么这么做,怎么做,甚至可能是什么。;)

相关内容