List Combinations dynamically, using VB.

jmaruta

New Member
Joined
Jan 20, 2014
Messages
8
Hi guys,

I need your help. Tried to check other post, but they don't exactly apply to my case.

So...

I have a list of names (let's say: A,B,C,D,E,F,G,H,I and J) and each one of them as a number - integer, (e.g. A-34; B-100; C-5; etc...) in another collumn.

Now, i would like to have a code that would publish all possible combinations taking into account 2 things:

- the Order of each letter matter;
- the sum of the numbers in each combination, cannot be more than 33;
- I might need to add letters (K, L, M, ...) and related numbers, frequently.

And if the Order restriction didn't apply, how would it be?

Thanks in advance for your help.

Any details, please be free to ask.

Best regards.
 
Last edited:

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Firstly, when order matters, it's called permutations. When order doesn't matter, it's called combinations. This can be VERY important depending on how many names we're dealing with; it could be the difference between thousands of calculations and billions.

If I understand what you're saying, you want to order the names (letters) in some way (alphabetically?), but you only want to include those names whose corresponding numbers sum to 33 or less. Is this correct? Also, how many names are you dealing with, and what is the format?
 
Upvote 0
Thks for your quick answer.

I'll be dealing with around 10 names (min:5; max:20).

Trying to explain in other words, i would like to get a function that for each set of names (letters) and their corresponding numbers would give me all ways there is to arrange the letters in groups, taking into account that the sum of each group cannot be more than 33.

Example:

Column A: A | B | C
Column B: 10 | 33 | 3

Result: B + A&C

thks
 
Upvote 0
I started working on this only to come to a pretty substantial stumbling block. Basically, I don't know a way to skip those combinations that have already been chosing. I could probably come up with a way to work around it, but I just don't have the time to do so.

I hate to do this, but it doesn't look like I will be able to help you further. Sorry.
 
Upvote 0

Forum statistics

Threads
1,214,520
Messages
6,120,008
Members
448,935
Latest member
ijat

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