IF, AND and OR
IF checks a condition and gives one answer if it is true and another if it is false.
IF lets your sheet make decisions: mark orders as "Free delivery" or "Charge Rs 40", label students "Pass" or "Fail", flag stock as "Reorder". The test is any comparison that is TRUE or FALSE (B2>=500, C2="Delhi"). Text answers must be in double quotes; numbers don't need them.
Example
=IF(test, value_if_true, value_if_false)
Order total in B2 is 650
=IF(B2>=500, "Free delivery", "Rs 40") → Free delivery
=IF(B2>=500, 0, 40) → 0Several levels
Example
=IF(B2>=1000, "Gold", IF(B2>=500, "Silver", "Basic")) → Silver
=IFS(B2>=1000, "Gold", B2>=500, "Silver", TRUE, "Basic") → SilverAND and OR
Real rules often have more than one condition: "buy if it's cheap and in stock", "good deal if it's cheap or there's lots of stock". AND is TRUE only when all its conditions are TRUE; OR is TRUE when at least one is. Put them inside IF's test.
Example
Price in B2 is 799, Stock in C2 is 4
=IF(AND(B2<1000, C2>0), "Buy now", "Skip") → Buy now
=IF(OR(B2<500, C2>10), "Good deal", "Normal") → NormalIFS is in Excel 2019 and later, Microsoft 365 and Google Sheets. In older versions, put IFs inside each other instead.Key points
=IF(test, if_true, if_false).- Text results go in double quotes.
- Nest IFs or use IFS for several levels.
- AND = all true; OR = at least one true.
📝 Test yourself
1. How many parts does an IF function have?
2. AND(...) is TRUE when...
3. Fill in the function that is TRUE if at least one condition is true:
=(A1>5, B1>5)
