Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
split post code (zip code) out of cell that includes full address | Excel Discussion (Misc queries) | |||
Drop Down/List w/Code and Definition, only code entered when selec | Excel Worksheet Functions | |||
Generic protect/unprotect code through buttons and code? | Excel Programming | |||
Create a newworksheet with VBA code and put VBA code in the new worksheet module | Excel Programming | |||
stubborn Excel crash when editing code with code, one solution | Excel Programming |