Identify set of values which total is given value - vba

Darshan Shah

New Member
Joined
Jul 4, 2020
Messages
11
Office Version
  1. 365
Platform
  1. Windows
Hello All,

As I am a new learner, stuck in a position with a large data bank.

I have a worksheet. In column A, Packet numbers are there (For example, Packet-1, Packet-2,......Packet-n).
In column B, weight of packets (For example, 1000 kg, 2000 kg, ..... ).
Permissible weight per vehicle is give as Minimum & Maximum kg which is variable.

I need to write a macro which will give output as a combination of packets with weight for each vehicle.

For example,

Total weight of Packet-1 , Packet-3, packet-4, Packet-10 & Packet-12 will be within a limit of Vehicle-X.

Total weight of Packet-2 , Packet-5, packet-6, Packet-7 & Packet-9 will be within a limit of Vehicle-Y.

Total weight of Packet-8 , Packet-11, packet-13, Packet-14 & Packet-15 will be within a limit of Vehicle-Z.

Up to all available vehicles...

At last, no packet should be left in a factory.
smile.gif


I hope this above example is understood and helpful too.
smile.gif


Thank you.
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,227
Messages
5,768,927
Members
425,506
Latest member
Coder33

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
Top