+ Reply to Thread
Results 1 to 10 of 10

GoalSeek VBA freezing up

  1. #1
    Registered User
    Join Date
    07-10-2012
    Location
    Midland, TX
    MS-Off Ver
    Excel 2010
    Posts
    37

    GoalSeek VBA freezing up

    When I enter a number 8 or less in cell E3, a very large number is created in G3. When I try to enter a different number in e3 after than, the macro won't change cell g3. I've attached the spreadsheet.
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,819

    Re: GoalSeek VBA freezing up

    Looks like a different facet of this problem: https://www.excelforum.com/excel-pro...ecxceeded.html If the algebraic suggestion I make in the other thread would work, then Goal Seek will not be needed at all, an the problems caused by Goal seek diverging to unreasonable numbers will also go away. Check your other thread and indicate whether or not an algebraic solution will work for you or not.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Registered User
    Join Date
    07-10-2012
    Location
    Midland, TX
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: GoalSeek VBA freezing up

    Yeah, it is a different facet of the same problem. I thought maybe I hadn't stated my problem very well. I can't figure out how to make solver work as a solution. I have to set objective m3 to value of "blank" but the value I want is what value the user enters in e3. The reason an algebraic solution will not work is because I have two unknowns and one equation.

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,819

    Re: GoalSeek VBA freezing up

    I have to set objective m3 to value of "blank" but the value I want is what value the user enters in e3.
    I don't follow you on this. You should be able to enter whatever value you want into the "to value of" field. Perhaps you are referring to the "feature" that prevents you from entering a reference to a cell in this field. I usually sidestep that problem by formulating the objective function to be =current formula in M3 - E3 then set M3 to a value of 0.

    The reason an algebraic solution will not work is because I have two unknowns and one equation.
    I must have not understood the spreadsheet, then, because I saw only the one equation and one unkown. Either you are solving for E3 at G3=100 (for the data validation rule), or solving for G3 at E3=entered value (and using data validation to make sure that this cannot be above 100). What am I misunderstanding?

  5. #5
    Registered User
    Join Date
    07-10-2012
    Location
    Midland, TX
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: GoalSeek VBA freezing up

    The problem arises with two unknowns and one equation when you enter a value for salt in cell b45. This is calculated off the weight of water (g3(gal)*8.33(lb/gal). But adding salt changes the bulk weight of material which affects the amount of water, g3, required to achieve the desired density. If it weren't for salt being derived from the weight of water, this wouldn't be a problem. However, for the industry I work in, calculating salt off the weight of water is the standard.

  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: GoalSeek VBA freezing up

    Why not just use a formula in G3?

    =(C53 - E3*G53) / (E3 - 8.33)
    Entia non sunt multiplicanda sine necessitate

  7. #7
    Registered User
    Join Date
    07-10-2012
    Location
    Midland, TX
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: GoalSeek VBA freezing up

    That will create a circular error.

  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: GoalSeek VBA freezing up

    If you have one equation in two unknowns, there isn't a single solution ...

  9. #9
    Registered User
    Join Date
    07-10-2012
    Location
    Midland, TX
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: GoalSeek VBA freezing up

    Well, that's why I like goal seek. It gets me close enough. I just need it to have a max value of 100 in g3.

  10. #10
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,819

    Re: GoalSeek VBA freezing up

    I did not see the "circular reference" between G3, C53, and B45. How does your spreadsheet handle the circular reference created when B45 is not 0 (I assume it will always be between 0 and 1)? As one who usually has iteration enabled, it seems to calculate the values of C45, J45, E45, C53, and G53 just fine with the simple "successive approximations" algorithm that is currently built into the spreadsheet, though I have no reference for knowing if it is converging on the correct value.

    Having C53 and G53 be functions of E53 does not introduce a new unkown. It simply makes the algebra more complicated. G3 should still be a straightforward function of E3. The main complication seems to be solving the equation exactly for the minimum value of E3 (that makes G3=100). I noted that, solving the equation for E3 as if C53 and G53 are not functions of E3 still seems to give a pretty close value for the threshold value for E3, and may still be useful. Or, as I suggested, simply use G3<=100 as your data validation criteria and don't worry too much about solving exactly for E3

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Freezing A Row Without Freezing Rows Above Said Row
    By STUARTXL in forum Excel General
    Replies: 2
    Last Post: 02-19-2017, 06:49 AM
  2. VBA Goalseek Offset
    By David.Harris in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-21-2016, 11:06 AM
  3. Goalseek in VBA - Is it possible to see how many iterations were used?
    By Belisartih in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-12-2014, 04:12 PM
  4. Formula Instead of Goalseek
    By Darreno in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-31-2014, 05:58 PM
  5. Similar to Goalseek
    By pizzle523 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-30-2012, 11:18 AM
  6. [SOLVED] GoalSeek in VBA
    By [email protected] in forum Excel General
    Replies: 1
    Last Post: 07-20-2006, 12:20 AM
  7. mimic goalseek
    By Monique in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-25-2005, 03:05 PM

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