Fix Excel Solver AllDifferent Constraint Error
Question details
The user needs to resolve an unspecified error that occurs when applying the AllDifferent constraint within the Excel Solver add-in.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Optimizing a complex spreadsheet model where a specific range of variables must contain mutually exclusive values.
- Observed behavior
- Excel Solver displays an error upon execution or setup when the AllDifferent constraint is applied to the model variables.
Ensure that the Excel Solver add-in is properly enabled in your Options menu and that your decision variables are structured in a single, contiguous range.
Verify Variable Bounds and Integer Requirements
Ensure your model variables are set up correctly, as the AllDifferent constraint requires specific integer and range handling to function without errors.
The AllDifferent constraint forces a group of decision variables to assume unique mathematical values (like a permutation). It requires that variables act as integers. Misconfigured bounds or discontinuous ranges are the most common causes of Solver failures.
Open the Solver Parameters dialog and ensure the 'By Changing Variable Cells' field contains a single, continuous range (e.g., $A$1:$A$5) rather than multiple separated ranges.
In the 'Subject to the Constraints' box, verify that the AllDifferent constraint is applied strictly to that exact continuous range of decision variables.
Change the 'Select a Solving Method' dropdown to 'Evolutionary'. The AllDifferent constraint creates a non-smooth model, which the standard Simplex LP or GRG Nonlinear methods cannot process.

Isolate the Error with a Sample Model
Create a simplified version of your spreadsheet data to determine if the error stems from model complexity or a specific formula conflict.
Try WPS Office for Seamless Spreadsheet Analysis
Struggling with complex add-in errors? WPS Office offers a lightweight, high-performance alternative to Microsoft Office. It features robust data analysis tools, complete format compatibility, and a highly familiar interface without the heavy processing overhead.
- 1. Download and Install: Visit the official WPS website to download the free installation package for your operating system.
- 2. Open Your Spreadsheet: Launch WPS Spreadsheet and easily open your existing .xlsx or .csv files without losing any formatting.
- 3. Analyze Your Data: Navigate to the Data tab to utilize built-in data analysis tools, Goal Seek, and advanced formatting features seamlessly.

Frequently Asked Questions
What does the AllDifferent constraint do in Excel Solver?
The AllDifferent constraint forces a specified contiguous range of decision variables to take on mutually exclusive integer values. It is commonly used for sequencing, scheduling, or routing problems like the Traveling Salesperson Problem.
Which solving method should I use with the AllDifferent constraint?
You must use the Evolutionary Solving Method. The AllDifferent constraint creates a non-smooth optimization problem that traditional linear (Simplex LP) and non-linear (GRG Nonlinear) engines cannot solve.
Why does Solver say 'The conditions for Assume Linear Model are not satisfied'?
This error occurs when you apply a non-linear constraint, such as AllDifferent, while attempting to use the Simplex LP solving method. To resolve this, simply change the solving method to Evolutionary in the Solver Parameters window.
How do I enable the Solver add-in if it is missing from my ribbon?
Go to File > Options > Add-ins. At the bottom of the window, select 'Excel Add-ins' from the Manage dropdown and click 'Go'. Check the 'Solver Add-in' box and click OK. The Solver tool will then appear on the Data tab.




