I just read your post - Subject: all possible combinations
(but seems this is not the same thing right?)
Hi. Not so much Combinations. What you are solving are Linear
Diophantine equations.
Before running Solver, we note that in order for there to be a solution
at all, GCD(275,85) (ie 5) must divide into 1165. Which it does.
(Mod(1165,5) = 0)
If, for example, your total was 1166, then we know right away that there
are no solutions, and there would be no sense in running Solver.
Even if the total was 5, there is a least a solution.
-4*275 + 13*85 = 5
However, these have negative numbers, and not what you want.
BTW, how do you get those answers?!
If given a total of say 28050, we note that both 275, and 85, divide
into this number as an integer.( ie 102, and 330 respectively)
So, our first solution is {0,333}
Here is one way to get the family of solutions:
Sub Demo()
Dim a, b, x, y, t, d
a = 275
b = 85
x = 0
y = 330
d = WorksheetFunction.Gcd(a, b)
For t = 0 To 6
Debug.Print x + t * (b / d); ": "; y - t * (a / d)
Next t
End Sub
Returns:
0 : 330
17 : 275
34 : 220
51 : 165
68 : 110
85 : 55
102 : 0
Always an interesting subject. :>)
= = = = =
Dana DeLouis