+ Reply to Thread
Results 1 to 5 of 5

Preventing VLOOKUPS From Executing on Data Load

  1. #1
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Preventing VLOOKUPS From Executing on Data Load

    It seems that using code such as

    Please Login or Register  to view this content.
    Doesn’t turn off ALL calculations.

    I have an application where I read in two tables from an external file, each into its own tab. If that’s all I did, the tables load in seconds.

    I now add another table in a third tab. It refreshes data from a data source. in a matter of seconds.

    Now I add two columns to the third tab. One does a VLOOKUP against the first table and the other does a VLOOKUP against the second table. In the next column I take the mathematical difference between these two columns and finally one more column to see if the result is zero.

    As I said, to load the data without the formulas takes about 5 seconds. With the formulas loading the table takes about 13 minutes. I suspect that this is because the VLOOKUPS are being executed as the data are being loaded even though calculations are set to manual.

    So I rewrote the code to remove the columns with the formulas, import the data and then add the columns back in with the formulas. This program takes about 5 seconds for the data to load and 2 minutes (plus or minus about 5 seconds) for the formulas to get calculated.

    OK, so I have something that works, but do I have to go through all this trouble? Is there some other means that I am overlooking that will hold off execution of the VLOOKUPS until the data load is complete?

    The data are proprietary so I can't post the program.

    Here is the code howerver.

    Please Login or Register  to view this content.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  2. #2
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,958

    Re: Preventing VLOOKUPS From Executing on Data Load

    Hi dflak

    Two tables from an external file, each into its own tab
    Why copy the table...why not just copy the sheet...with all formula in tact....Or does your setup not allow for this...

    I suppose not seeing the file it is not possible to suggest an alternative...
    Good Luck...
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
    Also....Add a comment if you like!!!!
    And remember...Mark Thread as Solved...
    Excel Forum Rocks!!!

  3. #3
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: Preventing VLOOKUPS From Executing on Data Load

    The source data files: I do a snapshot each day of a download from our database and I save that snapshot to a date-stamped tab. So today's download went to 205019 and yesterday's download went to 200518.

    I tell the program in question to open up this spreadsheet and copy in those two tabs. I need to find the difference in a certain metric for parts between them. The snapshots have no formulas.

    The third tab (the one with the formulas) is read from a database - it is a list of all our parts. So I look up the metric for each part for yesterday's download and the day before and take the difference. Most parts have zero difference so I filter them out and reduce the number of records from about 18,000 to about 400 for further analysis. I can handle the 400 .

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,015

    Re: Preventing VLOOKUPS From Executing on Data Load

    If you assign a formula to a cell using the Formula property, it will calculate, regardless of what you set the Calculation property to. It only makes a difference if you then use a Fill operation to populate the rest of the cells, since Excel will simply put the result of the initial calculation into every cell. Your problem here is that the table is automatically assigning the formula to each row of the table in turn, which requires it to calculate.
    Everyone who confuses correlation and causation ends up dead.

  5. #5
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: Preventing VLOOKUPS From Executing on Data Load

    Most of what I was able to find elsewhere on the web is some variant of what I wound up doing. It's a bit of a PITA but it's not like I have to do it EVERY day. Now that I got this one programmed, it should last for a long time.

+ 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] Slow Load and running with VBA and Vlookups
    By bbqqsmokeman in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-08-2017, 08:19 PM
  2. Preventing Data Validation
    By rakumar in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-16-2013, 03:10 AM
  3. Preventing changes to data.
    By jimwilliams in forum Excel General
    Replies: 5
    Last Post: 10-21-2008, 07:18 AM
  4. Preventing Data Import
    By eileenj in forum Excel General
    Replies: 0
    Last Post: 08-08-2006, 10:55 PM
  5. Preventing duplicate data
    By tillytee1 in forum Excel General
    Replies: 2
    Last Post: 03-20-2006, 11:49 AM
  6. Too many calculations preventing Private Sub from executing macro
    By tx12345 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-14-2006, 04:43 PM
  7. Preventing macro from .xlt from executing in a .xls
    By XxLicherxX in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-18-2005, 02:35 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