Function Problems

How to Add an Integer Linear Programming Constraint in Excel Solver

Bushra ParveenBushra Parveen Nov 18, 2026 870 views

Question details

Add integer or binary restrictions to decision variables in an Excel linear programming model.

How to Add an Integer Linear Programming Constraint in Excel Solver
Product
Microsoft Excel Solver
Device & OS
not provided
Scenario
The user has an optimization model with decision cells, an objective, and constraint expressions.
Observed behavior
Solver should find a feasible solution in which the specified decision cells contain integers or binary values.
Before you start

Identify the decision cells, objective formula, and formulas and limits for each constraint. Open the workbook in desktop Excel and check whether Solver appears on the Data tab.

Solution 1Recommended

Add integer or binary constraints in Excel Solver

Use Solver to restrict changing cells to whole numbers or to 0 and 1 while solving a linear model.

The objective and constraint formulas must be linear in the decision variables for Simplex LP. The exact cell references and constraint limits depend on your worksheet.

1
Enable Solver

If Solver is missing from the Data tab, enable the Solver Add-in. In Excel for Windows, select File > Options > Add-ins, choose Excel Add-ins under Manage, click Go, and check Solver Add-in.

2
Build the model

Enter initial values in the decision cells and create formulas for the objective and constraint expressions. For example, use SUMPRODUCT to multiply a range of decision cells by a corresponding range of coefficients.

3
Set the objective and variables

Select Data > Solver. In Set Objective, select the objective formula cell and choose Max, Min, or Value Of. In By Changing Variable Cells, select the decision cell range.

4
Add model constraints

Under Subject to the Constraints, click Add. Select a constraint formula cell, choose a relation such as <=, and enter or select its limit. Repeat for each model constraint.

5
Restrict the decision cells

Click Add again, select the decision cell range as the Cell Reference, and choose int for integers or bin for binary values. Add separate restrictions if different decision cells need different types.

6
Solve the model

Choose Simplex LP as the solving method, then click Solve. Review the Solver Results dialog and select Keep Solver Solution if the result meets your needs.

Add integer or binary constraints in Excel Solver
Integer does not mean nonnegative: An integer constraint permits negative whole numbers unless another restriction prevents them. Add a >= 0 constraint or select Make Unconstrained Variables Non-Negative when appropriate.
Free Microsoft Office alternative

Prepare optimization worksheets with WPS Spreadsheets

WPS Office is a free, lightweight alternative with a familiar spreadsheet interface. Open an Excel workbook to review decision cells and formulas, or create a model for use in Excel Solver. Check Solver-specific features after moving the workbook between applications.

Organize decision variables, objective formulas, and constraint tables in a spreadsheet.Open and save Microsoft Excel XLSX and XLS files.Use a familiar interface to make migration from Microsoft Office easier.Work with a free, lightweight office suite.
microsoft office alternative - wps office

Frequently Asked Questions

What is the difference between an integer and a binary constraint?

An int constraint permits whole numbers, subject to other model restrictions. A bin constraint restricts the selected decision cells to 0 or 1. Choose the appropriate relation in Solver's Add Constraint dialog.

Why can't I see Solver on the Data tab?

Solver may not be enabled. In Excel for Windows, go to File > Options > Add-ins, select Excel Add-ins under Manage, click Go, and check Solver Add-in. Solver availability can vary by Excel version and platform.

Which cells should have the integer constraint?

In Solver's Add Constraint dialog, select the changing decision cells that must be whole numbers. The objective formula cell normally does not need an integer constraint.

Why did Solver report that it could not find a feasible solution?

The constraints may conflict, or no integer values may satisfy all the limits. Review the formulas, cell references, bounds, and int or bin restrictions in Data > Solver.