Excel Supreme

Excel track · Exercise 68 of 86 Paid

Read #N/A, #VALUE! and #REF!

Tell a missing match apart from a broken reference, and print that difference as words.

Advanced

Code and price table with one code the table does not hold

Read-only data · screen 1 of 2 · answer in B9

In B9, say missing when the code in A8 is not in the table, and found when it is.

AB
1CodePrice
2A-110
3B-220
4C-330
5A-112
6B-222
7C-332
8Q-9
9Missing or found

Download this grid (.xlsx) Two tabs: the grid you see, and the answer.

B9

What it does

An error in Excel is a value sitting in a cell, so a formula can test it like a number. ISNA answers TRUE only for #N/A, the error a lookup or a match raises when nothing matched. ISERROR answers TRUE for any error at all. ISERR is the same test with #N/A taken out.

The first screen asks about Q-9, which the code column does not hold, so MATCH fails and ISNA prints missing. The second asks INDEX for a third column of A2:B7, and the table has two, so the call fails with #REF! and ISERROR prints out of range.

The three errors differ in kind. #N/A is a data question: the list does not hold the code. #REF! is a formula question: the range does not reach that far. #VALUE! is arithmetic handed text where it expected a number.

Syntax

=IF(ISNA(x),"missing","found"); =IF(ISERROR(x),"bad","ok")

Worked example

On Code and price table with one code the table does not hold, =IF(ISNA(MATCH(A8,A2:A7,0)),"missing","found") returns missing.

=IF(ISNA(MATCH(A8,A2:A7,0)),"missing","found")

Common errors

Error codes for ISNA versus ISERROR, and how #N/A, #REF! and #VALUE! are produced
ErrorWhat it means and how to fix it
#N/ANothing matched: the code in A8 is not in the list MATCH searched.
#REF!The reference lies outside the range, as a column number past the last column does.
#VALUE!Arithmetic was handed text, as dividing the word missing by zero does.

At work

An import log that says which rows have no matching product code, so nobody scrolls a column of #N/A.