How to Convert Column Number to Column Letter in Google Sheets

Introduction

In Google Sheets, columns are labeled with letters (A, B, C... Z, AA, AB, etc.), but sometimes you might have the column number and need to find its corresponding letter. This is common in automation scripts, formulas, or when building dynamic references. In this tutorial, you’ll learn how to convert a column number into a column letter using both built-in formulas and Google Apps Script.

Step 1: Using the ADDRESS Function

The simplest formula method uses the ADDRESS function to return a cell reference, and then removes the row number to keep only the column letter.

Formula:

=REGEXREPLACE(ADDRESS(1, 28, 4), "[0-9]", "")
        

Explanation:

  • ADDRESS(1, 28, 4) → Returns AB1 (column 28, row 1, with relative referencing).
  • REGEXREPLACE(..., "[0-9]", "") → Removes any digits, leaving only AB.

Result: For column number 28, this returns AB.

Step 2: Using the SUBSTITUTE and ADDRESS Functions

Another formula-based method without regex:

=SUBSTITUTE(ADDRESS(1, A1, 4), "1", "")
        

Where A1 contains the column number.

This replaces the row number ("1") from the ADDRESS output, leaving only the column letters.

Step 3: Custom Function with Google Apps Script

If you need to do this often or in bulk, a Google Apps Script custom function is a clean solution.

function columnNumberToLetter(columnNumber) {
  var temp;
  var letter = '';
  while (columnNumber > 0) {
    temp = (columnNumber - 1) % 26;
    letter = String.fromCharCode(temp + 65) + letter;
    columnNumber = Math.floor((columnNumber - 1) / 26);
  }
  return letter;
}
        

How to use:

  1. Go to Extensions > Apps Script in your Google Sheet.
  2. Paste the above code and save it.
  3. Back in your sheet, use:
=COLUMNNUMBERTOTLETTER(28)
        

This will return AB for the number 28.

Step 4: Combining with COLUMN Function

If you already have a cell reference and want to get its letter:

=REGEXREPLACE(ADDRESS(1, COLUMN(C5), 4), "[0-9]", "")
        

This will give you the column letter of cell C5 without manually counting columns.

Step 5: Why This is Useful

Converting column numbers to letters is helpful for:

  • Dynamic range references in formulas
  • Generating reports or export templates
  • Automating Google Sheets tasks with Apps Script
  • Building custom dashboards

Conclusion

Whether you prefer formulas or Apps Script, converting column numbers to letters in Google Sheets is straightforward. For quick conversions, use the ADDRESS + REGEXREPLACE or SUBSTITUTE method. For automation or bulk processing, create a custom Apps Script function. Both approaches save time and make working with column references more dynamic.