Solver: Constraint for values in a range

pdhil87

New Member
Joined
Aug 27, 2018
Messages
8
Hi

I am looking to add a constraint where the output is within a range of -0.1 and +0.1.

I have the following code set up which satisfies the +0.1 constraint. Is there a way to impose the second constraint to define the range?

Thanks

SolverOk SetCell:="$B$94", MaxMinVal:=2, ValueOf:=0, ByChange:="$AJ$55:$AJ$84", _
Engine:=1, EngineDesc:="GRG Nonlinear"
SolverAdd CellRef:="$B$91", Relation:=2, FormulaText:=Sheets("GLOB").Range("$AQ$15").Offset(i, 0).Address
SolverOk SetCell:="$B$94", MaxMinVal:=2, ValueOf:=0, ByChange:="$AJ$55:$AJ$84", _
Engine:=1, EngineDesc:="GRG Nonlinear"
SolverAdd CellRef:="$AJ$87", Relation:=2, FormulaText:="=1"
SolverOk SetCell:="$B$94", MaxMinVal:=2, ValueOf:=0, ByChange:="$AJ$55:$AJ$84" _
, Engine:=1, EngineDesc:="GRG Nonlinear"
SolverOk SetCell:="$B$94", MaxMinVal:=2, ValueOf:=0, ByChange:="$AJ$55:$AJ$84", _
Engine:=1, EngineDesc:="GRG Nonlinear"
SolverAdd CellRef:="$AJ$55:$AJ$84", Relation:=1, FormulaText:="=0.1"
SolverOk SetCell:="$B$94", MaxMinVal:=2, ValueOf:=0, ByChange:="$AJ$55:$AJ$84", _
Engine:=1, EngineDesc:="GRG Nonlinear"
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Code:
  SolverOk SetCell:="B94", _
           MaxMinVal:=2, _
           ValueOf:=0, _
           ByChange:="AJ55:AJ84", _
           Engine:=1
  SolverAdd CellRef:="AJ55:AJ84", _
            Relation:=1, _
            FormulaText:="=0.1"
[COLOR="#0000CD"]  SolverAdd CellRef:="AJ55:AJ84", _
            Relation:=3, _
            FormulaText:="=-0.1"
[/COLOR]  SolverAdd CellRef:="B91", _
            Relation:=2, _
            FormulaText:=Range("AQ15").Offset(i, 0).Address
  SolverAdd CellRef:="AJ87", _
            Relation:=2, _
            FormulaText:="=1"
 
Upvote 0

Forum statistics

Threads
1,214,561
Messages
6,120,234
Members
448,951
Latest member
jennlynn

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top