What Is The Minimum Numbers Set For 4 Digit Numbers From 0000 To 9

I am trying to generate the minimum number set for numbers from 0000 to 9999.
An example is with 1234 I can get all the combinations of the number.
example 2134, 2314, 2412 ..... My question is how can I generate all set of
numbers which will include all the combinations. I would be glad if someone
can give the full set of the 4 digit numbers.

Thank you

Free Excel Help Forum

- Ask any question about Excel and have it answered in no time.

Similar Excel Tutorials

Generate Random Numbers within a Range in Excel
How to generate random whole numbers (integers) that are between two numbers.  This allows you to set a minimum and ...
Make All Numbers in a List Positive in Excel
Take a list of numbers and make them all positive, regardless of whether the list contains a mixed set of positive ...
Make Negative Numbers Positive in Excel and Vice Versa
I will show you a few ways to change negative numbers to positive numbers and back again in Excel. Don't forget to ...
Excel Data Validation - Limit What a User Can Enter into a Cell
Data Validation is a tool in Excel that you can use to limit what a user can enter into a cell.  It is a great too ...

Helpful Excel Macros

Generate a Non-Repeating List of Random Numbers in Excel - UDF
- Generate a series of non-repeating random numbers in Excel with this UDF (user defined function). This is a great funct
Return the Max Number from a Range That is Within a Minimum and Maximum Target Value in Excel - UDF
- Return the highest number between two numbers that is in a range of cells with this UDF (user defined function) in Excel
Get the Number(s) Out of a Cell that Contains Both Text and Numbers in Excel - UDF
- This free Excel UDF allows you to get the numbers out of a cell that contain both text and numbers. This is a great fun
Format Cells in The Number (Numerical) Number Format in Excel
- This free Excel macro formats selected cells in the Number or Numerical number format in Excel. This means that the cel
Delete Only the Text from Cells
- This macro will delete all text from selected cells. This will not delete any other characters or numbers from any cell

Similar Topics


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



I'm still learning Excel and I would like help on how to automatically generate four digit numbers without repeating the same number in any four number combination.

Eg. The list would include: 1234, 4321, but not include 1123, 2244.

There must be an easy way to do this in Excel.

Could anyone help me please?

Thank you very much!

Excel sorts by number placement, first digit, then by the second and so on. All part numbers starting with a one are sorted first, if the second digit is a one also, the next sequence will be all numbers with 11 as the first two digits so on & so on.

Is there any way to set the criteria to sort part numbers with 3 numbers first, then 4 numbers second, 5 numbers third etc.

Questions on my question, hoped I worded it well enough to give you an idea of what I am trying to do.

I want to create 6 numbers from 11 numbers..
lets suppose my numbers a 1,2,3,4,5,6,7,8,9,10,11
I want to generate all possibilities of the 6 numbers. But i dont want duplicate series.. I mean 1,2,3,4,5,6 and 6,5,4,3,2,1 are duplicates.



Has anybody got a VBA Macro that will take a number of items and combine them in various different ways and show all possible combinations?

For example, if I put 4 numbers, (1 into each A1, B1, C1 and D1) the macro should figure out all the possible ways of combining those numbers in a different order. Lets say:

A1 = 1
B1 = 2
C1 = 3
D1 = 4

Then the output would be something like

etc. until all possible solutions are found.

It would be great if the macro could output the combinations in line with the columns the items were in and then have a separate concatentation column that combines them at the end.

