Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

Kutools for Excel 20.00 HOT

300+ Powerful Features You Must Have in Excel

Kutools-for-Excel

Kutools for Excel is a powerful add-in that frees you from performing time-consuming operations in Excel, such as combine sheets quickly, merge cells without losing data, paste to only visible cells, count cells by color and so on. 300+ powerful features / functions for Excel 2019, 2016, 2013, 2010, 2007 or Office 365!

Read More Download Buy now

Office Tab 14.00HOT

Adding Tabbed Interface for Office

Office Tab

It enables tabbed browsing, editing, and managing of Microsoft Office applications. You can open multiple documents / files in a single tabbed window, such as using the browser IE 8/9/10, Firefox, and Google Chrome. It's compatible with Office 2019, 2016, 2013, 2010, 2007, 2003 or Office 365. Demo

Read More Download Buy now

Kutools for Outlook 11.00NEW

100+ Powerful Features for Outlook

Kutools-for-Outlook

Kutools for Outlook is a powerful add-in that frees you from time-consuming operations which majority of Outlook users has to perform daily! It can save your time from using Microsoft Outlook 2019, 2016, 2013, 2010 or Office 365!

Read More Download Buy now

Kutools for Word  9.00NEW

100+ Powerful Features for Word

Kutools-for-Word

Kutools for Word is a powerful add-in that frees you from time-consuming operations which majority of Word users have to perform daily! It can save your time from using Microsoft Word / Office 2019, 2016, 2013, 2010, 2007, 2003 or Office 365!

Read More Download Buy now

Classic Menu for Office

Bringing Back Your Familiar Menus

Restores the old look and menus of Office 2003 to Microsoft Office 2019, 2016, 2013, 2010, 2007 or Office 365. Don’t lose time in finding commands on the new Ribbon. Easy to deploy to all computers in enterprises and organizations.

Read More Download Buy now

How to generate or list all possible permutations in Excel?

For example, I have three characters XYZ, now, I want to list all possible permutations based on these three characters to get six different results as this: XYZ, XZY, YXZ, YZX, ZXY and ZYX. In Excel, how could you quickly generate or list all permutations based on different number of characters?

Generate or list all possible permutations based on characters with VBA code


List or generate all possible combinations from multiple columns

If you need to generate all possible combinations based on multiple columns data, maybe, there is not a good way for dealing with the task. But, Kutools for Excel's List All Combinations utility can help you to list all possible combinations quickly and easily. Click to download Kutools for Excel!

doc list all combinations

Kutools for Excel: with more than 300 handy Excel add-ins, free to try with no limitation in 60 days. Download and free trial Now!


arrow blue right bubble Generate or list all possible permutations based on characters with VBA code

The following VBA code may help you to list all permutations based on your specific number of letters please do as follows:

1. Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window.

2. Click Insert > Module, and paste the following code in the Module Window.

VBA code: List all possible permutations in excel

Sub GetString()
'Updateby Extendoffice 20160606
    Dim xStr As String
    Dim FRow As Long
    Dim xScreen As Boolean
    xScreen = Application.ScreenUpdating
    Application.ScreenUpdating = False
    xStr = Application.InputBox("Enter text to permute:", "Kutools for Excel", , , , , , 2)
    If Len(xStr) < 2 Then Exit Sub
    If Len(xStr) >= 8 Then
        MsgBox "Too many permutations!", vbInformation, "Kutools for Excel"
        Exit Sub
    Else
        ActiveSheet.Columns(1).Clear
        FRow = 1
        Call GetPermutation("", xStr, FRow)
    End If
    Application.ScreenUpdating = xScreen
End Sub
Sub GetPermutation(Str1 As String, Str2 As String, ByRef xRow As Long)
    Dim i As Integer, xLen As Integer
    xLen = Len(Str2)
    If xLen < 2 Then
        Range("A" & xRow) = Str1 & Str2
        xRow = xRow + 1
    Else
        For i = 1 To xLen
            Call GetPermutation(Str1 + Mid(Str2, i, 1), Left(Str2, i - 1) + Right(Str2, xLen - i), xRow)
        Next
    End If
End Sub

3. Then press F5 key to run this code, and a prompt box is popped out to remind you enter the characters that you want to list all permutations, see screenshot:

