Advanced Excel Lesson 3 Solver Pre-reqs/Technical Skills Office for Engineers Module Basic computer use Expectations Read lesson material Implement steps in software while reading through lesson material Complete quiz on Blackboard Submit completed assignment on Blackboard Attend help sessions as necessary Post comments on lesson web page Objectives/Measurables Learn how to use Solver for Max/Min problems, measured via score on assignment Understand the applications of Solver, measured via Blackboard quiz score Table of Contents Advanced Excel... 1 Lesson 3 Solver... 1 Pre-reqs/Technical Skills... 1 Expectations... 1 Objectives/Measurables... 1 1. Introduction... 1 1.1 Install Solver... 2 2. Solver for Equations... 3 3. Solver for Optimization... 4 3.1 Profit Maximization... 4 Conclusion... 7 1. Introduction Solver is an Excel application that can be applied to a spreadsheet with formulas to find the maximum or minimum value of the result of a cell formula. As you already know from the projectile motion spreadsheet, the value in one cell can depend of the value in many other cells which in turn may depend on other cells. If you wanted to find the absolute maximum distance that it can shoot while staying inside the parameters, you could continue guessing input values for a long time until you find the max distance, or you could set up Solver and have it do the hard work. 1
1.1 Install Solver In order to use Solver first you must install the add-in from the options menu. Click on the Office Button in the top left corner, and then select the Excel Options button at the bottom of the drop down menu (click the File button then select Options in Excel 2010) The Excel Options window should open, in the left pane select add-ins Figure 1 - Add-Ins - Excel Options On the bottom of the scroll box there is Solver Add-in, select it and then click on the Go button near the bottom of the window. Figure 2 - Add-Ins That should make the Add-Ins window open, on this check the box next to Solver Add-in and click OK Depending on the computer you are on, an error message might pop up saying Microsoft Office Excel can run this Add-In. This feature is not currently installed, would you like to install it now? simply hit install and wait for Excel to finish. This could take a few minutes. Once it is finished, you are ready to use Solver 2
2. Solver for Equations Before you use Solver on the projectile problem, you ll set up Solver to find a solution to a mathematic equation, in this case the general form of the Polynomial equation, but could be applied to almost any problem. Download Polynomial from the IDE 20 website Figure 3 - Polynomial Select cell B3, the Right Side value, this is the value of Ax 2 +Bx+C. If all the coefficients and the value for x are correct, this value will be zero. Click the Solver button to the far right on the Ribbon under the Data tab Solver Parameters window should open Figure 4 - Solver on the Ribbon Figure 5 - Solver Parameters (2007 Left, 2010 Right) This is an extremely powerful Excel tool; it tests a cell for a desired value while varying the values in other cells according to constraints to change the tested value. Let s go through the parts of the window: Set Target Cell (2007) or Set Objective (2010) is the cell that solver will test, either for a Max/Min or a specific value Equal To (2007) To (2010) is where you designate Max/Min or the target value 3
By Changing Cells are the cells that you are allowing Solver to change in order to change the tested value to Max/Min or the value Subject to the Constraints sets limitations of how much Solver is allowed to change the cells Select Value of: and make sure that the value is 0 This tells Solver that you want to make the value in the cell B3 equal to 0 The cells that contribute to the value in B3 are cells B4 through B7, however to solve a quadratic, you are only allowed to change x as everything else is constant. So in By Changing Cells: enter or select x, cell B7 This allows Solver to change the x value any way it wants to make the value in B3 equal to 0 Lets run this problem, click Solve The value should change and the Solver Results Window should open Select Keep Solver Solution and click OK There should be a value of 2, this is one solution to the Polynomial This will work for any values of A, B and C, if you change the coefficients, you will need to refresh the problem, which can be done by clicking the solver button; Excel saves the criteria you entered into solver to make recalculation quick. 3. Solver for Optimization While you could enter any value into the Quadratic Solution Generator for solver to calculate, it still doesn t come close to what Solver is actually capable of. Next, we will solve a problem with multiple constraints and changeable values. 3.1 Profit Maximization You are the engineer in charge of a computer hardware manufacturing plant; you need to decide what products you are going to produce in order to maximize profit. You have the all the relevant data in a spreadsheet, you just need to run Solver to find the number of each product to produce. Open the Manufacturing spreadsheet off the website Figure 6 - Solver Problem The top part of the sheet is just data on the different products. Under that are the number of Machine hours and Labor hours available, these will act as limits for Solver. Below that is all the data formatted into a chart On the left is all the raw data, and on the right is all the totals Select cell G15, and open solver 4
Figure 7 - Solver Parameters Solver should have imported cell G15 into the target cell box, if not set the Target Cell to G15 In this Problem we want the maximum profit possible, so select Max Next, you have to specify which cells Solver is allowed to change, the variable in this case is the number of units of each product With the By Changing Cells box active, select cells F12:F14 For this problem there a few constraints, click the Add button, which opens this window Figure 8 - Constraint Window First, it is important that the number of units produced is less than the demand, while in the first box select F12:F14, choose less than or equal to in the drop down box, and while in the second box select E12:E14, then hit Add Figure 9 - First Constraint This is just a more compact way of telling solver to check that F12 <= E12, F13<= E13, and F14 <= E14, Next, Select Labor Hours, cell H15, and constrain it to be less than or equal to Labor Hours Available, cell B8 5
Figure 10 - Second Constraint Same thing for Machine hours (cell I14 < = B9). Figure 11 - Third Constraint Finally, it is only possible to create whole (integer) numbers of units, it is impossible to profit from.333 of a keyboard. Select F12:F14, choose int from the drop down box, hit OK This tells Solver that you only want integers in those cells Figure 12 - Fourth Constraint Back on the first window, click Solve. Solver should again adjust the numbers, and then ask if you want to keep the numbers it calculated, click Keep Solver Solution. Figure 13 - Solver Window 6
Figure 14 - Result Conclusion As you can see Solver can quickly find solutions for complex problems, and this problem is far from Solver s limit. Solver is frequent use in engineering applications to solve minimum value, maximum value (such as a Figure of Merit) and target problems. Assignment Use the ProjectileMotion spreadsheet from Lesson 01 as a starting point. Use Solver to find the angle of launch and launch velocity necessary to hit a target 300m away with a cliff height of 10m. The angle of launch must be between 30 and 60 degrees and has to be an integer (express these things as constraints). Input values should be: Cliff Height (B4): 10 Total Distance (B8): 300 Points will be assigned as follows: Correct projectile motion formulas (from Lesson 01) (2) 30 degree min constraint (2) 60 degree max constraint (2) Angle integer constraint (2) Solver setup correctly and successfully solved (2) Submit an Excel spreadsheet with Solver set up for this problem and a valid result from Solver saved. 7