# How to convert a letter to its position in the alphabet in Excel

Use the character code: =CODE(UPPER(A2))-64 returns 1 for A, 2 for B, up to 26 for Z.

**Excel:** `=CODE(UPPER(A2))-64` (Excel 2021, 2024 and Microsoft 365)

**Google Sheets:** the same formula works.

## Example

Sample data (row 1 is the header):

| A | B |
| --- | --- |
| Letter | Position |
| A |  |
| c |  |
| M |  |
| z |  |
| Q |  |

Formula in B2, filled to B6: `=CODE(UPPER(A2))-64`

Result: 1; 3; 13; 26; 17

## How it works

CODE returns the character code of the first character: capital A is 65, B is 66, up to Z at 90. Subtracting 64 maps them to 1 to 26. UPPER first makes lowercase letters, which have codes 97 to 122, use the same numbers.

## Other ways

- `=SEARCH(A2,"abcdefghijklmnopqrstuvwxyz")`: Finds the letter in the alphabet written out. SEARCH ignores case, so no UPPER is needed.
- `=MATCH(UPPER(A2),CHAR(SEQUENCE(26,1,65)),0)`: Excel 365: matches the letter against a generated list A to Z.

## Common mistakes

- CODE only reads the first character: "Apple" returns 1.
- Digits and symbols give meaningless results, like 0 for "@". Check with `AND(CODE(UPPER(A2))>=65,CODE(UPPER(A2))<=90)` first.

## Questions

**How do I turn a number back into a letter?**

Add 64 and use CHAR: `=CHAR(64+B2)` gives C for 3.

**How do I get the column number of a column letter like "AB"?**

Use `=COLUMN(INDIRECT(A2&"1"))`.

Every formula and result on this page was checked by running it in the Spreadsheet Practice formula engine on 2026-10-30.

Source: https://spreadsheetpractice.com/formulas/convert-a-letter-to-its-alphabet-position
