I have to admit it. I don't have all of the answers, and many times there are multiple answers to an Excel problem. Here's a case in point. Below I have a table that has approximately 20,000 rows. It consists of records from the accounts receivable detail table (Customer, Invoice Number and Amount). I have added a VLOOKUP formula in the next column (see my blog Linking with the VLOOKUP Formula dated 7/7/09 for an explanation and example of a VLOOKUP).
The VLOOKUP matches the invoice number to the general ledger detail table and returns the general ledger amount. The final column is the difference between the AR Amount and the VLOOKUP amount.
Another method to insert a blank cell to replace the #N/A error is to use the IFERROR formula. The syntax for this formula is IFERROR(value,value_if_error). Simply use the VLOOKUP formula in the (value) section within the iFERROR formula and use a blank in the (value_if_error) section of the IFERROR formula. Warning: The IFERROR formula is only available in the 07 version of Excel. An ISERROR function combined with an IF statement can be used to perform the same task in prior versions of Excel.
The Find & Select (Go To > Special) command and the IFERROR function are two methods that can be used to replace errors that result from formulas. Are there any more ways? I'm sure there are. At my last seminar someone asked "Why not just use Find & Replace"? She was incredulous in her query as if why would anyone consider any other method? The question took me by surprise. After all, I use Find & Replace all the time. Why didn't I think of that? So after the class, naturally I tried it out without success. Below are the instructions from Excel Help regarding Find & Replace.
Notice the highlight text or numbers
indicates that Find & Replace will not work on "#N/A" returned in a formula. One can, however use Copy, Paste Special, Values over the LOOKUP column which deletes the formula and converts the #N/A formula result into text. Now Find & Replace will work, but it takes an extra step.
Which method is the most efficient? For me, if I know an unwanted error will result or at least there is potential that an error will result, I immediately incorporate an IFERROR formula. If I discover an error after I have already written a formula, I generally use the Find & Select command. Clearly, the most efficient method reverts to an individual's personal taste and experience.
Now we have three methods to turn sporadic errors resulting from formulas over an extensive range into desirable blanks. Are there more?