How to Add an Integer Linear Programming Constraint in Excel Solver
Question details
Add integer or binary restrictions to decision variables in an Excel linear programming model.

- 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.
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.
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.
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.
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.
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.
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.
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.
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.

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.

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.




