Tracker
HOME    TRACKER    Excel

# How To Calculate Combinations ?

## I want to see how much combinations are possible when i got 6 numbers.. -- got this numbers 1--2--3--4--5--6 -- want to calculate how much combinations of ( 2 ) numbers possible -- want to calculate how much of ( 3 ) numbers possible -- want to calculate how much of ( 4 ) numbers possible -- want to calculate how much of ( 5) numbers possible -- never 2 same numbers together (2-2) or (2-2-3) or (2-2-3-4) may not be in list -- How can i make the result visible in kind of list ? I would be nice if somebody knows a good solution..

Related Forum Messages:
Calculate All Possible Combinations
I have check list of 14games. With this I'd like to make combinations.

Each row has one default value for unchecked rows of 3 columns in the list.

Calculate The Combinations Of Entries
(I am unable to use Colo’s HTML Maker to post this—I have noticed several newer members indicating the same thing).

|....| 1 | 2 | 3 |4 | 5 | 6 | 7 | 8 |
| A | Y | N | Y | N | Y | Y | N | N |
| B | Y | N | N | Y | Y | N | N | N |
| C | Y | Y | N | Y | N | Y | Y | N |
| D | Y | Y | Y | N | Y | Y | N | Y |

The answer to the table above is: 144 combinations (using "Y" entries only). The answer is not to do just a simple count of the entries in each row and multiply as this produces 360 combinations rather than the desired 144 combinations. In this example, combinations such as 1-1-1-1 or 5-4-4-3 would not need to be calculated, which is the reason the answer is not 360 combinations.

The table always allows for 8 x 4 cell entries.
It is possible that every cell can be selected (the answer would be 8!/4! in this instance);
At least one entry must occur in each of the first 3 rows. In this example, if row 4 was excluded the answer would be 38 combinations (3 rows);

I am looking for 2 formulae: The first one to calculate the combinations of entries in 4 rows and the second to calculate for 3 rows only.

Getting Excel To Calculate All Combinations Of A Set Of Data
I've found myself having to use a spreadsheet to calculate some acoustics problems, (problematic frequencies, called modes, in orders ranging from 0,1,2,3....).

Ideally what I want to be able to do is simply to get Excell to calculate all the possible combinations of these modes.

A combination could be:
000
011
101
110
111
012
143
etc.

Obviously this is a nightmare to input by hand, is there any kind of function I can use to help with this process?

Also these frequencies only need to be calculated up to a certain point, so is it possible I could also instruct the cell to only display a value if it is less than a value in another cell?

Calculate Number Of Hours Between Two Date/time Combinations
I am trying to find a way to calculate the number of hours between date/times found in separate rows. The attached data set will help to envision what I am talking about.

For each couple of rows, I need to find a way to calculate the number of hours elapsed from row 1 to row 2. In the first example, to calculate the number of hours between 12/2/2009 8:56:51 and 12/4/2009 6:35:27.

Number Combinations :: 25 Random Numbers (5 Digit Combinations)
I have 25 random numbers and I would like to get a possible 5 digit combinations of these numbers. Can anybody help me with the possible formula?

Number Combinations :: Between 7 To 15 (6 Digit Combinations)
What I am looking for is to select between 7 and 15 numbers in total, I want all the possible 6 digit combinations for this.

EG: if I choose 2,9,11,13,15,17&26, it would look something like this

2,9,11,13,15,17
2,9,11,13,15,26
9,11,13,15,17,26
And so on.

If I chose more numbers (10) 1,2,3,4,3,6,7,8,9,10 it would start something like this

1,2,3,4,5,6
1,2,3,4,5,7
1,2,3,4,5,8
1,2,3,4,5,9
1,2,3,4,5,10
And so on.

Please remenber I would like to be able to secelt between 7 and 15 number and be given all the possible combinations.

I would like it to be in one sheet but if that can not be done on as many as it takes.

