IF is the most powerful formula for beginners. Once you understand it, you'll use it in almost every spreadsheet you build. Here's everything โ from syntax to nested IFs.
IF makes Excel think. Instead of just calculating a number, IF lets Excel make a decision based on your data.
Think of it like this: if this is true, do this โ otherwise do that.
You use it whenever you want Excel to behave differently depending on what's in a cell. Is the value above target? Flag it. Did the customer pay? Show "Paid". Is the score above 50? Show "Pass". IF handles all of that.
=IF(condition, value_if_true, value_if_false)
The simplest example: check if a score is a pass or fail.
=IF(A2>=50, "Pass", "Fail")
If A2 is 72, the condition 72>=50 is TRUE, so you get "Pass". If A2 is 34, you get "Fail".
When the result is text (a word), put it in double quotes: "Pass", "Yes", "Overdue". When the result is a number or a formula, no quotes: 0, A2*2, B2-C2.
The condition inside IF uses comparison operators:
> โ greater than< โ less than>= โ greater than or equal to<= โ less than or equal to= โ equal to (one equals sign, unlike most programming)<> โ not equal to=IF(B2>=50, "Pass", "Fail")
=IF(C2<TODAY(), "Overdue", "On time")
=IF(B2>5000, B2*0.1, 0)
โ 10% bonus if sales exceed $5,000, otherwise $0
=IF(A2="", "Missing", "Complete")
=IF(B2>AVERAGE(B:B), "Above average", "Below average")
=IF(C2="Paid", "Yes", "No")
=IF(A2>0, B2/A2, 0)
โ avoids dividing by zero โ returns 0 if A2 is empty
=IF(B2>50000, B2*0.4, B2*0.2)
โ 40% tax above $50k, 20% below
=IF(B2<0, "โ ๏ธ Loss", "Profit")
=IF(A2=B2, "Match", "Mismatch")
What if you need more than two outcomes? You can put an IF inside another IF โ this is called nesting.
=IF(B2>=70, "First", IF(B2>=60, "2:1", IF(B2>=50, "2:2", "Fail")))
Read it left to right: if over 70, First. Otherwise check again โ if over 60, 2:1. Otherwise check again โ if over 50, 2:2. Otherwise Fail.
Nested IFs get confusing fast. If you need 4+ outcomes, use the IFS function instead โ it does the same thing with a much cleaner formula.
Sometimes a condition needs to check two things at once. That's where AND and OR come in.
AND โ both conditions must be true:
=IF(AND(B2>=50, C2="Attended"), "Pass", "Fail")
โ must score 50+ AND have attended
OR โ at least one condition must be true:
=IF(OR(B2>=90, C2="Distinction"), "Excellence award", "Standard")
โ either score 90+ OR get a Distinction
IFS is like multiple IFs in one โ much cleaner than nesting. It checks conditions in order and returns the first one that's true.
=IFS(B2>=70, "First", B2>=60, "2:1", B2>=50, "2:2", TRUE, "Fail")
โ TRUE at the end acts as the "else" catch-all
The TRUE at the end is the catch-all โ it always matches if nothing else does, so it acts as your "else" or default case.
Reading is one thing. Actually typing IF formulas in a real spreadsheet is how you'll remember them. Try ExcelPro's IF exercises โ free to start.
Start with IF exercises โ