Developer Lists

Excel column letter to number

What to do

Transformed in your browser · nothing is uploaded

Local · bijective base-26, no zero digit

Converts spreadsheet column letters to their index and back. A is 1, Z is 26, AA is 27, and XFD is 16,384, which Microsoft documents as the last column of a worksheet. Convert a whole list at once, one entry per line or separated by spaces or commas.

How to use the excel column letter to number

1 Paste your text into the first box.
2 Choose what you want done to it.
3 Copy the result, or save it as a text file.

The system is bijective base-26, which is not ordinary base-26, and the difference is why the obvious implementation is wrong. In normal base-26 there is a zero digit, so the value after Z would be written BA. Spreadsheet columns have no zero: the digits run A to Z with no placeholder, so after Z comes AA. The practical consequence is that converting a number to letters needs a subtraction inside the loop, and code that omits it is correct up to column 26 and wrong from 27 onward. That is a bug that passes every casual test and reaches production, because nobody checks column 27.

Going the other way is simpler than it looks. Reading letters to a number is just the usual left-to-right accumulation, value times 26 plus the letter position, and no subtraction is involved. The asymmetry catches people who assume both directions need the same correction.

The limits are Microsoft's and are worth having to hand: 16,384 columns, ending at XFD, and 1,048,576 rows. Both are powers of two, 2 to the 14th and 2 to the 20th. This converter does the arithmetic rather than enforcing the ceiling, so asking it for column 16,385 gives you XFE quite happily. That is deliberate. The same lettering is used by Google Sheets, LibreOffice and a dozen file formats with different limits, and refusing a valid conversion because one particular application stops there would be the wrong call.

Anything that is not letters comes back with a question mark rather than a wrong answer. A1 is a cell reference and not a column, so it is refused; if you want the column from a cell reference, strip the digits first.

What people use it for

  • Working out which column a spec means when it says "column BJ"
  • Turning a column index out of a script back into the letter the sheet shows
  • Mapping a list of column letters to indices for an import
  • Checking how close a wide export is to the 16,384-column ceiling

Questions

Because the system has no zero digit. It is bijective base-26, so the sequence runs A to Z then AA, not A to Z then BA.

Microsoft: Excel specifications and limits
Was this tool any good?
Internal signal only · I use it to find the tools worth rebuilding