# Solver Help: Setting a Constraint to Allow Two Values

1. ## Solver Help: Setting a Constraint to Allow Two Values

Hello,

I am designing a bond amortization table. I am trying to constrain the principal payments, lets call them A1:A8 to be either \$5,000 difference from the previous payment, or \$0 difference from the previous payment. I cannot find the correct syntax to set a constraint that does the following. Assuming B2:B8 are the difference values.

Constraint:
B1:B8 = (\$5,000 or 0)

Im guessing this is probably a simple error and I am overlooking an easy formula. But I would appreciate any help I could get.

Thanks  Register To Reply

2. ## Re: Solver Help: Setting a Constraint to Allow Two Values

It's not the kind of problem I usually solve. I would be tempted to use a couple of helper cells:

In one cell, put 5000
In C1:C8 (or A1:A8 or wherever is convenient) put 0 (or 1).
B1:B8 might be 5000*A1 (copied across).
In your Solver model, include A1 to A8 in your by changing cells, and add a constraint that those cells are bin (binary -- meaning Solver will force them to be 0 or 1)

When B1 is 0, the difference will be 0, when B1 is 1, the difference will be 5000.

See if something like that will work.  Register To Reply

3. ## Re: Solver Help: Setting a Constraint to Allow Two Values

Solution worked great. Ended up tweaking it a bit to allow increments of 5,000 using integers as opposed to binary. Appreciate the help.  Register To Reply