doc list permutations 1

4. After entering the characters, and then click OK button, all the possible permutations are displayed in column A of active worksheet. See screenshot:

doc list permutations 2

Note: If the entered character length is equal or greater than 8 characters, this code will not work because there are too many permutations.

doc list permutations 3


Kutools for Excel - The Best Office Productivity Tool Increase Your Productivity by 80%

  • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
  • Merge Cells/Rows/Columns and Keeping Data; Split Cells Content; Combine Duplicate Rows and Sum/Average... Prevent Duplicate Cells; Compare Ranges...
  • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
  • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
  • Favorite and Quickly Insert Formulas, Ranges, Charts and Pictures; Encrypt Cells with password; Create Mailing List and send emails...
  • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
  • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
  • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
  • More than 300 powerful features. Works with Office 2007-2019 and 365. Supports all languages. Easy deploying in company. Full features 60-day free trial.
kte tab 201905

Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
officetab bottom
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    lyto · 1 months ago
    who can send me a list of 10 diferent items permutatted by 2 outcomes. this code doe

    snt work on this
  • To post as a guest, your comment is unpublished.
    ilhan · 3 months ago
    peki bunu listeleyecek bir program uygulama yok mu?basit sıradan bir hesaplamadan daha fazlasına ihtiyacı olan ne yapacak?
  • To post as a guest, your comment is unpublished.
    MC · 4 months ago
    this code will not work because there are two many permutations


    should be:

    this code will not work because there are too many permutations


    HTH
    • To post as a guest, your comment is unpublished.
      skyyang · 4 months ago
      Hello, MC,
      Thank you for your warm reminder, it is my mistake. I have corrected it.
      Thanks a lot!
  • To post as a guest, your comment is unpublished.
    Paul · 1 years ago
    Hello everyone. I need help on this. I have two alphabets to be permutated in 20 rows. But am not getting it right. Anyone who could help me out should send the permutation to my email. pauladah69@gmail.com.


    1.a b b a
    2.a a b b
    3.a a b b
    4.a a b b
    5.a a b b
    6.a a b b
    7.a a b b
    8.a a b b
    9.a a b b
    10.a a b b
    11.a a b b
    12.a a b b
    13.a a b b
    14.a a b b
    15.a a b b
    16.a a b b
    17.a a b b
    18.a a b b
    19.a a b b
    20.a a b b
  • To post as a guest, your comment is unpublished.
    Wule · 1 years ago
    How many sequences of 3things can be formed from 7 different things replacement and order is important?
  • To post as a guest, your comment is unpublished.
    Declan Keogh · 1 years ago
    @Supraja...

    in the first sub clear all cells... not just the first row
    --Cells.Clear

    Sub GetPermutation(Str1 As String, Str2 As String, ByRef xRow As Long)
    Dim i As Integer, xLen As Integer
    xLen = Len(Str2)
    If xLen < 2 Then
    'move to the next column when you get to 100
    Cells(((xRow - 1) Mod 100) + 1, 1 + Int(xRow / 100)) = Str1 & Str2
    xRow = xRow + 1
    Else
    For i = 1 To xLen
    Call GetPermutation(Str1 + Mid(Str2, i, 1), Left(Str2, i - 1) + Right(Str2, xLen - i), xRow)
    Next
    End If
    End Sub
  • To post as a guest, your comment is unpublished.
    Supraja · 1 years ago
    Hello,

    Im trying to get a permutation for 82 characters, the code provided works, but, since the columns are only 1048576, I want to move the next output in B,C,D..... Can any of you help me on this regard
  • To post as a guest, your comment is unpublished.
    Terence · 2 years ago
    Hello,

    Im doing a small project using permutation and combination rules. I need your support on this please.
    Scenario: I have 13 digit alpha numeric data (00SHGO8BJIDG0) I want a coding to interchange S to 5, I to 1 and O to 0 and vise versa.

    The project is that if I have the correct 13 digit data I will receive a 3 digit pass code.

    (eg) 00SHG08BJ1DG0 - 500 is the pass code but because of wrong typo that is instead of 1 it was I and 0 it was O there is a wrong info.
    can you please help me.

Feature Tutorials