+ Reply to Thread
Results 1 to 12 of 12

pls turn this into VB macro

  1. #1
    Registered User
    Join Date
    04-10-2004
    Posts
    23

    pls turn this into VB macro

    The spreadsheet calculates the Up and Down Capture ratio with input for the fund and benchmark's monthly return, and results are displayed in cells F96 & I96. Because I don't know how to write a macro in VB, can someone please help me to turn this into macro so that I can have the formula like =UpCapture(B:B, C:C)

    so, what I want is to have a single cell display the end result with 2 input columns

    the definition and formula to calculate up capture and down capture ratio is as follows: (also the method I used in the spreadsheet)
    http://support.pertrac2000.com/statbody.asp#upcap
    Attached Files Attached Files

  2. #2
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,

    Do you mean into a UDF (User Defined Function) ?

    Carim

  3. #3
    Registered User
    Join Date
    04-10-2004
    Posts
    23
    yes, yes.. thanks

  4. #4
    Registered User
    Join Date
    04-10-2004
    Posts
    23
    Can anybody help please?

  5. #5
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Vicky,

    Had a look at your spreadsheet ...

    Contrary to the reference site you have indicated, your calculations do not reflect the exact definitions of the Upcapture ratio and the Downcapture ratio

    Your calculations are adjusted for annualization ...
    So my first question would be which version are you after ...?

    HTH
    Carim

  6. #6
    Registered User
    Join Date
    04-10-2004
    Posts
    23
    Opp... you are right, I have annualised it rather than really follow the formula given by the website, now, I have changed my formula in excel (please find attached), please help me to convert this into VB as a user defined function, as well as the others in green and orange in the spreadsheet, thanks
    Attached Files Attached Files
    Last edited by vickyho1008; 12-03-2006 at 02:31 PM.

  7. #7
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Vicky,

    Sorry if I was not clear ...

    1. The site describes a formula which is not annualized ...

    2. Your spreadsheet uses a formula which is annualized ...

    The question is

    Which formula would you rather have ...?

    HTH
    Carim

  8. #8
    Registered User
    Join Date
    04-10-2004
    Posts
    23
    Ops.. I just edited my previous post.. please see above, sorry, my fault

  9. #9
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Since it is not getting clearer, I will include the annualization as an option ...
    and, by the way, if you see anything green or orange in the worksheet you have sent ... let me know where exactly ...

    Carim

  10. #10
    Registered User
    Join Date
    04-10-2004
    Posts
    23
    I am wrong and the website's formula is correct and also the way I want to calculate the capture ratio, I have already corrected in the "Up and Down.xls" spreadsheet I have attached recently.

    In Row 96-97:

    Col G & J are the result for Up & Down Capture Ratios respectively (I marked them in blue)

    Col N & Q are the result for Up & Down Percentage Ratio respectively (I marked them in green)

    Col T & Q are the result for Up & Down Number Ratio respectively (I marked them in orange)

    Overall, I would like to have 3 functions written in VB to avoid all calculations, one function for capture ratio , one for percentage ratio and one for number ratio

    thanks

  11. #11
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    As a working rule, please do not edit previous posts ...
    it makes it very difficult to follow the thread ...

    As far as the zipped worksheet is concerned, you are definitely talking about another file ...

    Bye
    Carim

  12. #12
    Registered User
    Join Date
    04-10-2004
    Posts
    23
    this is the file
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1