It would be good if I could just type the required number into A1,B1,C1 and so on and they just gave the combinations required.

Combinations Using Formula
I've attached an Excel..Its a small 4X4 matrix with numbers filled inside...Next to the right is a Combinations Column..I want to know how can i use just forumla to optain 4digit combination based on the 4X4 matrix. Rule is only numbers from the 4X4 be used.

Given Number Combinations
I want to have a sheet with all the previous drawings for the florida lottery.
Then I want excel to ask me how many numbers do I wish to play.

Then when I say 12 (for example) it would pick 12 numbers from 1 to 53 and match all possible comibinations of thoses numbers to the the previous drawings and tell me wich 12 number combination would have won more times then others. So it would need to compare each possible 12 nmber combination to each other and see wich one won more 6outof6, 5outof5, 4outof4, and 3outof3. Then give me the one with the highest winings

Figure Out The Combinations Available
i'm doing a process and in column N, i would need to have the following combinations:

A1
A2
C1
C2
H1
I1

so basically, a formula that would figure out the combinations available!
can this be done using a formula?

******** ******************** ************************************************************************>Microsoft Excel - Cost Calculator---V5---Try.xls___Running: 11.0 : OS = Windows XP (F)ile (E)dit (V)iew (I)nsert (O)ptions (T)ools (D)ata (W)indow (H)elp (A)boutK39=
KLMN39A12 40B 41C12 42D 43E 44F 45G 46H11 47I11 48J Cost Calculator
[HtmlMaker 2.42] To see the formula in the cells just click on the cells hyperlink or click the Name box
PLEASE DO NOT QUOTE THIS TABLE IMAGE ON SAME PAGE! OTHEWISE, ERROR OF JavaScript OCCUR.

Median Of All Combinations
I have 5 numbers (can be with decimals) in column A (A1:A5). For these
numbers, I want all combinations as well as the median of these
combinations.

I'm pretty far already. However, the median seems to be calculated
wrong.

Display The Combinations
I have a list of numbers from 1 to 20 form a2 to a21, what I would like to do if possible if figure out many combinations of 5 there are for these numbers, and then second if possible display the combinations.

E.g. say there was a total 250000 combinations then show those 250000

Creating All Possible Combinations
I am trying to create a combination list. I have 48 items and I want to create all possible comibinations of 3 items from this group of 48 items.

I did something similar to create all possible combinations of 2 items from the group of 48 items in the attached spreadsheet. This was done manually and was time consumning. I want to do something similar for all possible combinations of 3 items from this group of 48 items.

All my 48 items are listed in rows 4 and 5. I want to enter the number "1" in each column to indicate my selection. Right now I have 2 ones per row. But I want to do 3 ones per row.

Generate All Possible Combinations
Is there an Excel Addin that will let me figure out the total number of combinations for any size number pool I specify (39,49, 53) and with any combination quantity I specify (3, 4, 5, 6)? And most important is that all these combinations be displayed in a column separated by commas.

Is a VBA script designed to handle something this complex.

Find Possible Combinations
I need to find possible combinations for the following example:

a*x + b*y + c*z = t
p = 10

Where
a = 0
b = 5
c = 10
t = 30

x + y + z has to = p

a, b, c, t, and p would be variables that I would specify. The numbers above are just examples. What I would need to see as output would be:

7a, 0b, 3c
4a, 6b, 0c
5a, 4b, 1c
etc...

All Combinations/Permutations
I must first thank the forums for the amazing help in making my life just a little easier, especially member "shg" for helping set up the VBA code to help me.

So I have a sheet to develop all possible combinations of units, the letters with their associated values above, as well as the maximum number of units possible. The user inputs a top value, this is followed by some subtraction leading to a working value with a tolerance level in which the sum of the combinations needs to remain within.

What my predicament is that while the VBA code in the attached book works to develop most combinations, when I input a small number such as 405, the combinations that arise are not complete. The results are shown in the attached workbook: show combinations of H and PP, but any human can read that there should also be 2 HN in the results, as the math add's up to within the tolerance level.

