VLOOKUP query

hatstand

Well-known Member
Joined
Mar 17, 2005
Messages
764
Office Version
  1. 2016
Platform
  1. Windows
I have a VLOOKUP formula that when a recognised entry is made. A cell is populated with the answer. My problem is that some entries are made that are not in the table so the answer is, what ever the closest match is. Can the formula include something that gives the answer “not on list” when a non-table entry is made.
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
For an exact match you need to set VLOOKUP's fourth (Range_lookup) to FALSE. You can use ISNA to check and return some text, eg:

=IF(ISNA(VLOOKUP(Ref,Table,2,FALSE)),"not on list",VLOOKUP(Ref,Table,2,FALSE))
 

barry houdini

MrExcel MVP
Joined
Mar 23, 2005
Messages
20,825
If you use 0 as the 4th argument you only get exact matches or #N/A, i.e.

=VLOOKUP(A1,B2:C3,2,0)
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
56,934
Office Version
  1. 365
Platform
  1. Windows
Make sure that you have the last argument in the VLOOKUP function set to FALSE or 0 so that it does not return approximate matches. It will then return "#N/A" for all non-matches.

If you want to return something else, use this format:
=IF(ISNA(VLOOKUP(...)),"not on list","VLOOKUP(...))
 

hatstand

Well-known Member
Joined
Mar 17, 2005
Messages
764
Office Version
  1. 2016
Platform
  1. Windows
A big thank you

A big thanks to everyone, never had so many answers so quick. It's working perfectly.
 

Watch MrExcel Video

Forum statistics

Threads
1,129,683
Messages
5,637,780
Members
416,982
Latest member
lisam77

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top