+ Reply to Thread
Results 1 to 6 of 6

Excel 2007:VBA Code: Any alternate to vlookup function

  1. #1
    Forum Contributor
    Join Date
    02-22-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    102

    Excel 2007:VBA Code: Any alternate to vlookup function

    Hello,

    is there any alternate to vlookup function to search for larger number of rows/col ( half-million plus..) as it is time consuming

    1. if i use the normal vlookup function the system freezes ( just a formula and no vba code)
    2. i use vlookup function in vba code in two ways but it takes more then 45 minutes to complete ( approximate 20 seconds per 1000 records)
    a. through code i write the formula in the cell and copy it to every 500 rows and then convert as values (just to see something happening!)
    b. through code i store the result of the formula in the variable and write back the variable in the cell ( cell by cell)

    as mentioned both is heavily time consuming...is there any alternate ( probably database functions?) which takes the entire data set( like sql) and not each and every individual cell..

    Thx

  2. #2
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Excel 2007:VBA Code: Any alternate to vlookup function

    Hi Vidhuthrajesh,

    welcome to the forum.

    Try looking at DGET database function. Thanks.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), [email protected]

  3. #3
    Forum Contributor
    Join Date
    02-22-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    102

    Re: Excel 2007:VBA Code: Any alternate to vlookup function

    Hi Dilip,

    Appreciate your response. DGET also navigates cell by cell....is my understanding right?? and if so, this may not bring down the processing time... thx

  4. #4
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Excel 2007:VBA Code: Any alternate to vlookup function

    Hi Vidyuthrajesh,

    I have suggested DGET as you have asked for alternate Database function. Regarding their calculation speed, they should be faster as they are "DATABASE" function. Also you can search "Excel Database function: how efficient are they" over google to learn more. Thanks.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Excel 2007:VBA Code: Any alternate to vlookup function

    Using VBA will be no faster than having the formulas in the worksheet. With the amount of data it will be slow.

    If your code uses a loop then again it will be slow.

    Instead of just stating the problem try explaining what the purpose of the formula/code is & post the code
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  6. #6
    Registered User
    Join Date
    10-13-2011
    Location
    Northern California
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Excel 2007:VBA Code: Any alternate to vlookup function

    I assume you're using VLOOKUP(x,y,z,FALSE) to find exact matches. Better to sort the table (y) in ascending order on the first column so you could use VLOOKUP(x,y,z). This latter form uses binary search, so even with 1,048,576 (2^20) rows, it'd take at most 20 comparisons to find the closest match, and just one more comparison to ensure it's an exact match.

    VBA isn't going to make this better unless you use it to create static sorted lists or binary trees, and that can eat a lot of memory. Better to sort very long lists in place.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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