Email:      Pass:    Pass?
Close Window   
Free Ebook
Get Your Free Excel
Our Top 15 Excel Tutorials
Instant Access!

Subscribe for Free Excel tips & more!

Free Excel Forum

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

Forum Register
Search Excel Forum Posts, Tutorials, Macros, Tips, and More

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

View Answers     

Similar Excel Tutorials

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 ...
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 ...
Convert Numbers Stored as Text to Numbers in Excel
I'll show you 4 ways to convert numbers stored as text to numbers in Excel.  This situation often happens when you ...
Keep Leading Zeros in Numbers in Excel - 2 Ways
I'll show you 2 ways to add and keep leading zeros in front of numbers in Excel. These two methods are very simple ...

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


The question, in all likelyhood will not make anyone rich, but it is an
interesting lotto question all the same:

I had a look at Myrna Larsons code (now thats clever!) and searched the
forums but cannot find what I want to see:

The numbers range 1 to 49 with a drawn set of 6 numbers:

In any set of of six numbers there a

246,820 combinations that contain 3 of the six numbers drawn

13,545 combinations that contain 4 of the six numbers drawn

252 combinations that contain 5 of the six numbers drawn

How can I generate the the 252 - 5 of 6 number combinations from the 6 numbers? etc etc
In effect the will be 252 sets of 6 numbers generated with 5 of the 'Target' number in them.
(Across 6 columns)


2 - 9 - 15 - 24 - 31 - 39

2 - 10 - 15 - 24 - 31 - 39
2 - 11 - 15 - 24 - 31 - 39
2 - 12 - 15 - 24 - 31 - 39
2 - 13 - 15 - 24 - 31 - 39
2 - 14 - 15 - 24 - 31 - 39
2 - 15 - 16 - 24 - 31 - 39
2 - 15 - 17 - 24 - 31 - 39
2 - 15 - 18 - 24 - 31 - 39
2 - 15 - 19 - 24 - 31 - 39
2 - 15 - 20 - 24 - 31 - 39
2 - 15 - 21 - 24 - 31 - 39
2 - 15 - 22 - 24 - 31 - 39
2 - 15 - 23 - 24 - 31 - 39
2 - 15 - 24 - 25 - 31 - 39
2 - 15 - 24 - 26 - 31 - 39
2 - 15 - 24 - 25 - 31 - 39
2 - 15 - 24 - 27 - 31 - 39
2 - 15 - 24 - 28 - 31 - 39
2 - 15 - 24 - 29 - 31 - 39
2 - 15 - 24 - 30 - 31 - 39
2 - 15 - 24 - 31 - 32 - 39
2 - 15 - 24 - 31 - 33 - 39
2 - 15 - 24 - 31 - 34 - 39
2 - 15 - 24 - 31 - 35 - 39
2 - 15 - 24 - 31 - 36 - 39
2 - 15 - 24 - 31 - 37 - 39

can any kind person help?



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 have the following list of numbers

0000 0000 0000 0000 0000 0100
0000 0000 0000 0000 0000 0101
0000 0000 0000 0000 0000 0102

and I need to continue the list to

0000 0000 0000 0000 0000 0326

I tried dragging by the grip in the bottom right hand corner but it changes the first didit only.

I tried to put it the numbers in the format


and using a custom format number to put in the extra zeros. This worked fine until I used a countif (or it may of been a lookup) statement in my code to look for 0000 0000 0000 0000 0000 0100 and it can't find it as the number is 100.

Is there away around this that will save me typing in an awful lot of zeros.


