+ Reply to Thread
Results 1 to 7 of 7

Way to list out all permutations of a set of numbers

  1. #1
    Registered User
    Join Date
    05-12-2015
    Location
    Chiang Mai, Thailand
    MS-Off Ver
    14.3.5
    Posts
    8

    Way to list out all permutations of a set of numbers

    I realized that I need a way to list out all permutations of a set of 7 numbers so I can apply a formula to the permutations. Is there a way that I can do this?

  2. #2
    Forum Expert
    Join Date
    06-26-2010
    Location
    Austin, TX
    MS-Off Ver
    Excel 2010
    Posts
    1,673

    Re: Way to list out all permutations of a set of numbers

    You will need to use a macro. Lots of examples on the web. Such as this one: http://spreadsheetpage.com/index.php..._permutations/
    Pauley
    --------
    If I helped with your issue, I'd appreciate a rep bump (hit the '*' icon to the bottom left of this post).

  3. #3
    Registered User
    Join Date
    05-12-2015
    Location
    Chiang Mai, Thailand
    MS-Off Ver
    14.3.5
    Posts
    8

    Re: Way to list out all permutations of a set of numbers

    Is there a way to do this without macros, preferably with formulas?

  4. #4
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: Way to list out all permutations of a set of numbers

    Start in A1 with
    =mod(row(),7)
    B1
    =mod(roundup(row()/7,0),7)
    C1
    =mod(roundup(row()/7^2,0),7)
    D1
    =mod(roundup(row()/7^3,0),7)
    And so on. Copy down and may be adjust formulas may be (row ()-1) will be better, may be rounding down, may be adding 1 to all furmulas to avoid zeros. ... Play with it a bit.
    Best Regards,

    Kaper

  5. #5
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: Way to list out all permutations of a set of numbers

    PS. this approach will generate repetitions ( 1 1 1 1 1 1 1 etc) too. see file sample.xls (copy cells A1:G1) down as needed.

    Unfortunately, I do not know good appproach by formulas to generate just permutatuins (so without repetitions), while VBA is pretty easy.
    Nevertheless - see second file (not mine it's based on https://sites.google.com/site/e90e50fx/ pages) sample2.xls

    try with 4, 5, then 6 shall also go, but 7 will be probably too tough for Excel.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    05-12-2015
    Location
    Chiang Mai, Thailand
    MS-Off Ver
    14.3.5
    Posts
    8

    Re: Way to list out all permutations of a set of numbers

    Thank you! This is exactly what I needed. I'll try to figure out a way to make it not crash at 7. Is there a way to make it so that the numbers of on permutation are spread out instead of all in one cell? That would be preferable but if not, this much more than I hoped for, so again thank you.

  7. #7
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: Way to list out all permutations of a set of numbers

    I'm not sure if it's that easy to change formula in sample2 to work on separate cells rather than all in one cell.

    Have a look on such proposition:
    - in sample2 write a small number (say4) in A5
    - copy cell G2 down to G721
    - in H2 write formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    - copy it to H2:N721
    - write 6 in A5
    - wait for spreadsheet recalc
    - select G2:N721, copy and paste special as values
    - delete column G.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Permutations for 4 numbers
    By jiehui79 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-28-2014, 01:08 PM
  2. Permutations between 2 numbers
    By gan_xl in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-20-2014, 08:48 AM
  3. Calculate all possible permutations of dataset - 60 numbers on 3 positions
    By Baruch in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-10-2013, 08:11 PM
  4. Create Combinations and permutations from 27 numbers
    By theborg in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-18-2012, 02:28 AM
  5. Replies: 1
    Last Post: 03-08-2008, 10:53 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1