Solved

Excel 2000 Custom alphanumeric Series

Posted on 2002-07-29
6
323 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Article by: dandraka
There are several quick shortcuts that can make your life easier in Microsoft Programs.  These simple tips and tricks will your work more productive and you faster at completing your tasks! MS Word (1) Creating Re-usable Scraps You can create s…
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
This video shows and describes the main difference between both orientations in Microsoft Word. Viewers will understand when to use each orientation and how to get the most out of them.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

746 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

11 Experts available now in Live!

Get 1:1 Help Now