#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default loops

I am a beginner programmer and I am trying to understand looping to optimize
a investment portfolio with 3 types of assets S, B & C. Does anyone have
experience with such a routine? I want to find the optimal weights for this
portfolio by changing each asset wieght. A portfolio cant hold more than
100%. In other words, what weights will optimize my return?

i.e. S = 70%, B = 25% and C = 5%

Total (S + B + C) cant exceed 100%.

Therefore I am looping 3 different variables. I have tried a couple of
methods but keep getting errors. Does anyone have a template for something
similar I can try to work through??

ANy help is much appreciate!

Capp
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default loops

Run this with a blank sheet active and see if it gives you some ideas:

Sub AF()
Dim i As Long, s As Long
Dim b As Long
i = 1
Cells(i, 1).Resize(1, 3).Value = Array("s", "b", "c")
For s = 1 To 100
For b = 0 To 100 - s
i = i + 1
Cells(i, 1) = s
Cells(i, 2) = b
Cells(i, 3) = 100 - (b + s)
Next
Next
End Sub

--
Regards,
Tom Ogilvy





"Capp" wrote in message
...
I am a beginner programmer and I am trying to understand looping to

optimize
a investment portfolio with 3 types of assets S, B & C. Does anyone have
experience with such a routine? I want to find the optimal weights for

this
portfolio by changing each asset wieght. A portfolio cant hold more than
100%. In other words, what weights will optimize my return?

i.e. S = 70%, B = 25% and C = 5%

Total (S + B + C) cant exceed 100%.

Therefore I am looping 3 different variables. I have tried a couple of
methods but keep getting errors. Does anyone have a template for

something
similar I can try to work through??

ANy help is much appreciate!

Capp



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
loops???? harry buggy Excel Worksheet Functions 2 August 14th 07 06:33 PM
loops ... jer Excel Programming 4 April 15th 05 04:17 PM
Using For - Next Loops in VB Biomed New Users to Excel 4 March 22nd 05 07:12 PM
for each loops adncmm1980[_3_] Excel Programming 1 October 4th 04 12:56 PM
help with loops Rick B[_6_] Excel Programming 8 January 28th 04 12:32 AM


All times are GMT +1. The time now is 06:07 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"