Contact

CHAR Function (Gnumeric)

Text Beginner Gnumeric

Learn the CHAR function in Gnumeric: Converts a code number into a character or letter.

Verification status: Official documentation referenced; example outcomes independently reasoned or arithmetically checked where stated. Not executed in Gnumeric. How formula examples are checked

Validation limits: Examples were independently checked against character encodings and the checksum-verified official Gnumeric 1.12.62 source. No native Gnumeric execution or screenshots were performed.

What CHAR returns — a crucial encoding detail

Gnumeric’s CHAR returns the character associated with a CP1252 (Windows-1252) code from 1 to 255 [R1]. This is not a general Unicode code-point converter and should not be described simply as ASCII. Codes 65–90 include familiar Latin letters, but 128 represents the euro symbol (€) in CP1252, whereas character set definitions differ elsewhere. For Unicode code points, Gnumeric’s manual describes the separate UNICHAR function [R1].

Use CHAR to construct a punctuation mark, create a reproducible control-character test, or reverse a valid CP1252 code. Example: =CHAR(65) is expected to return A [R1]. Gnumeric’s manual states that code positions 129, 141, 143, 144, and 157 have no corresponding character in CP1252; do not treat these as ordinary mappings [R1].

Exact Gnumeric syntax, argument types, and range

=CHAR(x)
Position Argument Required? Type / default / limit
1 x Yes Code number representing a CP1252 character; documented inclusive range 1–255, with noted unmapped positions; no default.

The manual documents one argument, in that order, and describes the CP1252 encoding explicitly [R1]. The basic one-argument formula has no list separator; nested examples may use the & text concatenation operator. Decimal grouping and localized function names may depend on application locale; for reliable cross-platform exchange, do not silently assume a typed symbol’s displayed glyph maps to the same byte encoding. Input coercion of fractional, Boolean or numeric-text arguments is not specified by the quoted Gnumeric syntax and is not asserted here.

Official scope: 1.12-series manual, Gnumeric release 1.12.62 [R3]; catalogue registers char as Complete with project Basic testing [R2]. Catalogue registration, upstream completeness and local runtime availability are different facts: no native Gnumeric run took place in this batch.

Direct, reproducible worksheet examples

The expected characters below are independently calculated from the documented CP1252 mapping. Enter each formula in an empty cell. "A" below denotes textual content for clarity; Gnumeric displays the letter, not the quote marks.

Enter formula Expected cell content Evidence and validation
=CHAR(65) A CP1252 code 65; documentation + independent encoding lookup [R1].
=CHAR(66) B CP1252 code 66; independent encoding lookup [R1].
=CHAR(45) - CP1252 code 45 (hyphen-minus) [R1].
=CHAR(128) € CP1252 code 128 is euro sign; not generic ASCII [R1].
=CHAR(233) é CP1252 code 233 maps to accented Latin e [R1].
=CHAR(65)&CHAR(45)&CHAR(66) A-B Independently concatenated expected characters [R1].
=CODE(CHAR(65)) 65 Official reciprocal identity at a valid code [R1].
=CODE(CHAR(128)) 128 Official identity applies to 128; no native execution [R1].

The last two cases rely on Gnumeric’s companion CODE function. The documented identity CODE(CHAR(x))=x applies for 1–255 except codes 129, 141, 143, 144, and 157 [R1]. It is not a claim that every arbitrary Unicode symbol round-trips through CP1252.

Build a code-to-character lookup worksheet

Cell Enter Role / expected output
A1 Code Heading
B1 Character Heading
C1 Reverse code Heading
A2 65 Numeric code
A3 45 Numeric code
A4 128 Numeric code
B2 =CHAR(A2) Expected A
B3 =CHAR(A3) Expected -
B4 =CHAR(A4) Expected €
C2 =CODE(B2) Expected 65
C3 =CODE(B3) Expected 45
C4 =CODE(B4) Expected 128

This tests three non-problematic mappings and the documented round-trip property without importing any remote dataset. The outputs are mathematical/encoding expectations, not measured application output. Select an appropriate font if the euro sign does not display clearly.

Advanced technique: making a test string with hidden control data

Gnumeric’s documentation uses the nonprinting code 7 in its CLEAN illustration [R1]. To reproduce an import-cleaning problem, enter:

="A"&CHAR(7)&"B"

This is expected to contain a nonprinting control character between A and B. In another cell, enter:

=CLEAN("A"&CHAR(7)&"B")

Expected cleaned output: AB, by the manual’s definition of removing nonprinting characters [R1]. This is a useful workflow for identifying why strings that look identical may not match. Do not use CHAR to synthesize the whole range of Unicode characters; UNICHAR is the differently defined function [R1].

Invalid input, gaps, and troubleshooting

  • Code is 0, negative or above 255: outside the manual’s valid interval. Do not assume an output character. Exact error messages/codes remain native-unverified [R1].
  • Code is 129, 141, 143, 144 or 157: these CP1252 entries are documented as unmapped. Never promise a printable result or reversible CODE value for these cases [R1].
  • I entered a Unicode code point such as 9731: that is outside CHAR’s 1–255 range; use the distinct UNICHAR function if suitable [R1].
  • Result looks blank: the code may represent a control character (for example, 7). Check with CODE where defined, or choose a printable diagnostic code such as 65 [R1].
  • Punctuation or accented letter looks wrong: double-check CP1252 instead of assuming ISO-8859-1, Unicode, or another application’s code page. The mapping can differ [R1].
  • Input is a fraction, TRUE/FALSE, empty, or a numeric-looking string: the manuals cited here do not give a complete conversion/error table. Test it in Gnumeric before making claims about rounding/coercion.
  • I passed two arguments: the documented signature has one code-number argument. Precise failure output has not been measured [R1].
  • Excel import/export: the Gnumeric manual labels CHAR Excel compatible, but byte encodings, locale and font handling should be checked with the target spreadsheet. This batch provides no other-product execution evidence [R1].

The official Gnumeric manual explicitly calls CHAR Microsoft Excel compatible, but also specifies Gnumeric’s precise CP1252 interpretation [R1]. No external product results were copied into this Gnumeric guide. Related Gnumeric guides: CODE · UNICHAR · UNICODE · CLEAN · LEN.

Primary source verification: The official Gnumeric 1.12.62 archive was verified against GNOME’s SHA-256 checksum, then plugins/fn-string/functions.c was inspected without compilation or execution.

Official evidence, access dates and validation

Validation: Official manual and checksum-verified release-source inspection; independent code-point, encoding and string calculations. Native Gnumeric execution, screenshots, locale/platform and workbook round-trip tests were not performed.