find the best match with sizing based on a certain sum VBA

Sotos13

New Member
Joined
Mar 8, 2019
Messages
42
Hello everyone,

i have this problem i have to solve. It's not that easy but here it is .... In column A i have a list of sizes maybe Hundreds Thousands.. and they might be from 10 to 100 in column B. i also have a certain target range for example 95 to 100.
i want to add all numbers in column B in order to result from 90 to 100(my target range) for example A1 with A10 = 100, A2+A3+ A11 =90, A4+A6 =90, then A5+A12 = 95 and so on.. The numbers which are used cannot be used again. The result will be a table with this info as the table below SIZE 1 and SIZE 10 100 etc or A1 and A10 something like that. I know it's hard but if anyone has an idea please be free to share

SIZE 1 90 A1+A10 100 Range 90- 100RESULTS
SIZE 2 50 A2+A3+A1190SIZE 1 and SIZE 10100
SIZE 330SIZE 2 and SIZE 3 and SIZE 1190
SIZE 460 A4+A690SIZE 4 and SIZE 690
SIZE 570 A5+A1295SIZE 5 and SIZE 1295
SIZE 630SIZE 7 and SIZE 16100
SIZE 780 A7+A16100
SIZE 840
SIZE 980
SIZE 1010
SIZE 1110
SIZE 1225
SIZE 1335
SIZE 1475
SIZE 1595
SIZE 1620

<tbody>
</tbody>
Thanks

<tbody>
</tbody>
 
Last edited:
great Dante....amazing !!!
thank you very much...i might come back to you with some questions concerning the code just so i can make some things more clear to me.
if you could reply ..but thanks again

Regards
Sotos13
 
Upvote 0

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
great Dante....amazing !!!
thank you very much...i might come back to you with some questions concerning the code just so i can make some things more clear to me.
if you could reply ..but thanks again

Regards
Sotos13

Of course, tell me what doubts you have?
 
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,918
Members
449,094
Latest member
teemeren

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