Linear Programming in Excel

Linear Programming in Excel using Solver

Linear Programming is one of the important concepts in statistics. Based on available data of variables we can do predictive analysis. In our earlier article “Linear Regression in Excel” we have discussed in detail about the “Linear Regression”. However, in excel we have an option called “Solver in excel” which can be used to solve a linear programming problem, with this solver we can use linear programming to enable resources optimization.

In this article, we will show you how to solve the linear programming problem in excel in detail. Follow the entire article to learn about this.


You are free to use this image on your website, templates etc, Please provide us with an attribution linkHow to Provide Attribution?Article Link to be Hyperlinked
For eg:
Source: Linear Programming in Excel (

How to Solve Linear Programming through Excel Solver?

To apply solver to solve linear programming, we should have a proper problem in detail. For this example, I have created the below scenario.

You can download this Linear Programming Excel Template here – Linear Programming Excel Template

Problem: A manufacturer wants to alter this production model of the current product. He has two kinds of products, “Product 1” & “Product 2”. For Product 1 requires three raw materials, Raw Material 1 20 Kg, Raw Material 2 30 Kg, and Raw Material 3 5 Kg. Similarly, for Product 2, it requires three raw materials, Raw Material 1 10 Kg, Raw Material 2 25 Kg, and Raw Material 3 10 Kg.

Manufactures require a minimum of Raw Material 1 550 Kg, Raw Material 2 800 Kg, and Raw Material 3 250 Kg. If Product 1 costs Rs. 30 per unit and Product 2 costs 35 per unit, how many units of each product should the manufacturer blend meet the minimum raw material requirements at a low cost as possible, and what is the cost?

Now enter all this information into an excel spreadsheet in the below format.

Linear Programming Example 1

In cell D3 and D5 to D7, we need to apply the excel formulaExcel FormulaThe term "basic excel formula" refers to the general functions used in Microsoft Excel to do simple calculations such as addition, average, and comparison. SUM, COUNT, COUNTA, COUNTBLANK, AVERAGE, MIN Excel, MAX Excel, LEN Excel, TRIM Excel, IF Excel are the top ten excel formulas and more, i.e., Cost * Cost Per Unit. Cost Price we need to arrive from the solver in cell B2 & C2. To apply the formula as below.

Linear Programming Example 1-1

After setting up this, we need to go to the solver tool in excel. The solver tool is available under the Data tab in excel.

Enable Solver Add-in

Linear Programming Example 1-2

If your spreadsheet is not showing this option, then you need to enable it. To enable this solver option to follow the below steps.

  • Step 1: Go to the File tab; then, under the File tab, click on “Options.”
Linear Programming Example 1-3
  • Step 2: Go to Add-ins under Excel Options.
Linear Programming Example 1-4
Linear Programming Example 1-5
  • Step 4: Under below pop up choose “Solver Add-in” and click on “Ok” to enable it.
Linear Programming Example 1-6

Now we can see “Solver Add-in” under the DATA tab.

Solve Linear Programming through Excel Solver

  • To apply solver, go to the DATA tab and click on “Solver” we will see below the window.
Example 1-7

In the above window, our first option is “Set Objective.”

  • Our objective is to identify the “Total Cost,” so our total cost cell is D3, so select the cell D3 for this “Set Objective” and set it to “Min.”
Linear Programming Example 1-8
  • The next option is “By changing variables.” In this example, our variables are “Product 1” and “Product 2”. To select a range of cell B2:C2 and click on “Add.”
Example 1-9
  • Once you click on “Add,” we will see below the add constraint window. In this window, select B2:C2 range of cells and put the constraint as “>=0”.
Example 1-10
  • Click on “Add” to stay back in the same window. Now in the second constraint, select the range of values as D5:D7 and select “>=” and under constraint, select G5:G7 cells.
Linear Programming Example 1-11
  • Click on “Ok” to come out of the Add Constraint window.
Linear Programming Example 1-12
  • Now all our parameters are ready. Click on the “Solve” option to get the result.
Example 1-13
  • So, the cost to produce Product 1 per unit is 20, and Product 2 per unit is 15.
Example 1-14

Like this, by using SOLVER, we can solve linear programming in excel.

Things to Remember

  • Solver, by default, is not available to use.
  • A solver is not only limited to a linear programming language, but we can solve many other problems as well. Refer to our article “Solver Option in Excel.”
  • Setting the objective cell is important.
  • Adding constraints should be ready well in advance.

This has been a guide to Linear Programming in Excel. Here we discuss how to solve the linear programming problem in excel using the solver option with example and downloadable excel template. You may learn more about excel from the following articles –

  • 35+ Courses
  • 120+ Hours
  • Full Lifetime Access
  • Certificate of Completion