What is the IF Function
The IF function checks a condition and returns one value if the condition is true and another if it is false. It is the most important function for decision-making in Excel and the foundation of most business logic.
Formula: =IF(logical_test, value_if_true, value_if_false)
Practical Example 1
Student marks are in B2. Pass mark is 40.
Type: =IF(B2>=40, Pass, Fail)
Result: Pass or Fail
Practical Example 2
Give a discount if the purchase amount is above 1000.
Type: =IF(B2>1000, 10 percent, 0 percent)
Result: the discount rate
Practical Example 3
Nest IF to check multiple conditions.
Type: =IF(B2>=80, A, IF(B2>=60, B, IF(B2>=40, C, Fail)))
Result: the grade letter
Practical Example 4
Combine IF with AND for multi-condition checks.
Type: =IF(AND(B2>=40, C2>=75), Pass, Fail)
Result: Pass only if both conditions are met
When to Use It
IF is used for grading students, for setting targets and flags, for eligibility checks, for budget approval routing, for assigning categories, and for any decision logic in Excel.