+ Reply to Thread
Results 1 to 4 of 4

Formula for 12345

  1. #1
    Forum Contributor
    Join Date
    08-15-2014
    Location
    Michigan, USA
    MS-Off Ver
    MS Office 2021
    Posts
    105

    Formula for 12345

    Is there a formula that would give me all the possible combination of 5 digits.
    In column A I have the Area A B C D E. Each area has a number in column B. Column D is not needed but it show the possible #. Column E-I shows the Digit position. And J shows the all the next to each other in one number (I have the formula worked out for J)
    Is there a way to auto figure all the possible number combinations without me sitting and type every possible combination hoping I got them all and didn't miss any.
    Attached Files Attached Files

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Formula for 12345

    You can do this quickly with a little bit of VBA.

    First, let's calculate the actual number of permutations: =PERMUT(5,5) = 120.

    To list them, we use the UDF below.

    We select E2:I121 since we know there are 121 permutations to cover. Next we enter =ListPermut(5) and use Ctrl+Shift+Enter to exit the cell and apply the array formula to all cells simultaneously.


    Please Login or Register  to view this content.




    How to install your new code
    1. Copy the Excel VBA code
    2. Select the workbook in which you want to store the Excel VBA code
    3. Press Alt+F11 to open the Visual Basic Editor
    4. Choose Insert > Module
    5. Edit > Paste the macro into the module that appeared
    6. Close the VBEditor
    7. Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)
    Attached Files Attached Files
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Formula for 12345

    UDF?

    A
    B
    1
    12345
    2
    12345 A2:A121: {=asPermute(A1)}
    3
    12354
    4
    12435
    5
    12453
    6
    12534
    7
    12543
    8
    13245
    115
    53421
    116
    54123
    117
    54132
    118
    54213
    119
    54231
    120
    54312
    121
    54321


    Please Login or Register  to view this content.
    Requires a reference to Microsoft Scripting Runtime.
    Last edited by shg; 11-03-2016 at 08:40 PM.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Formula for 12345

    shg code is best code

+ 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. if a cell in column P contains "12345" then delete entire row
    By justlearning123 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-19-2015, 10:55 AM
  2. How to enter "12345", where 12345 is from a cell, in Excel formula?
    By Ning in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-07-2013, 01:27 PM
  3. urgent! save excel to csv, 012345 will change to 12345!!
    By counterking in forum Excel General
    Replies: 1
    Last Post: 08-07-2012, 09:30 AM
  4. Change 12345 into 123,45
    By Washington in forum Excel General
    Replies: 3
    Last Post: 05-01-2007, 04:42 AM
  5. Replies: 1
    Last Post: 08-20-2006, 04:15 PM
  6. formating the number from 12345.1 to 12345.001
    By sr25 in forum Excel General
    Replies: 7
    Last Post: 11-29-2005, 11:55 AM
  7. convert 12345(figure) into word
    By Hirak Chatterjee in forum Excel General
    Replies: 6
    Last Post: 11-06-2005, 03:00 PM

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