Formula to find all possible 4 digit combinations using the nu
Or, just to make things more difficult, you can do it with a macro:
Sub Build4DigitNumsFrom10()
Dim ThousandsLoop As Integer
Dim HundredsLoop As Integer
Dim TensLoop As Integer
Dim OnesLoop As Integer
Dim myNumber As Integer
For ThousandsLoop = 0 To 9
For HundredsLoop = 0 To 9
For TensLoop = 0 To 9
For OnesLoop = 0 To 9
myNumber = ThousandsLoop * 1000 + _
HundredsLoop * 100 + _
TensLoop * 10 + OnesLoop
ActiveSheet.Range("A" & myNumber + 1) = _
myNumber
ActiveSheet.Range("A" & myNumber + 1).NumberFormat = _
"0000"
Next ' ones loop
Next ' tens loop
Next ' hundreds loop
Next ' thousands loop
End Sub
"Pete_UK" wrote:
Put this formula in A1:
=ROW(A1)-1
and use a custom format on the cell of "0000" (without the quotes).
Or alternatively use this formula:
=TEXT(ROW(A1)-1,"0000")
and have the format as General.
Then copy the down to A10000.
Both formulae will give you all the 4-digit numbers from 0000 to 9999.
Hope this helps.
Pete
On Sep 22, 11:19 pm, Danelle Sanchez wrote:
Hi,
I need to create a formula that will show the results of all possible 4 digit combinations using the numbers 0,1,2,3,4,5,6,7,8,9. I found a similar question on this forum but it was only for the numbers 0,1,3,4.
Here is the formula I found but did not know how to edit it for my required results
0, 1, 2, 3, 4
=MOD(INT((ROW(A2)-1)/125),5)&MOD(INT((ROW(A2)-1)/25),5)&MOD(INT((ROW(A2)-1)Â*/5),5)&MOD(ROW(A2)-1,5)
EggHeadCafe - Software Developer Portal of Choice
WPF And The Model View View Model Patternhttp://www.eggheadcafe.com/tutorials/aspnet/ec832ac7-6e4c-4ea8-81ab-7...
|