Generate all possible permutations given input values
Please note my question is different from the suggested duplicate. The suggested duplicate does not show all possible variations based on the number of options, so an input of 3 can have a variation of 1, 2, and 3 of the inputs. The suggested duplicate always provides 3 inputs per variation.
Furthermore, my question also asks for variations to show all possible orders of the inputs too. The suggested duplicate always shows column A at the left most position of the output, column b in the middle of the output and column c at the left of the output.
Therefore, the suggested duplicate does not answer my question.
Original Question
How do I go about creating a formula which takes any number of given input values, and then generates an output value with all possible combinations permutations based on the input values given.
For example, if the input values where as following
One
Two
The output generated should be something like this
One
OneTwo
Two
TwoOne
Here is what it should look like if 3 values are given:
Does anyone know how to do this in Excel?
I would like to be able to type in any number of input values and the input values will be any word, phrase, number, letters, or a combination permutation of all of those.
I have given this a try https://www.ozgrid.com/forum/forum/help-forums/excel-vba-macros/146983-all-possible-combinations-from-single-column but it does not seem to work.
In column A, if I type (one word per row):
One
Two
Three
In column B the VBA gives me (in a single cell):
one,two,three
It doesn't give me all possible combinations permutations, it just changes what I typed in vertically down a column, and outputs the results horizontally.
microsoft-excel vba microsoft-excel-2016
|
show 6 more comments
Please note my question is different from the suggested duplicate. The suggested duplicate does not show all possible variations based on the number of options, so an input of 3 can have a variation of 1, 2, and 3 of the inputs. The suggested duplicate always provides 3 inputs per variation.
Furthermore, my question also asks for variations to show all possible orders of the inputs too. The suggested duplicate always shows column A at the left most position of the output, column b in the middle of the output and column c at the left of the output.
Therefore, the suggested duplicate does not answer my question.
Original Question
How do I go about creating a formula which takes any number of given input values, and then generates an output value with all possible combinations permutations based on the input values given.
For example, if the input values where as following
One
Two
The output generated should be something like this
One
OneTwo
Two
TwoOne
Here is what it should look like if 3 values are given:
Does anyone know how to do this in Excel?
I would like to be able to type in any number of input values and the input values will be any word, phrase, number, letters, or a combination permutation of all of those.
I have given this a try https://www.ozgrid.com/forum/forum/help-forums/excel-vba-macros/146983-all-possible-combinations-from-single-column but it does not seem to work.
In column A, if I type (one word per row):
One
Two
Three
In column B the VBA gives me (in a single cell):
one,two,three
It doesn't give me all possible combinations permutations, it just changes what I typed in vertically down a column, and outputs the results horizontally.
microsoft-excel vba microsoft-excel-2016
1
@cybernetic.nomad It looks like the Poster wants all the permutations associated with each combination
– Gary's Student
Jan 15 at 0:16
ORDER is important. in the linked question, order is not important.
– Forward Ed
Jan 15 at 0:24
2
Because there are a finite number of rows (1 048 576) to excel you will be limited to only 9 entries if you wish all the permutations to be written out in a single column. If I did my math right, you will be looking at 986 409 permutations. 10 entries would give 9 864 100 which exceeds the number of available rows.
– Forward Ed
Jan 15 at 0:27
1
I'd be looking at nested loops in vba. Start by writing out all the single entries, then repeat the process starting with the first entry, and loop through the remaining letters, then bump to the next entry and loop through the remaining letters until all the 2 combinations are written. just keep repeating the pattern and eventually all will be written out.
– Forward Ed
Jan 15 at 0:31
1
Here's a screen shot in case it rings a bell for an idea with any Excel functions or add-on features people may be familiar with: i.imgur.com/zTh37v6.png Perhaps there's a PowerShell that can do this, if I knew of something I'd try but this should be easy with a relation type query or join of the data in a table object or something to itself if applicable with some of those features.
– Pimp Juice IT
Jan 18 at 1:53
|
show 6 more comments
Please note my question is different from the suggested duplicate. The suggested duplicate does not show all possible variations based on the number of options, so an input of 3 can have a variation of 1, 2, and 3 of the inputs. The suggested duplicate always provides 3 inputs per variation.
Furthermore, my question also asks for variations to show all possible orders of the inputs too. The suggested duplicate always shows column A at the left most position of the output, column b in the middle of the output and column c at the left of the output.
Therefore, the suggested duplicate does not answer my question.
Original Question
How do I go about creating a formula which takes any number of given input values, and then generates an output value with all possible combinations permutations based on the input values given.
For example, if the input values where as following
One
Two
The output generated should be something like this
One
OneTwo
Two
TwoOne
Here is what it should look like if 3 values are given:
Does anyone know how to do this in Excel?
I would like to be able to type in any number of input values and the input values will be any word, phrase, number, letters, or a combination permutation of all of those.
I have given this a try https://www.ozgrid.com/forum/forum/help-forums/excel-vba-macros/146983-all-possible-combinations-from-single-column but it does not seem to work.
In column A, if I type (one word per row):
One
Two
Three
In column B the VBA gives me (in a single cell):
one,two,three
It doesn't give me all possible combinations permutations, it just changes what I typed in vertically down a column, and outputs the results horizontally.
microsoft-excel vba microsoft-excel-2016
Please note my question is different from the suggested duplicate. The suggested duplicate does not show all possible variations based on the number of options, so an input of 3 can have a variation of 1, 2, and 3 of the inputs. The suggested duplicate always provides 3 inputs per variation.
Furthermore, my question also asks for variations to show all possible orders of the inputs too. The suggested duplicate always shows column A at the left most position of the output, column b in the middle of the output and column c at the left of the output.
Therefore, the suggested duplicate does not answer my question.
Original Question
How do I go about creating a formula which takes any number of given input values, and then generates an output value with all possible combinations permutations based on the input values given.
For example, if the input values where as following
One
Two
The output generated should be something like this
One
OneTwo
Two
TwoOne
Here is what it should look like if 3 values are given:
Does anyone know how to do this in Excel?
I would like to be able to type in any number of input values and the input values will be any word, phrase, number, letters, or a combination permutation of all of those.
I have given this a try https://www.ozgrid.com/forum/forum/help-forums/excel-vba-macros/146983-all-possible-combinations-from-single-column but it does not seem to work.
In column A, if I type (one word per row):
One
Two
Three
In column B the VBA gives me (in a single cell):
one,two,three
It doesn't give me all possible combinations permutations, it just changes what I typed in vertically down a column, and outputs the results horizontally.
microsoft-excel vba microsoft-excel-2016
microsoft-excel vba microsoft-excel-2016
edited Jan 25 at 23:26
oshirowanen
asked Jan 14 at 21:33
oshirowanenoshirowanen
609104370
609104370
1
@cybernetic.nomad It looks like the Poster wants all the permutations associated with each combination
– Gary's Student
Jan 15 at 0:16
ORDER is important. in the linked question, order is not important.
– Forward Ed
Jan 15 at 0:24
2
Because there are a finite number of rows (1 048 576) to excel you will be limited to only 9 entries if you wish all the permutations to be written out in a single column. If I did my math right, you will be looking at 986 409 permutations. 10 entries would give 9 864 100 which exceeds the number of available rows.
– Forward Ed
Jan 15 at 0:27
1
I'd be looking at nested loops in vba. Start by writing out all the single entries, then repeat the process starting with the first entry, and loop through the remaining letters, then bump to the next entry and loop through the remaining letters until all the 2 combinations are written. just keep repeating the pattern and eventually all will be written out.
– Forward Ed
Jan 15 at 0:31
1
Here's a screen shot in case it rings a bell for an idea with any Excel functions or add-on features people may be familiar with: i.imgur.com/zTh37v6.png Perhaps there's a PowerShell that can do this, if I knew of something I'd try but this should be easy with a relation type query or join of the data in a table object or something to itself if applicable with some of those features.
– Pimp Juice IT
Jan 18 at 1:53
|
show 6 more comments
1
@cybernetic.nomad It looks like the Poster wants all the permutations associated with each combination
– Gary's Student
Jan 15 at 0:16
ORDER is important. in the linked question, order is not important.
– Forward Ed
Jan 15 at 0:24
2
Because there are a finite number of rows (1 048 576) to excel you will be limited to only 9 entries if you wish all the permutations to be written out in a single column. If I did my math right, you will be looking at 986 409 permutations. 10 entries would give 9 864 100 which exceeds the number of available rows.
– Forward Ed
Jan 15 at 0:27
1
I'd be looking at nested loops in vba. Start by writing out all the single entries, then repeat the process starting with the first entry, and loop through the remaining letters, then bump to the next entry and loop through the remaining letters until all the 2 combinations are written. just keep repeating the pattern and eventually all will be written out.
– Forward Ed
Jan 15 at 0:31
1
Here's a screen shot in case it rings a bell for an idea with any Excel functions or add-on features people may be familiar with: i.imgur.com/zTh37v6.png Perhaps there's a PowerShell that can do this, if I knew of something I'd try but this should be easy with a relation type query or join of the data in a table object or something to itself if applicable with some of those features.
– Pimp Juice IT
Jan 18 at 1:53
1
1
@cybernetic.nomad It looks like the Poster wants all the permutations associated with each combination
– Gary's Student
Jan 15 at 0:16
@cybernetic.nomad It looks like the Poster wants all the permutations associated with each combination
– Gary's Student
Jan 15 at 0:16
ORDER is important. in the linked question, order is not important.
– Forward Ed
Jan 15 at 0:24
ORDER is important. in the linked question, order is not important.
– Forward Ed
Jan 15 at 0:24
2
2
Because there are a finite number of rows (1 048 576) to excel you will be limited to only 9 entries if you wish all the permutations to be written out in a single column. If I did my math right, you will be looking at 986 409 permutations. 10 entries would give 9 864 100 which exceeds the number of available rows.
– Forward Ed
Jan 15 at 0:27
Because there are a finite number of rows (1 048 576) to excel you will be limited to only 9 entries if you wish all the permutations to be written out in a single column. If I did my math right, you will be looking at 986 409 permutations. 10 entries would give 9 864 100 which exceeds the number of available rows.
– Forward Ed
Jan 15 at 0:27
1
1
I'd be looking at nested loops in vba. Start by writing out all the single entries, then repeat the process starting with the first entry, and loop through the remaining letters, then bump to the next entry and loop through the remaining letters until all the 2 combinations are written. just keep repeating the pattern and eventually all will be written out.
– Forward Ed
Jan 15 at 0:31
I'd be looking at nested loops in vba. Start by writing out all the single entries, then repeat the process starting with the first entry, and loop through the remaining letters, then bump to the next entry and loop through the remaining letters until all the 2 combinations are written. just keep repeating the pattern and eventually all will be written out.
– Forward Ed
Jan 15 at 0:31
1
1
Here's a screen shot in case it rings a bell for an idea with any Excel functions or add-on features people may be familiar with: i.imgur.com/zTh37v6.png Perhaps there's a PowerShell that can do this, if I knew of something I'd try but this should be easy with a relation type query or join of the data in a table object or something to itself if applicable with some of those features.
– Pimp Juice IT
Jan 18 at 1:53
Here's a screen shot in case it rings a bell for an idea with any Excel functions or add-on features people may be familiar with: i.imgur.com/zTh37v6.png Perhaps there's a PowerShell that can do this, if I knew of something I'd try but this should be easy with a relation type query or join of the data in a table object or something to itself if applicable with some of those features.
– Pimp Juice IT
Jan 18 at 1:53
|
show 6 more comments
2 Answers
2
active
oldest
votes
The following VBA script created for me this spreadsheet:
This is the script:
Option Explicit
Sub PermutationsN()
Dim vElements As Variant, vresult As Variant
Dim lRow As Long, i As Long
vElements = Application.Transpose(Range("A1", Range("A1").End(xlDown)))
Columns("B:Z").Clear
For i = 1 To UBound(vElements)
ReDim vresult(1 To i)
Call PermutationsNPR(vElements, i, vresult, lRow, 1)
Next i
End Sub
Sub PermutationsNPR(vElements As Variant, p As Long, vresult As Variant, lRow As Long, iIndex As Integer)
Dim i As Long, unique As Variant
For i = 1 To UBound(vElements)
vresult(iIndex) = vElements(i)
If iIndex = p Then
unique = UniqueArray(vresult)
If (UBound(vresult) = UBound(unique)) Then
lRow = lRow + 1
Cells(lRow, 3).Value = Join(unique)
End If
Else
Call PermutationsNPR(vElements, p, vresult, lRow, iIndex + 1)
End If
Next i
End Sub
Function UniqueArray(todoarray As Variant) As Variant
Dim arr As New Collection, a
Dim i As Long
On Error Resume Next
For Each a In todoarray
arr.Add a, a
Next
ReDim returnVal(1 To arr.count)
For i = 1 To arr.count
returnVal(i) = arr(i)
Next
UniqueArray = returnVal
End Function
The macro will work for any number of items in the A column, within Excel limits.
Very nice script Harry +1. I tested and confirmed that this does exactly what is requested. You must have worked hard for the money on this one sir, nice job!!
– Pimp Juice IT
Jan 18 at 17:41
That's an impressive script. Thank you!
– oshirowanen
Jan 19 at 10:54
add a comment |
consider this example
A column data:- Numbers(header) one two three four five
B column data:- OutPut(header)
paste this formula in B2 :-
=IFERROR(IF(INDEX(OFFSET($A$1,1,0,COUNTA($A$2:$A$20)),ROUNDUP(ROWS($A$1:A1)/COUNTA($A$2:$A$20),))=INDEX(OFFSET($A$1,1,0,COUNTA($A$2:$A$20)),MOD(ROWS($A$1:A1)-1,COUNTA($A$2:$A$20))+1),INDEX(OFFSET($A$1,1,0,COUNTA($A$2:$A$20)),ROUNDUP(ROWS($A$1:A1)/COUNTA($A$2:$A$20),)),INDEX(OFFSET($A$1,1,0,COUNTA($A$2:$A$20)),ROUNDUP(ROWS($A$1:A1)/COUNTA($A$2:$A$20),))&INDEX(OFFSET($A$1,1,0,COUNTA($A$2:$A$20)),MOD(ROWS($A$1:A1)-1,COUNTA($A$2:$A$20))+1)),"")
this function works "Numbers" column having data upto A20.
Your formula just gives the permutations for the terms taken one and two at a time, not all permutations. It's possible to do this kind of formula for a specific number of terms, although it quickly gets insane. Even at three entries, the formula is outrageous. See Forward Ed's comment about 9 entries being all that would fit in Excel's row limit, which tells you that if your formula goes up to 19 entries, it's not doing what was asked in the question.
– fixer1234
Jan 18 at 10:25
Thank you for attempting this. :)
– oshirowanen
Jan 25 at 23:25
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1394273%2fgenerate-all-possible-permutations-given-input-values%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
The following VBA script created for me this spreadsheet:
This is the script:
Option Explicit
Sub PermutationsN()
Dim vElements As Variant, vresult As Variant
Dim lRow As Long, i As Long
vElements = Application.Transpose(Range("A1", Range("A1").End(xlDown)))
Columns("B:Z").Clear
For i = 1 To UBound(vElements)
ReDim vresult(1 To i)
Call PermutationsNPR(vElements, i, vresult, lRow, 1)
Next i
End Sub
Sub PermutationsNPR(vElements As Variant, p As Long, vresult As Variant, lRow As Long, iIndex As Integer)
Dim i As Long, unique As Variant
For i = 1 To UBound(vElements)
vresult(iIndex) = vElements(i)
If iIndex = p Then
unique = UniqueArray(vresult)
If (UBound(vresult) = UBound(unique)) Then
lRow = lRow + 1
Cells(lRow, 3).Value = Join(unique)
End If
Else
Call PermutationsNPR(vElements, p, vresult, lRow, iIndex + 1)
End If
Next i
End Sub
Function UniqueArray(todoarray As Variant) As Variant
Dim arr As New Collection, a
Dim i As Long
On Error Resume Next
For Each a In todoarray
arr.Add a, a
Next
ReDim returnVal(1 To arr.count)
For i = 1 To arr.count
returnVal(i) = arr(i)
Next
UniqueArray = returnVal
End Function
The macro will work for any number of items in the A column, within Excel limits.
Very nice script Harry +1. I tested and confirmed that this does exactly what is requested. You must have worked hard for the money on this one sir, nice job!!
– Pimp Juice IT
Jan 18 at 17:41
That's an impressive script. Thank you!
– oshirowanen
Jan 19 at 10:54
add a comment |
The following VBA script created for me this spreadsheet:
This is the script:
Option Explicit
Sub PermutationsN()
Dim vElements As Variant, vresult As Variant
Dim lRow As Long, i As Long
vElements = Application.Transpose(Range("A1", Range("A1").End(xlDown)))
Columns("B:Z").Clear
For i = 1 To UBound(vElements)
ReDim vresult(1 To i)
Call PermutationsNPR(vElements, i, vresult, lRow, 1)
Next i
End Sub
Sub PermutationsNPR(vElements As Variant, p As Long, vresult As Variant, lRow As Long, iIndex As Integer)
Dim i As Long, unique As Variant
For i = 1 To UBound(vElements)
vresult(iIndex) = vElements(i)
If iIndex = p Then
unique = UniqueArray(vresult)
If (UBound(vresult) = UBound(unique)) Then
lRow = lRow + 1
Cells(lRow, 3).Value = Join(unique)
End If
Else
Call PermutationsNPR(vElements, p, vresult, lRow, iIndex + 1)
End If
Next i
End Sub
Function UniqueArray(todoarray As Variant) As Variant
Dim arr As New Collection, a
Dim i As Long
On Error Resume Next
For Each a In todoarray
arr.Add a, a
Next
ReDim returnVal(1 To arr.count)
For i = 1 To arr.count
returnVal(i) = arr(i)
Next
UniqueArray = returnVal
End Function
The macro will work for any number of items in the A column, within Excel limits.
Very nice script Harry +1. I tested and confirmed that this does exactly what is requested. You must have worked hard for the money on this one sir, nice job!!
– Pimp Juice IT
Jan 18 at 17:41
That's an impressive script. Thank you!
– oshirowanen
Jan 19 at 10:54
add a comment |
The following VBA script created for me this spreadsheet:
This is the script:
Option Explicit
Sub PermutationsN()
Dim vElements As Variant, vresult As Variant
Dim lRow As Long, i As Long
vElements = Application.Transpose(Range("A1", Range("A1").End(xlDown)))
Columns("B:Z").Clear
For i = 1 To UBound(vElements)
ReDim vresult(1 To i)
Call PermutationsNPR(vElements, i, vresult, lRow, 1)
Next i
End Sub
Sub PermutationsNPR(vElements As Variant, p As Long, vresult As Variant, lRow As Long, iIndex As Integer)
Dim i As Long, unique As Variant
For i = 1 To UBound(vElements)
vresult(iIndex) = vElements(i)
If iIndex = p Then
unique = UniqueArray(vresult)
If (UBound(vresult) = UBound(unique)) Then
lRow = lRow + 1
Cells(lRow, 3).Value = Join(unique)
End If
Else
Call PermutationsNPR(vElements, p, vresult, lRow, iIndex + 1)
End If
Next i
End Sub
Function UniqueArray(todoarray As Variant) As Variant
Dim arr As New Collection, a
Dim i As Long
On Error Resume Next
For Each a In todoarray
arr.Add a, a
Next
ReDim returnVal(1 To arr.count)
For i = 1 To arr.count
returnVal(i) = arr(i)
Next
UniqueArray = returnVal
End Function
The macro will work for any number of items in the A column, within Excel limits.
The following VBA script created for me this spreadsheet:
This is the script:
Option Explicit
Sub PermutationsN()
Dim vElements As Variant, vresult As Variant
Dim lRow As Long, i As Long
vElements = Application.Transpose(Range("A1", Range("A1").End(xlDown)))
Columns("B:Z").Clear
For i = 1 To UBound(vElements)
ReDim vresult(1 To i)
Call PermutationsNPR(vElements, i, vresult, lRow, 1)
Next i
End Sub
Sub PermutationsNPR(vElements As Variant, p As Long, vresult As Variant, lRow As Long, iIndex As Integer)
Dim i As Long, unique As Variant
For i = 1 To UBound(vElements)
vresult(iIndex) = vElements(i)
If iIndex = p Then
unique = UniqueArray(vresult)
If (UBound(vresult) = UBound(unique)) Then
lRow = lRow + 1
Cells(lRow, 3).Value = Join(unique)
End If
Else
Call PermutationsNPR(vElements, p, vresult, lRow, iIndex + 1)
End If
Next i
End Sub
Function UniqueArray(todoarray As Variant) As Variant
Dim arr As New Collection, a
Dim i As Long
On Error Resume Next
For Each a In todoarray
arr.Add a, a
Next
ReDim returnVal(1 To arr.count)
For i = 1 To arr.count
returnVal(i) = arr(i)
Next
UniqueArray = returnVal
End Function
The macro will work for any number of items in the A column, within Excel limits.
edited Jan 18 at 21:52
answered Jan 18 at 16:08
harrymcharrymc
257k14268568
257k14268568
Very nice script Harry +1. I tested and confirmed that this does exactly what is requested. You must have worked hard for the money on this one sir, nice job!!
– Pimp Juice IT
Jan 18 at 17:41
That's an impressive script. Thank you!
– oshirowanen
Jan 19 at 10:54
add a comment |
Very nice script Harry +1. I tested and confirmed that this does exactly what is requested. You must have worked hard for the money on this one sir, nice job!!
– Pimp Juice IT
Jan 18 at 17:41
That's an impressive script. Thank you!
– oshirowanen
Jan 19 at 10:54
Very nice script Harry +1. I tested and confirmed that this does exactly what is requested. You must have worked hard for the money on this one sir, nice job!!
– Pimp Juice IT
Jan 18 at 17:41
Very nice script Harry +1. I tested and confirmed that this does exactly what is requested. You must have worked hard for the money on this one sir, nice job!!
– Pimp Juice IT
Jan 18 at 17:41
That's an impressive script. Thank you!
– oshirowanen
Jan 19 at 10:54
That's an impressive script. Thank you!
– oshirowanen
Jan 19 at 10:54
add a comment |
consider this example
A column data:- Numbers(header) one two three four five
B column data:- OutPut(header)
paste this formula in B2 :-
=IFERROR(IF(INDEX(OFFSET($A$1,1,0,COUNTA($A$2:$A$20)),ROUNDUP(ROWS($A$1:A1)/COUNTA($A$2:$A$20),))=INDEX(OFFSET($A$1,1,0,COUNTA($A$2:$A$20)),MOD(ROWS($A$1:A1)-1,COUNTA($A$2:$A$20))+1),INDEX(OFFSET($A$1,1,0,COUNTA($A$2:$A$20)),ROUNDUP(ROWS($A$1:A1)/COUNTA($A$2:$A$20),)),INDEX(OFFSET($A$1,1,0,COUNTA($A$2:$A$20)),ROUNDUP(ROWS($A$1:A1)/COUNTA($A$2:$A$20),))&INDEX(OFFSET($A$1,1,0,COUNTA($A$2:$A$20)),MOD(ROWS($A$1:A1)-1,COUNTA($A$2:$A$20))+1)),"")
this function works "Numbers" column having data upto A20.
Your formula just gives the permutations for the terms taken one and two at a time, not all permutations. It's possible to do this kind of formula for a specific number of terms, although it quickly gets insane. Even at three entries, the formula is outrageous. See Forward Ed's comment about 9 entries being all that would fit in Excel's row limit, which tells you that if your formula goes up to 19 entries, it's not doing what was asked in the question.
– fixer1234
Jan 18 at 10:25
Thank you for attempting this. :)
– oshirowanen
Jan 25 at 23:25
add a comment |
consider this example
A column data:- Numbers(header) one two three four five
B column data:- OutPut(header)
paste this formula in B2 :-
=IFERROR(IF(INDEX(OFFSET($A$1,1,0,COUNTA($A$2:$A$20)),ROUNDUP(ROWS($A$1:A1)/COUNTA($A$2:$A$20),))=INDEX(OFFSET($A$1,1,0,COUNTA($A$2:$A$20)),MOD(ROWS($A$1:A1)-1,COUNTA($A$2:$A$20))+1),INDEX(OFFSET($A$1,1,0,COUNTA($A$2:$A$20)),ROUNDUP(ROWS($A$1:A1)/COUNTA($A$2:$A$20),)),INDEX(OFFSET($A$1,1,0,COUNTA($A$2:$A$20)),ROUNDUP(ROWS($A$1:A1)/COUNTA($A$2:$A$20),))&INDEX(OFFSET($A$1,1,0,COUNTA($A$2:$A$20)),MOD(ROWS($A$1:A1)-1,COUNTA($A$2:$A$20))+1)),"")
this function works "Numbers" column having data upto A20.
Your formula just gives the permutations for the terms taken one and two at a time, not all permutations. It's possible to do this kind of formula for a specific number of terms, although it quickly gets insane. Even at three entries, the formula is outrageous. See Forward Ed's comment about 9 entries being all that would fit in Excel's row limit, which tells you that if your formula goes up to 19 entries, it's not doing what was asked in the question.
– fixer1234
Jan 18 at 10:25
Thank you for attempting this. :)
– oshirowanen
Jan 25 at 23:25
add a comment |
consider this example
A column data:- Numbers(header) one two three four five
B column data:- OutPut(header)
paste this formula in B2 :-
=IFERROR(IF(INDEX(OFFSET($A$1,1,0,COUNTA($A$2:$A$20)),ROUNDUP(ROWS($A$1:A1)/COUNTA($A$2:$A$20),))=INDEX(OFFSET($A$1,1,0,COUNTA($A$2:$A$20)),MOD(ROWS($A$1:A1)-1,COUNTA($A$2:$A$20))+1),INDEX(OFFSET($A$1,1,0,COUNTA($A$2:$A$20)),ROUNDUP(ROWS($A$1:A1)/COUNTA($A$2:$A$20),)),INDEX(OFFSET($A$1,1,0,COUNTA($A$2:$A$20)),ROUNDUP(ROWS($A$1:A1)/COUNTA($A$2:$A$20),))&INDEX(OFFSET($A$1,1,0,COUNTA($A$2:$A$20)),MOD(ROWS($A$1:A1)-1,COUNTA($A$2:$A$20))+1)),"")
this function works "Numbers" column having data upto A20.
consider this example
A column data:- Numbers(header) one two three four five
B column data:- OutPut(header)
paste this formula in B2 :-
=IFERROR(IF(INDEX(OFFSET($A$1,1,0,COUNTA($A$2:$A$20)),ROUNDUP(ROWS($A$1:A1)/COUNTA($A$2:$A$20),))=INDEX(OFFSET($A$1,1,0,COUNTA($A$2:$A$20)),MOD(ROWS($A$1:A1)-1,COUNTA($A$2:$A$20))+1),INDEX(OFFSET($A$1,1,0,COUNTA($A$2:$A$20)),ROUNDUP(ROWS($A$1:A1)/COUNTA($A$2:$A$20),)),INDEX(OFFSET($A$1,1,0,COUNTA($A$2:$A$20)),ROUNDUP(ROWS($A$1:A1)/COUNTA($A$2:$A$20),))&INDEX(OFFSET($A$1,1,0,COUNTA($A$2:$A$20)),MOD(ROWS($A$1:A1)-1,COUNTA($A$2:$A$20))+1)),"")
this function works "Numbers" column having data upto A20.
answered Jan 18 at 9:58
vivekvivek
662
662
Your formula just gives the permutations for the terms taken one and two at a time, not all permutations. It's possible to do this kind of formula for a specific number of terms, although it quickly gets insane. Even at three entries, the formula is outrageous. See Forward Ed's comment about 9 entries being all that would fit in Excel's row limit, which tells you that if your formula goes up to 19 entries, it's not doing what was asked in the question.
– fixer1234
Jan 18 at 10:25
Thank you for attempting this. :)
– oshirowanen
Jan 25 at 23:25
add a comment |
Your formula just gives the permutations for the terms taken one and two at a time, not all permutations. It's possible to do this kind of formula for a specific number of terms, although it quickly gets insane. Even at three entries, the formula is outrageous. See Forward Ed's comment about 9 entries being all that would fit in Excel's row limit, which tells you that if your formula goes up to 19 entries, it's not doing what was asked in the question.
– fixer1234
Jan 18 at 10:25
Thank you for attempting this. :)
– oshirowanen
Jan 25 at 23:25
Your formula just gives the permutations for the terms taken one and two at a time, not all permutations. It's possible to do this kind of formula for a specific number of terms, although it quickly gets insane. Even at three entries, the formula is outrageous. See Forward Ed's comment about 9 entries being all that would fit in Excel's row limit, which tells you that if your formula goes up to 19 entries, it's not doing what was asked in the question.
– fixer1234
Jan 18 at 10:25
Your formula just gives the permutations for the terms taken one and two at a time, not all permutations. It's possible to do this kind of formula for a specific number of terms, although it quickly gets insane. Even at three entries, the formula is outrageous. See Forward Ed's comment about 9 entries being all that would fit in Excel's row limit, which tells you that if your formula goes up to 19 entries, it's not doing what was asked in the question.
– fixer1234
Jan 18 at 10:25
Thank you for attempting this. :)
– oshirowanen
Jan 25 at 23:25
Thank you for attempting this. :)
– oshirowanen
Jan 25 at 23:25
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1394273%2fgenerate-all-possible-permutations-given-input-values%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
@cybernetic.nomad It looks like the Poster wants all the permutations associated with each combination
– Gary's Student
Jan 15 at 0:16
ORDER is important. in the linked question, order is not important.
– Forward Ed
Jan 15 at 0:24
2
Because there are a finite number of rows (1 048 576) to excel you will be limited to only 9 entries if you wish all the permutations to be written out in a single column. If I did my math right, you will be looking at 986 409 permutations. 10 entries would give 9 864 100 which exceeds the number of available rows.
– Forward Ed
Jan 15 at 0:27
1
I'd be looking at nested loops in vba. Start by writing out all the single entries, then repeat the process starting with the first entry, and loop through the remaining letters, then bump to the next entry and loop through the remaining letters until all the 2 combinations are written. just keep repeating the pattern and eventually all will be written out.
– Forward Ed
Jan 15 at 0:31
1
Here's a screen shot in case it rings a bell for an idea with any Excel functions or add-on features people may be familiar with: i.imgur.com/zTh37v6.png Perhaps there's a PowerShell that can do this, if I knew of something I'd try but this should be easy with a relation type query or join of the data in a table object or something to itself if applicable with some of those features.
– Pimp Juice IT
Jan 18 at 1:53