+ Reply to Thread
Results 1 to 10 of 10

Advanced Loop in macro find maximum value

  1. #1
    Registered User
    Join Date
    12-22-2008
    Location
    Sweden
    Posts
    56

    Advanced Loop in macro find maximum value

    Hi,
    I've an excelsheet with quite advanced formulas that area really nested and using quite a bit of iteration.

    What I would like to do is finding the maximum of

    A while Amin<A<Amax
    By changing B

    There is a Variable C than should be constant unless it becomes larger than Cmax ( Cmax dependas on A,B ,C, D and all kinds of things)

    If C is > than Cmax there is a variable D that can be changed has to be less or equal to Dmax

    So the question is how to find the maximum of A while fulfilling all these variables?

    What I've come up with so far is:

    Please Login or Register  to view this content.
    It's not really correnct since the MAx values of A B and C can change which means that the loop can exit without all satements fulfilled.

    Could you help me please?

  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

    Re: Advanced Loop in macro find maximum value

    Why not use Solver?
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    12-22-2008
    Location
    Sweden
    Posts
    56

    Re: Advanced Loop in macro find maximum value

    AS I understood the user need to have the solver function installed on his/her local computer. Therefore I though it would be better to have something that can run on all computers.

    DOn't you think it can be done with loops`?
    Best regards

    Andy

  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

    Re: Advanced Loop in macro find maximum value

    Of course you could do it with a loop, but why bypass the resource that was specifically designed for this purpose, and that does it more accurately, faster, with better methods?

    People doing analytical 'stuff' should all have Solver; it's a standard part of Excel, even if installation is optional. Everyone with a non-pirated copy of Office can install it.

  5. #5
    Registered User
    Join Date
    12-22-2008
    Location
    Sweden
    Posts
    56

    Re: Advanced Loop in macro find maximum value

    THanks I'll look into the solver solution to this problem.
    Allthough As an exercise I would appreciate a solution using loops. COuld you help out?

    Br
    Andy

  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

    Re: Advanced Loop in macro find maximum value

    Maybe, if you post a workbook.

  7. #7
    Registered User
    Join Date
    12-22-2008
    Location
    Sweden
    Posts
    56

    Re: Advanced Loop in macro find maximum value

    IT's taking values from some other workbook on the network. THe file I have on my computer is not enough to run the formulas. nevertheless the problem is as stated about. Looking forward to your expert advice.

    Br

    Andy

  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

    Re: Advanced Loop in macro find maximum value

    Then how about mocking up a workbook, Andy?

  9. #9
    Registered User
    Join Date
    12-22-2008
    Location
    Sweden
    Posts
    56

    Re: Advanced Loop in macro find maximum value

    What do you mean with mocking?

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

    Re: Advanced Loop in macro find maximum value

    As in, make up a workbook such that it the code solves the problem in the mockup, you can apply it to your actual problem.

+ 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