+ Reply to Thread
Results 1 to 6 of 6

Help with Generating Number Combinations [SOLVED]

  1. #1
    Registered User
    Join Date
    03-20-2023
    Location
    New York, NY
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2302) 32-bit
    Posts
    22

    Question Help with Generating Number Combinations [SOLVED]

    Hi - I am trying to figure out if there is a way to set up an excel sheet so that it lists all of the different ways x numbers can be combined in a comprehensive way. I know that's a little unclear so here is an example assuming x = 4.

    1 2 3 4
    12 3 4
    12 34
    13 2 4
    13 24
    14 2 3
    14 23
    123 4
    124 3
    134 2
    1 234
    1234
    1 23 4
    1 24 3
    1 2 34
    1 234
    12 34

    Maybe easier to see with brackets denoting numbers that a paired together:
    [1] [2] [3] [4]
    [12] [3] [4]
    [12] [34]
    [13] [2] [4]
    [13] [24]
    [14] [2] [3]
    [14] [23]
    [123] [4]
    [124] [3]
    [134] [2]
    [1] [234]
    [1234]
    [1] [23] [4]
    [1] [24] [3]
    [1] [2] [34]
    [1] [234]
    [12] [34]

    Each of the above rows includes all of numbers 1,2,3,4, with no duplicates of any number in a row, and different combinations of individual vs. linked numbers are distinct combinations. I think this is a comprehensive list for x=4 but I may have missed some. Doing this manually becomes increasingly onerous for x>4.

    Is there a way to produce a list of these combinations in excel? Obviously understand there is likely an upper limit because the # of possible combinations grows exponentially, but is it possible for x=7 for example?
    Last edited by ascheetz1; 05-11-2023 at 03:56 PM. Reason: solved

  2. #2
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2404
    Posts
    13,406

    Re: Help with Generating Number Combinations

    I'm working on this. At the moment I do not see a solution, but will stick with it.

    One thing I do notice though you have a duplication in rows 3 and 17. So there are actually 2^4 =16 combinations if I understand you correctly. Sounds like trumpet key/note combinations.
    Dave

  3. #3
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2404
    Posts
    13,406

    Re: Help with Generating Number Combinations

    BTW you mentioned " but is it possible for x=7 for example? " specifically.

    By chance are you trying to work out custom weekends for the functions NETWORKDAYS.INTL or WORKDAY.INTL? They are designated by 7 digit strings of 1s and 0s. If so that can be done and it is one of the approaches I am considering.

  4. #4
    Registered User
    Join Date
    03-20-2023
    Location
    New York, NY
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2302) 32-bit
    Posts
    22

    Re: Help with Generating Number Combinations

    No but that's interesting! 7 is as high as I think I'll need but not days of the week-related.

  5. #5
    Registered User
    Join Date
    03-20-2023
    Location
    New York, NY
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2302) 32-bit
    Posts
    22

    Re: Help with Generating Number Combinations [SOLVED]

    Figured out a VBA solution with the help of Chat GPT-4. I'm sure this is not close to the most efficient solution but it should work for my purposes. Posting here for reference for anyone interested - all that's required is a named cell in the workbook called NumItems which equals a number "x" in the above example. Runs quickly enough at NumItems as high as X=8 - slow at X=9 and wouldn't recommend higher than that.

    Please Login or Register  to view this content.

  6. #6
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2404
    Posts
    13,406

    Re: Help with Generating Number Combinations [SOLVED]

    Glad you found solution.

    Sorry I didn't help. I couldn't find a formula solution that distinguished between [1234] in row 12 and [12] [34] in the last row.

+ 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. Replies: 3
    Last Post: 06-18-2021, 06:04 AM
  2. Generating all possible combinations of 4 digit number via formula
    By Shawn7160 in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 1
    Last Post: 04-01-2021, 11:30 AM
  3. Generating Combinations
    By kiprotich in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-06-2020, 11:23 AM
  4. generating 6 number lotto combinations
    By Hollywood691 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-19-2014, 02:04 AM
  5. generating combinations
    By fern4500 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 04-11-2012, 08:47 AM
  6. Replies: 10
    Last Post: 01-24-2012, 08:58 PM
  7. Help generating combinations
    By JamRock in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-02-2006, 03:40 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