3.14 AND, OR, NOT and SWITCH
| Function | Example | Meaning |
|---|---|---|
AND(l1, l2, …) |
=AND(C2="Pune",H2<=10) |
TRUE only if all are TRUE |
OR(l1, l2, …) |
=OR(I2="Cancelled",I2="Returned") |
TRUE if any is TRUE |
NOT(logical) |
=NOT(I2="Delivered") |
Reverses TRUE/FALSE |
SWITCH(expr, v1, r1, …, [default]) (Excel 2019+) |
see below | Match one value against a list |
Worked example – combine with IF.
=IF(AND(C2="Pune",H2<=10),"Pune 10-min hero","")
=IF(OR(I2="Cancelled",I2="Returned"),"Lost order","OK")
=SWITCH(LEFT(A2,3),"BLK","Blinkit","AMN","Amazon Now","Unknown")
Row 7 (Pune, 8 mins) → Pune 10-min hero; row 9 (Returned) → Lost order; row 4 → Amazon Now.
Ravindra Bagale's Tip
Khup students =IF(C2="Pune" AND H2<=10, …) asa English sarkha lihitat – Excel madhe AND ha function aahe, operator nahi. AND(condition1, condition2) asach liha. SWITCH fakt "equal to" check karto – > sarkhe comparisons sathi IFS vapra.
Practice task
Flag orders that are Blinkit AND Fruits AND more than ₹200. Use SWITCH to convert city names to codes (Pune → PUN, Nashik → NSK, Nagpur → NGP, Kolhapur → KOP, Solapur → SLP, Sambhaji Nagar → SBN).