+ Reply to Thread
Results 1 to 9 of 9

Iterate until cell values match

  1. #1
    Forum Contributor
    Join Date
    01-07-2006
    Location
    San Jose, CA
    MS-Off Ver
    2007, 2016
    Posts
    115

    Iterate until cell values match

    Iterate until cell values match

    The thread posted today "Recalculate sheet repeatedly until condition met" is similar but I don't know how to apply the code in that thread to my calculation. What I am trying to do is described below.

    The following expression calculates the standard deviation of a linear regresion fit to a data set.

    The calculation is performed in cell R14: =KMAX/STDEVP($I$8:INDEX($I$8:$I$500,R11))/50 and yields the standard deviation value which is

    typically in the range 0-3.0.

    The desired standard deviation input is in cell R15. How can the variable KMAX be iterated until the desired standard deviation value

    is achieved in cell R14 matching the desired standard deviation in cell R15?

    Depending on the data, the variable KMAX typically varies between 0 and 1000.

    Can anyone help?

    Thanks,

    Art

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    How about Solver?

  3. #3
    Forum Contributor
    Join Date
    01-07-2006
    Location
    San Jose, CA
    MS-Off Ver
    2007, 2016
    Posts
    115
    Using Solver has been suggested. Honestly, I prefer to be "closer" to the calculation being performed. Using a VBA routine is also more flexible.

    Art

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Unless you have a closed-form solution, you'll need to write something that does the same thing Solver does (using Newton-Raphson or other root-finding methods). Depending on the behavior of the dependent data, that could range from straightforward to complex.

  5. #5
    Forum Contributor
    Join Date
    01-07-2006
    Location
    San Jose, CA
    MS-Off Ver
    2007, 2016
    Posts
    115
    I think that it's easier than than that. If I manually increment the variable KMAX in integer steps, I can get to the value of the desired standard deviation. I think that if the loop simply incremented KMAX in a similar manner, i.e., integer steps, the two cells would match quickly.

    Art

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Could be. If (simplest case) the STDEVP part isn't influenced by KMAX, you can just solve it in closed form.

  7. #7
    Forum Contributor
    Join Date
    01-07-2006
    Location
    San Jose, CA
    MS-Off Ver
    2007, 2016
    Posts
    115
    That's the key, STDEVP isn't influenced by KMAX. Any suggestions on how to set up a loop to do this?

    Art

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Why use a loop?

    R15 = KMAX / STDEVP(...) / 50

    KMAX = R15 * STDEVP(...) * 50
    Last edited by shg; 07-02-2008 at 06:47 PM.

  9. #9
    Forum Contributor
    Join Date
    01-07-2006
    Location
    San Jose, CA
    MS-Off Ver
    2007, 2016
    Posts
    115
    Thanks for pointing this out. I don't know How I missed it. Guess I had it in my head that I was solving for the standard deviation.

    Thanks,

    Art

+ 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