I fixed it, but boss wants to know WHY his way didnt work . . . Simple VLOOKUP

Jeffrey Green

Well-known Member
Joined
Oct 24, 2007
Messages
1,021
He used =Vlookup(A2,Sheet2!A2:B50,2,0) Works on some rows, #NA on others (the item being looked for is always there)

I used =Vlookup(A2,Sheet2!A:B,2,0) it works
(I have told him 100 times to name his ranges, but he is stubborn)

Just curious why his formula won't work on all rows . . .

thanks
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Hi,

To be honest, if the data table is in the range A2:B50, in my opinion, his formula is better, cause yours is checking the Entire Columns of A and B (over a million rows).
Lets say you're checking A2, second row, and dragging the formula down, checking A3, A4, A5, etc.

Your boss's formula should be =VLOOKUP(A2,Sheet2!A$2:B$50,2,0) and this is faster than your version.
 
Last edited:
Upvote 0
If your boss didn't lock the range down, like jtakw showed in his formula, as you copy it down the range will move, i.e. next line will be:
Code:
[COLOR=#333333]=Vlookup(A3,Sheet2![/COLOR][COLOR=#ff0000][B]A3:B51[/B][/COLOR][COLOR=#333333],2,0)[/COLOR]
As you keep copying the formula down, you keep cutting more and more out the original range.
So, you need to lock it down, either by using the absolute range references like jtakw showed you, or by naming your range.
 
Upvote 0
Jtakw - - - thanks . . . i prefer to use whole columns . . . the speed hit is negligible in our world. Also, that dept is know for adding additional data to the Array . . . . . without knowing they have to adjust the array.
thanks though!!
 
Upvote 0
You're welcome. How about limiting it to something you know won't be "out grown" like A$2:B$10000 just a suggestion.
 
Upvote 0

Forum statistics

Threads
1,214,654
Messages
6,120,758
Members
448,991
Latest member
Hanakoro

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