vba select best sum combination from a column which exceeds a value by the lowest amount?

murtaep

New Member
Joined
May 30, 2012
Messages
3
I have a column of numbers eg:
Colum B
B1 523
B2 438
B3 956
B4 673
B5 45
B6 55
B7 911


How do i write code (using vba) to Sum of all the possible combinations of these numbers in order to reach the value of a cell (A1) and gives me the smallest excess?
For example A1 is 1100
So result should be =SUM(O25,O28)
=SUM(673,438) 1111
Remainder
remainder 11

All I really need is something that will sum all the possible comlumns and i will be able to complete the rest myself.
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Forum statistics

Threads
1,219,162
Messages
6,146,661
Members
450,706
Latest member
LGVBPP

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