[태그:] excel if function

  • Excel for Office Workers Part 3: Master IF, IFS, and Nested Functions for Complex Logic

    Excel IF function conditional logic

    Complex conditions, made simple with one function ⓒ Unsplash

    📊 [Excel & PowerPoint for Office Workers Series] Part 3
    Master IF, IFS, and nested functions to handle complex conditional logic.

    “90 and above is an A, 80+ is a B, 70+ is a C…” Grading logic like this quickly turns into a mess of nested IF statements — and one misplaced parenthesis can break the entire formula. Thankfully, modern Excel has a cleaner solution: IFS. Let’s cover conditional logic from the basics to real-world use.

    1. IF Function Basics — Get This Right First

    =IF(condition, value_if_true, value_if_false)
    The Simplest IF Usage

    Example: if the score is 60 or higher, return “Pass,” otherwise “Fail”
    =IF(A2>=60, "Pass", "Fail")

    💡 Text results must always be wrapped in quotation marks (” “).

    2. The Nested IF Trap — Parenthesis Hell

    Once you have three or more conditions, you end up nesting IF inside IF inside IF. The problem: parentheses multiply exponentially as conditions grow.

    =IF(A2>=90,”A”,IF(A2>=80,”B”,IF(A2>=70,”C”,IF(A2>=60,”D”,”F”))))
    ⚠️ Why Nested IF Gets Dangerous

    ❌ A single missing parenthesis breaks the whole formula
    ❌ Readability collapses as you add a 5th, 6th condition
    ❌ Hard to find what to fix when you need to update it later

    → Once you pass 3 conditions, switch to IFS.

    3. IFS — The Clean Alternative to Nested IF

    =IFS(condition1, result1, condition2, result2, condition3, result3, …)
    Same Grading Logic, With IFS

    =IFS(A2>=90,"A", A2>=80,"B", A2>=70,"C", A2>=60,"D", TRUE,"F")

    💡 The final TRUE, “F” pair acts as your “else” — the default result when none of the earlier conditions match. Skip this and you’ll get a #N/A error for any value that doesn’t fit a condition.

    4. IF vs. IFS Side by Side

    📗 Grading Example
    ScoreNested IF ResultIFS Result
    95AA
    85BB
    72CC
    55FF
    Nested IFIFS
    ReadabilityDrops sharply with more conditionsStays scannable even with many conditions
    Ease of editingHard to locate the right parenthesisJust add/edit condition-result pairs
    CompatibilityWorks in every Excel versionExcel 2019+ and 365 only
    ⚠️ Check Your Excel Version First
    IFS is a relatively recent function and won’t work in Excel 2016 or earlier. Confirm your organization’s standard Excel version before relying on it — nested IF or VLOOKUP-based range matching are fallback alternatives.

    5. Combining AND and OR for Compound Conditions

    Real work often demands “AND” and “OR” logic together — for instance, flagging performance that’s high AND has a low defect rate.

    AND / OR Real-World Examples

    📌 AND (both must be true)
    “Revenue ≥ $10,000 AND defect rate < 1% → Excellent"
    =IF(AND(B2>=10000, C2<0.01), "Excellent", "Standard")

    📌 OR (either can be true)
    "Department is Sales OR Marketing → eligible for bonus"
    =IF(OR(D2="Sales", D2="Marketing"), "Eligible", "Not Eligible")

    📌 Combining AND + OR
    =IF(AND(OR(D2="Sales",D2="Marketing"), B2>=5000000), "Top Performer", "Standard")

    6. Real-World Use — Auto-Classifying Equipment Status

    Engineering Example

    A formula that auto-classifies equipment status by utilization rate:

    =IFS(A2>=95,"Excellent", A2>=85,"Good", A2>=70,"Attention", TRUE,"Needs Inspection")

    Set this up once, and instead of manually scanning hundreds of equipment records, just filter for "Needs Inspection."
    📊 Coming Up Next (Part 4)
    Using conditional formatting and data validation to prevent input errors before they happen.

    Frequently Asked Questions

    Q. What happens if no condition in IFS matches?
    If you don't add a final TRUE, "default value" pair, you'll get a #N/A error. Always add a catch-all condition at the end.

    Q. How is SWITCH different from IFS?
    SWITCH is best when comparing a value against specific exact matches (e.g., department codes 1, 2, 3 → department names). IFS is better for ranges or inequalities (e.g., "90 and above").

    Q. My conditions have grown to 10+. Isn't IFS getting messy too?
    At that scale, it's cleaner to build a separate reference/grading table and use VLOOKUP against it. That way, when thresholds change, you edit the table — not the formula.