Logical Functions in Excel
Logical Functions are used to test conditions and return results based on whether the condition is TRUE or FALSE. These functions are commonly used in marksheets, attendance reports, payroll systems, sales reports, and data validation.
IF Function
The IF Function checks a condition and returns one value if the condition is TRUE and another value if the condition is FALSE.
Syntax
=IF(logical_test,value_if_true,value_if_false)
Arguments
| Argument | Description |
|---|---|
| logical_test | Condition to be checked. |
| value_if_true | Value returned when condition is TRUE. |
| value_if_false | Value returned when condition is FALSE. |
Example
=IF(B2>=35,"Pass","Fail")
| Part | Meaning |
|---|---|
| B2>=35 | Condition |
| Pass | Returned if TRUE |
| Fail | Returned if FALSE |
Nested IF Function
Nested IF means using one IF Function inside another IF Function to test multiple conditions.
Syntax
=IF(condition1,result1, IF(condition2,result2, IF(condition3,result3,result4)))
Grade Example
=IF(B2>=90,"A+", IF(B2>=80,"A", IF(B2>=70,"B+", IF(B2>=60,"B", IF(B2>=50,"C+", IF(B2>=35,"C","Fail"))))))
Evaluation Flow
| Marks | Grade |
|---|---|
| 90 and Above | A+ |
| 80 – 89 | A |
| 70 – 79 | B+ |
| 60 – 69 | B |
| 50 – 59 | C+ |
| 35 – 49 | C |
| Below 35 | Fail |
AND Function
The AND Function returns TRUE only when all specified conditions are TRUE.
Syntax
=AND(logical1,logical2,...)
Arguments
| Argument | Description |
|---|---|
| logical1 | First condition. |
| logical2 | Second condition. |
Example
=AND(B2>=35,C2>=35,D2>=35)
Result: TRUE only if all subjects are passed.
OR Function
The OR Function returns TRUE if any one of the conditions is TRUE.
Syntax
=OR(logical1,logical2,...)
Example
=OR(B2>=35,C2>=35,D2>=35)
Result: TRUE if at least one condition is TRUE.
NOT Function
The NOT Function reverses a logical result. TRUE becomes FALSE and FALSE becomes TRUE.
Syntax
=NOT(logical)
Example
=NOT(B2>=35)
| Original Result | NOT Result |
|---|---|
| TRUE | FALSE |
| FALSE | TRUE |
IFERROR Function
The IFERROR Function returns a custom value when a formula generates an error. This helps create professional reports by hiding Excel error messages.
Syntax
=IFERROR(value,value_if_error)
Arguments
| Argument | Description |
|---|---|
| value | Formula or expression to evaluate. |
| value_if_error | Value returned if an error occurs. |
Example 1
=A2/B2
If B2 contains 0, Excel returns #DIV/0!
Example 2
=IFERROR(A2/B2,"Invalid Calculation")
If division by zero occurs, Excel displays Invalid Calculation instead of an error message.
