This one comes from a real life problem. We solved it, of course, but it keeps feeling like it could have be done better, that it's too lengthy and roundabout solution. However none of my colleagues can think of a more succinct way of writing it. Hence I present it as code-golf.
The goal is to convert a nonnegative integer into a string the same way Excel presents its column headers. Thus:
0 -> A
1 -> B
...
25 -> Z
26 -> AA
27 -> AB
...
51 -> AZ
52 -> BA
...
16,383 -> XFD
It has to work at least up to 16,383, but beyond is acceptable too (no bonus points though). I'm looking forward most to the C# solution, but, as per traditions of code-golf, any real programming language is welcome.
=ADDRESS(1,1)
returns$A$1
. See Dr. belisarius' Excel answer. \$\endgroup\$+1
, so it doesn't matter much. :) \$\endgroup\$