vlookup a value not existing the table returning last value

lezawang

Well-known Member
Joined
Mar 27, 2016
Messages
1,805
Office Version
  1. 2016
Platform
  1. Windows
Hi

I have table like below, so I wrote vlookup function. user will enter id # and vlookup will return the salary. the vlookup function works no problem. then I tried to enter id = 100 which is not existed in the table, vlookup returned to me the last salary 17K. I tried different ID not existed in the range and vlookup keeps returning the last salary! why is that? I expected #value message or something like that. Thank you so much.

idfirstlastdeptsalary
1john1clark1it43 k
2mary1jones1hr38 k
3alex1wilson1sales55 k
4sarah1king1marketing97 k
5david1lkim1it37 k
6john2clark2it17 k

<colgroup><col width="64" span="5" style="width:48pt"> </colgroup><tbody>
</tbody>
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Sorry ignore my post. In vlookup functuon, I forgot to say False/True. Thank you.
 
Upvote 0
A​
B​
C​
D​
E​
F​
G​
H​
I​
1​
id
first
last
dept
salary
2​
1​
john1clark1it43 k
1​
43 kH2: =IF(LOOKUP(G2, $A$2:$A$7) = G2, LOOKUP(G2, $A$2:$E$7), NA())
3​
2​
mary1jones1hr38 k
3​
55 k
4​
3​
alex1wilson1sales55 k
6​
17 k
5​
4​
sarah1king1marketing97 k
7​
#N/A​
6​
5​
david1lkim1it37 k
7​
6​
john2clark2it17 k
 
Upvote 0
If the numbers in the list are always sequential from 1, just =index(e2:e7, id)
 
Upvote 0

Forum statistics

Threads
1,214,805
Messages
6,121,665
Members
449,045
Latest member
Marcus05

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
Back
Top