Number to Letter Counting algorithim needed



Hi,

not sure if this best place to ask but hoping ill get answer to a bugging
algorithim im trying to work out.

Basically im trying to convert numbers into a character sequence as such
that A = 1 to Z = 26, but when you get to 27 it becomes AA all the way to
702 which is ZZ then 703 is AAA

ie...

AAA
AAB
AAC
.....
ABA
ABB
ABC

Now what ive been doing so far is this....(works 90% time)

ie take number 12131 which stands for QXO

ill divind 12131 by 26^2 or 676 which gives 17 MOD 639
then ill divind 639 by 26^1 or 26 which gives 24 MOD 15

taking the 17, 24 and 15 in order give the character value of QXO

another example

ie take number 1406 which stands for BBB

ill divind 1406 by 26^2 or 676 which gives 2 MOD 54
then ill divind 54 by 26^1 or 26 which gives 2 MOD 2

taking the 2, 2 and 2 in order give the character value of BBB

My problem comes with say 16224 - WYZ

ill divind 16224 by 26^2 or 676 which gives 24 MOD 0
????
which is now already wrong as 24 is X now W. im now stuck in what to do lol

If your curious im tring to work out how to convert Excel 2007 column
numbers to there letter equilivant.

Any help be very much appreciated.

Many Thanks

Gary









.



Relevant Pages

  • Re: Currently reading
    ... I really like Susan Isaacs but ... this one is bugging me a bit; the main character keeps misunderstanding ...
    (rec.arts.mystery)
  • Re: Number to Letter Counting algorithim needed
    ... 676, not 702, combos. ... Reinterpret result in your scheme by the observation above. ... Basically im trying to convert numbers into a character sequence as such ... 24 and 15 in order give the character value of QXO ...
    (sci.math)
  • gripe about sequencing
    ... There are 5 POV characters, and I've been switching between them when one of ... But now, character A is unconscious; ... What's really bugging me is that character C's doings are studded with the ... kind of minor cliffhangers that I've been using as a cue to switch POVs. ...
    (rec.arts.sf.composition)
  • Re: Size limit on NSString cStringUsingEncoding?
    ... just 'cause it's bugging me: ... This now works with the UTF-8 encoding. ... if you look at an accented character such as e' ... the string when you treat it as a C string. ...
    (comp.sys.mac.programmer.help)