Quick Navigation
IF Function
Summary
The IF function is Excel's fundamental decision-making tool that evaluates a condition and returns one value if true, another if false. As one of the most essential logical functions, it forms the foundation for conditional logic across all spreadsheet analysis.
Syntax
IF(logical_test, value_if_true, [value_if_false])
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| logical_test | Any |
Yes | Any value or expression that can be evaluated as TRUE or FALSE |
| value_if_true | Any |
Yes | Value or calculation to return if condition is met |
| value_if_false | Any |
No | Optional value or calculation if condition fails |
Using the IF Function
IF statements power conditional logic in Excel spreadsheets. Use them for budget analysis, pass/fail grading, data categorization, dynamic messaging, and as building blocks for more complex conditional functions like nested IFs or array formulas.
Common IF Examples
Basic Text Condition
=IF(C2="Yes",1,2)
Returns 1 if C2 contains 'Yes', otherwise returns 2
Numeric Comparison
=IF(A2>B2,"Over Budget","OK")
Displays budget status based on actual vs. planned values
Calculation Result
=IF(C2>B2,C2-B2,0)
Calculates variance only when actual exceeds budget
Tax Calculation
=IF(E7="Yes",F5*0.0825,0)
Applies sales tax only when applicable
Frequently Asked Questions
Common Errors and Solutions
#NAME? error
Cause: Formula misspelled or unrecognized function name
Solution: Check spelling of 'IF' and ensure correct syntax
Unexpected 0 result
Cause: Missing arguments for value_if_true or value_if_false
Solution: Provide values or TRUE/FALSE for both outcomes
Notes
- TRUE/FALSE don't need quotes, but text values do
- Supports mathematical calculations in return values
- Frequently nested for multiple conditions
- Combines powerfully with AND, OR, NOT functions
Compatibility
Available in: Excel 2007, Excel 2010, Excel 2013, Excel 2016, Excel 2019, Excel 2021, Microsoft 365
Not available in:
Content last reviewed: December 11, 2025
Update frequency: As needed
Excel versions tested: Excel 2007+