Excel IFERROR Practice Question: Divide each sales figure in column A by the units in column B, treat the…
The question
Divide each sales figure in column A by the units in column B, treat the errors as 0, and add everything up. Put the total in D2.
The data
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Sales | Units | Total | |
| 2 | 100 | 4 | ? | |
| 3 | 50 | 0 | ||
| 4 | 90 | 3 | ||
| 5 | 40 | 2 |
The yellow cell is where your answer goes.
Show answer
Answer in D2: 75
How it works
Explanation: IFERROR works on every row of the array at once and turns the one division by zero into 0. SUMPRODUCT then adds the results.
Syntax: =SUMPRODUCT(IFERROR(A2:A5/B2:B5,0))
The rows give 25, 0 (error), 30 and 20. The total is 75.
Try it yourself in the live sheet
Type your formula in the highlighted cell and get instant feedback. Free, no Excel install needed.
Try this question in the live sheet →IFERROR syntax
Runs a formula, but shows a fallback value instead of an error if it fails. IFERROR is used to build decision rules directly into a spreadsheet instead of manually judging each row. Full IFERROR guide.
More IFERROR practice questions
- Divide the sales by the units for each row, but show 0 when the units are 0. Put it in…
- Look up the price of each item in the table (D2:E4). Show Not found if the item is not…
- The values are typed as text. Turn each into a number, and show 0 if it is not a number.…
- Find the growth (this year minus last year, divided by last year). Show New when last…
- Find the average of the three marks in B to D for each student. Show No marks when the…
- Look in list 1 (C2:D3) first, then in list 2 (E2:F3), and show Not found if the code is…
- Each note may contain a reference like #101. Take the number after the # sign, or show…
- Product IDs to price are in A2:A7 and the price list is in D2:E6. Show the price in…
All practice questions · Excel exercises · Interview prep · Cheat sheet