+ Reply to Thread
Results 1 to 13 of 13

Macro for multiple values within a Goal Seek

  1. #1
    Registered User
    Join Date
    12-06-2015
    Location
    Michigan
    MS-Off Ver
    Office 365
    Posts
    79

    Question Macro for multiple values within a Goal Seek

    I have a macro that generates a break even value amount ($0) for different price points. I'm not skilled in writing VBA's, so I recorded the macro. I'm trying to see if theirs a way that I can add additional values to the .GoalSeek Goal:=0 so I can decrease/increase the profit margins of the price points. I'm looking to be able to change the zero (in the .GoalSeek Goal:=0) to a wide range of different values, i.e. 0-1000. File is attached.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,947

    Re: Macro for multiple values within a Goal Seek

    Try

    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    12-06-2015
    Location
    Michigan
    MS-Off Ver
    Office 365
    Posts
    79

    Re: Macro for multiple values within a Goal Seek

    Thanks for the reply. I really like this, and it worked really well, but is their a way to allow it to be more discrete without the pop-up box? Maybe another way to approach this idea? Thanks again for the help, I really like this idea.

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,947

    Re: Macro for multiple values within a Goal Seek

    Of course (I think!). Try this - enter all the values of interest in a range of cells, say A20:A40, and this will process them all, placing the end value into B20:B40:

    Please Login or Register  to view this content.

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

    Re: Macro for multiple values within a Goal Seek

    Are you required to use Goal Seek, or would you be allowed to consider a direct formula approach? You current formula in H12:I12 is x-(0.25x+0.3x)+cost=0. A little bit of algebra should allow you to solve for x directly. Then you can enter that formula directly into K8.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  6. #6
    Registered User
    Join Date
    12-06-2015
    Location
    Michigan
    MS-Off Ver
    Office 365
    Posts
    79

    Re: Macro for multiple values within a Goal Seek

    Quote Originally Posted by MrShorty View Post
    Are you required to use Goal Seek, or would you be allowed to consider a direct formula approach? You current formula in H12:I12 is x-(0.25x+0.3x)+cost=0. A little bit of algebra should allow you to solve for x directly. Then you can enter that formula directly into K8.
    I'm not required to use Goal Seek, and I would definitely use a direct formula instead. Was using Goal Seek at the time and became interested in it's use. What kind of formula would you recommend? Thanks for the help.

  7. #7
    Registered User
    Join Date
    12-06-2015
    Location
    Michigan
    MS-Off Ver
    Office 365
    Posts
    79

    Re: Macro for multiple values within a Goal Seek

    Quote Originally Posted by Bernie Deitrick View Post
    Of course (I think!). Try this - enter all the values of interest in a range of cells, say A20:A40, and this will process them all, placing the end value into B20:B40:

    Please Login or Register  to view this content.
    I will try this and get back to you. Thanks for the help!

  8. #8
    Registered User
    Join Date
    12-06-2015
    Location
    Michigan
    MS-Off Ver
    Office 365
    Posts
    79

    Re: Macro for multiple values within a Goal Seek

    Quote Originally Posted by Bernie Deitrick View Post
    Of course (I think!). Try this - enter all the values of interest in a range of cells, say A20:A40, and this will process them all, placing the end value into B20:B40:

    Please Login or Register  to view this content.
    I've tired the code, and it works, but it's only returning the highest value in the range. It's not auto-adjusting to the different values being placed in cell E8.

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

    Re: Macro for multiple values within a Goal Seek

    Quote Originally Posted by clogistics View Post
    I'm not required to use Goal Seek, and I would definitely use a direct formula instead. Was using Goal Seek at the time and became interested in it's use. What kind of formula would you recommend? Thanks for the help.
    I'd have to take a couple of minutes to be careful with the minus sign across the parentheses, but is looks like it should come down to =cost/(1-something). If you are a little rusty on these kinds of basic algebra problems, I would recommend spending a little time refreshing your skills https://www.purplemath.com/modules/solvelin3.htm

  10. #10
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,947

    Re: Macro for multiple values within a Goal Seek

    I get a table when I do that - see attached: It also includes the correct formula in column C.
    Attached Files Attached Files
    Last edited by Bernie Deitrick; 03-03-2020 at 12:22 PM.

  11. #11
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,947

    Re: Macro for multiple values within a Goal Seek

    See my reply with the attachment - basically, the formula is

    =(CellWithTarget+$E$8)/0.45

  12. #12
    Registered User
    Join Date
    12-06-2015
    Location
    Michigan
    MS-Off Ver
    Office 365
    Posts
    79

    Re: Macro for multiple values within a Goal Seek

    Quote Originally Posted by Bernie Deitrick View Post
    See my reply with the attachment - basically, the formula is

    =(CellWithTarget+$E$8)/0.45
    After a little adjusting, on my behalf, I was able to correlate it with the original Inputbox code you gave me, initially.

    Question. If I needed to input, let's say 1000 of entries, would that be very time consuming with this method? Could I implement some type of < or > to the values? And two, how can I get the macro to react to a specific value, instead of the last entry in the range? i.e. instead of $35, can it react to $15, $20, $22, etc.,?

    I really appreciate your time with the help. I have a much bigger spreadsheet surrounding this an I'm trying to come up with a few better options. Your initial options are helping with my re-adjustments, and i appreciate it.

  13. #13
    Registered User
    Join Date
    12-06-2015
    Location
    Michigan
    MS-Off Ver
    Office 365
    Posts
    79

    Re: Macro for multiple values within a Goal Seek

    Quote Originally Posted by MrShorty View Post
    I'd have to take a couple of minutes to be careful with the minus sign across the parentheses, but is looks like it should come down to =cost/(1-something). If you are a little rusty on these kinds of basic algebra problems, I would recommend spending a little time refreshing your skills https://www.purplemath.com/modules/solvelin3.htm
    I'm not understanding why you just didn't stop the reply after your first sentence. Instead of focusing your efforts on my "basic algebra problems" how about trying to help with my initial reasoning for creating this post, instead of being condescending? Isn't that the reason behind seeking help within these threads, rather it be basic or not? You may be well versed in this, but I'm not. It seems more like disparagement instead, that's not a way of helping.

    FYI, I thought you were initially referring to a specific type of formula that you were going to recommend.

+ 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. VBA goal seek multiple independent data sets with one macro
    By dballinger001 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-31-2018, 06:58 PM
  2. Finding values / goal seek
    By DMueller in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-21-2013, 07:20 PM
  3. Goal Seek Macro for multiple lines
    By ksamarin88 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-11-2013, 08:04 AM
  4. Multiple Goal Seek
    By atamayoz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-12-2012, 01:37 PM
  5. Using Goal Seek in Macro to automatically change a cell value in multiple columns
    By Josiah in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-21-2008, 05:56 AM
  6. Multiple goal seek ?
    By Joenash in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-04-2007, 12:30 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