******** ******************** ************************************************************************> Microsoft Excel - Masterlock Test formula value full done but not done yet.xls ___Running: xl2000 : OS = Windows XP (F)ile (E)dit (V)iew (I)nsert (O)ptions (T)ools (D)ata (W)indow (H)elp (A)bout F20 F21 F22 F23 B25 C25 D25 E25 B26 C26 D26 E26 F26 G26 H26 I26 J26 K26 G27 G29 G30 G31 G32 G35 G36 G37 =
B C D E F G H I J K 19 * * * * Reccomended*First*Possible*Numbers * * * 20 * * * * *
* * * * * 21 * * * * 24 * * * * * 22 * * * * *
* * * * * 23 * * * * 12 * * * * * 24 * * * * * * * * * * 25 - 2 - - * * * * * * 26 2 6 10 14 18 22 26 30 34 38 27 * * * * * 18 * * * * 28 * * * Reccomended*Second*Possible*Numbers * * 29 * * * * * *
* * * * 30 * * * * * *
* * * * 31 * * * * * 46 * * * * 32 * * * * * 10 * * * * 33 * * * * * * * * * * 34 * * * Digit*1 Digit*2 Digit*3 * * * * 35 * * Code*1 * * 0 * * * * 36 * * Code*2 * * 0 * * * * 37 * * Code*3 * * 0 * * * * 38 * * Etc * * * * * * * Possible Combinations *
[HtmlMaker 2.42] To see the formula in the cells just click on the cells hyperlink or click the Name box

The 4 numbers under "reccomended first possible numberS" and reccomended second possible numbers" only show up under 2 conditions.

1. That the number is not below 0 or over 39.
2. That the number matches one of the 10 numbers above it. For the 2nd groupd these numbers are shwon from the range b26-k26

I need a formula that will show all of the possible 3 number combinations that the "reccomended first possible numbers" and "reccomended second possible numbers" give. *The third number i have figured out and does not need to be worried about*

Another addition to this question is that it must only show the numbers that meet the two conditons bolded previous in the post. So any number over 39 or under 0 it excludes and any number that does not show up in the range of ten numbers above the "first and second possible number list"

So if the formula worked in this example for the possible combinations it would show


the 24 and 12 would go in the first digits column shown followed by 26 and 10 in the second. it would be better however if the codes were shown like this

24,26,0 in one cell seperated by commas rather than having

24 in one cell 26 in the cell to the right of it and 0 in the cell to the right of that

I know this is very complicated so any help is appreciated.

I need a 3 digit wheel that will change 3 digit numbers according to these specifications…


There are six different possible combinations …


Let’s say I have the numbers… 123 this would be OEO

However, I would like to change this number into OOE (132 or 312)
The odd numbers (1 and 3) can be randomized if possible because I only want one instance of this number (not both combinations).

I have to do this for alot of numbers (particularly those that would apply).

I'm not sure if this can be done by formulas or by VB. Please ask me anything you do not understand.


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!

Hello, I have a various difficulties within this excel problem.

counting combinations.xlsx

I must calculate all combinations of 7 numbers that give sum of 100. Numbers must be in interval from 1 to 39.
First condition is that sum of numbers must be changeable (i mentioned before sum of 100 to be simpler so I typed number 100 in the document). The sum can be also 150 or 88 for example, depending what number is entered in cell K2.

Second condition is that every combination must be unique (no such things like 7,8,9,10,16,20,30 and 30,20,16,10,9,8,7 and 7,8,10,9,3,20,16). This is example how results shouldn't be because all 3 combinations have same numbers only with different position/order). Only one combination of same numbers is possible and numbers must be ordered from smaller to larger numbers).

Is this possible to do, what is best option: functions or maybe some macro?

Need Help in the color formula----
Example attached---
I want the colors to show up in a match when I input
the 3 digit and 4 digit number----example 035 in red
also 053,350,305,503,530 if they are in Arow....
Also A row is around 2 to 3000 numbers---
Now the 4 digit which is more numbers
4 digits --they also come in a double number, triple number
and quad number---example --1234 = 16 different ways
to 1234,1243,1342---etc....
Is there a way to do it in a macro????or formula???
3 digt numbers in RED and 4 digit numbers in light blue...

