+ Reply to Thread
Results 1 to 8 of 8

Solver - decimal places

  1. #1
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Solver - decimal places

    Hi
    Im new to using solver

    I have 3 values that require changing but would prefer to be kept to 2 decimal places.
    They are formats of
    £00.00
    0.0%
    0.0%

    however what ever restraints I place they will return up to 13 decimal places.
    This provides me with the wrong answer
    is there anyway I can limit the values to be changed to the above formats
    Regards
    Sean

    Please add to my reputation if you think i helped
    (click on the star below the post)
    Mark threads as "Solved" if you have your answer
    (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code:
    [code] Your code here [code]
    Please supply a workbook containing example Data:
    It makes its easier to answer your problem & saves time!

  2. #2
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Solver - decimal places

    Hi

    Have you tried ROUND ?
    Attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  3. #3
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: Solver - decimal places

    I cant use round.
    Its not a case of just rounding the numbers up
    Solver changes the values in cells J5:J7 and these are the figures I want to control via solver.
    I have some values that are certain.
    Labour hours
    Parts (retail cost)
    Paint (retail cost)
    other (retail cost)

    I have a target value of £1350 of which I am trying to get solver to achieve this figure.
    If I set solver to get the 3 variables to change to calculate the exact amount it will return results with say 11 decimal places.
    If I was to replace these with results rounded up to 2 decimal places then it would calculate a different value

    Solver only seems to allow you to use integers or it will use any decimal value but doesn't seem to allow the constraints to be to 2 decimal places.
    Attached Images Attached Images
    Attached Files Attached Files

  4. #4
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Solver - decimal places

    Hi

    In solver use LP Simplex

    See the file
    Attached Files Attached Files

  5. #5
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: Solver - decimal places

    That isn't calculating if I try changing the target to 1400

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

    Re: Solver - decimal places

    IMO, Solver is not going to like trying to have "number of decimal places" as part of its model. Here's how I would do this:

    1) Run Solver like you currently have it to get the "exact" solution to the problem.
    2) After Solver comes to the exact solution, round the values up/down to the desired precision so that K9 will be larger than K11. You can do this manually, or have a second copy of this block of cells that performs the calculation with the rounded values. It depends on how this fits into your overall project and how automated it must be.

    Looking at Jose's file and my sample runs, it appears that there are multiple possible solutions for a given problem. One of my runs gave me 25.0, .147, .890 to get something just larger than 1350. Another run gave me 25.1, .112, .834 to get 1350. I note that Jose's run gave him 25.0, .010, .693 for 1350. If you are not concerned by this, then don't worry about it.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  7. #7
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Solver - decimal places

    Hi

    See this model Evolucionary.

    The formulas in K6:K8 uses ROUND as you need
    Attached Files Attached Files

  8. #8
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: Solver - decimal places

    Thanks Mr Shorty
    I pretty much came up with the same solution in the end

+ 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. Adusting decimal places based on greatest number of places in a series
    By anelson87 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-11-2022, 01:05 PM
  2. [SOLVED] rounding down to nearest 3 decimal places after the decimal point
    By swfarm in forum Excel General
    Replies: 2
    Last Post: 10-18-2018, 11:42 AM
  3. Replies: 4
    Last Post: 01-01-2017, 07:38 PM
  4. [SOLVED] Calculating decimal places in a non decimal format (ie sixes not tens)
    By Mike Brewer in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-07-2013, 08:58 AM
  5. Paste two decimal number in excel without extra decimal places appearing
    By jeffery_frick in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-13-2009, 07:49 PM
  6. Replies: 4
    Last Post: 06-10-2009, 12:50 PM
  7. Replies: 3
    Last Post: 07-06-2005, 09:05 AM

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