Solved

Excel 2000 Custom alphanumeric Series

Posted on 2002-07-29
6
326 Views
Last Modified: 2012-06-27
I have an alphanumeric numbering system. I need to sort it.

It goes:
A, AA, AB, AC, AD, AE... AZ then B, BA, BB, BC, BD, BE.... BZ then C, CA, CB, CC, CD... CZ then D, DA, DB through to Z, ZA, ZB, ZC.... etc. After that it's 1, 1A, 1B, 1C.. 1Z then 1AA, 1AB.... 1ZZ, 2A, 2B.... get the drift!?

Anyway, what's the best way to create this in Excel so I can sort my revision control data. I was amazed to find that Excel didn't have a basic alphabet series in the series list. It's not a million miles away from a hexadecimal system, so it can't be that hard.
I know I can type a huge list and then import a custom series, but is there a better way? Is a custom number format a better option?

Thanks,

Steve :)
0
Comment
Question by:Steve2276
  • 3
  • 2
6 Comments
 
LVL 3

Expert Comment

by:Elmo_
ID: 7185003
Steve,

Just one or two Questions.

1.  When you start adding numbers to the list how high do you want to go?  Are you just just 1 or want to go to something like 10 on this.

2.  Should the list not follow suit after the inital alpha list?

E.g.

You have:
A, AA, AB, AC, AD, AE... AZ
1, 1A, 1B, 1C.. 1Z then 1AA, 1AB.... 1ZZ

Should it not be:
A, AA, AB, AC, AD, AE... AZ
1, 1A, 1AA, 1AB.. 1AZ then 1B, 1BA.... 1ZZ


Cheers,

Ed.
0
 

Author Comment

by:Steve2276
ID: 7185186
My list is already pre-defined.
I don't need to create a list as such, just order an existing list.
I figured the custom series route was the correct one to take - ie. it would determine the sort order. But I'm open to suggestions.

Steve
0
 
LVL 3

Expert Comment

by:Elmo_
ID: 7185231
Steve,

Sorry about that, I took up the question wrong.  I started to think about how to create the list.

OK.  Another one or two questions:

How do you currently have the list stored?

Are you trying to define how the list should be sorted?

cheers,

Ed.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:Steve2276
ID: 7188515
The list is stored as a single column in Excel (extracted and manipulated from a text file)

Yes, I am trying to define how the list should be sorted.

Thanks.

;o)
0
 
LVL 16

Accepted Solution

by:
sebastienm earned 102 total points
ID: 7192014
It is actually far from hex or any alphanum system since
all of them are built on 'basis'. So, you could never get:
A<AB<C<CA as you series is.
Anyway...

1.
One painfull method would be to write ALL of them
in order (once) in a sheet column A, then assign row number
to column B
A 1
AB 2
...
then anywhere you need this index (col B), you could do a
Vlookup().

2.
Else, you can use the bellow VBA function in your
spreadsheet, it transforms the code into a number, then
eg: in col B, =FormatSeriesString(B1)
then order by this number. It should work.

This also assumes that i understand your series (???):
In order: (3 digit code max starting at A ending at 9ZZ)
A
AA
AB
AZ
B
BA
BZ
Z
ZA
ZZ
1
1A
1AB
1Z
1ZZ
2
2A
2AB
2AZ
2Z
9
9A
9AB
9AZ
9Z
9ZA
9ZZ
----------------------------------------------
Function FormatSeriesString(Cell As Variant) As String
    Dim s As String
    Dim s1 As String, s2 As String, s3 As String
    Dim num As Integer

    s = Cell.Value
    s1 = Left(s, 1)
    num = Len(s)
   
    Select Case num
    Case 1
        If IsNumeric(s1) Then
            s = s & "00"
        Else
            s = "0" & s & "0"
        End If
    Case 2
        If IsNumeric(s1) Then
            s = s & "0"
        Else
            s = "0" & s
        End If
    Case 3
        s = s
    Case Else
        s = "000"
    End Select
   
    s1 = Left(s, 1): s2 = Mid(s, 2, 1): s3 = Right(s, 1)
    FormatSeriesString = _
        (Asc(s1) - IIf(IsNumeric(s1), 48, 55))*(36 * 36) _
        + (Asc(s2) - IIf(IsNumeric(s2), 48, 55)) * 36 _
        + (Asc(s3) - IIf(IsNumeric(s3), 48, 55))
   
End Function
---------------------------------------------------------
Regards,
Sébastien
0
 

Author Comment

by:Steve2276
ID: 7193147
Okay, cheers. It's all looking a bit complex now. I'm not opposed to VBA stuff, and I'll give it a go. But I may have found a better field to sort by now!
Cheers.
:)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

No matter the version of Windows you are using, you may have some problems with Windows Search running too slow or possibly not running at all. Before jumping into how you can solve this issue, just know there are many other viable alternative deskt…
Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
The viewer will learn how to make their project stand out over others by learning how to change colors and shapes, add spaces, change directions, and add bullets to their charts.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now