If cell A1 contains an Excel column name, enter =COLUMN(INDIRECT(A1&"1")) to return its number: A returns 1, Z returns 26, AA returns 27, and XFD returns 16,384. For a formula that works directly with the letters rather than building a cell reference, use the alternative shown below.
Quick method: convert a column name with COLUMN
For a label stored as text in A1, the formula =COLUMN(INDIRECT(A1&"1")) makes a cell reference by adding the row number 1 to the letters, then asks COLUMN for that reference’s position. For example, if A1 contains AB, Excel evaluates the reference AB1 and returns 28. The row number does not affect the result: AB1 and AB500 are both in column 28.
This is usually the shortest approach in Excel for Microsoft 365 on Windows, and it also works in many older Excel versions. The text in A1 must form a valid column reference. It is not necessary to capitalize the letters; Excel column references are not case-sensitive. If the cell contains a space, punctuation, a number, or a label beyond the worksheet’s last column, the formula can return an error rather than a useful number.
For a quick one-off conversion, you can also type a reference directly into COLUMN. With any valid worksheet column reference, the formula =COLUMN(AB1) returns 28. This version is convenient when the column is already known, but it does not convert a text label in another cell.
How Excel column numbers work
Excel column labels follow a base-26 counting system using the letters A through Z. It resembles ordinary base 10, but there is an important difference: Excel’s letter system has no zero-valued digit. A represents 1, B represents 2, and Z represents 26. After Z, Excel starts a two-letter label at AA rather than moving to a label with a zero digit.
That makes AA equal to 27, not 11. To work it out, take the value of A in the first position, multiply by 26, then add the value of A in the second position: 1 × 26 + 1 = 27. AB is 1 × 26 + 2 = 28, and AZ is 1 × 26 + 26 = 52. The next label, BA, is 2 × 26 + 1 = 53.
For a three-letter label such as XFD, each position has a different place value. X is 24, F is 6, and D is 4, so the calculation is 24 × 26² + 6 × 26 + 4, which equals 16,384. The worksheet limit in current desktop Excel is column XFD, number 16,384, and row 1,048,576. Excel 2007 and later use these limits; Excel 2003 and earlier ended at column IV, number 256.
Convert letters without INDIRECT
INDIRECT is simple, but it interprets text as a cell reference. If you want to calculate from the characters themselves, use the following formula instead. It assumes the column letters are in A1 and that A1 contains one or more valid letters from A to Z. It uses SEQUENCE, which is available in Excel 2021 and Microsoft 365.
With a valid column label in A1, enter =SUMPRODUCT((CODE(MID(UPPER(A1),SEQUENCE(LEN(A1)),1))-64)*26^(LEN(A1)-SEQUENCE(LEN(A1)))). If A1 contains XFD, the formula returns 16,384. It converts each letter to a number from 1 to 26, weights each position by its base-26 place value, and adds the results.
For XFD, SEQUENCE supplies the character positions 1, 2, and 3. The letter values are 24, 6, and 4, and the place values are 26², 26¹, and 26⁰. SUMPRODUCT adds 24 × 676, 6 × 26, and 4 to produce 16,384. UPPER means lowercase input such as xfd is treated the same way as uppercase input.
This arithmetic version avoids INDIRECT, but it is not a complete input validator. It assumes A1 contains letters only; spaces or other characters can produce a plausible-looking but incorrect number. It also returns an error for a blank input because there are no characters to process. If labels may come from unclean data, check or clean the input before relying on the result.
Convert a number back to a column name
The reverse conversion is useful when a report, script, or calculation gives you a column number and you need the familiar Excel letters. With the number in A1, enter =SUBSTITUTE(ADDRESS(1,A1,4),"1",""). If A1 contains 28, the formula returns AB. The ADDRESS function builds a reference for row 1 and the specified column number; the SUBSTITUTE function removes the row number from that reference.
Use a whole-number column number from 1 through 16,384 for a current worksheet. A value of 1 returns A, 26 returns Z, 27 returns AA, and 16,384 returns XFD. A number outside the worksheet’s column range is not a valid column position, so do not assume the result can be used as a valid reference. This method returns text representing a label, not a numeric position.
Choosing the right conversion method
For most ordinary worksheets, COLUMN with INDIRECT is the easiest to read and maintain. Choose the character-based formula when you specifically want to avoid constructing a reference from text, or when volatility matters in a large workbook. The difference is not that INDIRECT is inherently wrong: it is a practical shortcut with a particular trade-off.
- Use COLUMN with INDIRECT for a short, straightforward formula and trusted column labels. It is easy to explain and works in older Excel versions too.
- Use the SUMPRODUCT formula when you want the result calculated from the letters themselves and have Excel 2021 or Microsoft 365. Validate the input separately if it may contain anything other than A–Z.
- Use COLUMN with a direct reference when you already know the cell reference and simply need its position, rather than converting text stored in a cell.
- Use ADDRESS with SUBSTITUTE when you need to turn a numeric column position back into letters.
INDIRECT is a volatile function: Excel may recalculate it whenever calculation occurs, even if its direct inputs have not changed. A few such formulas are generally unremarkable, but a workbook with many volatile formulas can recalculate more often than necessary. In a large model, consider whether you need the flexibility of interpreting a text reference or whether a direct reference or the character-based calculation is a better fit.
Common errors and misconceptions
The most common conceptual error is treating the letters as ordinary digits in a base-26 system that starts at zero. Excel labels do not work that way. Z is 26, so AA is 27; it is not 0 × 26 + 0, and it is not the number 11. When checking a result, the boundary labels are useful: Z is 26, AA is 27, AZ is 52, BA is 53, and XFD is 16,384.
A #REF! result from the INDIRECT method commonly means that the text did not produce a valid cell reference. Check for leading or trailing spaces, a misspelled label, or letters beyond XFD. A label such as XFE is outside the current Excel worksheet. If the cell looks correct but still fails, inspect the actual contents; copied data can contain invisible spaces.
A result that is one column off can come from mixing up the first position or counting from zero. Excel’s first column is 1, not 0. Also distinguish a column number from a cell’s position in a selected range: COLUMN returns the worksheet column number, not a number starting at 1 within your selection. For instance, column C is always worksheet column 3, even if it is the first column in a smaller table.
Finally, a column label is not a complete address. AB identifies a column, while AB7 identifies a cell at the intersection of column AB and row 7. Adding 1 in the INDIRECT formula supplies a row solely to form a usable reference; it does not mean that the answer depends on row 1.
Practical uses in worksheets
Column-number conversion is useful when a worksheet stores column labels as text, when you are comparing positions, or when you need to construct a reference programmatically. For example, a report might hold a target label such as Q in a settings cell. Converting it to 17 lets another calculation compare that position with a numeric threshold or use it in logic that expects a number.
It can also help explain why a reference points to a particular part of a sheet. If a formula or imported setting supplies the label BD, converting it to 56 makes its position easier to compare with other numeric column indexes. The conversion alone does not retrieve data from that column or change a cell reference; it only returns the number associated with the label.
When a task is simply to find a value in a table, converting a column label may be unnecessary. A direct cell reference or an appropriate lookup formula can be clearer. Column-number conversion is most useful when the label itself is the input, or when another part of a workbook specifically needs a numeric index. Keep the conversion separate from any later lookup or reference-building step so that an error can be traced to the right stage.
Frequently Asked Questions
What number is column AA in Excel?
AA is column 27. A is 1, Z is 26, and the next label, AA, is 27.
What number is column XFD?
XFD is column 16,384, the final column in Excel 2007 and later, including Microsoft 365.
Can Excel convert a column letter stored as text?
Yes. If the label is in A1, =COLUMN(INDIRECT(A1&"1")) returns its worksheet column number when the text forms a valid column reference.
Does COLUMN return a position within my selected range?
No. COLUMN returns the worksheet’s column number. For example, it returns 3 for a cell in column C, even if C is the first column of a selected range.
How do I turn a column number into letters?
If A1 contains a valid column number, use =SUBSTITUTE(ADDRESS(1,A1,4),"1",""). For example, 28 returns AB.
Why does my conversion formula return an error?
Check that the text contains only valid column letters and does not include extra spaces. With INDIRECT, also make sure the resulting reference is within the worksheet, ending no later than XFD.
Related
- How to Find a Z-Score Using Excel Solver Step by Step
- Excel Goal Seek Shortcut: Open It, Set a Target, Solve
- How to Enable Solver in Excel on Windows and Mac
Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.
More in Formulas & functions
- Excel TEXTJOIN Limit: Character Cap and WorkaroundsIn Excel, TEXTJOIN can return a maximum of 32,767 characters in one cell—the worksheet cell-content limit. If its…
- Excel AVERAGEIF Formula Examples: Criteria, Ranges, FixesUse Excel’s AVERAGEIF function to average values that meet one condition: =AVERAGEIF(A2:A6,"North",B2:B6). If A2:A6 contains regions and B2:B6…
- How to Group the Same Numbers in Excel: Sort and CountTo group identical numbers in Excel, sort the entire data range by the column containing those numbers: select…
- How to Copy a Formula Horizontally in ExcelTo copy a formula horizontally in Excel, select the cell that contains it and drag the small fill…
- INDIRECT Excel Formula for a Different Sheet: ExamplesIf cell A1 contains a worksheet name and you want the value in B2 on that sheet, use…
- Excel Formula Bar: What It Shows and How to Use ItIn Excel, the Formula Bar is the field above the worksheet that shows the contents of the selected…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.