Analyze a number as a sum

remalguy

New Member
Joined
Jul 17, 2018
Messages
8
Hello,
I want to analyze any given number as a sum of other given numbers in a table.

Example : Numbers in table (500, 250, 10, 5, 1)
Number : 1306

result : 500x2, 250x1, 10x5, 5x1, 1x1

Thanks in advance
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

Excel 2010
BCDEFG
1
213065002501051
3
3b
Cell Formulas
RangeFormula
B2=SUMPRODUCT(C2:G2,{2,1,5,1,1})
 
Last edited:
Upvote 0
You can use a "greedy" method like this:



ABCD
1NumberTableCount
213065002
32501
4105
551
611

<tbody>
</tbody>
Sheet3

Array Formulas
CellFormula
D2{=INT(($A$2-SUM(IF(ISNUMBER($C$1:$C1),$C$1:$C1,0)*IF(ISNUMBER($D$1:$D1),$D$1:$D1),0))/C2)}

<tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces
{}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>
 
Upvote 0
If the OP requires a distribution
try the following


Excel 2010
ABCDEFG
1Denomination
2Amount05002501051
31,306021511
3bbb
Cell Formulas
RangeFormula
C3=INT(ROUND($A3-SUMPRODUCT($B3:B3,$B$2:B$2),2)/C$2)
 
Upvote 0

Forum statistics

Threads
1,216,105
Messages
6,128,859
Members
449,472
Latest member
ebc9

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top