Я сталкиваюсь с ошибкой «вы ввели слишком много аргументов для этой функции» и не могу понять, почему. У меня есть вложенные операторы 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 ответ1

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(
        ...
    )
)

А если серьезно, не делай этого. Вы никогда не сможете пересмотреть это, начиная с послезавтра. Просто потому, что вы не сможете понять, почему вы это сделали, и как, а может, даже что. ;)

Всё ещё ищете ответ? Посмотрите другие вопросы с метками .