Combinatorics problem (VBA code)

adigada

New Member
Joined
Dec 18, 2014
Messages
2
Hi guys. Is it possible for us to process a combinatorics problem from Excel?
For example, say I have 2 columns A & B. Column A contains 100 orders of quantities of items from 1-10 (with repetitions), and Column B contains rate per unit of that item. Let's say I set a parameter in which I say that the total no.of items required is 150. I want the output in two ways :
1. Total no.of combinations of item quantities possible that total up to 50 (10+10+10+10+10, 10+10+10+10+9+1, 10+8+2+10+10 and so on).
2. Output showing the break up of those combinations alongwith the corresponding average rate from those specified in column B.
Is this possible via a VBA code?

Input
Order quantitiesRates
112.25
211.30
314.70
410.55
410.10
39.85
210.80
111.95

<tbody>
</tbody>

Output parameter value = 10

Output

No.of possible combinations : _____

<tbody>
</tbody>


List of combinations
Quantities CombinationsAverage Rate
4+4+210.17
4+3+311.55 (Picking up the value of 4 as 10.10)
4+3+311.70 (Picking up the value of 4 as 10.55)
4+3+2+110.68
4+2+2+1+111.37

<tbody>
</tbody>

It would be great if someone could come up with a VBA for this. Would save up a lot of manual time and labour.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

Forum statistics

Threads
1,214,388
Messages
6,119,227
Members
448,878
Latest member
Da9l87

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