Sub topic 9
Reading common error values
This chapter explains how to read the error values Google Sheets shows when a formula fails. It assumes you can enter and edit formulas, use cell references and ranges such as B2 and A:A, apply comparison operators, and write a basic IF. You will also see the IFS and SWITCH formulas from earlier chapters, because their mistakes produce several of these errors.
By the end you should be able to recognize #N/A, #DIV/0!, #VALUE!, #REF!, #NAME?, and #NUM!, and say what each one means and where to look first. Reading the error correctly comes before handling it. Wrapping a formula in a fallback without knowing why it fails is how real bugs get hidden.
What an error value is
An error value is a result, not a crash. The formula ran, but it could not produce a normal answer, so the cell holds a code that starts with #. Sheets also shows a small red triangle in the cell's corner. Hover over the cell to see a short explanation, which often names the function and the argument that caused the problem.
Two properties of error values matter for everything that follows:
- Errors propagate. If
C2holds an error andE2is=C2*2, thenE2shows the same error. ASUMover a range that includes an error cell also returns that error. One bad cell can turn a whole column of totals into errors. - The error type is information. Each code points to a different kind of cause, so the code tells you where to start looking.
The six errors at a glance
| Error | Plain meaning | Typical cause |
|---|---|---|
| `#N/A` | A value is not available | A lookup finds no match. `IFS` has no true condition. `SWITCH` has no match and no default. |
| `#DIV/0!` | Division by zero | The divisor is `0` or an empty cell. |
| `#VALUE!` | The wrong type of value | Text where a number is needed, or a condition that is not TRUE or FALSE. |
| `#REF!` | A reference is not valid | A deleted row, column, or sheet. An index outside a range. A circular dependency. |
| `#NAME?` | Sheets does not recognize a name | A misspelled function, or text typed without quotation marks. |
| `#NUM!` | A number is not valid for the operation | The square root of a negative number, or a result too large to represent. |
The sections below take each one in turn.
#N/A: nothing matched
#N/A means "not available." It is the error you will meet most often when working with IFS, SWITCH, and lookups, because all three return it when they find nothing.
This IFS has no fallback condition:
=IFS(B2>=90,"A",B2>=80,"B")For a score of 72, neither condition is true, so there is nothing to return and the cell shows #N/A. The fix is a final TRUE condition, which the chapter on IFS order and fallback covers.
SWITCH behaves the same way when you leave out the default value:
=SWITCH(A2,"NY","New York","CA","California")If A2 contains "TX", no case matches and there is no default, so the result is #N/A.
Lookups are the third common source:
=VLOOKUP(A2,Prices!A:B,2,FALSE)When A2 is not in the first column of Prices!A:B, the result is #N/A. Before assuming the formula is wrong, check the data. Common causes are a trailing space, a number stored as text, or a product that really is missing from the list.
#N/A is often an expected result: "no match" is a legitimate outcome. That is why Sheets has IFNA, a function that catches only this error. A later chapter covers it.
#DIV/0!: a zero divisor
#DIV/0! appears when a formula divides by zero. An empty cell counts as zero:
=C2/D2If D2 is 0 or blank, the cell shows #DIV/0!. This error often shows up in rows that are not finished yet, such as a conversion rate for a campaign that has no visits. Spotting that pattern is a good sign the error is harmless. If the divisor should never be empty, the real fix is on the data side.
#VALUE!: the wrong kind of value
#VALUE! means a function received a value of a type it cannot use. Arithmetic on text is the classic case:
=B2+10If B2 contains the word n/a, the hover message says the function expects number values but got text, and the cell shows #VALUE!. A number-looking value that was imported as text, such as "1,200 " with a stray space, causes the same thing.
IFS raises #VALUE! in a second way. Each condition must evaluate to TRUE or FALSE. A condition that returns text or a number instead is a mistake:
=IFS(B2,"A",TRUE,"F")Here the first condition is just B2, with no comparison operator. If B2 holds a number such as 95, the formula cannot treat it as a logical test. A condition needs a comparison such as B2>=90.
A related gotcha produces no error at all. Comparing text to a number does not fail. In Sheets, text counts as larger than any number, so a score cell containing "absent" makes B2>=90 TRUE. The IFS formula then returns "A" with no error. Errors are loud, but a wrong answer with no error is harder to find, so check your inputs as well as your results.
#REF!: a broken reference
#REF! means a reference points somewhere that does not exist. It appears in several situations:
- You delete a row, column, or sheet that a formula used. The formula keeps its shape but one reference becomes
#REF!, so a formula such as=SUM(A2:A10)can turn into one containing#REF!inside it. - A function asks for a position outside the range.
=INDEX(A1:A5,10)has only five rows to pick from. - A cell depends on itself, directly or through other cells. Sheets reports this as a circular dependency and shows
#REF!. - An array formula needs room to spill its results, and another cell is already occupied. The formula cell shows
#REF!and the hover message names the blocking cell.
When you see #REF!, click the cell and read the formula text. If the word #REF! appears inside the formula itself, a reference was deleted and you must rebuild it. If the formula text looks fine, suspect an index out of range, a circular dependency, or a blocked spill.
#NAME?: Sheets does not know that word
#NAME? means Sheets read part of the formula as a name and could not find it. There are two usual causes.
The first is a misspelled function:
=IFSS(B2>=90,"A",TRUE,"F")IFSS is not a function, so the cell shows #NAME?.
The second is text without quotation marks. Sheets treats an unquoted word as the name of a function or a named range:
=IFS(B2>=90,A,TRUE,F)The results A and F should be "A" and "F". This is an easy slip in IFS and SWITCH formulas, which contain many text results. If a formula that returns text shows #NAME?, check the quotation marks first.
#NUM!: a number that does not work
#NUM! means a numeric argument is not valid for the operation, or the result cannot be represented:
=SQRT(-4)The square root of a negative number is not a real number, so the cell shows #NUM!. A number that is too large to store causes the same error. You will see it less often than the others in everyday sheets. It usually means a calculation received data outside its allowed range, such as a negative number of years in a growth formula.
A seventh error: #ERROR!
You may also see #ERROR!. It means Sheets could not parse the formula at all, usually because of a missing parenthesis, a missing comma, or an unexpected character. Nested IF formulas produce it often, because every extra tier adds another closing parenthesis to count. This is one reason IFS is easier to maintain. Because the formula never evaluates, a fallback function cannot catch a parse error. You have to fix the syntax.
Finding the error type with a formula
When a column of results has errors, you can classify them with ERROR.TYPE. It returns a number for each error:
| Error | `ERROR.TYPE` result |
|---|---|
| `#DIV/0!` | 2 |
| `#VALUE!` | 3 |
| `#REF!` | 4 |
| `#NAME?` | 5 |
| `#NUM!` | 6 |
| `#N/A` | 7 |
If the cell is not an error, ERROR.TYPE itself returns #N/A. A small diagnostic column handles that:
=IFNA(ERROR.TYPE(C2),"no error")Fill this down next to the formula column you are checking. Rows with 7 are unmatched lookups or conditions, rows with 2 are division by zero, and so on. Filtering on the diagnostic column lets you fix one category at a time. ISNA(C2) and ISERROR(C2) return TRUE or FALSE if you only need to know whether a cell is an error.
A diagnostic path
The diagram summarizes where to look for each error type.
Working habits
- Hover first. The message names the function and often the argument.
- Fix before you mask. An error is the sheet telling you something. Decide whether it is an expected case, such as no match, or a mistake, such as a deleted column, before you add any fallback.
- Look upstream. Because errors propagate, the cell showing the error may not be where the problem started. Follow the references back until you find a cell that has a cause rather than a copy of someone else's error.
- Test with edge values. Try a blank cell, a zero, a text value, and a value that matches no case. These four inputs trigger most of the errors in this chapter.
Exercise
A grade column uses =IFS(B2>=90,"A",B2>=80,"B",B2>=70,"C"). Row 5 shows #N/A and row 6 shows #NAME?. Row 5 has a score of 62. Row 6 uses =IFS(B6>=90,A,TRUE,"F"). What causes each error?
Show answer
Row 5 gives #N/A because 62 is below 70, so no condition is true and the formula has no final TRUE fallback. Row 6 gives #NAME? because the result A has no quotation marks, so Sheets treats it as an unknown name instead of the text "A". Writing "A" fixes row 6, and adding TRUE,"F" at the end of row 5's formula fixes row 5.
Exercise
In a sheet, E2 is =C2*2 and C2 is =A2/B2, where B2 is blank. E2 and C2 both show an error. Which error do they show, and which cell should you fix first?
Show answer
Both show #DIV/0!, because a blank divisor counts as zero and the error propagates to E2. Fix C2's cause first, either by entering a value in B2 or by deciding how the formula should behave when B2 is empty. E2 is only repeating C2's error.