VBA - Faster alternative to Vlookup?

danmcdon

New Member
Joined
Mar 4, 2010
Messages
2
I have a macro that loops thousands of times, and I believe it is really being slowed down by several Vlookups occuring in the code. I have several large arrays with data, and I need to pull data from the array in each loop using a different lookup value. Currently I am using worksheetfunction.vlookup, but if you suggest a faster way I will be eternally grateful!

i.e.

Dim ArrData as Variant

ArrData = range("data") 'range is approx 10,000 x 5

Result = Application.WorksheetFunction.VLookup(LookupValue, Range("Data"), 5, -1)
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Hello

How many times do you execute that VLOOKUP function within your code?
Because 10,000 is not excessively high, and also you do not search for an exact match - which is way faster.
 
Upvote 0

Forum statistics

Threads
1,215,563
Messages
6,125,560
Members
449,237
Latest member
Chase S

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