Showing posts with label Information Functions. Show all posts
Showing posts with label Information Functions. Show all posts

Wednesday, May 23, 2007

Iserror

If you are obsessed with both formatting and efficiency, you just have to add iserror to your bag of tricks.

The way I use iserror is to keep those error messages off my spreadsheets. That isn't the only thing you can do with iserror, but it's how I use it.

Let's say that you have mastered VLOOKUP. But your two lists don't contain all of the same data. You don't really care about that. If your VLOOKUP doesn't find a value, that's OK. You just don't want to see an #N/A.

Here's what you do. First, build your VLOOKUP. GO ahead. Use the wizard. You know how.
=VLOOKUP(A2,[Phone.xls]Sheet1!$A$2:$B$312,2,0)
Now, add the iserror:
=ISERROR(VLOOKUP(A2,[Phone.xls]Sheet1!$A$2:$B$312,2,0))

This function is just asking a True or False Question. In this case, it is asking is my VLOOKUP returning a value or an error?

If it finds a value, the answer is NO or FALSE. If it finds no value and returns an error, the answer is YES or TRUE. You don't want to see TRUE or FALSE, though. You want to see a value or nothing. So, you need to use an IF.

=IF(ISERROR(VLOOKUP(A2,[Phone.xls]Sheet1!$A$2:$B$312,2,0)),"",VLOOKUP(A2,[Phone.xls]
Sheet1!$A$2:$B$312,2,0))

Now, the formula can be read like this:
If my VLOOKUP returns an error, enter a blank (""), otherwise, return the VLOOKUP result.

Although not slam dunk easy, if you take this in little chunks, it will work out just fine for you. And, it will save you time because you won't have to bother deleting the #N/A. So annoying.