Factorial conbinations

rize1159

Board Regular
Joined
Jan 8, 2011
Messages
51
For making factorial/permutation, we use the following fact function. Now let that we have three word a,b,c. Fact function will tell us that they can be arranged in 6 forms:
1.abc
2.acb
3.bac
4.bca
5.cab
6.cba

Now I have A1=a, A2=b & A3=c. Now I want the resultant pairs formation by some micro. Can I anyone help me in this. so that above pairs can be seen as an output.
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
I have tried the following code as a second option:
Dim CurrentRow

Sub GetString()
Dim InString As String
InString = InputBox("Enter text to permute:")
If Len(InString) < 2 Then Exit Sub
If Len(InString) >= 12 Then
MsgBox "Too many permutations!"
Exit Sub
Else
ActiveSheet.Columns(1).Clear
CurrentRow = 1
Call GetPermutation("", InString)
End If
End Sub

Sub GetPermutation(x As String, y As String)

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 If
End Sub

but the input box doesn;t read arabic /urdu font. rather display a ?? mark.
then I treid the following formula:

in A1 put
=CHAR(65+TRUNC((ROW()-1)/144))

in b1 put
=CHAR(65+MOD(TRUNC((ROW()-1)/12),12))

in C1 put
=CHAR(65+MOD(ROW()-1,12))

but it also didn't worked for font change. value error was generated. Moreover this displays the combinations like aaa,bbb,ccc, i.e letters are repeated and I need formula for without repetition.
Any help for change in above micro or this formula. I would like formula as its good to run it rather micro resulting in two much delay in time.
 
Upvote 0

Forum statistics

Threads
1,224,606
Messages
6,179,866
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top