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

#### murtaep

##### New Member
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

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Replies
15
Views
4K
Replies
1
Views
694
Replies
1
Views
670
Replies
1
Views
1K

Threads
1,212,096
Messages
6,105,935
Members
447,985
Latest member
gigi11

### 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

### 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