Number Combinations
Here is what my table kind of looks like

A B
4 0.25
7 0.3
2 0.1
3 0.15

4 0.30
1 0.4
8 0.05
2 0.1

Now there is the number and the number(A) that it value it represents (B). This is what I want. I want to see all possible number combinations between the upper and lower A columns listed veritcally under the whole set, with out duplicating any numbers and with the upper numbers only being in the 1st position and the lower numbers being in the second position Ex( 4-1, 4-8, 4-2, 7-4, 7-1, ect, ect (listed vertically). Now in column B under, right beside each possible combination I want to see the result of the two values multiplied (ex. beside 4-1 I would like to see 0.1)

So below that mess listed above I want to see something like this

A B
4-1 0.1
4-8 0.0125
ect
ect
ect

I want to be able to swith the values around and have it automatically make the correction.

How To Count All Possible Combinations
I have a table:

And i need to count all possible combinatins. Result could be as:

Custome who use Voice also use combination:1VOICE ADSLCustome who use Data also use combination:1DATAIP2DATAADSLCustome who use IP also use combination:1IPDATACustome who use ADSL also use combination:1ADSLDATA

Permutation/Combinations
Can this be done in Excel? Using the digits 0,1,2,3,4,5,6,7,8,9 create all the permutations/combinations with limits on some of the digits. The digits 0,7,8,9 can only be used a max of 3 times in any one permutation/combination, digits 2,3,4,5,6 can only be used 4 time in any one permutaion/combination, producing a 5-digit string.
Example of expected results.
0 1 0 2 7

Combinations (not Permutations)
You will find a VBA Code for a PRIVATE example - displaying all 6 numbers combinations out of 10 (1-10).

My code displays them (in column "A") BUT What my question to you is - does someone have a General/Universal code to handle other kinds of combinations.

To my opinion, the usage of Nested (For-Next) Loops will not be the ideal solution - so maybe by using VBA Recursion ?

All Possible Combinations From Groups
I have a set of 13 groups, each with anywhere from 1-9 different variables for a total of 56 variables. I want to find all the possible combinations of 1-5 variables. Only one variable can be used from each group in a combination. Please see attached data sheet.

Combinations Which Are Exclusive Of Each Other
in columns CT, CU, and CV i have listed all possible combinations of 3 produced from the 12 variables (a through l). each combination has a score (listed in column cw). I have sorted all combinations in descending order by score. is there a way I can search all the combinations and select the 4 which have the highest score but are also exclusive? that is, none of the 4 combinations may contain the same variables.

Chart All Possible Combinations
I have 4 groups of 5 variables each. I need to know how to make a chart in excel that lists out all of the possible 4 variable combinations of each.

Example: The groups are Group A, grp B, Grp C, Grp D and each group has 5 variables. You can use one variable from each group for a combination.

All Possible Combinations That Sum Up To X
I have a column of transactions lets say 500 or so, of irregular numbers such as 257,273.80 (not something ou can add up in your head...). I know that of those 500 transactions a handful of them have a sum of lets say 2,877,000.00, which I know. Now I need to find all possible combinations of values in this column that equal a sum I enter.

Create A Table Of Combinations
I have a list of variables, each of which has an associated list of possible values. Simple example:

Fruit (apple, pear, peach)
Snack (Snickers, peanuts, crackers, pretzels)

Now, I need to build a table that for each line has every possible combination:

Fruit Snack
Apple Snickers
Apple Peanuts
Apple Crackers
Apple Pretzels
Pear Snack
Pear Snickers
Pear Peanuts
Pear Crackers
Pear Pretzels
Peach Snickers
Peach Peanuts
Peach Crackers
Peach Pretzels

My table will have over 18000 lines, so building it from scratch will take time...is there an easier way (I'm real rusty on VBA, so that would take a while just to figure out the syntax again).

Concatenating All Combinations From Two Lists
Column A has a list of items beginning in A2:
1
4
11
29
109
234

Column B has another list of items beginning in B2:
CAR
BOAT
TRUCK

Would like to put a list in column D, starting at D1, that concatenates both lists like this:
1CAR
1BOAT
1TRUCK
4CAR
4BOAT
4TRUCK
11CAR
11BOAT
11TRUCK
etc until all combinations have been covered.

Notes:
-Both lists can vary in number of items
-Both lists will never have a blank cell until the end of the list

I am thinking of a looping macro to do this, perhaps a loop within a loop? But I am stumped how to go about this.

I know this should be done in Access. but I need to do it in Excel.

Combinations Of Arrays Using Vba
I need to find the possible combinations for several arrays consisting of binary data. I shall give a simplified example with three arrays and four fields. Lets assume the three starting arrays look as follows:

1 0 0 0
1 0 0 0
1 0 0 0

Each row may contain one field = "1" and all other fields = "0". So the next possible combinations may be:

1 0 0 0
1 0 0 0
0 1 0 0

1 0 0 0
1 0 0 0
0 0 1 0

etc...until:

0 0 0 1
0 0 0 1
0 0 0 1

Assuming k = number of fields and c = number of arrays the possible combinations are k ^ c = 4 ^ 3 = 64. I am looking for vba coding that allows to cycle through all possible combinations and displays them in an excel spreadsheet. Ideally, the code should work for any k and c. Could anyone please give me any pointers as to how to tackle this problem?

p.s. in essence I'm looking for the tabular representation of a tree plan with four branches to commence with, a total of 16 decision nodes, and two possible outcomes (1 and 0)

Generating Permutations And Combinations
For Ex:- If there are three Items.. A B C and forming a group of 2
then the the total no of combinations would be permut(3,1) = 6...

I need this to be shown as follows depending on the no of itmes and no of group no=2 in this case...

Permuations & Combinations are as follows:

AB
AC
BC
CA
CB
BA

Combinations/Permutations Of Values
I have a number 23753.2570, to be precise.

in another column, i have 400 rows filled with different numbers, from 1.4 to 23000,7840.

I need to find out all the possible combinations of which numbers from that 400 can make up 23753.2570.

so if my number was 40,000, and i had 4 cells with 10,000 in them, the outcome will be:

"There are 4 possible combination to your value"
then paste it into a new worksheet with the results
[cell1] = 10000 + [cell2] = 10000 + [cell3] = 10000 + [cell4] = 10000
Total = 40000

i found this code, but i tested it on the example above and it said "All Combinations exhausted" which they wasn't?

Sub findsums()

'This *REQUIRES* VBAProject references to
'Microsoft Scripting Runtime
'Microsoft VBScript Regular Expressions 1.0 or higher

Const TOL As Double = 0.000001 'modify as needed
Dim c As Variant

Combinations - Win Or Draw
I'm creating a spreadsheet regarding football teams and want to lis thte combinations of results for each team.

Specifically, if the team will win or draw.

So, I have 6 teams, each team can either win or draw.

I want to display the combinations of team 1 winning AND team 2 winning AND team 3 winning etc.

List Of All Possible Combinations Of The Integers
A user would input 4 integers.
How can I generate a list of all possible combinations of the integers?

Parking Charges Combinations
I have coins in the following denominations: 10 cents and 20 cents

IF my parking charge is 30 cents, I can pay the charge using:
a: 10 + 10 + 10 cents
b: 10 + 20 cents
c: 20 + 10 cents

= 3 combinations (a, b, c)
= 2 unique (a, b) or (a, c)

If my parking charge is 80 cents
What is the formula to use to find:
(i) The combinations (answer should be 34(?) posible combinations)
(ii) The unique combinations

whilst if the parking charge was 50 cents
Than there would be 8 possible combinations (as the answer to the formula!)

Get All Combinations Listed In Spreadsheet
i know by the formula =combin(49,6) how many combination of 6 numbers there are from a available 49 numbers (13983816).

how do i manage to get all combinations listed in a excel spreadsheet? I would want the numbers in individual cells. For example, Row 1 would show 6 numbers individually from A1 - F1.

I do realise that excel does not have enough rows to do this so may have to continue on other sheets.

Key Show All Of The Possible Combinations
Outside the door of my flat I have a key holder – which has a combination of 4 digits. No-one knows what the combination is, so I’d like to try to find it, clear it and use it.
I wondered if there was a way to use excel to show all of the possible combinations so I can then tick them off as I try them…?

The possible numbers are 0-9, but you cant press a button more than once in any given attempt… so… first possible combination would be 0123… not 0001.

Combinations From Set Of Numbers
I want to do all columns combination that is (C=4^N/(3*N+1); N=4) for numbers 1,2,3,4.

as like this,

1111....2222....3333.....4444.....
1111....2222....3333.....4444.....
1111....2222....3333.....4444.....
1234....1234....1234.....1234....

Searching For 50 Combinations Of Something Out Of Hundreds
ive got table consisting of about 4000 entries. Below is a small example.

[url]

I want to be able to make a button through macro's, where when pressed, it shows only certain postcodes - the way i've been doing it so far is using a combination of If, And, and Or functions to return true or false if a postcode begins with either 'AH4, AH1' and has an order number beginning with 'W', for example. Then I'd record a macro where it shows the ones showing true, via data filter. The problem I've got is I need to search for about 50 different combinations of postcode, out of a list of maybe 300 types of postcode, and using my current IF,AND,OR functions, I simply run out of room in the formula bar! For example, I need find a postcode beginning with CB1-25 (i.e. CB1, CB2, CB3) etc..etc.. the only problem is if i use my current LEFT function, and i want to search for say, CB1, CB14, CB15, out of a list of 'CB1,CB14,CB15,CB16', it will still return a postcode beginning with CB16, due to the CB1.

In the link I've highlighted the postcodes I want to search for out of that small list, and hopefully any solution I'm giving here I could expand to up to 100 combinations out of 500 combinations of postcode, for example.

How do I get it to search for a massive combination of criteria?

Repeated Combinations After Sorting
What I’ve done is mix up set of results to give me every combination of 8 sets of 3 (6500 combinations), when I summed every row (combination), and sorted then numerically it looks like I have some combinations that are exactly the same.

All Combinations Or Permutations From 2 Lists
I've got what I think is a pretty interesting problem, not sure if it can be solved with Excel, and if not that's fine I'll think of something better but thought I would put it up here.

I have two lists, one of adjectives, one of nouns. I want somehow to generate every possible combination of the two. Eg:

List 1:

List2:
Noun1
Noun2
Noun3

gives us:

Is there a way to solve this problem using a macro or a pivot table?
NB ideally i would like all possible combinations to include reversals. i.e. 'Noun1&Adj1' and 'Adj1&Noun1' etc.

Number Of Combinations Across Fields
I wish to calculate the total number of combinations using the number of entries in 6 fields regardless of what the actual entries are. In other words only the number of entries are relevant. They look as follows for example:

Field A1=4; Field B1=3,5,12; Field C1=9,2,11; Field D1=14,1,5; Field E1=18,2; Field F1=3,7

Calculating it using a calculator is too tedious since I have several rows of data with similar entries. I just need to know what the total number of combinations are eg in the above example 1X3x3X3X2X2=108 using some excel formula.

Matrix Combinations And Permutations
i've got 2 numeric numbers one in each cell. These numbers indicate Maximum occupancies for a hotel room...

3 5

The Occupancy table looks like this

Adults Children Infants... so taking the above numbers the table should be built up like this

1 0 0
2 0 0
3 0 0
1 1 0
1 2 0
1 3 0
1 4 0
1 1 1
1 1 2
1 1 3

3 2 0
3 0 2
3 1 1

etc...

so basically to room can have a maxium of 3 adults and 2 children equaling the maxium room occupancy.

i'm trying to create a function that will automatically do this and workout subsquent numbers below the maxmium but i can't get anywhere near the result i am looking for...

Generating A Combinations List
I have ten numbers (i.e. 1,2,3,4,5,6,7,8,9,10) and I'm trying to figure out how to make Excel generate a list of all the combinations possible for these 10 numbers. I'm trying to avoid using a VBA script. Is it possible to accomplish this task only using a function formula? This way I will have the ability to tweak the formula and test different qauntities of numbers (i.e. 1,2,3,4,5,6,7 or 44,56,77,33). Is getting a list of all possible combinations to output on a single column with commas between numbers possible with a formula?

List Character Combinations
I know the COMBIN function, i want to list all combinations from a given set of cells (numbers), each item of the combination - in separate cell. Example:

1 2 3 4 5 a b 6 ....

after combin (x,3) i want to list me this: 123........but each number must be in separate cell (1-one cell, 2 -one cell, 3 -one cell)

124
125
12a
12b
126
234
etc

Find Matching Combinations In Any Order
How do I create a formula that will count the occurrences on each row within the range F7:H106 where the single digit in FJ6 is paired with the 2 digit value in FF7. Match in any order.

example
If FF7=00 and FJ6=1 (Match 00 with 1 in any order)
f7:h7=010, match, count 1
f8:H8=059, no match
f9:h9=100, match, count 1
f10:h10=001, match, count 1
f11:h11=007, no match
Result=count=3

Identify Matches Of Number Combinations
After looking at other similar post titles I could not find a formula to work exactly proper.

I have attatched a sample of my problem. What I need is for cells E4:J4 to look for a match in cells B4:B16 and give a value of " Yes or No " in cell K4 if a match is found. Then copy down formula through E5:J5 to B4:B16 - E9:J9 to B4:B16. As my examples indicate Cells K4 would = yes, K5 = yes, K6 = yes, K7 = no, K8 = no, K9 = yes. Column D is the results, Columns E-J represents all combinations of column D.

I have tried the following formulas but they did not work entirely correct.

= NOT( ISNA( MATCH(\$b\$4:\$b\$16, e5:j9, 0 ) ) )

= COUNTIF(e9:j9,"="&b4:b16)>0

Block Alt Key And All Combinations With It Except
This supposed to block Alt key and all combinations with it except Alt+F1, Alt+Tab and Alt+Shift. But what I get is: if I press Alt+F1 only, F1 is triggered.

Private Function LowLevelKeyboardProc(ByVal nCode As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long

Static kbdllhs As KBDLLHOOKSTRUCT

If nCode = HC_ACTION Then
Call CopyMemory(kbdllhs, ByVal lParam, Len(kbdllhs))
If CBool(kbdllhs.flags And LLKHF_ALTDOWN) Then
Select Case kbdllhs.vkCode
Case vbKeyF1, VK_LSHIFT, VK_TAB
Case Else
LowLevelKeyboardProc = 1
Exit Function
End Select
End If
End If
LowLevelKeyboardProc = CallNextHookEx(m_hDllKbdHook, nCode, wParam, lParam)
End Function

Finding Unique Combinations Of 2 Columns
I have a spreadsheet with two columns:
The first one will always have a 'W' or a 'E'.
The second one will have a three digit code. Like this:

W 507
W 507
W 507
E 504
E 504
W 505
W 505
W 504
W 504

Is it possible to have output that show how many of each combination there is? Like this(for the example above):
W 504 2
W 505 2
W 507 3
E 504 2

Listing All Part Number Combinations
im looking to piece together all possible part number combinations with a one condition:

The values in Column A must come before the values in Column B. The values in Column B must come before the values in Column C. And So forth...

Example: If Column A had the values of A, B, C; Column B had the values of -1, -2, -3; and Column C had the values of -01, -02, -03

The outcome(s) would be: A-1-01, A-1-02, A-1-03 and so forth...

How can I get it to do that? But I need the flexibility of adding on more "options" should the part number be bigger (for future part number combinations).

Permutations Or Combinations Of A Set Of Numbers
I want to output every combination of a set of numbers. These permutations must include combinations that use only a few of the numbers as well as all eight...ie.

1,
1,2
1,2,3
as well as 1,2,3,4,5,6,7,8

The macro below is from
http://www.j-walk.com/ss/excel/tips/tip46.htm
This only produces combinations using every number. I'm not sure how this macro works but hopefully someone with better know how could run with it or break it down for me!

I only need to achieve this once but am pretty sure doing it manually will cause error and or madness

Dim CurrentRowSub GetString() Dim InString As String InString = InputBox("Enter text to permute:") If Len(InString) < 2 Then Exit Sub If Len(InString) >= 8 Then MsgBox "Too many permutations!" Exit Sub Else ActiveSheet.Columns(1).Clear CurrentRow = 1 Call GetPermutation("", InString) End IfEnd SubSub GetPermutation(x As String, y As String)' The source of this algorithm is unknown Dim i As Integer, j As Integer j = Len(y) If j < 2 Then Cells(CurrentRow, 1) = x & y CurrentRow = CurrentRow + 1 Else For i = 1 To j Call GetPermutation(x + Mid(y, i, 1), _ Left(y, i - 1) + Right(y, j - i)) Next End IfEnd Sub

Macro To Concatenate Unique Combinations??
I have the following example values in Column A and I want to concatenate each unique combination to a list.

A
B
C
D

Example necessary output:

A vs. B
A vs. C
A vs. D
B vs. C
B vs. D
C vs. D

Notice there are no duplicates (e.g., A vs. B / B vs. A). I have found many macros that will create all the duplicates but none that will create only unique.

Unique Combinations/Permutations Of Words
I have a list for example:

apple
pear
grape
orange

i'm after some code that will create every possible combination of the list.

The examples i've found in the archives give all possible combinations of the same list in a different order

e.g apple, pear, orange, grape.......apple, orange, pear, grape.........apple, grape, orange, pear etc etc etc... THIS IS NOT WHAT I'M AFTER.

i'm after every possible combination starting right at the beginning with single words

e.g

apple
apple, pear
apple, pear, orange
apple, pear, orange, grape
pear, orange,
pear, orange, grape
orange,
orange, apple

etc etc you get the idea..... but i do not want repititions like

apple, pear.........pear, apple.
apple, orange, pear ...........pear, orange, apple.

Probability Combinations Of Events Occuring
I need a probability distribution for amounts to be shipped taking into account both the probabilty distribution on parcel sizes (amounts to be shipped) per ship as well as the probabilities on the number of ships arriving.

Say you have a probabilty distribution for ships arriving, i.e. the probabilty of 1 ship arriving in a specific time period= 0.25 ( event a), the probabilty of 2 ships arriving = 0.2 (event B) etc. Please take into account that this can go up to about 20 ships per time period.

Each ship can have one of four parcel sizes, (demand that needs to be met) (the following are just example probabilties)

0 tons with a probability of 0.67 event 1
1000 tons with a probabilty of 0.08 event 2
1500 tons with a probabilty of 0.222 event 3
2000 tons with a probabilty of 0.022 event 4

Thus event a has a probabilty of occuring, in event a, events 1to 4 can occur with their respective probabilties.

I assumed events 1 to 4 stay the same for all ships arriving (as we are dealing with multiple products, each product will have different parcel size distributions, however I look at products seperately, thus only one product is considered here)

This is simple for 1 or 2 ships, but as the number of ships increase the number of combinations become excessively large.

Should i use a macro that determines permutations/combinations? I am kind of clueless on this one.

If it helps to put the problem in context; I am trying to determine a demand distribution as input for a stochastic programming model