IF

    Logical

    Performs a logical test and returns one value if TRUE, another if FALSE. The foundation of decision-making in Excel formulas.

    Translations
    EnglishIF
    FrenchSI
    SpanishSI
    GermanWENN
    ItalianSE
    PortugueseSE
    DutchALS
    PolishJEŻELI
    RussianЕСЛИ
    TurkishEĞER
    CzechKDYŽ
    HungarianHA
    SwedishOM
    DanishHVIS
    FinnishJOS
    Syntax
    IF(logical_test, value_if_true, [value_if_false])

    Arguments

    • logical_testThe condition to evaluate (TRUE or FALSE)
    • value_if_trueThe value returned if the test is TRUE
    • value_if_falseThe value returned if the test is FALSE(optional)
    Examples
    =IF(A1>10,"High","Low")
    High or Low

    Returns 'High' if A1>10, otherwise 'Low'

    =IF(B1="Yes",100,0)
    100 or 0

    Returns 100 if B1 is 'Yes', otherwise 0

    =IF(A1>=60,"Pass","Fail")
    Pass or Fail

    Classic grade pass/fail check

    Tips & Best Practices
    • You can nest up to 64 IF functions in Excel
    • Consider using IFS for multiple conditions (Excel 2016+)
    • If value_if_false is omitted and test is FALSE, returns FALSE
    Common Mistakes
    • Stacking five or six IFs inside each other because it's the first tool that comes to mind. It works, until you have to debug it six months later
    • Comparing text with = and expecting it to fail on case or spacing differences - Excel doesn't care, but your assumptions about the data might be wrong elsewhere
    • Skipping value_if_false and being confused later when the cell shows the word FALSE instead of just staying blank
    Related Functions
    IFSSwap to this the moment you're testing more than two or three conditions in a row
    IFERRORFor catching a calculation error, not a custom condition you define yourself
    SWITCHReads much better than nested IFs when you're really just matching one value against a list of options
    ANDDrop it inside IF's logical_test when several conditions all need to be true at once
    Frequently Asked Questions

    How many conditions can I nest inside one IF formula?

    Technically up to 64. Realistically, past 3-4 nested IFs the formula becomes a nightmare to read and debug. That's your cue to switch to IFS or a lookup table instead.

    What does IF return if I omit value_if_false?

    You get the boolean FALSE sitting in the cell, not a blank space like you might expect. If you want it empty, write value_if_false as "" explicitly.

    Can IF test multiple conditions at once?

    Yes, just not on its own - wrap AND() or OR() inside logical_test, for example IF(AND(A1>0,B1>0),"Both positive","No").

    Need to translate a formula using IF?

    Use our translator to convert your complete formula