Excel column letter to number
Transformed in your browser · nothing is uploaded
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
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.
XFD, number 16,384. Microsoft documents that alongside the 1,048,576-row limit; both are powers of two.
A missing subtraction when converting a number to letters. Plain base-26 arithmetic is right up to Z and wrong from AA onward.
No, and that asymmetry is the trap. Reading letters is a straight accumulation of value times 26 plus the letter position.
No. Ask for 16,385 and it gives XFE. The arithmetic is general, and other spreadsheet applications and file formats have different limits.
Yes, case is ignored entirely. Output is uppercase, which is what every spreadsheet shows.
Yes. One per line, or separated by spaces or commas. Each result is printed next to what you typed.
A1 is a cell reference, not a column. Strip the row number and convert the letters on their own.
Yes. The lettering scheme is shared across Excel, Google Sheets, LibreOffice and the common file formats. Only the ceiling differs.