Contact

UNICODE Function (LibreOffice Calc)

Text Beginner LibreOffice Calc

Diagnose leading characters in LibreOffice Calc with UNICODE. Distinguish spaces from nonbreaking spaces, inspect supplementary characters and avoid encoding or normalization confusion.

Verification status: See the evidence and test scope described in this guide. How formula examples are checked

Quick answer: UNICODE returns the code point of the first character in a text string. It is useful for diagnosing invisible leading characters, but does not analyze the whole string.

Availability and version history

  • Introduced: Documented by LibreOffice 26.8.1.1; original introduction not established.
  • Availability: Supported in LibreOffice 26.8.1.1, verified against its function registry. This identifies a supported release, not a final working version.
  • Scope: Desktop Calc, using the English function name. Availability in other spreadsheet applications is separate.
  • Checked: 2026-10-14 — function reference; versioned support. Documentation/source check; not a new native test. Existing example-specific test claims below retain their stated scope.

The UNICODE function in LibreOffice Calc is used for this task: Returns the numeric code for the first Unicode character in a text string. Find a Unicode character code.

This guide explains how to read the formula, reproduce a concrete example, interpret its result and recognize common input mistakes.

Syntax and arguments

UNICODE(text)
Argument Required? Meaning
Text Yes This is the text for which the code of the first character is to be found.

Calc formulas normally use semicolons (;) between arguments in common configurations; the displayed separator may depend on settings or locale.

Worked example

=UNICODE("★")

Expected result: 9733.

Why it works: Find a Unicode character code.

How to use it in your own spreadsheet

  1. Identify the cells or inputs that correspond to the sample values above.
  2. Enter the formula in an empty cell, changing the references or literal values to match your sheet.
  3. Compare the output with a manual check on a small known example.
  4. Extend the formula to a larger dataset only after you understand the result.

Common problems and practical checks

  • Check unwanted spaces, character case, and whether the input is stored as text.
  • Character positions and formatting can change the result; test with realistic sample text.
  • A pasted formula may produce an error when it uses the other program’s argument separator or unsupported options.

Additional worked application and edge cases

First code point, not the whole string

Text is one required argument. A literal text string must be quoted; a cell reference is written without quotes. The function returns the numeric Unicode code point at the start of the text. Appending other characters does not change that first code point.

For example, =UNICODE("ABC") is independently expected to return 65, the code point of A. It does not return a checksum, a list of all three codes or a number representing the whole string. Likewise, =UNICODE("★ done") returns 9733, just as the original one-character star example does.

Stepwise example: distinguish invisible leading spaces

Create three strings in A2:A4 using formulas so the leading characters are reproducible:

Cell Input formula Expected first code point from UNICODE
A2 ="A123" 65
A3 =" "&"A123" 32
A4 =UNICHAR(160)&"A123" 160

In B2 enter =UNICODE(A2) and fill down. A3 starts with an ordinary space; A4 starts with a nonbreaking space. They can look nearly identical, but their leading codes differ. In A5, =UNICHAR(9)&"A123" starts with a tab and gives expected first code 9. The visible width of these characters depends on rendering; inspect the code rather than judging only by appearance.

Advanced application: targeted cleanup after diagnosis

For the supplied A4 fixture, =SUBSTITUTE(A4;UNICHAR(160);" ") replaces nonbreaking spaces with ordinary spaces. The result starts with code 32. =TRIM(SUBSTITUTE(A4;UNICHAR(160);" ")) gives A123, and applying UNICODE to that cleaned value gives 65.

Make a copy or use a helper column before applying a cleanup policy to real data. SUBSTITUTE affects every matching occurrence in the string, so this formula can change intentional internal nonbreaking spaces too. A diagnosis of code 160 does not authorize changing every invisible character or stripping distinctions that matter to the data.

For a source that might be empty, =IF(A2="";"Empty";UNICODE(A2)) returns the text label Empty instead of calling UNICODE on an empty string. It does not catch unrelated source errors. An actually empty input has no first code point; the reviewed Calc implementation rejects it rather than returning zero.

Supplementary characters and UTF-16

=UNICODE(UNICHAR(128512)) is expected to return 128512 for the grinning-face code point U+1F600. The pinned ScUnicode implementation uses iterateCodePoints, so it reads a valid supplementary character as one complete code point rather than merely returning its first UTF-16 surrogate code unit.

The result is not a UTF-8 byte value. In UTF-8 a character can use several bytes, and in UTF-16 a supplementary character uses two code units. UNICODE is a text inspection function, not an encoding detector or a repair tool for incorrectly decoded imports. See the Unicode encoding FAQ.

Use well-formed text. A numeric result from an isolated malformed surrogate would not establish that the whole string is valid Unicode or will survive file interchange. This guide does not certify malformed-input round-tripping.

A visible character may contain multiple code points

Compare =UNICODE(UNICHAR(233)) with =UNICODE("e"&UNICHAR(769)). The first is expected to return 233, the precomposed é; the second returns 101, the initial e before the combining acute accent. A font may display the two strings alike, yet UNICODE correctly sees different initial code points.

A user-perceived character, often represented by a grapheme cluster, can include a base letter and combining marks or an emoji sequence. UNICODE does not summarize that whole cluster. Nor does it normalize the input before inspection. Unicode normalization and grapheme terminology describe those separate concepts.

Errors and display checks

The versioned ScUnicode implementation explicitly rejects an empty string and otherwise reads its first code point. A formula returning "" therefore needs the same empty-text guard as an empty source. Numeric zero as a code point and absence of a character are different situations; do not substitute zero to mean both.

When a supposedly identical identifier behaves differently, inspect leading characters, check whether the text was normalized consistently and validate the import encoding. UNICODE alone cannot prove that two full strings are equal, identify every hidden character farther into a string or tell you which font was used. The earlier star result remains the only historical native-test claim on this page; these expanded examples are independently checked expectations.

Verification scope for this addition: These added results were independently calculated or derived from the cited documentation/source. They were not newly tested in LibreOffice Calc. The original example-specific Calc 25.2.3.2 claims elsewhere on this page remain historical and apply only to those original examples. The cited 26.8.1.1 source tag is a code reference, not a claim of a new run in that release.

Documentation and verification

  • LibreOffice Calc Help
  • The standalone example was calculated using LibreOffice Calc 25.2.3.2 on October 9, 2026 and its computed result matched the expected value. This does not certify every option, version, or other example.

Detailed reference checked October 17, 2026