Explain the use of IF, AND, OR, and nested IF formulas.

These functions are used to create logical tests in Excel, helping to make decisions based on conditions.

1. IF Function (Basic Conditional Statement)

The IF function checks a condition and returns one value if TRUE and another if FALSE.

Syntax :
=IF(logical_test, value_if_true, value_if_false)
Example :

If a student’s score is ≥50, return "Pass", otherwise "Fail":

=IF(A1>=50, "Pass", "Fail")
  • If A1 = 60 → "Pass"
  • If A1 = 45 → "Fail"

2. AND Function (Multiple Conditions - All Must Be TRUE)

The AND function checks if all conditions are TRUE. If even one condition is FALSE, the result is FALSE.

Syntax :
=AND(condition1, condition2, ...)
Example :

Check if a score (A1) is ≥50 and attendance (B1) is ≥75%:

=AND(A1>=50, B1>=75)
  • If A1 = 60, B1 = 80 → TRUE
  • If A1 = 40, B1 = 80 → FALSE
Using AND with IF :
=IF(AND(A1>=50, B1>=75), "Pass", "Fail")
  • Both conditions must be TRUE for "Pass".

3. OR Function (Multiple Conditions - Any Can Be TRUE)

The OR function checks if at least one condition is TRUE.

Syntax :
=OR(condition1, condition2, ...)
Example :

Check if a student passed either the exam (A1≥50) or extra credit (B1≥60):

=OR(A1>=50, B1>=60)
  • If A1 = 40, B1 = 65 → TRUE
  • If A1 = 40, B1 = 55 → FALSE
Using OR with IF :
=IF(OR(A1>=50, B1>=60), "Pass", "Fail")
  • If either condition is TRUE, the student passes.

4. Nested IF (Multiple Conditions with Different Outcomes)

A Nested IF is when you use multiple IF functions inside each other for more than two conditions.

Example :

Grade students based on their scores:

=IF(A1>=90, "A", IF(A1>=80, "B", IF(A1>=70, "C", IF(A1>=60, "D", "F"))))
  • A1 = 95 → "A"
  • A1 = 85 → "B"
  • A1 = 72 → "C"
  • A1 = 58 → "F"
Comparison Table
Function Purpose Example
IF Returns values based on a condition =IF(A1>50, "Pass", "Fail")
AND Checks if all conditions are TRUE =AND(A1>50, B1>75)
OR Checks if at least one condition is TRUE =OR(A1>50, B1>75)
Nested IF Handles multiple conditions =IF(A1>90, "A", IF(A1>80, "B", "C"))