Excel Logical Functions (IF, AND, OR, NOT)
Excel Logical Functions (IF, AND, OR, NOT) Logical functions help Excel think like a human. They check conditions and then give results based on those conditions. In simple words, Logical Functions are used to make decisions in Excel. For example: If marks are greater than 40 → Show “Pass” If salary is above 50,000 → Show “High Income” If stock is less than 10 → Show “Order Now” Excel checks the condition and gives the result automatically. IF Function in Excel What is IF Function? The IF function in MS Excel checks a condition and gives different results based on whether the condition is TRUE or FALSE. It has 3 parts: Condition (logical test) What to do if condition is TRUE What to do if condition is FALSE Syntax of IF Function =IF(logical_test, value_if_true, value_if_false) Arguments Explanation logical_test → The condition you want to check value_if_true → Result if condition is TRUE value_if_false → Result if condition is FALSE Example 1: Pass or Fail Student Marks Ravi 75 Aman 32 Condition: If Marks ≥ 40 → Pass Otherwise → Fail Formula: =IF(B2>=40,”Pass”,”Fail”) Explanation: B2>=40 → This checks if marks are greater than or equal to 40 If TRUE → “Pass” If FALSE → “Fail” Result: Ravi → Pass Aman → Fail Example 2: Bonus Calculation Employee Sales Raj 60000 Mohan 30000 Condition: If Sales > 50000 → Bonus 5000 Else → Bonus 2000 Formula: =IF(B2>50000,5000,2000) AND Function in Excel What is AND Function? AND function checks multiple conditions at the same time. We use AND Function in ms excel when we need to apply more than one condition at the a time. AND Function returns the result in True or False. Important Rule: AND gives TRUE only when ALL conditions are TRUE. If even one condition is FALSE → Result will be FALSE. Syntax of AND Function =AND(logical1, [logical2], [logical3]…) Arguments: logical1 → First condition logical2 → Second condition logical3 → Third condition (optional) Example 1: Eligibility Check Condition: Age ≥ 18 Marks ≥ 50 Both conditions must be true. Name Age Marks Rohan 20 60 Amit 17 80 Formula: =AND(B2>=18,C2>=50) Result: Rohan → TRUE (both conditions true) Amit → FALSE (age condition false) Using AND with IF (Very Important) In real Excel work, AND is mostly used inside IF. Example: =IF(AND(B2>=18,C2>=50),”Eligible”,”Not Eligible”) This means: If Age ≥ 18 AND Marks ≥ 50 → Eligible Otherwise → Not Eligible OR Function in Excel What is OR Function? OR function also checks multiple conditions. Important Rule: OR gives TRUE if ANY ONE condition is TRUE. Even if one condition is true → Result will be TRUE. Syntax of OR Function =OR(logical1, [logical2], [logical3]…) Example: Scholarship Condition Condition: Marks ≥ 90 OR Sports Certificate = Yes Name Marks Sports Rahul 85 Yes Neeraj 92 No Formula: =OR(B2>=90,C2=”Yes”) Result: Rahul → TRUE (sports = Yes) Neeraj → TRUE (marks ≥ 90) OR with IF Function =IF(OR(B2>=90,C2=”Yes”),”Scholarship”,”No Scholarship”) Meaning: If any one condition is true → Scholarship NOT Function in Excel What is NOT Function? NOT function reverses the result. TRUE becomes FALSE FALSE becomes TRUE Syntax of NOT Function =NOT(logical) Example If A1 contains TRUE Formula: =NOT(A1) Result → FALSE Example with Condition If Marks < 40 means Fail But we use NOT =NOT(B2<40) If Marks = 35 B2<40 → TRUE NOT(TRUE) → FALSE Practical Combined Example (Advanced Level) Let’s combine IF + AND + OR Condition: Age ≥ 18 Marks ≥ 60 OR Sports = Yes Formula: =IF(AND(B2>=18,OR(C2>=60,D2=”Yes”)),”Selected”,”Rejected”) Logic: Age must be 18+ And either: Marks ≥ 60 OR Sports = Yes This is real-life Excel logic. Comparison Table Function Use Rule IF Make decision Based on TRUE/FALSE AND Multiple conditions All must be TRUE OR Multiple conditions Any one TRUE NOT Reverse logic TRUE → FALSE Important Operators Used in Logical Functions Operator Meaning > Greater than < Less than >= Greater than equal <= Less than equal = Equal to <> Not equal to Example: =A1<>10 Means A1 is not equal to 10. Logical functions are the foundation of: Salary Sheet Result Sheet Attendance Sheet GST Calculation Sales Reports Inventory Management
Excel Logical Functions (IF, AND, OR, NOT) Read More »