About MrExcel Consulting Services Learn Excel Resources Challenge of the Month MrExcel Seminars Message Board MrExcel Store Podcast Search Contact Home

 First off, a special nod to MrExcel for giving a hack like me a shot or two as guest daily tipster. Let me preface this by saying most everything I learned about excel came from this great site, so don’t be surprised (or accuse me of theft) if things look familiar. To the tip:Vlookup is a powerful tool. Sometimes, if an exact match is not found, a value other than the standard #N/A is desirable. For example, if your look up range (table_array) is A1:C10, the formula VLOOKUP("cat",\$A\$1:\$C\$10,3,FALSE)will return #N/A if cat is not found in A1:A10. If instead you wanted to return the phrase “No Match”, the following formula is often suggested:=IF(ISNA(VLOOKUP("cat",\$A\$1:\$C\$10,3,FALSE)),"no match",VLOOKUP("cat",\$A\$1:\$C\$10,3,FALSE))This functions properly, but at the expense of having to lookup your value twice. This can be improved by the following:=IF(COUNTIF(\$A\$1:\$A\$10,"cat")>0,VLOOKUP("cat",\$A\$1:\$C\$10,3,FALSE),"no match")or with even less carpal tunnel risk by recognizing excel treats zero and “False” identically:=IF(COUNTIF(\$A\$1:\$A\$10,"cat"),VLOOKUP("cat",\$A\$1:\$C\$10,3,0),"no match")IML By Ian Loughlin on 09-May-2002 MrExcel.com Consulting can be hired to implement this concept, or many other cool applications, with your data. MrExcel.com provides examples of Visual Basic procedures for illustration only, without warranty either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. The Visual Basic procedures on this web site are provided "as is" and we do not guarantee that they can be used in all situations.

Excel is a registered trademark of the Microsoft® Corporation.

All contents Copyright 1998-2008 by MrExcel Consulting.