How to Find a Character’s Code in Excel
CODE returns the number behind a character — find invisible spaces and tabs in imported IDs and turn seat-row letters into numbers.
You will learn to
- Reveal a hidden first character with CODE
- Inspect the last character with CODE and RIGHT
- Convert a letter into its alphabet position
How it works
=CODE(text) returns the character code of the first character: =CODE("A") is 65, a space is 32, a tab is 9 and a line feed is 10. When a lookup fails between two values that look identical, CODE is the fastest way to see what is really there — check the first character with =CODE(A2) and the last with =CODE(RIGHT(A2,1)).
Because capital letters are numbered consecutively (A = 65 … Z = 90), =CODE(UPPER(B2))-64 converts a letter to its position in the alphabet — handy for seat rows, grade bands or column letters. CHAR does the reverse, turning a code back into a character.
=CODE(A2)