← All how-to recipes

How to convert a column letter to a number

✓ Verified in LibreOffice 25.8.7.3

Turn "AB" into 28 — for driving INDEX, building references, or documentation.

The formula

AppFormulaNotes
Excel=COLUMN(INDIRECT(A2&"1"))A2 holds the column letters. INDIRECT builds a reference; COLUMN reads its number.
Google Sheets=COLUMN(INDIRECT(A2&"1"))Identical.
LibreOffice Calc=COLUMN(INDIRECT(A2&"1"))Identical.

How it works

INDIRECT turns the text "AB1" into a real cell reference, and COLUMN returns that cell's column number — 28 for column AB. The reverse (number to letter) is the ADDRESS/SUBSTITUTE trick in the convert-a-column-number-to-a-letter recipe. INDIRECT is volatile (recalculates constantly), so for a one-off conversion it's fine, but avoid thousands of them; when you actually need to fetch data by a computed column, INDEX with the numeric result is faster and non-volatile.

Verified, not just documented

We ran =COLUMN(INDIRECT(A2&"1")) in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned 28 — exactly the expected result. Every formula here is confirmed by actually executing it.