Nested IF becomes necessary as soon as there are more than two answers. A supermarket does not give the same discount to a product that expires in 2 days and one that expires in 10. Each extra tier adds an IF inside the previous one, and the order of the tests decides if the result is right.
The following exercise shows you how to build a nested IF with three tiers and use its result in a price calculation.
What you will practice in this exercise
You work on a supermarket aisle with products, prices and expiry dates. You answer 8 questions, one formula per question:
- Calculate the days left before the expiry date (date subtraction)
- Apply 75%, 50%, 25% or no discount depending on the days left (nested IF)
- Calculate the discounted price (price × (1 − rate))
- Calculate the total of the initial prices and of the discounted prices (SUM)
- Fill each formula down the list (copy a formula)
Practice with exercises
Nested IF — Expiry dates (discounts)
Apply the right discount based on the expiry date using nested IFs.
Related articles
All the exercises in this series are based on real cases found on Excel forums. Each one answers a question that Excel users really ask.