+ Reply to Thread
Results 1 to 5 of 5

Iterative process in a VBA function

  1. #1
    Registered User
    Join Date
    03-12-2011
    Location
    Leiden, Netherlands
    MS-Off Ver
    Office 365
    Posts
    8

    Smile Iterative process in a VBA function

    Hi Everybody,


    I am trying to define a function that calculates a forward price, this should be an iterative process and unfortunately I am not able to properly define the required loop.

    The function shown below performs the required calculation but it should be repeated until the LOAN_AMOUNT + FPA_COST equals the SETTLEMENT_AMOUNT. I have made the calculation manually in Excel and the price is normally found in 3 to 5 steps. (see enclosed spreadsheet)

    Would anyone be able to define the required loop?

    Many thanks in advance!,

    Paul

    ---------------------------------
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Paul Schmitz; 03-13-2011 at 05:23 AM. Reason: Added Code Tags

  2. #2
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Iterative process in a VBA function

    hi, Paul, please check attachment.

    Notes:
    1. Function returns result when loan_amount = settlement_amount calculated (at least that's how I understand your example)
    2. Attachment PaulItFunc1.xls - 7 steps to get result, PaulItFunc1.xls - calculated settlement amount rounded to two digits, 4 steps to get result as in your example

    Hope this helps
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    01-25-2011
    Location
    Virginia
    MS-Off Ver
    Excel 2016
    Posts
    166

    Re: Iterative process in a VBA function

    Paul,

    In your post you said, "LOAN_AMOUNT + FPA_COST equals the SETTLEMENT_AMOUNT" but looking at your spreadsheet the criteria seems to be iterate until LOAN_AMOUNT equals FPA_COST + SETTLEMENT_AMOUNT. If that is in fact the criteria then the below works and generates the same number as E26 in your example.

    Regards,

    Tom

    Please Login or Register  to view this content.
    Last edited by tom.hogan; 03-12-2011 at 06:48 PM.

  4. #4
    Registered User
    Join Date
    03-12-2011
    Location
    Leiden, Netherlands
    MS-Off Ver
    Office 365
    Posts
    8

    Re: Iterative process in a VBA function

    Thank you guys, both solutions work!!

  5. #5
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Iterative process in a VBA function

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

+ 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