Logical Functions
Eng\Mohammed Abdel Rahman Alwali
Main Logical Functions in Excel:
IF: Test a condition and return a result based on it.
AND: Test if all conditions are TRUE.
OR: Test if at least one condition is TRUE.
1. IF Function
Purpose:
Returns one result if the condition is TRUE and another if it’s
FALSE.
Syntax:
=IF(condition, result_if_true, result_if_false)
Example:
If the score in A1 is greater than or equal to 60 →
"Pass", otherwise → "Fail".
=IF(A1>=60, "Pass", "Fail")
Example:
If B2 equals "Paid" → "Thank You", otherwise →
"Pending"
Example:
If age is less than 18 → "Minor", otherwise →
"Adult".
=IF(E5<18, "Minor", "Adult")
2. AND Function
Purpose:
• Returns TRUE if all conditions are TRUE, otherwise FALSE.
Syntax:
=AND(condition1, condition2, ...)
Example:
Both scores must be above 50.
=AND(A1>50, B1>50)
Example:
Status must be "Active" and amount must be ≥ 100
=AND(C1="Active", D1>=100)
Example:
Value in E1 must be between 0 and 100.
=AND(E1>=0, E1<=100)
Example:
Both cells G1 and H1 must meet their
conditions ("Yes" and "Confirmed").
=AND(G1="Yes", H1="Confirmed")
3. OR Function
Purpose:
•Returns TRUE if any condition is TRUE, otherwise FALSE
Syntax:
=OR(condition1, condition2, ...)
Example:
At least one of the two scores is above 90.
=OR(A1>90, B1>90)
Example:
Payment method is either "Cash" or "Card".
=OR(C1="Cash", C1="Card")
Example:
Either one of the sales amounts exceeded the limit.
=OR(D1>1000, E1>5000)