Convert column index into corresponding column letter
I wrote these a while back for various purposes (will return the double-letter column names for column numbers > 26):
function columnToLetter(column){ var temp, letter = ''; while (column > 0) { temp = (column - 1) % 26; letter = String.fromCharCode(temp + 65) + letter; column = (column - temp - 1) / 26; } return letter;}function letterToColumn(letter){ var column = 0, length = letter.length; for (var i = 0; i < length; i++) { column += (letter.charCodeAt(i) - 64) * Math.pow(26, length - i - 1); } return column;}
This works good
=REGEXEXTRACT(ADDRESS(ROW(); COLUMN()); "[A-Z]+")
even for columns beyond Z.
Simply replace COLUMN()
with your column number. The value of ROW()
doesn't matter.
=SUBSTITUTE(ADDRESS(1,COLUMN(),4), "1", "")
This takes your cell, gets it's address as e.g. C1, and removes the "1".
How it works
COLUMN()
gives the number of the column of the cell.ADDRESS(1, ..., <format>)
gives an address of a cell, in format speficied by<format>
parameter.4
means the address you know - e.g.C1
.- The row doesn't matter here, so we use
1
. - See
ADDRESS
docs
- The row doesn't matter here, so we use
- Finally,
SUBSTITUTE(..., "1", "")
replaces the1
in the addressC1
, so you're left with the column letter.