With Solver, you can find an optimal value for a formula. Formula A sequence of values, cell references, names, functions, or operators in a cell that together produce a new value. A formula always begins with an equal sign (=). Constraints The limitations placed on a Solver problem. If the add-ins are available in the Excel for Mac installation that you are using, follow these steps to locate them: Start Excel for Mac. Click Tools, and then click Add-Ins. Click the Data Analysis ToolPak or Solver option to enable it. Then, click OK. Locate Data Analysis ToolPak or Solver on the Data tab.
Is there a way to record a macro that. copy data from a 'data' sheet to a 'calculator' sheet. activate the 'SOLVER' function. goes to a 'result' sheet. copy result and paste into 'data' sheet.
then loops I tried recording these but the problem I faced was that the macro didn't give SOLVER enough time to finish the iterations needed to get a solution. One very slow way I could think of was to get macro to do everything from step 3 to step 5 and then step 1 and ends, then I manually start the solver and wait for the iterations to complete.
Anyone can help me? Sorry I'm super newbie here. There is a bug in the solver for Mac Excel2011. Vba must stop running before solver can start. This means that loops like that you show will not work. The only work around I can find is to create two solver functions: The first initiates the loop and makes the calls to solver. It then initiates a call to an application wait to invoke the second function after a time delay which must be long enough for Solver to do its task.
It then exits The second function captures the results from solver, manages the loop advance and again starts solver. It too invokes the same delay and exits.
If the second function finds the loop is complete it just exits without calling Solver. This approach works but is very slow. In my example the PC loop like your example above took just over 1 minute for 180 iterations of a 10 parameter solver system with 60 data points to evaluate.
On the Mac I had to allow a 10second delay to ensure completion. Result Mac 30 minutes Not good but workable.
Under Add-ins, select Solver Add-in and click on the Go button. Check Solver Add-in and click OK. You can find the Solver on the Data tab, in the Analyze group.
Formulate the Model The model we are going to solve looks as follows in Excel. To formulate this linear programming model, answer the following three questions.
What are the decisions to be made? For this problem, we need Excel to find out how much to order of each product (bicycles, mopeds and child seats). What are the constraints on these decisions? The constrains here are that the amount of capital and storage used by the products cannot exceed the limited amount of capital and storage (resources) available.
For example, each bicycle uses 300 units of capital and 0.5 unit of storage. What is the overall measure of performance for these decisions? The overall measure of performance is the total profit of the three products, so the objective is to maximize this quantity. To make the model easier to understand, the following ranges. Range Name Cells UnitProfit C4:E4 OrderSize C12:E12 ResourcesUsed G7:G8 ResourcesAvailable I7:I8 TotalProfit I12 3.
Insert the following three SUMPRODUCT functions. Explanation: The amount of capital used equals the of the range C7:E7 and OrderSize. The amount of storage used equals the sumproduct of the range C8:E8 and OrderSize. Total Profit equals the sumproduct of UnitProfit and OrderSize. Trial and Error With this formulation, it becomes easy to analyze any trial solution. For example, if we order 20 bicycles, 40 mopeds and 100 child seats, the total amount of resources used does not exceed the amount of resources available.
This solution has a total profit of 19000. It is not necessary to use trial and error. We shall describe next how the Excel Solver can be used to quickly find the optimal solution. Solve the Model To find the optimal solution, execute the following steps. On the Data tab, in the Analyze group, click Solver. Enter the solver parameters (read on).
The result should be consistent with the picture below. You have the choice of typing the range names or clicking on the cells in the spreadsheet.
Enter TotalProfit for the Objective. Enter OrderSize for the Changing Variable Cells. Click Add to enter the following constraint.
Check 'Make Unconstrained Variables Non-Negative' and select 'Simplex LP'. Finally, click Solve. Result: The optimal solution: Conclusion: it is optimal to order 94 bicycles and 54 mopeds. This solution gives the maximum profit of 25600.