ExcelFormulas logoExcelFormulas.
Ask AI
Logical & ConditionalVerified QA Tested

IF.

Checks whether a condition is met, and returns one value if TRUE, and another if FALSE.

Category: Logical & Conditional
ExcelExcel 365Excel 2021Excel 2019Google Sheets

How it works.

The IF function lets you make logical comparisons between a value and what you expect. An IF statement has two results: the first is if your comparison is True, the second is if your comparison is False.

💡 In simple terms.

Checks whether a condition is true or false. If true, it outputs one value; if false, it outputs another.

Everyday Analogy

"Think of this like a referee checking a score: IF the score is 70 or higher, they shout "Pass!"; otherwise, they shout "Fail!"."

Formula syntax.

Standard Excel Notation
=IF(logical_test, value_if_true, [value_if_false])
Tip:Arguments wrapped in square brackets [like_this] are optional; all other arguments are required.

Formula arguments.

Every parameter accepted by the IF function is detailed below.

logical_testRequired

A condition that can be evaluated to TRUE or FALSE.

Example value: C2>=70
value_if_trueRequired

The value to return if logical_test evaluates to TRUE.

Example value: "Pass"
value_if_falseOptional

The value to return if logical_test evaluates to FALSE.

Default: "Fail"

Simple example.

Step-by-Step Scenario

Pass/Fail Grade Check

Label student results as "Pass" if their score is 70 or above, otherwise "Fail".

StudentSubjectScoreStatusPass Threshold
SophiaMath85—70
JacksonMath62——
LucasMath74——
Applied Formula
=IF(C2>=70, "Pass", "Fail")
Expected Result:Pass

Evaluates IF over the sample table cells, placing the verified output in cell D2:D6.

Formula generator.

Full Generator Wizard

Customize the argument fields below to generate a tailored IF formula ready to paste directly into your worksheet.

Generated FormulaReady to copy

Expected result behavior.

Returns "Pass" based on sample evaluation criteria and active cell references.

Sample Output:Pass
Output Type:Text String

Best Practices

  • You can nest multiple IF statements inside each other to handle more than two outcomes, although the IFS function is now preferred.
  • To leave a cell blank on FALSE, use empty quotes: "" as the value_if_false.

Common Mistakes

  • Avoid nesting more than 3-4 IF functions, as they become extremely hard to debug and maintain. Consider using IFS or VLOOKUP/XLOOKUP tables.
Compatibility Database

Platform & version compatibility.

Verified platform compatibility matrix based on actual spreadsheet calculation engine specifications.

Excel✓
Supported
Excel 365✓
Supported
Excel 2021✓
Supported
Excel 2019✓
Supported
Google Sheets✓
Supported
Microsoft Excel History & Version Availability

Core standard function supported across all modern and legacy Microsoft Excel versions (365, 2021, 2019, 2016, 2013, 2010), as well as Excel for the Web and Mac.

Google Sheets Compatibility Notes

100% compatible with Google Sheets. Uses identical argument order, data types, and standard calculation logic.

Frequently asked questions.

Technical Q&A
How many IF statements can be nested in modern Excel?↓

Modern Excel allows up to 64 nested IF statements, but using IFS, SWITCH, or XLOOKUP is strongly recommended for readability and performance.

How do I check multiple conditions inside an IF statement?↓

Combine IF with logical functions AND or OR, for example: =IF(AND(A2>50, B2="Approved"), "Qualify", "Disqualify").