Excel Column Number Calculator: Convert Letters to Numbers
In this article
This page explains how to convert Excel column letters (like A, B, AA, or XFD) into their corresponding numeric positions (1, 2, 27, or 16384) and vice versa. You can use the built-in formulas below to perform the conversion manually in Excel, or simply follow the reference table and examples to understand the pattern.
Why You Need This Conversion
Excel displays columns as letters (A, B, C, ... Z, AA, AB, ...), but many functions and programming interfaces (like VBA, the Excel Object Model, or formulas such as ADDRESS and INDIRECT) work with column numbers. For example, ADDRESS(1, 27) returns "$AA$1", and if you need to loop through columns in a macro, you often need the numeric index. Knowing how to convert between the two systems helps you write cleaner formulas, debug spreadsheet errors, and understand how Excel internally references cells.
How the Letter-to-Number System Works
Excel's column labeling is a base-26 system, but with a twist: it uses letters A through Z (1 through 26) instead of digits 0 through 25. This means there is no zero digit. After Z (26) comes AA (27), AB (28), and so on. The system is similar to how Excel names rows with numbers, but columns use letters to keep the grid readable.
To convert a column letter to a number, you process each character from left to right. For each letter, you take its positional value (A=1, B=2, ..., Z=26), multiply the current total by 26, and add that value. For example, to convert "AA": start with 0, multiply by 26 (still 0), add 1 (A=1) → 1; then multiply 1 by 26 (26), add 1 (A=1) → 27. So AA = 27.
The reverse conversion (number to letters) uses repeated division by 26, but with a correction because there is no zero. When the remainder is 0, you use "Z" and subtract 1 from the quotient before continuing. For example, to convert 27: 27 ÷ 26 = 1 remainder 1 → the last letter is A (remainder 1), then the quotient 1 corresponds to A, so you get "AA". For 52: 52 ÷ 26 = 2 remainder 0 → last letter is Z, quotient becomes 1 (since you subtract 1), then 1 → A, giving "AZ". This is a common source of off-by-one errors.
Excel Formulas for Conversion
You can perform these conversions directly in Excel without writing VBA code. The following formulas assume your column letter is in cell A1 and your column number is in cell B1.
- Letter to number (single column, up to Z): Use
COLUMN(INDIRECT(A1 & "1")). This works for any single letter, but for multi-letter columns you need a more robust formula. - Letter to number (any length, e.g., AA or XFD): Use an array formula like
=SUMPRODUCT((CODE(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1))-64)*26^(LEN(A1)-ROW(INDIRECT("1:"&LEN(A1))))). This formula calculates each character's value and multiplies by the appropriate power of 26. - Number to letter (single column, up to 26): Use
=SUBSTITUTE(ADDRESS(1, B1, 4), "1", ""). This returns the column letter directly. - Number to letter (any number): Use a more complex formula that loops through divisions, but a simpler approach is to use
=SUBSTITUTE(ADDRESS(1, B1, 4), "1", "")which actually works for any number up to 16384 (the last column in Excel).
For most users, the ADDRESS function is the easiest for number-to-letter, and the COLUMN(INDIRECT()) trick works for letter-to-number when the column is not too long. The array formula above is more general but requires entering it with Ctrl+Shift+Enter in older Excel versions.
Common Mistakes and Pitfalls
One frequent error is assuming that A=0 instead of A=1. This leads to off-by-one results, especially when converting numbers like 26 (which should be Z, not AA) or 27 (which should be AA, not AB). Another mistake is forgetting that Excel's maximum column is XFD (16384), so any conversion beyond that is invalid. Also, when using the ADDRESS function, the third argument (abs_num) must be 4 to return a relative reference without dollar signs; otherwise you get $A$1 and need to strip those.
When writing VBA code, the built-in Cells property uses numbers, so if you have a column letter from user input, you must convert it. A common VBA snippet is:
Dim colNum As Long
colNum = Range("A1").Column
This returns the number for column A, but if you have a letter in a string variable, you need to use Range(letter & "1").Column.
Reference Table for Quick Lookup
Here is a small reference table for common columns:
- A = 1, B = 2, ..., Z = 26
- AA = 27, AB = 28, ..., AZ = 52
- BA = 53, BB = 54, ..., BZ = 78
- ... and so on up to XFD = 16384
You can generate this table in Excel by putting numbers 1 to 16384 in a column and using =SUBSTITUTE(ADDRESS(1, A1, 4), "1", "") in the adjacent column. This is a quick way to create a permanent reference.
Alternatives and Built-in Tools
If you don't want to write formulas, you can use Excel's built-in Name Manager or Go To feature. For example, pressing F5 (Go To) and typing AA1 will take you to that cell, and the Name Box (left of the formula bar) will show the cell reference. For a quick conversion, you can also type a formula like =COLUMN(INDIRECT("AA1")) in any cell to get 27. There is no dedicated Excel function for this conversion, so these workarounds are standard.
For programmers, many languages have libraries that handle Excel column conversions. In Python, the openpyxl library has utils.column_index_from_string and utils.get_column_letter. In JavaScript, you can write a simple function using the same base-26 logic. These are useful when automating Excel files outside of Excel itself.
Frequently Asked Questions
How do I convert a column letter to a number in Excel without VBA?
Use the formula =COLUMN(INDIRECT(letter & "1")) where letter is a cell reference containing the column letter. For example, if A1 contains "AA", then =COLUMN(INDIRECT(A1 & "1")) returns 27. This works for any valid column letter up to XFD.
What is the maximum column number in Excel?
Excel's maximum column is XFD, which corresponds to column number 16384. This is true for Excel 2007 and later versions. Earlier versions had only 256 columns (IV).
Why does my conversion give 0 for A?
If you are using a formula that subtracts 64 from the ASCII code of the letter, you might get 0 if you mistakenly use 65 as the base. A=65 in ASCII, so subtracting 64 gives 1. If you subtract 65, you get 0. Always use 64 as the offset.
Can I convert a column number to a letter using a simple formula?
Yes, the simplest is =SUBSTITUTE(ADDRESS(1, number, 4), "1", ""). Replace number with a cell reference or a number. This returns the column letter, such as "AA" for 27.
Is there a way to convert a whole range of columns at once?
You can drag the formula down a column to convert multiple letters. For letter-to-number, use the array formula mentioned earlier, but ensure you enter it correctly. For number-to-letter, the ADDRESS formula drags easily.
What is the difference between column numbers and column letters in Excel formulas?
Most Excel formulas use letters for direct cell references, like A1 or B2. However, functions like INDEX and ADDRESS can use numbers. For example, INDEX(A1:C3, 1, 2) returns the cell in the first row and second column of the range, which is B1. Understanding both systems helps you build dynamic formulas.