← All functions

CODE

Supported, behaves as documented

Category: Text · Last tested 2026-09-01

Real compatibility results for the CODE function: executed in Excel for the web, Google Sheets and LibreOffice Calc, with desktop Excel behavior from Microsoft’s official documentation (we do not run desktop Excel — Excel for the web is a different application and is executed separately). Syntax and links to that documentation are below.

Support matrix

EngineDocumentedLive-testedVerdict
Excel (desktop)Yes No — documented only n/a
Excel for the web— Yes (recalc, 2026-09-01) Supported, behaves as documented
Google SheetsYes Yes (Drive import, 2026-08-29) Supported, behaves as documented
LibreOffice CalcYes Yes (25.8.7.3, 2026-07-29) Supported, behaves as documented

LibreOffice version history

We executed the same test cases under each LibreOffice release to show exactly when CODE’s support changed — not documentation claims, real results.

LibreOffice versionVerdictTested
24.2.0.3 Supported, behaves as documented 2026-08-29
24.8.7.2 Supported, behaves as documented 2026-08-29
25.2.0.3 Supported, behaves as documented 2026-08-29
25.8.7.3 Supported, behaves as documented 2026-07-29

Executed test cases

Excel for the web (executed 2026-09-01 via OneDrive recalculation)

These values come from Excel for the web, not from desktop Excel. They are two different implementations of the calculation engine, and this run measured only the web one: the corpus was uploaded to OneDrive as .xlsx, recalculated by Excel for the web on open, and downloaded again for readback. Excel for the web is a rolling service with no pinnable version, so the run is identified by its date. Where a value here disagrees with the Expected column — which is Microsoft’s documentation of the desktop product — we cannot tell you whether the web engine diverges from the desktop one or the documentation is wrong about both, because we do not run desktop Excel.

FormulaDescriptionResultExpectedVerdict
=CODE("A") Basic character-to-code lookup 65 65 Matched
=CODE("!") Microsoft's own documented example 33 33
Provenance

Source: https://support.microsoft.com/en-us/office/code-function-c32b692b-2ed0-4a04-bdd9-75640144b928

Matched
=CODE("Apple") CODE only looks at the first character of a multi-character string 65 65
Provenance

Microsoft docs: CODE "Returns a numeric code for the first character in a text string." Source: https://support.microsoft.com/en-us/office/code-function-c32b692b-2ed0-4a04-bdd9-75640144b928

Matched
=CODE(CHAR(97)) CODE and CHAR are exact inverses of each other for values 1-255 97 97 Matched

Google Sheets (executed 2026-08-29 via Drive import)

Google Sheets is a rolling service with no pinnable version, so this run is identified by its date. The corpus was imported to Drive as .xlsx, recalculated by Sheets, and exported back for readback.

FormulaDescriptionResultExpectedVerdict
=CODE("A") Basic character-to-code lookup 65 65 Matched
=CODE("!") Microsoft's own documented example 33 33
Provenance

Source: https://support.microsoft.com/en-us/office/code-function-c32b692b-2ed0-4a04-bdd9-75640144b928

Matched
=CODE("Apple") CODE only looks at the first character of a multi-character string 65 65
Provenance

Microsoft docs: CODE "Returns a numeric code for the first character in a text string." Source: https://support.microsoft.com/en-us/office/code-function-c32b692b-2ed0-4a04-bdd9-75640144b928

Matched
=CODE(CHAR(97)) CODE and CHAR are exact inverses of each other for values 1-255 97 97 Matched

LibreOffice Calc 25.8.7.3 (tested 2026-07-29)

FormulaDescriptionResultExpectedVerdict
=CODE("A") Basic character-to-code lookup 65 65 Matched
=CODE("!") Microsoft's own documented example 33 33
Provenance

Source: https://support.microsoft.com/en-us/office/code-function-c32b692b-2ed0-4a04-bdd9-75640144b928

Matched
=CODE("Apple") CODE only looks at the first character of a multi-character string 65 65
Provenance

Microsoft docs: CODE "Returns a numeric code for the first character in a text string." Source: https://support.microsoft.com/en-us/office/code-function-c32b692b-2ed0-4a04-bdd9-75640144b928

Matched
=CODE(CHAR(97)) CODE and CHAR are exact inverses of each other for values 1-255 97 97 Matched

Docs & syntax

Compared against other functions