Vlookup Question

bradjedis
4StarLounger
Posts: 538
Joined: 30 Mar 2010, 18:49
Location: United States

Vlookup Question

Post by bradjedis »

Greetings,

I am curious if, while doing a vlookup if something is found or not found something can be in the cell besides a result or "#N/A"

For instance, if the item being looked for is not found, it can say something like NOT FOUND.


Brad

User avatar
HansV
Administrator
Posts: 78416
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Vlookup Question

Post by HansV »

You can use the IFERROR function for this:

=IFERROR(expression,replacement) will evaluate the expression. If it has a valid result, IFERROR will return that result. If not, it will return the replacement.

So for example, if your formula is

=VLOOKUP(A1, Sheet2!$A$2:$B$100, 2, FALSE)

change it to

=IFERROR(VLOOKUP(A1, Sheet2!$A$2:$B$100, 2, FALSE), "NOT FOUND")
Best wishes,
Hans