Results 1 to 7 of 7

Thread: Load multiple data tables into arrays and using vlookup on the arrays for speed improvement
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular
    Join Date
    Jun 2018
    Posts
    328
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

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

    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?

  2. #2
    Board Regular
    Join Date
    Jun 2018
    Posts
    328
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

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

    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 by Waimea; Mar 2nd, 2019 at 06:23 PM.

  3. #3
    Board Regular
    Join Date
    Jun 2018
    Posts
    328
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

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

    It would be very kind of someone could give me a hint on where I should start with this coding problem?

  4. #4
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    27,997
    Post Thanks / Like
    Mentioned
    467 Post(s)
    Tagged
    47 Thread(s)

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

    Cross posted https://www.excelforum.com/excel-pro...readsheet.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.
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

  5. #5
    Board Regular
    Join Date
    Jun 2018
    Posts
    328
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

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

    Fluff is 100% correct, I posted a similar thread at https://www.mrexcel.com/forum/redire...readsheet.html.

  6. #6
    Board Regular
    Join Date
    Jun 2018
    Posts
    328
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

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

    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 by Waimea; Mar 4th, 2019 at 03:24 AM.

  7. #7
    Board Regular
    Join Date
    Jun 2018
    Posts
    328
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

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

    I created a second array with the headerrowrange in it and used that array in the match function!

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •