Об этом упражнении
Набор данных (строк: 50) на одном листе, одна ячейка ответа, около 6 мин. Проверка прямо в браузере: значение и формула, которая его даёт, с обратной связью о том, что исправить.
Как решить
- F2
=IFERROR((E2-D2)/D2,"n/a")
Dividing by an empty or zero cost raises #DIV/0!, and one error cell is enough to break every AVERAGE or SUM that reads the column. IFERROR(value, value_if_error) returns the first argument when it computes normally and the second when it produces any error, so =IFERROR((E2-D2)/D2,"n/a") shows the margin for priced items and n/a for the four free ones. Filled down, the same formula handles every row without you knowing in advance which products have a zero cost.
Pitfall 1: IFERROR hides every error, not just #DIV/0! — a typo like (E2-D2)/D3 or a text value in column E is silently replaced by n/a too. When only the zero-cost case is expected, =IF(D2=0,"n/a",(E2-D2)/D2) is the more honest formula; IFERROR is the pragmatic choice when the data can hold several kinds of junk. Pitfall 2: returning 0 or "" instead of n/a changes the statistics — AVERAGE ignores text but counts a 0, so a 0% margin on free stock drags the average down. Pitfall 3: margin on cost (markup) is not margin on price: (E2-D2)/E2 never divides by zero here and gives a different, smaller number; always state which one a report uses. Alternatives: IFNA only catches #N/A (useful around lookups, useless here); in Excel 365, =LET(m,(E2-D2)/D2,IF(ISERROR(m),"n/a",m)) avoids computing the division twice. Formatting: the fallback text sits in a column formatted 0.0% — text ignores number formats, which is why n/a shows as typed.
Другие рабочие способы
- =IF(D2=0,"n/a",(E2-D2)/D2) — explicit test on the cost; only the expected error case is handled
- =IF(ISERROR((E2-D2)/D2),"n/a",(E2-D2)/D2) — the pre-2007 pattern IFERROR replaced
- =IFERROR(E2/D2-1,"n/a") — algebraically the same margin on cost
Частые ошибки
Writing =IFERROR((E2-D2)/D2) with no second argument, or putting the fallback first — IFERROR needs the calculation first and the replacement value second, in quotes when it is text.
Как мы проверяем
Принимается любая формула, которая даёт верный результат, если только задание не называет функцию: тогда другая функция даёт половину балла. Мы сравниваем значения с небольшим допуском и не учитываем регистр и пробелы в тексте. Верное число, введённое вручную вместо формулы, даёт половину балла. Задания с несколькими ячейками получают полный балл, если верны 100% ячеек, и половину — если верны от 50%. Там, где это важно, мы также меняем входную ячейку в копии вашего листа и проверяем, что формула пересчитывается правильно.
Ответы рассчитаны по правилам Excel 365 и 16 ноября 2026 г. сверены в нашей системе проверки. Автор: GridBelt team.