FormulaCamp
Completed
← Google Sheets functions
Google Sheets function

CODE in Google Sheets

CODE with worked examples you can test in the live grid. The argument details are in the Excel guide.

In Google Sheets

The arguments and common errors are covered in the CODE Excel guide; check the function help in Google Sheets for its own argument list.

Worked examples in Google Sheets

Code of a capital letter

A
1Letter
2A

Formula: C2: =CODE(A2)

Result: 65

Capital A is 65 in ASCII.

Capitals and lowercase differ

A
1Letter
2a

Formula: C2: =CODE(A2)

Result: 97

Lowercase letters are 32 higher than their capitals.

Alphabet position

A
1Letter
2C

Formula: C2: =CODE(A2)-CODE("A")+1

Result: 3

C is two steps after A, so its position is 3.

Try it

A tiny spreadsheet with example data. Edit the formula or any number and see the result.

Formula in D2: =CODE(A5)

Example spreadsheet for CODE
ABCD
1TextOtherResult
2Alice Johnsonalice johnson83
3[email protected][email protected]
4 extra spaces
5SKU-2026-0415
6iced coffee, tea, sugar
7Order 417 shipped
Result in D2: 83

Google Sheets is used here only as a descriptive product name. FormulaCamp is not affiliated with Google.