Sub topic 8
How Replacement Values Affect Totals and Other Formulas
This chapter assumes you can enter and copy formulas, use relative and absolute references, and write a basic IF and VLOOKUP. It also assumes you know what IFERROR and IFNA do. Here the focus is on what happens after the error is replaced: the replacement value becomes real data for every formula that reads that cell.
The replacement is data, not decoration
An error value such as #DIV/0! spreads. Any formula that refers to the cell returns the same error. A replacement stops that spread, but it also changes what the dependent formulas calculate.
Each replacement type behaves differently:
| Replacement | Cell type | Effect on SUM and AVERAGE | Effect on arithmetic (+, *) | Effect on COUNT |
|---|---|---|---|---|
| `0` | Number | Included. SUM is unchanged, but AVERAGE is pulled down. | Works. Multiplying by 0 gives 0. | Counted |
| `""` | Text | Ignored | Returns #VALUE! | Not counted. COUNTA counts it. |
| `"Not found"` | Text | Ignored | Returns #VALUE! | Not counted. COUNTA counts it. |
The empty string is the case that surprises most people. The cell looks blank, but it holds text of zero length.
Example: averages with 0
Suppose column C holds a price per unit, calculated as revenue divided by units. Some units are 0, because the product has not launched.
=IFERROR(A2/B2, 0)Say three products give 10, 20 and 0 (one failed division). Then =AVERAGE(C2:C4) returns 10, because the 0 counts as a value. If you expected the average of the two real prices, the answer should be 15. A replacement of 0 is fine for a SUM, but it distorts an AVERAGE, MIN or a count of values.
Use an empty string and the average comes out as 15:
=IFERROR(A2/B2, "")AVERAGE ignores text in a range, so only 10 and 20 are used. The trade-off is that the same cell now breaks any formula that does arithmetic on it directly.
Example: text breaks arithmetic
Now add a column D that calculates a 10% increase:
=C2*1.1If C2 holds "" or "Not found", D2 returns #VALUE!. You handled the error in column C and created a new one in column D. Note that this applies to direct references. Functions such as SUM skip text in a range, but the + operator does not: =C2+C3 returns #VALUE! if either cell holds text.
You have three options:
- Return 0 in column C, if 0 is a meaningful value for your data.
- Wrap column D in its own check, such as
=IF(C2="", "", C2*1.1). - Use
=IF(ISNUMBER(C2), C2*1.1, ""), which handles any non-numeric content, including messages.
Option 3 is usually the most reliable, because it does not depend on the exact replacement text.
Mixed data in one column
A column that contains numbers, blanks-that-are-text and messages is hard to use later. Sorting puts text in a different group from numbers. Filters list the text values separately. A pivot table may treat the column as text and count instead of sum. COUNTBLANK counts "" cells as blank, but ISBLANK returns FALSE for them, so two checks that seem equivalent give different answers.
=ISBLANK(C2)This returns FALSE when C2 holds "", even though the cell looks empty.
Choosing with downstream use in mind
Before you pick a replacement, ask what reads the cell next.
- If the column feeds only SUM, 0 is safe and keeps the cell numeric.
- If it feeds AVERAGE, MIN, MAX or a count, prefer
""so the missing item is left out. - If people read the column and nothing calculates from it, a message is the clearest.
- If other formulas multiply or add the cell directly, keep it numeric or guard those formulas with ISNUMBER.
Exercise
Column C contains =IFERROR(A2/B2, ""). Row 2 fails the division, and row 3 returns 8. What do =SUM(C2:C3) and =C2+C3 return, and why?
Show answer
=SUM(C2:C3) returns 8, because SUM skips text in a range and the empty string is text. =C2+C3 returns #VALUE!, because the + operator cannot add the text value "" to a number. To avoid the error, use =SUM(C2:C3), or guard the addition with =IF(ISNUMBER(C2), C2, 0)+C3.
Exercise
A sales sheet shows the average price per unit with =AVERAGE(C2:C100). Column C uses =IFERROR(A2/B2, 0). Why might the average be too low, and what change fixes it?
Show answer
Every failed division now holds the number 0, and AVERAGE counts those zeros as real prices. This pulls the average down. Changing the replacement to "" makes AVERAGE skip those cells, so only real prices are averaged.