Unique Combinations/Permutations Of Words
May 16, 2008
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.
View 9 Replies
ADVERTISEMENT
Apr 23, 2008
I'm trying to figure out how to generate all combinations from a list
of N values in a column, let's say column A. In particular, I want to have all combinations of 2 values, 3 values, 4, ... up to 7 values. To give an example: Let's assume I have a list of only 3 values (1,2,3) for which I want to have all combinations of two values. In this case, the result would be 1,2; 1,3; and 2;3. The ordering of the values does not matter, i.e. duplicates should be eliminated.
View 4 Replies
View Related
Dec 6, 2011
I have 15 different words that I want to order in as many ways as possible, but only 3 at a time.
So let's say the words are:
cat
dog
elf
clown
monkey
rock
bananas
(etc)
then I want a list that has all of these possible combinations:
cat dog elf
cat dog clown
cat dog monkey
cat dog rock
cat dog bananas
cat elf clown
cat elf monkey
(etc)
until all are listed. I understand there is a huge number, I don't mind having a couple of thousand as long as they are all genuinely unique.
I CAN have elf dog cat, elf cat dog, dog elf cat later on ... it's just the order that needs to be unique not the words in the phrase.
View 9 Replies
View Related
Apr 26, 2006
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 ?
View 3 Replies
View Related
Jun 2, 2007
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.
View 9 Replies
View Related
Jun 27, 2009
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
View 10 Replies
View Related
Mar 1, 2013
I own a custom print shop and I am trying to generate skus based on variables..Column A will only have one item (the product code), column B will have the sizes, Column C may contain more or less colors depending on what is offered for the shirt style, Column D hopefully can contain all the combinations. All this data will be in contained within one worksheet..
Column A
Column B
Column C
Column D
G200
S
Red
[Code] .......
View 3 Replies
View Related
Mar 11, 2009
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
View 9 Replies
View Related
Oct 5, 2006
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
View 9 Replies
View Related
Oct 24, 2006
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:
Adj1
Adj2
Adj3
List2:
Noun1
Noun2
Noun3
gives us:
'Adj1&Noun1', 'Adj1&Noun2', 'Adj1&Noun3', 'Adj2&Noun1' ... etc etc
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.
View 9 Replies
View Related
Mar 15, 2007
i've got 2 numeric numbers one in each cell. These numbers indicate Maximum occupancies for a hotel room...
Maximum Adults Maxmium Occ
3 5
The Occupancy table looks like this
Adults Children Infants... so taking the above numbers the table should be built up like this
Adults Children Infants
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...
View 8 Replies
View Related
Feb 14, 2013
I have two columns of data in a worksheet, and I need a third column that shows all of the possible combinations of the data in those two columns. For example:
A
A
AA
B
B
AB
[Code] .....
I don't need permutations so, for example, the third column should only give the combination "AB" and exclude "BA".
View 4 Replies
View Related
Aug 30, 2006
I was just wondering is it possible that a excel spreadsheet could find all the different combinations for these set of letters. Also i can only have 1 letter from each group per combination.
First Group ABCDE
Second Group FGHIJK
Third Group LMNOP
Forth Group QRST
Anyone know is this is possible to create?
View 4 Replies
View Related
Aug 23, 2009
I need to figure out how I can get excel to write me a list of permutations / combinations for the Group (column a) and Item (column b) columns in the example. The group designates the items that should be inlcuded in the combination / permutation in Related Items (column c). I have thousands of lines to do this with so I need to figure a way to automate it. I have started the Related Items column which is the results I need output. If it could format it like this adding in the space between the rows as it outputs the answer that would be perfect. Anyone know how to do this? I've found many answers, but none that have 2 columns with separate grouping within the column.
View 4 Replies
View Related
Jul 23, 2012
I need VB codes for an activity in excel. Im trying to create an example file for the suppliers to enter keywords (Search keyword) where it should generate different formats of the search (WORDS) and its case sensitive. Suppliers would be typing the keywords in A2 and it should generate the Permutations horizontally against the keyword (B2 C2 D2 E2 etc). Let me know if you need more clarifications.
Example given below and also attached the file for your reference.
New Keyword – Singular Proper Case
Singular-PR
Singular-LC
Singular-UC
[Code]....
View 4 Replies
View Related
May 30, 2008
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
View 14 Replies
View Related
Sep 10, 2009
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.
View 3 Replies
View Related
Jul 2, 2014
I have a table with 6 columns (A to F) and multiple rows each, with cells containing words. Taking the words in any one cell from each of the columns in order from A to F will form a complete sentence each time. I need a solution to display all unique possible combinations in column G.
The number of rows is different for each column. A successful result in column G has to include cells from all columns (A to F).
I searched this forum and found a few analogous questions/solutions, but nothing close enough for me to apply to my case. I tried using a concatenation formula, but I have to manually edit the formula in each cell to get all unique combinations (and that would mean thousands of times). If I just drag the formula down it will increment all cell rows instead of one cell's row at a time.
Here's an example : all possible unique combinations.jpg
View 7 Replies
View Related
Apr 20, 2014
I have two columns in a spreadsheet, and I need to write a formula to determine how many times each combination shows up. Example:
SKU-A Location1
SKU-A Location1
SKU-A Location2
SKU-B Location1
SKU-B Location7
SKU-B Location7
SKU-B Location8
SKU-B Location8
SKU-B Location8
SKU-B Location8
I want it to have the data converted to be like this (with the third column being the the number of times that combination appears):
SKU-A Location1 2
SKU-A Location2 1
SKU-B Location1 1
SKU-B Location7 2
SKU-B Location8 4
View 6 Replies
View Related
Mar 26, 2012
I coordinate access requests for several contracts, and I have to list the approved accesses in a list where each line represents one person and one contract. For each access request, there will be an arbitrary number of persons obtaining access to an arbitrary number of contracts.
The input would then be as follows: Joe A and Jill B request access to contracts 1001, 1002 and 1003 ->
Joe A 1001
Joe A 1002
Joe A 1003
Jill B 1001
Jill B 1002
Jill B 1003
To automate this task, I have made a simple macro for generating a combination list of all persons having obtained access to a selection of contracts.
My macro worked well when I only wanted to list unique and independent list items, but now I have been asked to include each person's email address. How I can change my code so that only one email address is copied into my list for each person?
Code:
Sub AccessList()
Sheets("requests").Select
Dim rng As Range, c As Range
Dim rng1 As Range, c1 As Range
Dim rng2 As Range, c2 As Range
[Code]....
View 1 Replies
View Related
Sep 30, 2008
Usually it's to count for one unique word in a cell. But what if I have 2 or more unique word in a cell and need to be counted for?
for example
10827Holiday Decorations & Party Supplyholiday decoration supply10827Holiday Decorations & Party Supplyseasonal decorative
this category has 5 unique words in the synonym list
11044Facial massagerfacial11044Facial massagerbeauty care product11044Facial massagerbeauty appliance11044Facial massagerbeauty11044Facial massagerbeauty care11044Facial massagerbeauty product11044Facial massagerfacial appliance
this category has only 5 unique words although the synonym list is much longer.
View 9 Replies
View Related
Jan 16, 2010
I would like to modify the below macro so it only counts a word once even if it appears more than once in a row. The reason I want to do this is so I can get a snapshot of the data without certain terms being over-represented.
For example, in the attached example the word 'Microsoft' appears 5 times in row 4 but I only want this to be counted once. In the whole data set Microsoft appears 20 times but only in 7 of the 20 rows so I would like the count to be 7.
The example is set out as follows: In column B there is a description field which in practice will contain consumer complaints and inquiries. To keep the data anonymous the description is filled out with random words and all other columns are blank. The output of Andy Pope's unique word counting macro appears in I:J.
View 12 Replies
View Related
May 9, 2014
in column A i have fruit words (e.g. apple, banana, orange...)
in column B i have cities (e.g. london, paris, rome...)
i would like a formula in column C that gives "british apples" when "apple" and "london" are on the same row
whilst also giving "french bananas" when "paris" and "banana" are on the same row.
View 10 Replies
View Related
Dec 15, 2008
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?
View 9 Replies
View Related
Jun 30, 2008
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.
View 9 Replies
View Related
Sep 20, 2006
I have a column of words in Column A and I want to replace all the times that these words appear in the rest of the excel sheet with the words in Column B. If someone has already answered a similar problem link me to the thread because I can't find anything.
View 5 Replies
View Related
Jun 3, 2014
I'm looking for a macro to remove all words (in a single word per cell format) in a range (approx 100 columns & 7000 rows), except for a list of 100 words.
I'd prefer to email the file if that's okay.
View 7 Replies
View Related
Jul 16, 2009
I've been using conventional method to do this and it's time consuming. I would like to total up 2 column. A multiply B to be exact. Below are some examples:
Table 1 - Before totaling up:
Quantity
Product
5
2 x Button A White
3
4 x Button B Pink
4
5 x Ribbon A Black
2
3 x Thread A White
6
2 x Cloth A Blue
Table 2 - After totaling up:
Quantity
Product
10
Button A White
12
Button B Pink
20
Ribbon A Black
6
Thread A White
12
Cloth A Blue
I need to have the sum of the "Quantity" multiply "Product". Or in short A x B.
And the end result need to have the number and "x" sign removed while keeping on the the products names. (2 x ) Take note it's "number" space "symbol" space.
View 9 Replies
View Related
Jun 23, 2006
I am trying to find certain words in a column and delete the word and characters following. For example, Say I have a column of info as seen below. This is a test of me. I am just experimenting with this stuff. Deleted (6/15/01) Let me know what you think. I am not sure about it all, but I guess I will figure it out. riviledge1 (01/05/06) Now let's see what happens when I try to test it.
I want to find all the "Priviledge1 (01/05/06)" and replace with nothing. Please note, the date will change with each record, so I need to figure out how to tell Excel to find "Priviledge1", delete it and the date behind it. So I want to delete "Priviledge1" and the next 11 characters including the space.
View 3 Replies
View Related
Feb 4, 2013
On to the topic, I have all the US and Canadian states abbreviated (CO = Colorado, etc.) and was wondering if there is a way to make all of them convert to their respective names in one fell swoop instead of writing it in for each one, one at a time. Something along the lines where I can make, CO = Colorado, TX = Texas and then hit enter and all of the abbreviations would convert. Some kind of command.
View 2 Replies
View Related