+ Reply to Thread
Results 1 to 10 of 10

WorksheetFunction.VLookup in Large Range

  1. #1
    Registered User
    Join Date
    01-28-2019
    Location
    Managua, Nicaragua.
    MS-Off Ver
    2016
    Posts
    4

    WorksheetFunction.VLookup in Large Range

    Hi!

    New in the forum, hope you can help me. After several hours of research in internet, I give up to ask you . Also, sorry for my awful english 

    So, in resume, I have 2 Tables stored in listobjects variables: tbVenta and tbSKU.
    • tbVenta has the data of daily sales for 200,000 + SKU. Every row is the sale of a specific day for a specific SKU.
    • tbSKU has information regarding those SKU. Every row has the characteristics of a specific SKU.


    I basically want to do a VLookUP to add in several rows in tbVenta the information in tbSKU for the SKU in said row,
    I could use:
    Please Login or Register  to view this content.
    But I want to use my listobjects variables as reference, so im using:
    Please Login or Register  to view this content.
    The problem is that Im using a For, Next loop to apply the VLookup to every cell, and there’s 200,000+ cells in tbVenta. So it takes ages to complete the process. But, if I simple apply manually “.FormulaR1C1 = "=VLOOKUP()"” to the whole range, it only takes a cumple seconds to evaluate it.

    Is there a way to apply “Application.WorksheetFunction.VLookup()” to the whole range of tbVenta.ListColumn(“Canal”)

    As you would see in the code, Im also interested in deleting the row if the VLookup returns empty. But I know I can do that later in code, im more concerned with the VLookup not taking ages.

    Thanks.

    Please Login or Register  to view this content.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: WorksheetFunction.VLookup in Large Range

    There's no way to use Application.WorksheetFunction.VLookup like that on entire range.

    The nearest you might get would be to use Evaluate along with the original VLOOKUP formula and INDEX.

    You could try using arrays I suppose.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    01-28-2019
    Location
    Managua, Nicaragua.
    MS-Off Ver
    2016
    Posts
    4

    Re: WorksheetFunction.VLookup in Large Range

    I can’t use Evaluate + Application.WorksheetFunction.VLookup. Right?
    And I can’t use listobjects variables in a .FormulaR1C1 = "=VLOOKUP()", not even with Evaluate. Right?

    Somebody has an Idea how can I manage to do the VLookup (or similar results) using as reference the listobject variables and the header + index method?

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: WorksheetFunction.VLookup in Large Range

    Not sure what you mean about not using the listobject variables in .FormulaR1C1.

    You could use them but it would be basically the same as reference the tables in the formula.

    By the way, what are you looking up?

    If it's the same thing for each of the VLOOKUPs it might be an idea to switch to using MATCH.

    That could be used, once, to get the row number - something like this.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-28-2019
    Location
    Managua, Nicaragua.
    MS-Off Ver
    2016
    Posts
    4

    Re: WorksheetFunction.VLookup in Large Range

    But, with the Match alternative, I would still have the problem of a 200,000 repetitions For Next loop. Don’t I?

    Actually, I already solved it. You were right, I could use my listobject variables in the FormulaR1C1 using tbSKU.Name. Finally this is my code:

    Thanks

    Please Login or Register  to view this content.
    Last edited by Vanech; 01-29-2019 at 11:27 AM.

  6. #6
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: WorksheetFunction.VLookup in Large Range

    FYI, you can use Application.Vlookup or WorksheetFunction.Vlookup with an array of lookup values.
    Rory

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: WorksheetFunction.VLookup in Large Range

    Rory

    Never knew that, always resorted to using Evaluate for something like that.

  8. #8
    Registered User
    Join Date
    01-28-2019
    Location
    Managua, Nicaragua.
    MS-Off Ver
    2016
    Posts
    4

    Re: WorksheetFunction.VLookup in Large Range

    Rorya,

    Can you post a example code of it? Would highly appreciate it.

    Thanks you.

  9. #9
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: WorksheetFunction.VLookup in Large Range

    It would be something like:

    Please Login or Register  to view this content.

  10. #10
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: WorksheetFunction.VLookup in Large Range

    I'd speculate using Find would be faster on an unsorted list. Or sort on the search column and use a range lookup.
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Application.worksheetfunction.sumifs on large dataset
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-01-2013, 08:22 PM
  2. [SOLVED] WorksheetFunction.Large; With Variables
    By Kalithro in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-20-2013, 11:26 PM
  3. Having trouble with assigning a range in worksheetfunction.vlookup. help please!
    By kjy1989 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-22-2013, 04:35 AM
  4. [SOLVED] Trouble with WorksheetFunction.vLookup VBA using named range
    By stubbsj in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-14-2012, 11:00 AM
  5. VLOOKUP range too large?
    By PeterLokken in forum Excel General
    Replies: 3
    Last Post: 06-30-2011, 12:07 PM
  6. WorksheetFunction.Vlookup
    By Aland2929 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-25-2010, 06:57 AM
  7. Vlookup in large named range
    By KemS in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-23-2005, 02:20 PM
  8. [SOLVED] Automatic Sort with VLOOKUP/LARGE Functions-referencing a range
    By G in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-24-2005, 04:05 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1