Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default What happened to the calculation speed?

Hi there,

I am greatly puzzled by VBA running speed for the following code, which is run
inside a loop, with the number of total loops can be specified by the user.

When I use the gross return as the input value for the net return variable,
the macro/function runs fast and reasonable.

However, when I tried to use the calculated net return as the input for the
net return variable, either by referencing the worksheet cell or by
calculating as in below code, the macro/function got stuck when the number of
total loops specified exceeds some number, like 167 for me.


Is there some general reason why this could happen?

It seems the interaction among the rates can cause the problem, but why it
didn't cause problem for lower number of total loops?
Even when I tried to reference the copied/pasted values of calculated net
returns from worksheet cell, which should have removed the interaction among
the rates, it didn't solve the problem.


And the exported output of the calculated net returns in VBA code is
matching what are obtained in the worksheet calculation, for number of total
loops exceeding the stuck point 167, as mentioned above.

Really appreciate any advice or suggestion on this one!!


The code for the returns are as below:

NetReturn(i) = Cells(i, 4)

GrossReturn(i) = Cells(i, 4)
Rate1(i) = GrossReturn(i) * ((1 + f1) ^ (1 / 12) - 1)
Rate2(i) = (GrossReturn(i) - Rate1(i)) * ((1 - (1 - f2) ^ (1 / 12)) _
+ (1 - (1 - 0.0025) ^ (1 / 12)))
TotalRate(i) = Rate1(i) + Rate2(i)

NetReturntest(i) = GrossReturn(i) - TotalRate(i)
' NetReturn(i) = NetReturntest(i)

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculation Speed ColleenK Excel Discussion (Misc queries) 14 May 20th 09 05:06 PM
Question on Calculation Speed AccessHelp Excel Discussion (Misc queries) 2 May 14th 09 08:52 PM
Calculation Speed Jay Excel Worksheet Functions 1 April 18th 07 06:36 PM
Calculation Speed TJ Excel Discussion (Misc queries) 2 September 22nd 05 04:38 PM
Maximum Calculation Speed Ola Excel Worksheet Functions 3 February 19th 05 02:38 PM


All times are GMT +1. The time now is 09:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"