+ Reply to Thread
Results 1 to 5 of 5

Macro to calculate the percent difference after entering an input

  1. #1
    Registered User
    Join Date
    06-19-2012
    Location
    Silicon Valley, CA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Macro to calculate the percent difference after entering an input

    Hi all,

    I'm currently working on a spreadsheet for engineering purposes.

    Basically, I input the first value as shown in A1. Then I have to guess a value in A3 and adjust it until the percent difference between A6 and A7 is matched with an accepted value, which I want to be as close to zero as possible. A6 and A7 are linked with their own formula elsewhere on the spreadsheet and are dependent on the values of A1 and A3. A4 is dependent on both inputs and is just a difference between the inputs (A1-A3).

    I know I can do this with the "Goal Seek" function in Excel. However, I've tried it a few times and after many iterations it could not find a value that is close to my tolerance of 0.0001 or as close to zero as possible.

    I can keep on guessing a value in A3, but it takes a while and can be time consuming.

    Is there a way to automate this process? Basically, I want to input a value into A3 that gives me a percent difference as close to zero as possible.

    Thanks!

    sss.JPG
    Last edited by hydronicengr; 06-19-2012 at 05:32 PM.

  2. #2
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Macro to calculate the percent difference after entering an input

    Cross posted here: http://www.ozgrid.com/forum/showthread.php?t=166682
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

  3. #3
    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: Macro to calculate the percent difference after entering an input

    What's in A6, A7, and C6?
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Registered User
    Join Date
    06-19-2012
    Location
    Silicon Valley, CA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Macro to calculate the percent difference after entering an input

    I apologize for cross posting. I've requested the other thread to be deleted.

    A6 and A7 are outputs from calculations done on the same sheet and are dependent upon the data in A3 and A4. C6 is merged with the cell below it, which is the calculation of the percent difference between A6 and A7.

    The formula I used for percent difference is (ABS((A6-A7))/((A6+A7)/2))*100

    Unfortunately, I am not able to post the full spreadsheet on here due to company policy.

    Basically, I want to make C6 (percent difference) to be as close to zero as possible, or at least 0.001 or something. In order to do this, I need to adjust A3 many times in order to get this. Many times, I just guess to only 2 decimal places, but I would like a more precise answer. I would just like to automate this process with some sort of macro or iteration, sort of similar to Goal Seek.
    Last edited by hydronicengr; 06-19-2012 at 08:21 PM.

  5. #5
    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: Macro to calculate the percent difference after entering an input

    There are no parameters to GoalSeek that control the precision of the result. You could try Solver instead, which does have several parameters.

    Without knowing what's happening in A6 and A7, I have no further suggestion.

+ 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