Also it should be able to work for any number of items specified (For my purposes I'll only be going up to about 10 max).

I should probably point out that the 'items' being combined can be strings or numbers (should always be integers).

Oh and if it could show the number of combinations found in a separate cell that would be perfect

Appreciate any help with this I know its a big ask to have somebody produce this for me!

Hi, in the bonus ball format of the lottery with numbers from 1 to 49 possibly to be drawn. 6 main numbers are drawn and 1 bonus number. Generally the contestant would pick 6 numbers and then 6 would be drawn plus an additional bonus ball. In this scenario the following odds and combinations are relevant.

Matches Odds Combinations +B +B +B +B +B +B

Now say for argument sake all the above information remains the same except that instead of me picking 6 numbers, I only pick 4 numbers. How would I use excel to calculate the odds of all of the 4 numbers i picked appearing in the 7 numbers drawn (6 main numbers + 1 bonus number). Once the odds have been calculated in there a way for excel to generate all possible combinations (order of the numbers is not specific and can appear in any order) ? Thanks your assistance is greatly appreciated.

I'm trying to generate a series of random numbers. the criteria is that the numbers should only be generated once, and must have 4 digits (e.g. between 0000 and 9999).
I've tried the following in Excel:


but it still will show a number less than 1000 as 3 digits (or less than 100 as 2 etc), not 4. Also, it calculates with every change to the form.
Would anyone care to help? thanks.

Hi All,

I am not sure if this is feasible. I am trying to find a group of 20 to 30 combinations in a group of 50 combinations that doesn't consist of 6 to 10 of the numbers in 1 to 52.

I.E. below I have 50 combinations of numbers 1 to 52...

5 8 15 26 36 47
14 24 25 35 43 48
7 19 29 32 35 45
17 19 20 32 39 41
1 2 27 31 32 39
16 18 20 26 28 29
28 32 33 40 49 51
14 20 26 27 28 39
2 8 39 44 49 50
6 25 26 35 39 50
16 19 20 25 43 52
2 3 32 34 39 47
11 17 25 26 35 49
14 17 32 38 46 49
1 5 12 14 27 30
5 12 22 26 31 47
2 8 18 38 39 46
6 7 18 30 47 50
15 20 23 30 44 50
1 7 11 34 48 52
13 14 30 31 38 47
2 3 19 29 32 47
3 7 21 35 42 50
4 8 18 33 49 50
5 6 7 9 12 19
9 16 17 33 34 36
13 15 20 27 46 49
8 10 12 34 40 48
11 19 21 34 39 47
18 25 29 35 38 51
1 4 5 17 27 38
4 18 19 24 31 32
4 15 19 23 24 25
9 23 25 34 37 51
9 20 24 36 44 46
10 23 30 43 47 52
5 6 15 16 39 44
3 4 7 9 25 44
4 5 7 26 33 45
5 18 19 30 40 50
2 5 24 33 37 39
3 6 13 14 17 35
12 19 24 28 30 39
18 35 36 39 45 47
7 10 22 31 36 37
5 12 15 35 38 50
11 20 24 35 39 49
5 7 10 15 36 37
13 21 31 38 39 40
8 18 21 25 40 45

For the above of 50 combinations, I would like a macro to scan through all possible combinations of 20 to 30 combinations to look for a group of combinations that is missing 6 or 7 or 8 or 9 or 10 numbers in 1 to 52.

So its like the marco will prompt me asking how many combinations I want to scan through that 50 combinations. Maybe I enter 25 and it will look through all possible combinations of 25 in the 50 combinations for a group of combination that is missing 6 or 7 or 8 or 9 or 10 numbers in 1 to 52.

For the above case, I know excel would have to look through 126410606437752 groups of 25 combinations to look for 1 group of combination that has 6 or 7 or 8 or 9 or 10 missing numbers in 1 to 52, so I was wondering is it possible.

Thanks in advance for the help/advise.



Hopefully this is a rather trival problem which can be solved easily - my limited excel knowledge just doesn't let me get anywhere near solving it.

I want to have a user input 6 digit number (e.g. 494241) from which I generate, and see, all possible permutations of digits (720 I believe).

My next stage is then to use this list of numbers as a lookup table to find the number permutation which is nearest to another user input numbers (e.g. 100000, 200000).

So for my two examples the final solution would be 124449 and 194442.

Hope this makes sense - any help is greatly appreciated.

Many thanks


I need all the 5 digit number combination using the character 0-9, but there cannot not be any duplicate numbers.

For example, 01198, 02297, these couldn't be used as they have duplicate numbers.

Once the numbers with duplicate numerals have been removed, I need to come up with a formula that will remove every additional number that contains the same 5 numerals. For example, if I already have 01234, I need to remove (or somehow identify) every other combination of those four numbers....12340, 24301, 30124, etc

I've tried a custom format for entering credit card numbers (four groups of four digits, separated by dashes: xxxx-xxxx-xxxx-xxxx.

I have tried to use ####-####-####-#### and 0000-0000-0000-0000 but each of these causes the last digit to change to zero. So if I enter
5415779800902512 I get 5415-7798-0090-2510.

Anybody already solved this problem?

Hello friends,

If I have a column of unique numbers in a spreadsheet, is it possible to use excel to generate every single possible pairing of different numbers from that selection of numbers?

For example if the numbers were 1,2,3 and 4 could I get excel to generate two columns that were


Have a feeling that I haven't explained that very clearly but hope someone can help...

Thank you.

Hi, i have spent ages trying to write formulas that will generate all combinations of the lottery. Thats 6 numbers and a single bonus number; all ranging from 1 - 49. I do not wish to use VB or macros, but will have to if no other solution is possible. Ideally the individual numbers will be in seperate cells (eg: A1=1,A2=2..etc). Can anyone help?

Hi, i know by the formula =combin(49,6) how many combination of 6 numbers there are from a available 49 numbers (13983816).

how do i manage to get all combinations listed in a excel spreadsheet? I would want the numbers in individual cells. For example, Row 1 would show 6 numbers individually from A1 - F1.

I do realise that excel does not have enough rows to do this so may have to continue on other sheets.

As you may have guessed i am doing something on the lottery numbers and also would want it to generate a bonus number in column G.

Formulas in excel as oppose to excel VB code is preferred.

Many thanks.

Hi ALl,

I have a list of 8 digit numbers starting in CELL B3.

I need to convert the number i.e 12345678 to a 10 digit number, whereby the last 2 numbers are the sum of the 8 digiit number i.e Sum of 8 digits = 36 therefore 10 digit number is 1234567836

Thanks in advance


I need to know the formula (if there is one) for Excel to figure all the possible combinations of a given set of numbers that will add up to a specified sum.

In other words, if I give the following numbers 1, 2, 2, 3, 3, 4, 5, 5, 6, 7, 7 - I want Excel to figure all the possible combinations that will add up to 23, and also SHOW ME those combinations, and not just HOW MANY combinations there are.

i.e. one possible combination is 2, 2, 3, 4, 5, 7

Can this be done? What is the formula? I'm having a hard time figuring it out!!


I have an exported CSV file that needs to be uploaded into another system for a 911 database. I have over 4000 entries and in one column, I have the extension numbers of my users which is a 4 digit number. I need to place my 3 digit prefix in front of these 4 digit numbers for the database to work correctly. The 3 digit prefix is the same number for all cells. The merge cell doesn't work. I need to do this on a weekly basis, so hopefully there is a simple formula or feature that would work.

Thanks for any input you may have.

I have to export data from an apllication into a CSV file. One of the fields of data contains 16 digit card numbers. Unfortunately, the application does not give me any options as to how I want the data converted such as text, general, etc. When the export is completed, the end result is that the column with the 16 digit card numbers are all in scientific format and all end in a zero. Is there anyway to fix this after the fact? Or is the last digit lost once the export is done?

I would like to find a way to change the numbers back to text (or any other format that allows the cells to display all 16 digits as well as keep the last original digit).

Is this possible? Thank you for any help you can give me.

Hello gurus!

Here's my question...I have a list of numbers and I want to know how many combinations (and what they are) of adding the numbers will equal an amount.
List of Numbers

Amount to be reached = 12

These are some of the possible combinations to reach 12 :

Is there a function in Excel that will do this for me? I want to know which numbers (i.e. cells) can be added to reach 12. AND, if possible, colorcode the cells added for each combination.

Good luck and thanks!!

Does anyone know how to create a formula or table or anything on how I can set up where I can predict a 3-digit number (daily). Like for example 3 (REAL) Past Numbers, 238, 076, 281, and come up with a predicted New 3-digit Number like for example 693 or whatever. Or anything that I can predict future 3-digit numbers (daily).

i need excel to output all lottery combinations. the numbers are from 1-49 from which 6 numbers are drawn. i do realise the number of combinations are 13983816. i want the 6 numbers drawn to be in different cells across 6 different columns. so the 1st 6 numbers are in a1, b1, c1, d1, e1, f1. obviously excel 2003 has 65536 rows and so the formula/vb code should carry on onto a new worksheet or ideally a new workbook. its ideal in a new workbook so not to end up with a single huge 10gig file, but on several worksheets in 1 workbook is fine.

i have been trying to do this myself for a while now with no success. any help would be great. from what i understand; this is a bit of a challenge i know.

How do I generate a random number between 000 and 999

I am using Int((999 * Rnd) + 0) but It produces 2 digit numbers and 3 digit numbers.

It leaves off the first 0



I have a problem where I need to be able to change existing numbers in a column by adding additional, consistent numbers. Currently, I have 4 digit alpha-numeric and need to change them to 10 digit alpha-numeric. I need to add the number "9" before the existing number, and the numbers "00000" to the end of the existing number. For example:

A1 Number
A2 850C needs to be 9850C00000
A3 4321 needs to be 9432100000
A4 5621 needs to be 9562100000

Any good ideas so I don't have to do this manually on hundreds of columns?? Appreciate any assistance.

Hi there,

I work in accounting and we're trying to tie numbers very often. I would
like to know of a possible function or code that can output all possible
combinations of cells in a column in an Excel Worksheet that add up to a
certain number I enter in the adjacent column. This will help me narrow down
to the possible combinations of numbers that add up to the number I am

Any help would greatly be appreciated.


I'm trying to find a better (smarter) way of extracting a 9 digit number from a string.
The number can start anywhere within the string, and the string may contain other numbers (though not immediately adjacent to the 9 digit number).

I wrote a clumsy macro to text each character (from left to right) to see if it is a number (using a 'if variable >=chr(48) and variable <=chr(57) test) and then tested each of the following 8 characters. Once I established that I had a group of 9 numbers in the string then put the 9 numbers into an adjacent cell.
Then looped through the column with the strings.

I'm thinking there is a better way to do this and any suggestions / pointers most appreciated.