Theory
The sheet that warns her
Meera's shelf runs out of sugar because she did not notice the stock dropping. She wishes the sheet would simply tell her: whenever an item falls below 10 units, shout "Reorder".
It can. One formula makes a cell decide: check a condition, and show one thing if true, another if false. This is IF, and it is where a spreadsheet stops merely calculating and starts thinking. And you have already met the logic underneath it, twice.
Theory
A fork in the road, with a signpost
IF is a fork in the road with a signpost. The signpost asks one yes/no question ("is stock below 10?"). If yes, take the left road (show "Reorder"); if no, take the right road (show "OK"). The cell always ends up on exactly one road. Every IF is one question and two possible answers, nothing more complicated than that.
Theory
IF, formally
=IF(condition, value_if_true, value_if_false)
Three parts, in order: the question, what to show if it is true, what to show if it is false.
=IF(C2<10, "Reorder", "OK")
reads: "if the stock in C2 is less than 10, show Reorder, otherwise show OK". Meera copies this down her whole stock column and instantly every low item is flagged. The condition (C2<10) is just a comparison that comes out TRUE or FALSE, exactly like BCA104's if-statements.
Theory
AND, OR, NOT: combining questions
One question is often not enough. Meera wants to flag items that are low stock AND high demand, both must hold.
- AND(cond1, cond2): TRUE only when all conditions are true.
- OR(cond1, cond2): TRUE when at least one is true.
- NOT(cond): flips true to false and back.
Drop them inside an IF:
=IF(AND(C2<10, D2>50), "Priority reorder", "Normal")
This is exactly the AND/OR truth-table logic from BCA102, now earning its keep.
Quiz
For an item, C2 (stock) is 8 and D2 (demand) is 40. What does =IF(AND(C2<10, D2>50), "Priority", "Normal") return?
- Normal, because AND needs BOTH conditions true and demand is not > 50
- Priority, because stock is below 10
- Priority, because one condition is true
- An error, AND cannot be inside IF
Show the answer
Normal, because AND needs BOTH conditions true and demand is not > 50
AND is TRUE only when every condition holds. Stock 8 < 10 is true, but demand 40 > 50 is FALSE, so AND is false, and IF takes the else-road: "Normal". One true condition is enough for OR, but not for AND. This is precisely the AND truth table from BCA102: all inputs must be true.
Think first
Swap AND for OR
Same item (stock 8, demand 40). If Meera changes AND to OR: =IF(OR(C2<10, D2>50), "Check", "Fine"), what does it return now, and why the different answer?
Show the answer
"Check". OR needs only at least one condition true: stock 8 < 10 is true, so OR is true regardless of demand, and IF takes the true-road. AND demanded both; OR is satisfied by either. This is the exact BCA102 contrast: AND is the strict one (all), OR is the generous one (any). Choosing the right one is the whole skill.
Watch out
Where marks leak
Getting IF's three parts out of order, it is condition, then true-value, then false-value. Confusing AND (needs all true) with OR (needs one true), the single most common logic slip. Forgetting to quote text results ("Reorder" needs quotes; numbers do not). And nesting IFs wrongly for multi-way choices, each else can hold another IF, exactly like BCA104's if-else ladder. Trace the truth values one condition at a time.
Theory
One logic, three subjects
Pause on what just happened: the AND/OR truth tables from BCA102 maths and the if-else decisions from BCA104 C programming are the same idea as Excel's IF. Three subjects, one logic. When a concept keeps reappearing across your syllabus, it is a signal it is fundamental, worth truly owning. Next: turning Meera's numbers into charts, so trends jump off the page.
Summary
Key takeaways
- IF(condition, value_if_true, value_if_false) makes a cell choose between two outcomes.
- A condition like C2<10 evaluates to TRUE or FALSE (the same values as BCA102 logic).
- AND is true only when ALL conditions hold; OR when AT LEAST ONE holds; NOT flips.
- Nest AND/OR inside IF for combined conditions; nest IFs for multi-way choices.
- Text results need quotes ("Reorder"); this is BCA102 truth tables and BCA104 if-else, reused.
- Memory hook: IF is a fork with a signpost, one question, two roads.