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 — the last column in a modern Excel sheet.
How to use the excel column letter to number
The system is bijective base-26, which is not the same as ordinary base-26 and is why the obvious implementation is wrong. In normal base-26 there would be a zero digit, so after Z you would get BA. Spreadsheet columns have no zero — the digits run A to Z with no placeholder — so after Z comes AA. The practical effect is that the conversion needs a subtraction inside the loop, and code that forgets it works perfectly up to column 26 and is wrong from 27 onwards, which is exactly the sort of bug that reaches production. XFD at 16,384 is the limit because Excel uses 14 bits for the column index.
Questions
Because the system has no zero digit. It is bijective base-26, so the sequence is A–Z then AA, not A–Z then BA.