1
Excel Solver
To perform these tasks without using VBA, Solver needs to be used and a simple binary logic is used.
Enable Solver in Excel
The version used is Excel 2010.
- Enter the Office or File button.
- Click on Options.
- Click on Add-Ins.
- Install the Solver Add-in and click Ok.
Enable the Add-in
- Enable the Developer Mode
- On the tab Developer, click on Add-ins
- A window will open and the Solver Add-in must be marked.
Solution
With the data provided in the example, cells
A1:A10
were filled.The cell
B11
is filled with the formula=SUMPRODUCT(A1:A10;B1:B10)
or=SOMAPRODUTO(A1:A10;B1:B10)
Open the Solver in Dice
Choose the option Value of: and enter the desired sum number.
In the option By Changing Variable Cells, choose the cells
B1:B10
.Click on Add.
A window will open and cells
B1:B10
should be chosen as the reference. And the optionbin
should be chosen. Click Ok.In the choice solution method Simplex LP.
Solver results
Filter
After the Solver solution, insert a filter for the number 1
in the column B
.
Upshot
With the filter we can conclude that lines 3 and 4 are the coefficients of the sum.
Extra:
To change the optimization function, other forms of objective function or more constraints can be added. If you want to delve into the subject look for Linear Programming, Simplex Method or Solver. Or in English Linear Programming (LP), Simplex or Linear Optimization. A good tool for Excel optimization problems is the Solver Studio.
I think it is not possible, however it may be that someone explains better, now I am curious too. From what I understand you want to perform several sums of your range (column) and check if it matches your flagged column. That’s your problem?
– Claudio Lopes
Exactly, Claudio!
– Lucas Augusto
The problem is there are two numbers 23, so there are two answers. If not using a Solver (Linear Programming) would be enough to accomplish this with a simple model. However, with this, the model becomes more complex, and can become non-linear, but remains solvable without the use of Excel VBA. @Lucasaugusto there are some criteria for choosing the first or the second 23?
– danieltakeshi
@danieltakeshi, I was curious about your solution proposal. Actually the image is totally illustrative, I ended up putting the number 23 twice without noticing. What the solution would be if there were only 1 number 23?
– Lucas Augusto