thank you

Hey guys.

I am picking up more and more VBA skills as I go but I have a question.

If I have a list of numbers 1,2,3, ... , 10 and I want to print all possible two digit combinations of those numbers to a spread sheet how would I do that?

Thank you for your help.

Hi all,

What I am looking for is to select between 7 and 15 numbers in total, I want all the possible 6 digit combinations for this.

EG: if I choose 2,9,11,13,15,17&26, it would look something like this

And so on.

If I chose more numbers (10) 1,2,3,4,3,6,7,8,9,10 it would start something like this

And so on.

Please remenber I would like to be able to secelt between 7 and 15 number and be given all the possible combinations.
I would like it to be in one sheet but if that can not be done on as many as it takes.
It would be good if I could just type the required number into A1,B1,C1 and so on and they just gave the combinations required.

Thanks in Advance

I tried asking this before but I am afraid I was a bit unclear.

It is easy to compute the number of possible unique combinations of r numbers from a list of n numbers.

To do so it is just N!/(R!(N - R)!. So for example there are 45 unique combinations of 2 digits from a list of 10 numbers.

I am trying to create a program to output all possible unique combinations of r numbers from a list of n numbers. Ideally then I would like to output these combinations as some sort of variable that can be incorporated into some other code that I have.

I am thinking about something like this.


Sub nrcombination()
r = 1
n = 10
X = InputBox("max vlaue of r")

For r = 1 To X

'generate all combinations with r number of digits
'output to file

r = 1 + r


End Sub

I can think about how I would do this by hand but I cant think about how to do the code for it.

Any help would be appreciated.

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.

Hi there...

Looking for a piece of code that will allow me to generate all the possible combinations of 'x' set of variables.

For example: all combinations of 4 numbers from a set of 10 numbers(1 through 10).

Will need some sort of input controls to allow user to define the size of combinations (i.e. 3 number, 4 number etc) and to define the size of the set.
(1 through 5, 1 through 10 etc)

Perhaps the inputs should be on one sheet and results post to another sheet?

Thank you and appreciate any help you can give me.



Hello world. I have a variable list of numbers, say 1-32. I want to create a macro that lists all possible combinations (not permutations) choosing x numbers at a time. For example, a list of 32 numbers, chosen 3 at a time yields 4,960 possible combinations. I need to generate the list of 4,960 combinations.

Ideally, I'd provide the list of numbers in Col A and enter the sample size in another cell. Data validation on the sample size would limit the display of combinations to a reasonable number. For example, 32 items taken 15 at a time yields 565,722,720 combinations!! With 32 items, 5 or 6 would be the highest permitted sample size.

I've searched the forums (and Google) high and low for a workable solution without success.

Thanks in advance!!

I'm not to great with formulas in excel. Here's my problem and what I am trying to accomplish.. hopefully someone out there can help me. And if it's not possible, then it is what it is.

I have 10 rows. Each have 5 columns.

I want to take those 10 rows and their numbers and generate new combinations,
but I don't want the same number to be repeated in the new combination of 5 numbers twice.

For an example..

So if the number 26 is in those 10 rows somewhere, I need every combination that can be used with the number 26 only being used once, but using the other numbers from those 10 rows to produce a new set of 5 numbers.

Is that possible to do with excel or do I need something more? Or maybe it's not possible to do at all, maybe there are to many combinations to create?

actually this calculator I found online is close
but instead of a range of numbers, I need to be able to insert my own numbers for the calculator to chose from



I have that Formula in place and It designed to give me the sum of all the values found...So if a number in Column A Sheet1 matched 3 numbers in Column B of Sheet2 it would give me the total sum of all 3 of the values found in Column D of Sheet2....It works great except for this

The Numbers that are matching look like this

For some reason it seems that it is considering the *1 and *12 as the same and adding the values togeather...WHY!!!!

I'm trying to create a flat database in Excel to list all my books.The problem is how can I create a function that takes care of the ISBN numbers that books have? Sometimes they have 9 digit numbers, sometimes 10 or even 13 numbers. I need a function that looks in a column that has unformatted numbers and then takes the MID function to convert them into strings and then CONCATENATE them into their appropriate number format like 0-0000-9999-9. It seems that simply formatting the column using custom format doesn't work.

A1 is Title.
B1 is Year
C1 is Format
D1 is where I list the unformatted ISBN number.
E1 is the function that looks in D1 and uses the MID and CONCATENATE to create the appropriate ISBN number regardless if it's 9 digit, 10 digit or 13 digit.

Can anybody create a sample function that does this? Thanks in advance.


I need a formula to take a 6-Digit Number and change it into a 7-Digit Number.

Probably a if statement would better because i have 7 digit numbers in the same column with 6-digit numbers.

I need to insert zero between the 4th digit and the 5th digit of a 6-digit number.

For Example:

6-Digit Number


It needs to be


which would make it a 7-digit number.

This formula can only apply to 6-Digit Numbers and cannot affect any of the 7 digit numbers.

These numbers are the Year and Day Number of that Year. So day# 1-99 only shows up as a 6-digit number.

This is the formula i use to convert a date into that format:


I hope some one can help me

Fellow Forum Members,
I have figured out on my own how to use the "combin function" so that I can get the total number of combinations possible when picking 3 numbers out of a pool of 20 numbers. By using the function =COMBIN(20,3) I'm able to determine that a total of 1,140 combinations is possible. What I'm not able to figure out is how to get EXCEL to generate the actual numbers for all of the 1,140 combinations as a list in a single column with hyphens in between the numbers. Can anyone out there give me some idea on how to do this? I want EXCEL to produce all 1,140 number combinations on the "A" column on 1,141 separate rows as shown below:


How can this be done? Will it require a Macro? Any help will be greatly appreciated.


Using MS Excel 2003

A single column in spreadsheet contains (and will continue to receive) phone numbers which a
either 9-digit: 000-000-000
or 10-digit: 000-000-0000

The first digit in either format is a zero, which I want always to display.

Looking for a single Custom format, to format the entire column - which will allow either a 9 digit or a 10 digit string to be entered in any cell and always have the first 2 sets (6 digits, which start with a zero) displaying as 000-000- then allow the final set to show as either 000 or 0000

Is this possible? I've tried all ways I can think of but can't get it to work having a single format which will accept both types of ph.numbers.

I'd like to use the Format>Cells>Custom Format if possible - not VBA or Insert Function.


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.



In my previous thread I had question on combinations but there were fixed numbers. Now I try to minimize the combinations by picking few numbers from columns.I'm attaching workbook, but I think it is self explanatory. I'm looking for combinations not a permutations, and those 4 rows are just the first 4 combinations from those range of numbers.



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!

I need some help/advise on removing duplicates in a column of maybe 10000 cells where the number range from 0000 to 9999. Can someone please advise or help please.

for eg

in the column i have these datas, i need excel to display this numbers with the permutation duplicates remove in column C. Eg, display all the main set of number like 1234,1235,1236,1237 in Col C and deleting all permutation (1324,1423,1432,2134,....etc to remove)

Column A:

Hello Gurus,

I found this thread with a code in post #3 that almost gave me the answer for what I was lookking for. I don't know how to modify this code, so here I am asking your help.
This code gives all the possible combinations from a set of numbers. What want is for this to show only those combinations that totals to a desired result e.g the set of numbers is 1,2,3,4,5,6,7,8,9 and I want all combinations of three numbers that totals to 6. The answer is only 1,2 and 3. This is the ONLY combination with 3 numbers and every number is used opnly once.
A number in the set cannot be used twice which already is a part of the code. It selects one number only once but it doesn't give the total of all combinations.
Is there a way to get it to do what I want or is it not possible?