N
N
niksamara2016-11-10 23:02:25
excel
niksamara, 2016-11-10 23:02:25

How to find sum of counts of numbers for a specific sum (Excel), (Numbers)?

Sorry for the tricky title, I'll make it much clearer.
There is a certain amount, say 1,000,000.
There are certain numbers (no more than 15-20), say 50, 200, 500, 150, 300, etc.
It is necessary to sort out not just the indicated numbers so that their sum equals the known value (1,000,000), but the sum of the quantities is needed, that is, like this:
50 * 1000 + 200 * 600 + ... = 1,000,000
That is, which is essentially and you need a script or a hint on how to do it, which selects the specified formula with known values ​​\u200b\u200band a known final sum and automatically selects an unknown factor in this mathematical expression (highlighted in bold).
(multipliers will have a low number, up to 20)
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey, 2016-11-11
@skygliderus

Everything is very simple.
Install the Excel add-in Solver .
You drive your numbers into one column (A1, A2, etc.). In the next one, opposite them (B1, B2, etc.) - 1
At the end of the list, under the units (it's just easier for perception) you write the formula =A1*B1+A2*B2+...An*Bn
After that, run the add-on Finding a Solution .
In the Optimize objective function field, enter the cell with the formula.
To : Values ​​(radio button), enter a number in the field (in your case 1000000)
Changing the variable cells - specify the range of cells with units (B1...Bn)
If the coefficients are needed as integers, then you need to set the restrictions in the window below ... click the Add button and in the window that opens, specify:
button Click the Find solution button

Z
zooks, 2017-02-03
@zooks

Here it is:
https://github.com/modxcms/revolution/blob/2.x/ht....

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question