Code Golf: Numeric equivalent of an Excel column name

Vivin Paliath picture Vivin Paliath · Apr 14, 2010 · Viewed 53.7k times · Source

The challenge

The shortest code by character count that will output the numeric equivalent of an Excel column string.

For example, the A column is 1, B is 2, so on and so forth. Once you hit Z, the next column becomes AA, then AB and so on.

Test cases:

A:    1
B:    2
AD:   30
ABC:  731
WTF:  16074
ROFL: 326676

Code count includes input/output (i.e full program).

Answer

Danko Durbić picture Danko Durbić · Apr 14, 2010

Excel, 9 chars :)

Use the right tool for the job:

=COLUMN()

=COLUMN()