keepcalculator

06 Numbers and Powers

Convert Column Number to Letter (Excel & Sheets)

Card No. 06·14439 · Updated · Standard formula, shown below

The calculator on this card is switched off while it is checked. The formula is below, and the worked example shows how to do the sum by hand.

This page converts a spreadsheet column number (like 1, 27, or 703) into its corresponding column letter (A, AA, or AAA) using the standard A1 notation used in Excel, Google Sheets, and most other spreadsheet programs. Enter any positive integer, and you’ll get the exact column letter(s) that appear at the top of the sheet. The conversion follows the same bijective base-26 system these applications use, so the result will match what you see in the program.

Formula

The spreadsheet column system is a bijective base-26 numeral system. Unlike normal base-26 (which uses 0–25), this system has no zero digit: A=1, B=2, … Z=26, then AA=27, AB=28, and so on. To convert a column number n to its letter, you repeatedly divide by 26, but with a twist: when the remainder is 0, you record a ‘Z’ and subtract 1 from the quotient before the next division.

In plain words, the algorithm is:

  1. Start with the column number n.
  2. While n > 0:
    • Compute remainder = n mod 26.
    • If remainder = 0, set remainder = 26 and decrease n by 1.
    • Convert the remainder to a letter (1=A, 2=B, …, 26=Z).
    • Prepend that letter to the result.
    • Set n = floor(n / 26).
  3. The accumulated string is the column letter.

For example, the number 27 becomes: 27 mod 26 = 1 → ‘A’, then 27 / 26 = 1 (floor) → 1 mod 26 = 1 → ‘A’, so the result is “AAâ€�.

Worked Example

Let’s convert the default value 27 to a column letter, step by step:

  1. n = 27. Remainder = 27 mod 26 = 1 → letter ‘A’.
  2. n = floor(27 / 26) = 1.
  3. Now n = 1. Remainder = 1 mod 26 = 1 → letter ‘A’.
  4. n = floor(1 / 26) = 0, so we stop.

Reading the letters from last to first gives “AA�. This matches the calculator’s output for the default input of 27.

Why Spreadsheets Use This System

Spreadsheet software labels columns with letters for human readability. A1 notation (column letter + row number) is intuitive for referring to cells like B3 or AB12. The system is bijective base-26, which means every positive integer maps to exactly one unique letter combination, and every letter combination maps back to exactly one number. This is why column 26 is Z, not A0, and column 27 is AA, not BA.

This notation is universal across Excel, Google Sheets, LibreOffice Calc, and Apple Numbers. Even programming libraries that manipulate spreadsheets (like openpyxl for Python) use the same conversion functions.

How to Choose the Right Method

If you need to convert a column number to a letter, you have several options depending on your context:

  • In Excel or Google Sheets: Use the built-in ADDRESS function. For example, =SUBSTITUTE(ADDRESS(1, 27, 4), "1", "") returns “AAâ€�. The 4 in the formula makes it return a relative reference (no dollar signs).
  • In Google Sheets specifically: You can also use =REGEXEXTRACT(ADDRESS(1, 27, 4), "[A-Z]+") to extract just the letters.
  • In Python (openpyxl): Use openpyxl.utils.get_column_letter(27) which returns ‘AA’.
  • In VBA: Use Split(Cells(1, 27).Address, "$")(1) to get the column letter.
  • Manually: Use the algorithm described above if you need to do it by hand or in a language without a built-in function.

For most users, the built-in spreadsheet functions are the fastest and least error-prone. The manual algorithm is useful when you’re writing code or need to understand the underlying logic.

Common Mistakes and Pitfalls

One frequent error is treating the system as standard base-26. For example, some might think column 27 is “BAâ€� (like 1→A, 2→B, … 26→Z, then 27→BA). That’s wrong because there is no zero digit. Another mistake is using CHAR(64 + n) in Excel, which only works for n ≤ 26. For larger numbers, you need the full algorithm.

Also, be careful with the ADDRESS function: the third argument (abs_num) controls whether the reference is absolute or relative. Using 4 gives relative (no $ signs), which is usually what you want when extracting the letter. If you use 1, you’ll get $A$1 and need to strip the dollar signs.

Finally, remember that the column number starts at 1 for column A. If you have a zero-based index (like in some programming languages), add 1 before converting.

Limits and Edge Cases

The maximum column number in a modern Excel worksheet is 16,384 (column XFD). Google Sheets supports up to 18,278 columns (column ZZZ). This calculator accepts up to 1,000,000, which is beyond any current spreadsheet limit, but the conversion algorithm works for any positive integer.

For very large numbers, the letter string just gets longer. For example, column 1,000,000 converts to “EMYIH�. There is no practical limit to the length of the column label, though spreadsheet programs themselves cap the number of columns.

Also note that the conversion is case-insensitive in practice—spreadsheets display uppercase letters, but the underlying logic is the same.

Frequently Asked Questions

How do I convert a column letter back to a number?

To go from a letter to a number, you reverse the process: for each character from left to right, multiply the running total by 26 and add the letter’s position (A=1, B=2, … Z=26). For example, “AAâ€� = (1 × 26) + 1 = 27. In Excel, you can use =COLUMN(INDIRECT("A"&1)) but that’s circular; simpler is =COLUMN(INDIRECT("AA1")) which returns 27.

Why is there no column A0 or 0?

Because the system is bijective base-26, meaning it starts at 1 (A) and has no zero digit. This is similar to how we count with Roman numerals or how Excel names rows starting at 1. If there were a zero, you’d have ambiguity (e.g., is 26 “Z� or “A0�?).

What is the column letter for 16384 (Excel’s last column)?

Column 16,384 is XFD. You can verify with the calculator: enter 16384 and it will output XFD. This is the maximum column in modern Excel versions (2010 and later).

Can I use this conversion in Google Sheets formulas?

Yes. Google Sheets supports the same ADDRESS function. For example, =REGEXEXTRACT(ADDRESS(1, 27, 4), "[A-Z]+") returns “AA�. Alternatively, you can use a custom function in Google Apps Script with the same algorithm.

Does this work for LibreOffice Calc or Apple Numbers?

Yes. LibreOffice Calc and Apple Numbers use the same A1 notation and the same column labeling. The conversion is identical across all major spreadsheet applications.

What if I have a column number larger than 1,000,000?

The calculator caps at 1,000,000, but the algorithm works for any positive integer. If you need to convert a larger number, you can use the manual method or a programming language. For context, 1,000,000 is column EMYIH, which is far beyond any spreadsheet’s column limit.

Related

Formula used
in n | Column number | - | 27 | 1 | 1000000
out letter | Column letter | - | convert(n) | 0

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →