These functions are used to create logical tests in Excel, helping to make decisions based on conditions.
The IF function checks a condition and returns one value if TRUE and another if FALSE.
=IF(logical_test, value_if_true, value_if_false)
If a student’s score is ≥50, return "Pass"
, otherwise "Fail"
:
=IF(A1>=50, "Pass", "Fail")
The AND function checks if all conditions are TRUE. If even one condition is FALSE, the result is FALSE.
=AND(condition1, condition2, ...)
Check if a score (A1) is ≥50 and attendance (B1) is ≥75%:
=AND(A1>=50, B1>=75)
=IF(AND(A1>=50, B1>=75), "Pass", "Fail")
The OR function checks if at least one condition is TRUE.
=OR(condition1, condition2, ...)
Check if a student passed either the exam (A1≥50) or extra credit (B1≥60):
=OR(A1>=50, B1>=60)
=IF(OR(A1>=50, B1>=60), "Pass", "Fail")
A Nested IF is when you use multiple IF functions inside each other for more than two conditions.
Grade students based on their scores:
=IF(A1>=90, "A", IF(A1>=80, "B", IF(A1>=70, "C", IF(A1>=60, "D", "F"))))
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")) |