+ Reply to Thread
Results 1 to 7 of 7

Large Database - VBA Formulas

  1. #1
    Forum Contributor
    Join Date
    08-22-2013
    Location
    Sheffield
    MS-Off Ver
    Excel 2010
    Posts
    161

    Large Database - VBA Formulas

    Hi all,

    Currently have a spreadsheet that has some VBA written inside that imports a .csv file that is about 27mb (150k+ rows of data) and its has to do some vlookups, then after that filters the data. I'm just wondering if there was a different way this could work? The machines we currently use aren't the best so it takes about 3/4minutes to run through everything. Any help on this would be brilliant.

    Please Login or Register  to view this content.
    Thanks!

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,571

    Re: Large Database - VBA Formulas

    Well, you should avoid selecting anything. For example, this
    Please Login or Register  to view this content.
    can be this
    Please Login or Register  to view this content.
    You also use a double VLOOKUP with ISNA in some places and the more efficient VLOOKUP with IFERROR elsewhere.

    This
    Please Login or Register  to view this content.
    can be this
    Please Login or Register  to view this content.
    But, again, avoid the select.

    You can operate on most, if not all, objects (workbooks, worksheets, ranges, cells, Pivot Tables, etc...) without selecting them. But, if you DO select things, your code will be slower.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    08-22-2013
    Location
    Sheffield
    MS-Off Ver
    Excel 2010
    Posts
    161

    Re: Large Database - VBA Formulas

    That's great thank you.

    Would there be a better way of running these lookups though? Would an array be better or maybe not with the amount of data?

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,571

    Re: Large Database - VBA Formulas

    INDEX/MATCH is arguably more efficient than VLOOKUP, particularly where you have more than 2 columns.

    VLOOKUP should be ok with full column references but it would be better to determine the last row of data and adjust your formulae appropriately.

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,571

    Re: Large Database - VBA Formulas

    Oh, and switch ScreenUpdating off and set Calculation to manual before you start processing and reset at the end.

  6. #6
    Forum Contributor
    Join Date
    08-22-2013
    Location
    Sheffield
    MS-Off Ver
    Excel 2010
    Posts
    161

    Re: Large Database - VBA Formulas

    Hadn't really considered using index & match, would it be the same .formula = ("index/match")?

    I might give that a go now, thanks again! I'm going to switch the calc to manual and reset it at the end aswell i think that's the majority of the problem - the calc

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,571

    Re: Large Database - VBA Formulas

    Let me know how it goes. If you can provide a sample csv file and a workbook with ALL the current code, I will try and have a look at it.

+ 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. Replies: 3
    Last Post: 07-10-2017, 02:20 AM
  2. Replies: 5
    Last Post: 07-19-2015, 11:05 AM
  3. Large automated database
    By fipster in forum Excel General
    Replies: 4
    Last Post: 08-18-2014, 02:59 PM
  4. Large Database
    By jwaldmann in forum Excel General
    Replies: 4
    Last Post: 02-10-2012, 10:52 PM
  5. Dragging formulas in large database
    By doctorteeth in forum Excel General
    Replies: 5
    Last Post: 08-31-2010, 06:01 AM
  6. how to sum(group) a large database
    By Sparxx in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 12-24-2009, 12:53 PM
  7. [SOLVED] Navigating a large database?
    By Arsenio Oloroso in forum Excel General
    Replies: 3
    Last Post: 11-11-2005, 11:10 AM

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