Text
Convert letters to numbers (A=1 to Z=26 and phone keypad digits)
Map letters A–Z to 1–26 using CODE(UPPER(ch)) - 64, convert 1–26 back to letters with CHAR(n + 64), or map letters to T9 phone digits.
ASCII offset 64 turns A–Z into 1–26 instantly
In ASCII and Unicode, uppercase "A" is code 65 and uppercase "Z" is code 90. Normalizing case first with UPPER(A2) and subtracting 64—CODE(UPPER(A2)) - 64—maps A -> 1, B -> 2, ..., Z -> 26 without a 26-row lookup table.
Going in reverse, CHAR(N + 64) converts any integer 1..26 back into uppercase "A".."Z". For ITU E.161 telephone keypads (ABC=2..WXYZ=9), XLOOKUP with match_mode = -1 on boundary letters {"A","D","G","J","M","P","T","W"} maps any letter to digits 2–9.
| Letter (A) | UPPER ASCII Code | A=1..Z=26 | Phone Keypad (2–9) |
|---|---|---|---|
| A | 65 | 1 | 2 (ABC) |
| m | 77 | 13 | 6 (MNO) |
| Z | 90 | 26 | 9 (WXYZ) |
Alphabet index (1–26), reverse CHAR, and T9 keypad lookup
Guard valid A–Z range (1 to 26) so digits or punctuation flag cleanly.
=IF(OR(LEN(A2)<>1,LEN(UPPER(A2))<>1), "Not A-Z", LET(n, CODE(UPPER(A2))-64, IF(AND(n>=1,n<=26),n,"Not A-Z")))Reverse 1–26 integer back to uppercase letter
CHAR(13 + 64) = CHAR(77) = "M".
=IF(OR(B2<1,B2>26,B2<>INT(B2)), "Invalid index", CHAR(B2+64))Telephone keypad digit
Validate one letter first, then look up the nearest lower letter-group boundary.
=IF(ISNUMBER(IF(OR(LEN(A2)<>1,LEN(UPPER(A2))<>1), "Not A-Z", LET(n, CODE(UPPER(A2))-64, IF(AND(n>=1,n<=26),n,"Not A-Z")))), XLOOKUP(UPPER(A2), {"A","D","G","J","M","P","T","W"}, {2,3,4,5,6,7,8,9}, "Not A-Z", -1), "Not A-Z")Inputs and interpretation
These mappings are for one Latin letter A–Z after uppercasing. They are not a universal Unicode alphabet mapping; CODE/CHAR behavior outside this range differs between spreadsheet platforms. Keypad digits do not implement predictive T9 word selection.
Try the example
Use the original values or change them to test your understanding.