Load multiple data tables into arrays and using vlookup on the arrays for speed improvement

Waimea

Active Member
Joined
Jun 30, 2018
Messages
465
Office Version
  1. 365
Platform
  1. Windows
I have a couple of hundred rows that I want to vlookup and I have over 100 data tabels, when I change a combobox a couple of thousand formulas recalculate.

And it takes a couple of seconds to recalculate and I am looking at ways to increase speed.

Will it be faster do load every data table into an array and then using vlookup or vlookup/match on those arrays?

Are there any negative things with loading 100+ tables into arrays? Is there something I am missing?
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
I have a table with 10 columns and with 300 rows, how would I load the table into an array and then comparing the 9 columns in batches of 3?

I want to test if metric1 2019 is higher or lower then metric1 2018 and if metrci1 2018 is higher or lower then metric1 2017.

Ex.

Column1 has Country

Column2 has Metric1 2017
Column3 has Metric1 2018
Column4 has Metric1 2019

Column5 has Metric2 2017
Column6 has Metric2 2018
Column7 has Metric2 2019

Column8 has Metric3 2017
Column9 has Metric3 2018
Column10 has Metric3 2019

Code:
Dim myarray As Variant

myarray = Sheet4.ListObjects("Data").DataBodyRange.Value
 
Last edited:
Upvote 0
It would be very kind of someone could give me a hint on where I should start with this coding problem?
 
Upvote 0
Cross posted https://www.excelforum.com/excel-pr...use-array-declared-in-vba-in-spreadsheet.html

While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules).
This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0
I am loading two tables into arrays and given them a name with the name manager and I can VLOOKUP them.

Code:
=VLOOKUP($K$5;arrVal;4;FALSE)

However, I want to use VLOOKUP and MATCH?

Code:
Sub testarray()
'arrVal = Sheet4.ListObjects("Table2").DataBodyRange.Value
arrVal = Sheet4.ListObjects("Table2").Range.Value


Names.Add Name:="arrVal", RefersTo:=arrVal, Visible:=True
End Sub

I have tried with both DataBodyRange and Range.

How can I use VLOOKUP and MATCH on my array? Or INDEX and MATCH?

Seems like I can use HeaderRowRange.Value ?
 
Last edited:
Upvote 0
I created a second array with the headerrowrange in it and used that array in the match function! :)
 
Upvote 0

Forum statistics

Threads
1,213,485
Messages
6,113,931
Members
448,533
Latest member
thietbibeboiwasaco

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