# Thread: Solver: Constraint for values in a range Thanks: 0 Likes: 0

1. ## Solver: Constraint for values in a range

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

2. ## Re: Solver: Constraint for values in a range

Code:
```  SolverOk SetCell:="B94", _
MaxMinVal:=2, _
ValueOf:=0, _
ByChange:="AJ55:AJ84", _
Engine:=1
Relation:=1, _
FormulaText:="=0.1"
Relation:=3, _
FormulaText:="=-0.1"
Relation:=2, _
Relation:=2, _
FormulaText:="=1"```