If you’ve ever wanted Excel to make decisions for you, the IF function in Excel is your best friend. It’s like giving Excel a brain – “If this is true, do this. If not, do that.”
In this post, we’ll break it down in simple terms and show how you can use it in real-world situations. We’ll also combine it with AND and OR for smarter decisions.
What is the IF Function?
IF lets Excel return a value based on a condition.
Syntax:
=IF(condition, value_if_true, value_if_false)
In easy words:
👉 If the condition is true, do this… else, do that!
Example 1: Simple IF
Problem:
If a student’s marks are more than or equal to 40, show “Pass”; otherwise, “Fail”.
Formula:
=IF(B2>=40, "Pass", "Fail")
Name | Marks | Result |
---|---|---|
Rahul | 45 | Pass |
Priya | 35 | Fail |
Excel checks the marks and writes “Pass” or “Fail” automatically.
Example 2: IF with Bonus
Problem:
If sales are more than ₹50,000, give ₹1,000 bonus, else ₹500.
Formula:
=IF(B2>50000, 1000, 500)
Employee | Sales | Bonus |
---|---|---|
Ankit | ₹52,000 | ₹1,000 |
Meena | ₹43,000 | ₹500 |
Using IF with AND
AND is used when multiple conditions must be true.
Example 3: Employee Performance
If Sales > 50,000 AND Targets Achieved = “Yes”, then “Excellent”, else “Needs Improvement”.
Formula:
=IF(AND(B2>50000, C2="Yes"), "Excellent", "Needs Improvement")
Name | Sales | Target Achieved | Performance |
---|---|---|---|
Aman | 60000 | Yes | Excellent |
Kiran | 48000 | Yes | Needs Improvement |
Using IF with OR
OR is used when any one condition being true is enough.
Example 4: Discount Eligibility
If a customer is from “Gold” category OR their purchase is above ₹10,000, give a 10% discount.
Formula:
=IF(OR(B2="Gold", C2>10000), "10% Discount", "No Discount")
Customer | Category | Purchase | Discount |
---|---|---|---|
Rohan | Silver | ₹12,000 | 10% Discount |
Neha | Gold | ₹9,000 | 10% Discount |
Sumit | Silver | ₹8,000 | No Discount |
Bonus Tip: Nested IF
You can use multiple IFs inside one another to check more than two outcomes.
Example:
=IF(B2>=80, "A", IF(B2>=60, "B", "C"))
Result:
- If marks ≥ 80 → A
- If ≥ 60 → B
- Else → C
Final Thoughts
- Start with simple IF.
- Slowly combine them with AND, OR, and even nested IFs.
- Use real-world problems to practice — salary sheets, sales reports, student grades, etc.
What’s Next?
In the next post, we’ll learn about the IFERROR & IFNA in Excel