Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help With Vba Code


Dear All,

I am new to VBA and am stuck on trying to find the mean of a range of
values outputted by the following code:

' Create storage for FTSE100 and binary payoff simulations.
ReDim IndexSim(1 To SampleSz) As Double
ReDim Payoff(1 To SampleSz) As Double

'Do the simulations.
For Cnt = 1 To SampleSz
IndexSim(Cnt) = gBmProcess(Kt, r, q, Vol, TMat - TNow)

If IndexSim(Cnt) = IndexBetValue Then
Payoff(Cnt) = Range("D18").Value
Else
Payoff(Cnt) = Range("D19").Value
End If



Next Cnt

The first and last parts of the code have been omitted, but please
could somebody help me to attempt to find the mean of the IndexSim and
Payoff values outputted by the function.

Many thanks,

Suz


--
Suz84
------------------------------------------------------------------------
Suz84's Profile: http://www.excelforum.com/member.php...o&userid=36189
View this thread: http://www.excelforum.com/showthread...hreadid=559616

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Help With Vba Code




For Cnt = 1 To SampleSz
IndexSim(Cnt) = gBmProcess(Kt, r, q, Vol, TMat - TNow)

If IndexSim(Cnt) = IndexBetValue Then
Payoff(Cnt) = Range("D18").Value
Else
Payoff(Cnt) = Range("D19").Value
End If
Next Cnt


meanIndex = Application.Average(IndexSim)
meanPayoff = Application.Average(Payoff)

--
Regards,
Tom Ogilvy


"Suz84" wrote in
message ...

Dear All,

I am new to VBA and am stuck on trying to find the mean of a range of
values outputted by the following code:

' Create storage for FTSE100 and binary payoff simulations.
ReDim IndexSim(1 To SampleSz) As Double
ReDim Payoff(1 To SampleSz) As Double

'Do the simulations.
For Cnt = 1 To SampleSz
IndexSim(Cnt) = gBmProcess(Kt, r, q, Vol, TMat - TNow)

If IndexSim(Cnt) = IndexBetValue Then
Payoff(Cnt) = Range("D18").Value
Else
Payoff(Cnt) = Range("D19").Value
End If



Next Cnt

The first and last parts of the code have been omitted, but please
could somebody help me to attempt to find the mean of the IndexSim and
Payoff values outputted by the function.

Many thanks,

Suz


--
Suz84
------------------------------------------------------------------------
Suz84's Profile:
http://www.excelforum.com/member.php...o&userid=36189
View this thread: http://www.excelforum.com/showthread...hreadid=559616



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
split post code (zip code) out of cell that includes full address Concord Excel Discussion (Misc queries) 4 October 15th 09 06:59 PM
Drop Down/List w/Code and Definition, only code entered when selec Spiritdancer Excel Worksheet Functions 2 November 2nd 07 03:57 AM
Generic protect/unprotect code through buttons and code? StargateFanFromWork[_3_] Excel Programming 4 December 31st 05 12:10 AM
Create a newworksheet with VBA code and put VBA code in the new worksheet module ceshelman Excel Programming 4 June 15th 05 04:37 PM
stubborn Excel crash when editing code with code, one solution Brian Murphy Excel Programming 0 February 20th 05 05:56 AM


All times are GMT +1. The time now is 04:17 PM.

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"