Skip to main content

Excel Column Converter

Excel uses an alphabetic column naming system where columns are labeled as A, B, C, ..., Z, AA, AB, and so on. This tool helps you convert between Excel column names and their corresponding numerical indices.

Excel Column Converter

1-indexed (Excel standard)0-indexed (Programming)

Excel columns are named alphabetically: A, B, C, ... Z, AA, AB, ... ZZ, AAA, etc.

Column A corresponds to number 1, Z to 26, AA to 27, and so on.

You can enter multiple values, one per line, in either field to convert them all at once.

How Excel Column Naming Works

Excel's column naming system follows these rules:

  • The first 26 columns are labeled with single letters: A through Z
  • The next 26^2 columns use two letters: AA through ZZ
  • This pattern continues with AAA through ZZZ, and so on

The conversion between column names and numbers follows this pattern:

Column NameColumn Number
A1
B2
Z26
AA27
AB28
BA53
ZZ702
AAA703

Formula Explanation

Column Name to Number

To convert a column name to its corresponding number:

function columnNameToNumber(name) {
let sum = 0;
for (let i = 0; i < name.length; i++) {
sum = sum * 26 + (name.charCodeAt(i) - 64);
}
return sum;
}

This treats the column name as a base-26 number, where 'A' is 1, 'B' is 2, and so on.

Column Number to Name

To convert a column number to its corresponding name:

function columnNumberToName(num) {
let name = '';
while (num > 0) {
const modulo = (num - 1) % 26;
name = String.fromCharCode(65 + modulo) + name;
num = Math.floor((num - modulo) / 26);
}
return name;
}

This converts the decimal number to a base-26 representation, mapping the digits to letters.

info

I used AI tools to generate this whole page - I needed to convert some Excel columns and it was easiest to just get it to build the tool. It decided to add the explanations all on its own!

I've skimmed through and it all seems correct but if you spot an error please let me know.