Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Business Applications
Tag Cloud
access acer asus bios bsod computer crash desktop driver drivers error ethernet excel freeze gaming hard drive hardware hdmi internet laptop lcd malware memory modem monitor motherboard network printer problem ram registry router slow software sound toshiba trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Software & Hardware > Business Applications >
Calculating VBA functions twice in Excel

Reply  
Thread Tools
Phillyguy36's Avatar
Junior Member with 1 posts.
 
Join Date: May 2009
08-May-2009, 01:52 AM #16
Megadyne, two suggestions may be helpful:

You can control the sequence of calculations by calcing a specified range or worksheet. That will override the Excel order of calculations. It does require some care in determining the proper sequence.

Instead of the F9 button, set up a giant user "calc" button that accomplishes the same thing. And the button can call a calc macro that controls the sequence of calculations.
Megadyne's Avatar
Junior Member with 7 posts.
 
Join Date: Apr 2009
Experience: Learner!
08-May-2009, 07:36 AM #17
Thanks Phillyguy.

I had thought about a Calc button and that may yet be put in place. However, there are more fundamental problems that I need to sort out, if only for my own satisfaction, Your post has reminded me that I should feed back some progress so far, and this is it.

First point, I tried all the suggestions made above. They are all worth doing because I can see that they improve the style and quality of my work - but in fact they made no difference to the calculation time.

Except: thanks Nesr! Closing the VB editor certainly makes a difference! Although it's still too slow. :-(

Next, I found what I think is an 'artificial' circular reference in the computation order. One part of the whole workbook consists of an array of input data in columns, with a set of aggregating computations in the rows below the input data. Users add a new column of data, typically every day for 3 months or so. The aggregating formulas depend on the input data above them and on the previous column. So, working from left to right and top to bottom, there is no circular reference. However, if a user edits the input data in the middle of the table, then there are dependencies both to left and right. To add to the mix, there is a cell at the top of each data input cell that validates the input data in a rather complicated way. Working through the data (and validity checks) by hand - and with the eye of a human - there is a straightforward left-to-right calculation order with no circular references. By trial and error I discovered that Excel seems to create a recursive loop and recalculates many times, before, I suppose, hitting some threshold and dropping out - but with no warning to the user. In the end it gives the correct answer, though. Guess what? This was giving a bottleneck in the sequence. The solution was to replace the validation checks (which I had written in to a VBA UDF and called in the worksheet) with something that was based entirely in the worksheet, with no UDFs. The check is weaker, but it speeded up the sums by at least an order of magnitude.

The second big improvement was in some coding that was badly written. There are some intermediate calculations involving moderately complex arithmetic which I had written in to UDFs and called in an intermediate sheet. Easy to read, check and maintain, but slow because the UDFs were called hundreds and hundreds of times. I replaced the UDF by a large table of cells in a hidden worksheet, which again did the arithmetic using worksheet formulae only.

These two changes have made the calculation speed acceptable, but all this work - and your suggestions - have shown me that there are still some issues that I need to resolve and I shall probably use FastExcel to do the analysis - unless anyone can suggest an Open Source/freeware product that will do the job?

Again, thanks to everyone who has contributed to this thread. Your suggestions have been very helpful.
Zack Barresse's Avatar
Computer Specs
Distinguished Member with 5,030 posts.
 
Join Date: Jul 2004
Location: Oregon, United States
Experience: I'ma learnin'!
08-May-2009, 07:42 PM #18
IMHO FastExcel is well worth it.
Reply

Tags
calculation, excel, slow, vba

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 12:14 AM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.