+ Reply to Thread
Results 1 to 4 of 4

iteration formula

  1. #1
    Registered User
    Join Date
    05-08-2007
    Posts
    7

    iteration formula

    Hello,

    I'm not very good at VBasic, but I'm looking to do the following:

    In a cell, I would like to calculate a formula doing something like this:

    FOR x=0.1 TO VALEUR(K14), INCREMENT=0.1
    DO ((F14-x)*J23)-O23 = Y

    UNTIL Y is the biggest, and then display the X value in the F69 cell and the Y in the G68 cell.

    Any help would be very appreciated.
    Thanks.
    S.

  2. #2
    Forum Contributor
    Join Date
    01-21-2005
    Location
    Colorado
    MS-Off Ver
    2000,2003,2007
    Posts
    481
    Here's a For _ Next loop that will perform the calculation you described and return the max Y value to cell G68. But taking a closer look at your formula won't the first iteration always return the largest value for Y when x = 0.1?

    Please Login or Register  to view this content.
    HTH

  3. #3
    Registered User
    Join Date
    11-17-2005
    Location
    Georgia
    Posts
    82

    same result

    I came up with an almost identical macro as bhofsetz. The formula (as written) is a linear equation, so based opon the values the maximum value for the result will either the very first pass, or the last. Here is a sample workbook that gets the same results without any iterations or macros.

    If the formula is not supposed to be linear, then the macro and and iterations would be required to get an accurate result.



    Lee
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    05-08-2007
    Posts
    7
    Thanks a lot to both of you. I'll have a closer look at whhat you sent me.

    Thanks again.
    S.

+ 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