I’ve just published a post detailing a method of removing the errors returned by vlookup or hlookup utilising conditional formatting.

I had previously been using the double vlookup method to replace errors with blanks or zeros but then discovered that these excessive lookup functions had a tendency to bloat my spreadsheets.

While the conditional format method works, I can’t say that I particularly like it so I’ve been on the hunt for another method.

My first double lookup error hiding method looked like this:

=IF(ISERROR(VLOOKUP(L$7&$C13,’[WTE Apportionment Tables.xls]WTE APP TABLES SUB F’!$B:$K,9,0)),””,VLOOKUP(L$7&$C13,’[WTE Apportionment Tables.xls]WTE APP TABLES SUB F’!$B:$K,9,0))

and here’s method no 3 that feels somewhat neater:

=IF([WTE Apportionment Tables.xls]WTE APP TABLES SUB F’!$B:$K,L$7&$C13),VLOOKUP(L$7&$C13,’[WTE Apportionment Tables.xls]WTE APP TABLES SUB F’!$B:$K,9,0))

That’s a working formula but it is a bit confusing, so here’s a simpler example the syntax:

=IF(COUNTIF(A1:A10,”Some Value”),VLOOKUP(“Some Value”,A1:B10,2,FALSE),0)

The COUNTIF function is a logical function and will return TRUE or FALSE depending on whether “Some Value” is found in the range A1:A10. The IF function follows the format =IF(logical test, value if true, value if false). So if the COUNTIF function is TRUE the VLOOKUP will run, if it is FALSE the value 0 is returned.