CODE Function in Excel: Character Code of the First Letter

⏱ 1 min readUpdated 28 September 2026

TextLevel: IntermediateAvailable in: Excel 2007+

In this article
  1. Syntax
  2. Examples
  3. Example 1
  4. Related functions

CODE returns the number of the first character. It is the detective tool for “invisible” characters that break lookups: a non-breaking space shows up as 160, not 32.

Syntax

=CODE(text)
Argument What it means
text Text; only the first character counts.

Examples

Example 1

=CODE(RIGHT(A2))

Reveal what the last character of a clean-looking cell really is.

CHAR · UNICODE · CLEAN · TRIM

📚 Part of the free Excel course: Beginner → Expert · Try it in the Formula Lab or ask the AI Helper.

✨ Ask AI about this article

Stuck on a step? Ask a question and the AI answers using this article.

Free · AI can be wrong