Help with alphanumeric sequencing - 6 characters

damian1080

New Member
Joined
Jan 16, 2015
Messages
12
Hi,

I am relatively inexperienced Excel user and am trying to create a list of 6 digit alphanumeric serial numbers in Excel. I am looking for help to sequence 2 series of alphanumerics with the following rules

Series 1 - 2 letters in any of first 4 positions, 00AA00 until YY0000
Series 2 - 3 letters in any of first 4 positions , 0AAA00 will be used first until AAA000

I would like the series to be sorted in Excel so i can choose numbers between a range.

I would like to also implement the following rules
any digit (0 to 9) is acceptable in any position;
letters I and O are forbidden in any position because they can be confused with digits 1 and 0, respectively;
letters B, D, S, Z are forbidden in any position;
letters are All Caps

Any help on this would be gratefully received

Many Thanks

Damian1080 :)
 
if the rule is there has to be 2 letters with 4 numbers cycling from 0 to 9, one approach could be to accept that the two letters can only have 15 unique positions, so the macro has to put the letters in the following positions

12....13....14....15.....16.......23.....24....25.....26.........34.......35.....36...........45.......46........56

so for each of these 4 positions cycle from 0 to 9 ie 10000 for each AA in position 12, 10000 for each AB in position 12

this is 60 million unique numbers

I need OP go ahead before spending time on this....

Thanks for your ongoing assistance Oldbrewer. To answer your question A00A00 is allowed. Your idea of cycling the positions looks good. I have managed with some assistance to get your initial macro doing what I want it to do. I am planning on developing this further tomorrow. Please can you hold fire until I've tested that the solution that I'm working on gives me what I want. I've basically created a number of worksheets within the spreadsheet which give me each combination using your macro. It needs more work, but I'm hopeful of it working for me. I'll let you know how I get on. Thanks again

Damian1080:)
 
Upvote 0

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Code:
Sub Serial_A0A000()
Application.ScreenUpdating = False
Sum = 0
For n1 = Cells(9, 18) To Cells(9, 19)
For n2 = Cells(10, 18) To Cells(10, 19)
For n3 = Cells(11, 18) To Cells(11, 19)
For n4 = Cells(12, 18) To Cells(12, 19)
For n5 = Cells(13, 18) To Cells(13, 19)
For n6 = Cells(14, 18) To Cells(14, 19)
Sum = Sum + 1
If Sum = 1 Then n6 = n6 + Cells(14, 20): n5 = n5 + Cells(13, 20): n4 = n4 + Cells(12, 20): n3 = n3 + Cells(11, 20) - 1: n2 = n2 + Cells(10, 20): n1 = n1 + Cells(9, 20) - 1
Cells(1, 5) = n1: Cells(1, 6) = n2: Cells(1, 7) = n3: Cells(1, 8) = n4: Cells(1, 9) = n5: Cells(1, 10) = n6
Cells(Sum, 1) = Cells(1, 11)
If Sum = Cells(2, 16) Then GoTo 0
Next n6
Next n5
Next n4
Next n3
Next n2
Next n1
0 End Sub

Thanks for your assistance Oldbrewer, I have now got a code that works for me. See above. Because it's been decided that I want letters in specific positions then I've got 1 macro per series required.

Thanks again for your time on this

Damian 1080:LOL:
 
Upvote 0
Glad you were able to get this sorted out... I started working on a similar method yesterday evening that took the position of the alphanumeric character into account. I called my variables Pos1, Pos2,Pos3.... instead of n1,n2,n3. Thanks for sharing the solution.
 
Upvote 0
1121234561A1
2131324562CA
3141423563E
4151523464F
5161623455G
6232314566Hthe table to the left calculate where
7242413567Jthe letters and numbers should be
8252513468K
9262613459L
103434125610Mthis macro does it
113535124611N
123636124512Pwe start with AA0000
134545123613Qand finish with 9999ZZ
144646123514R
155656123415T
16Uafter ZZ9999 it goes to A0A000
17V
18W
19X
AA000020Ywarning
AA0001
AA0002to enable you to test it
AA0010the loops were curtailed to 2 for letters
AA0011and 2 for numbers- the correction is to the right
AA0012of the relevant lines
AA0020
AA0021Sum = 19
AA0022 For j = 1 To 15
AA0100 l1 = Cells(j, 4)
AA0101 l2 = Cells(j, 5)
AA0102 n1 = Cells(j, 6)
AA0110 n2 = Cells(j, 7)
AA0111 n3 = Cells(j, 8)
AA0112 n4 = Cells(j, 9)
AA0120 For let1 = 1 To 220
AA0121 Cells(1, 13) = let1
AA0122 r1 = Cells(2, 13)
AA0200 For let2 = 1 To 220
AA0201 Cells(1, 13) = let2
AA0202 r2 = Cells(2, 13)
AA0210 For num1 = o To 29
AA0211 For num2 = 0 To 29
AA0212 For num3 = 0 To 29
AA0220 For num4 = 0 To 29
AA0221 Sum = Sum + 1
AA0222 Cells(Sum, l1) = r1
AA1000 Cells(Sum, l2) = r2
AA1001 Cells(Sum, n1) = num1
AA1002 Cells(Sum, n2) = num2
AA1010 Cells(Sum, n3) = num3
AA1011 Cells(Sum, n4) = num4
AA1012these 2 lines put in a delay>>>>>>>>>>>> For delay = 1 To 7000000
so that you can see the sequencing >>>>>>>>>>>>>> Next delay
Next num4
Next num3
Next num2
I stopped the macro here Next num1
but earlier I let it run to completion Next let2
Next let1
Next j
End Sub

<colgroup><col span="3"><col><col><col span="14"></colgroup><tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,216,759
Messages
6,132,548
Members
449,735
Latest member
Gary_M

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top