VB For Combinations Permutations (3 Datasets)
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
ADVERTISEMENT
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 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
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
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
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
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
Apr 9, 2014
I have a spreadsheet that lists users plus 4 columns of data horizontally and other data vertically. See image forum_sheet.png
My problem is the sheet is getting wider and wider as users are added. What I would like to be able to do is have a dropdown or something that allows me to select a users name which would then display their data set [ four columns ] on its own. I have tried validating a dropdown list but this only works on a single column.
See image forum_sheet_2.png
View 1 Replies
View Related
Aug 3, 2014
What's the best way to look at two sets of data in excel and make comparisons between them. For instance how many matches (and what are the matches). Workbook attached as an example.
matches between data.xlsx
View 8 Replies
View Related
Jun 19, 2014
So I have two sets of data, I've attached a worksheet which has them both. The datasets have different intervals, but I need to drag "Colour" from Data2 into Data1 and associate it with the correct interval. Sometimes the intervals match up and sometimes they don't - which could be a problem, but as long as its within a small spread it's fine. The "Colour" column in Data1 is filled with my desired result, the source being Data2.
ManyToMany_Example.xlsx
View 3 Replies
View Related
Jul 24, 2014
I have several data sets taken from an instrument recording the same sample. The data are noisy so I would like to average them. Annoyingly, the operating software for the instrument allows you to specify start and end values, but not the amount of points in between (unbelievable, I know). I therefore have data which looks like:
25, 1
25.1, 5
25.6, 7
25.8, 10
25.9, 12
and
25.1, 1
25.4, 4
25.7, 6
25.9, 14
So each replicate has a different sampling rate (the data set is much larger than the example above though). Is there any built-in Excel function to standardize these data to a fixed amount of x values, and perhaps averaging both the X and Y values of all points within the bin?
View 4 Replies
View Related
Dec 10, 2013
I have a large set of data in an array of many cells. I need to subtract a fixed amount from each of these cells without changing the location of the cells as there are many different references too them Is there a way to do this?
View 3 Replies
View Related
Aug 7, 2013
I'm trying to work out a way to use a MAX function and IF Function to determine how i can find the highest number since a trade began. For example, i have a countif function that is identifying each trade (Column B) so what i want to do is to find the highest number for each trade (Column A) which is represented by dummy variable 1,2,3,4 etc. Please see example below: what i want to do is write code which runs for 3500 lines and finds the highest price since trade began and trade's are represented by 1,2,3,4,5,6,7 etc.
Close
Number
TRADE PRICE
HIGH PRICE
0.6347
1
$0.63
0.6565
0.6373
1
$0.63
[Code] ........
View 7 Replies
View Related
May 30, 2014
If I have ten numbers which I would like to split into 5 buckets (1,2,3,4,5) how can I best achieve this?
A trivial example:-
The series 12, 12, 18, 18, 25, 25, 34, 34, 40, 40 would neatly spilt into 1, 1, 2, 2, 3, 3, 4, 4, 5, 5.
Similarly
The series 12, 13, 18, 19, 25, 27, 33, 34, 40, 41 would neatly spilt into 1, 1, 2, 2, 3, 3, 4, 4, 5, 5.
A non-trivial example
The series 12, 13, 40, 41, 42, 50, 70, 71, 89, 90, 91 I would like to be split into 1, 1, 2, 2, 2, 3, 4, 4, 5, 5, 5.
So groupings are based on how close consecutive numbers are to each other and there must be at least one value in each bucket (1,2,3,4,5). The number of data items can vary form 5 to, say 20 or so.
View 7 Replies
View Related
Jun 23, 2014
I have 2 datasets. 1 of them is 5103 lines and other one is 5121. They contain the samde data but as you can see one of the dataset have 18 more lines than the other. Because of this I can not copy a columns from one dataset to other because the values will not match with the correct ones because of the line differences. How can i compare for different rows or how can i copy at least the 5103 line correctly and than fill other 18 by hand ?
View 1 Replies
View Related
Feb 24, 2009
I'm sure I should be able to do this but my brain is out of gear today!
Can someone tell me how I can create a list of every 5 letter permutation using only letters (A-D).
I also need to do the same for 4 letter and 3 letter, again using A-D.
Would prefer to do it without VB but if this is the only way......
View 6 Replies
View Related
Jul 23, 2007
I am creating a class of permutations. The problem is that there are many ways to describe what a permutation does. for example.
Dim aPerm As New clsPermutation
Dim bPerm As New clsPermutation
aPerm.DoesTranspose(2,3) : Rem aPerm.Action({a,b,c}) = {a,c,b}
MsgBox (aPerm Is aPerm.Inverse)
I want the message box to return True. But since aPerm and aPerm.Inverse are different instances of clsPermutaion, it returns False. (.Inverse is a read-only property that returns a clsPermutation.). What I would like to do is have a collection, myPermutations. When I specify the action that aPerm does, I would like
1) if nothing in myPermutations does the same thing as aPerm, then add aPerm to myPermutations.
2) if something (xPerm) does the same thing as aPerm, then
Set aPerm=xPerm
so that "xPerm Is aPerm" returns True.
The problem I have is that in the class module,.....................
View 8 Replies
View Related
Jul 10, 2014
All of the strings are in one column and are in General format. They contain a few different types of strings: some only numbers, some numbers separated by commas (which makes them NOT numbers according to ISNUMBER), some text only, some text and numbers (separated by comma), some are 3 numbers, each separated by comma, etc.
ldJBlt9.jpg
What I'm looking to do:I want each of these distinct types filtered out someway. I've already done ISNUMBER to filter out the values which are numbers only, no commas. Perfect.
For the next step, I'd like to filter out cells which have only numbers and commas. The comma itself makes them considered not numbers, so how do I add the condition that I'm looking for cells with digits and a comma? A wildcard?
Edit: I've found the following formula which can check if it contains a comma, but doesn't specify between digits or text. Just commas. =IF(ISNUMBER(FIND(",",A1)),"TRUE","FALSE")
View 1 Replies
View Related
Aug 8, 2013
I am collecting data the temperature of an animal, i am also collecting ambient temperature at the same time when i plot the two data sets there is an 89% Correlation so i know the animal temperature is affected by the ambient temperature. i want to be able to take this influence of ambient temperature out of the recorded temperature. I dont think its a linear relationship
View 5 Replies
View Related
Nov 2, 2013
indexing complete data sets for each entered value. see example to better understand what I am trying to do. I have been trying for weeks.
Steve
INDEX.xlsx
View 14 Replies
View Related
Mar 12, 2012
I have a list of people whose direct reports have either completed or not completed a task at work, and there are four tasks. The records look like this (I've removed the direct report's name, which is to the left):
Manager NameTask 1Task 2Task 3Task 4Mickey SmithCompleteCompleteCompleteCompleteDanny Ledbetter
IncompleteIncompleteCompleteCompleteDanny LedbetterCompleteCompleteCompleteIncompleteMickey SmithCompleteCompleteCompleteIncompleteMickey SmithCompleteCompleteCompleteIncompleteMickey SmithIncompleteCompleteCompleteIncompleteDanny LedbetterCompleteCompleteCompleteComplete
I want to pivot the data so that for each manager I can see the % who completed Task 1, the % who completed Task 2, etc. preferrably in a horizontal format.
So, I can get this easy enough for the first task:
Count of Task 1Column LabelsRow LabelsCompleteIncompleteGroup 1Danny Ledbetter67%33%Mickey Smith75%25%
However to the right of this I want the results for Task 2, 3, and 4. The best I can do is the following:
Column LabelsCompleteIncompleteRow LabelsCount of Task 1Count of Task 2Count of Task 1Count of Task 2Danny Ledbetter67%67%33%33%Mickey Smith75%75%25%25%Grand Total71%71%29%29%
The results for Task 2 are incorrect. I've tried % of Row, % of Parent Row, and all the other calculations, and can't seem to get it. I've also tried putting the fields in the Column Labels box, the Values Box, etc.
I can even get this if I put the SumValues field in the Row Labels, which yields a vertical result, but still, the values are incorrect (Mickey has 100% completion under Task 2):
Column LabelsRow LabelsCompleteIncompleteDanny LedbetterCount of Task 167%33%Count of Task 267%33%Mickey SmithCount of Task 175%25%Count of Task 275%25%Total Count of Task 171%29%Total Count of Task 271%29%
View 2 Replies
View Related
Mar 9, 2013
I have a large collection of datasets, sorted/grouped by rows. I need to perform some calculations against these SETS (Ave, Low, Median, etc.).
The number of member in each SET is variable (1 to NN), the number of SET Members is included in the data. Example:
Code:
3 Data Sets:
Row Set Members Price Ave
1 A 4 $1.00
2 A 4 $1.25
3 A 4 $1.50
4 A 4 $1.75
5 B 1 $4.00
6 C 3 $10.45
7 C 3 $14.50
8 C 3 $17.75
how to compute the AVE value for each SET above?
I am thinking if I can determine the FIRST Row number for each set, add the MemberQty as an ~offset to determine the LAST Row, then use an Indirect reference to compute the ave, something like:
=AVERAGE(INDIRECT("D"&A1&":D"&A1+C1)) The SET's Ave value should be added to EACH row in each SET.
I am struggling trying to point a formula like this to the First Row of the NEXT set.
View 3 Replies
View Related