# How to generate all 4 digit combinations out of an 8 number pool and then break down

1. ## How to generate all 4 digit combinations out of an 8 number pool and then break down

Hi,

I have played around with COUNTIF, SUM, PERMUT & COMBIN in order to get my own end results and being as I use Excel on a limited basis, I am in no way, shape or form a "formula/figure expert" person.

What I am looking to do...

I would like to enter my own (4) digit numbers and insert a formula to give me all possible combinations for those (4) digit numbers. Total numbers to be used would be 8. (1 through 8, each number occurring only 1 time in each line, no duplicates on a line)

Example: I am trying to get the actual number combinations listed - NOT just the total combinations available

4-3-2-1......getting me 3-2-1-4, 2-3-4-1, 4-1-2-3, etc...
8-7-2-4......getting me 7-2-4-8, 2-4-8-7, 7-4-2-8, etc...
5-2-3-1......getting me 5-1-2-3, 3-2-5-1, 2-5-3-1, etc...

The next step would to be able to pull out numbers that repeat (either 2 or three times) in each combination (like the 1-2 & 3 in the 1st & 2nd example)

As my username states - I am looking for the step by step (actual way to put it on spreadsheet) coding, as stated I have VERY Basic experience and this is for my job for parts coding

THANK YOU SOOOOO MUCH!!!

2. ## Re: How to generate all 4 digit combinations out of an 8 number pool and then break down

I don't know of a fully automatic way to do this, but with some work I can give you the solution for the first part of your question

with 4 digits there are always 4*3*2*1=24 possible sequences. since you will already give 1, there are 23 remaining.
formulas for isolating the different digits are as follows (assuming the first code is in A1):
the first digit: =LEFT(A1;1)
the second digit: =MIDDLE(A1;3;1)
the third digit: =MIDDLE(A1;5;1)
the fourth digit: =RIGHT(A1;1)

now 'just' build all the combinations by typing these formulas with ampersands between them
so it would begin like this:
=LEFT(A1;1)&MIDDLE(A1;3;1)&RIGHT(A1;1)&MIDDLE(A1;5;1)
=LEFT(A1;1)&MIDDLE(A1;5;1)&MIDDLE(A1;3;1)&RIGHT(A1;1)
etc etc etc etc etc etc...

sorry I don't know of an easier way

3. ## Re: How to generate all 4 digit combinations out of an 8 number pool and then break down

if i have a 5 digit combination 3-8-7-0-1 how do I get excel to show me all posiblities of combination, can some actual show me exactly how to do it, im lost? thanks

4. ## Re: How to generate all 4 digit combinations out of an 8 number pool and then break down

Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.

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

#### 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