I think these are combinations. Permutations need two full loops with a skip
on j=k.
If you're VBA-averse, it still can be done, albeit messy. Set up two index
columns B & C with formulas
=INT((ROW()-1)/$A$2)+1
=1+MOD(ROW()-1,$A$2)
$A$2 is the length of "AMERICA", =LEN(A1) with the word in A1. Then in
another column put
=MID($A$1,B1,1)&MID($A$1,C1,1)
This unfortunately repeats the same letter. It can be cleaned up by
detecting such in the index columns and filtering. This is an excellent
example showing how the VBA can be concise, but the authorities can't seem to
see it.
> Better I think,
>
[quoted text clipped - 35 lines]
> >
> > Prem
Mike H - 21 May 2008 16:01 GMT
Length of America=7
=permut(7,2)=42
This returns the 42 permutations
Sub combinations2()
'Perm any 2 from x
'Numbers/Text in Column A
mystring = Range("A1").Value
For j = 1 To Len(mystring) - 1
For k = j + 1 To Len(mystring)
Cells(l + 1, 2) = Mid(mystring, j, 1) & Mid(mystring, k, 1)
l = l + 1
Cells(l + 1, 2) = Mid(mystring, k, 1) & Mid(mystring, j, 1)
l = l + 1
Next
Next
End Sub
Mike
> I think these are combinations. Permutations need two full loops with a skip
> on j=k.
[quoted text clipped - 50 lines]
> > >
> > > Prem
Prem - 21 May 2008 19:04 GMT
Hi,
Thanks a lot Mike for your help. Thanks al lot Evan, I appreciate your help.
You really made my day.
Warm regards
Prem
> Length of America=7
>
[quoted text clipped - 71 lines]
> > > >
> > > > Prem