Contact

TRIM Function (Gnumeric)

Text Beginner Gnumeric

Normalize ordinary spaces with Gnumeric TRIM, preserving original text and recognizing that not every whitespace character is removed.

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

TRIM removes leading and trailing whitespace and collapses consecutive internal whitespace. It is useful for cleaning imported labels before comparison. Gnumeric 1.12.57 recognizes Unicode whitespace, and an important detail is that it retains the first whitespace character of an internal run instead of always replacing the run with an ordinary space.

Syntax

TRIM(text)

text is the input string. The result is text. Normal letters, punctuation, and capitalization are preserved; the function’s job is whitespace handling, not general data standardization.

Original worked example

=TRIM("  one   two  ")

The result is one two. Leading and trailing spaces disappear, and the three spaces between the words become one space. If A2 contains the same padded string, =TRIM(A2) gives the same result.

=TRIM(" ") returns an empty string because the entire input consists of whitespace. This is a text result from a formula, not a deletion of the formula cell.

Worked examples: tabs and nonbreaking spaces

The formula =TRIM("a"&CHAR(9)&CHAR(9)&"b") returns a, one tab, then b. The two tabs are collapsed, but the surviving separator is still a tab. In the same way, an input containing a, two nonbreaking spaces, and b retains one nonbreaking space between the words after trimming.

These cases differ from a claim that TRIM always creates ordinary ASCII spaces. The implementation checks Unicode whitespace and copies the first character in an internal whitespace run. Leading and trailing runs are removed entirely.

When inspecting an exported file, a retained tab may act as a delimiter or display differently from a space. Verify the actual characters rather than relying only on their appearance in the worksheet.

Advanced use: normalize a known import format

If a downstream system requires ordinary spaces specifically, first decide which whitespace characters are allowed to be replaced. Then use an explicit substitution step for those known characters and apply TRIM to the result. TRIM alone is not a universal whitespace-to-ASCII-space converter.

Retain an unmodified input column while cleaning. Extra whitespace is often accidental in names or labels, but it can be meaningful in fixed-width records, indentation, or coded strings. A cleanup that helps matching can also destroy information if applied indiscriminately.

A useful diagnostic compares a string’s LEN before and after trimming. A changed count confirms that characters were removed, but it does not establish that the cleaned text is the correct identifier or that all remaining separators are ordinary spaces.

Errors and troubleshooting

If a lookup still fails after TRIM, check case, Unicode normalization, and retained separator types. Whitespace cleanup does not correct misspellings or convert visually similar letters from different scripts.

If a cell appears blank after trimming, it may contain an empty-string result. Use a test that matches your definition of missing data rather than assuming that visually blank cells are all structurally identical. Upstream errors are not whitespace and should be diagnosed separately.

The bounded native cases cover ordinary spaces, tabs, and nonbreaking spaces. They do not certify every Unicode character classified as whitespace by every possible dependency version.

Availability and version history

  • Introduced: Original introduction not established in the retained historical evidence.
  • Historical source evidence: Supported in Gnumeric 1.12.62, based on the function-specific registration.
  • Scope: Desktop; the fn-string function module must be included and enabled.
  • Historical check: October 14, 2026; the 1.12.62 registration evidence is not a native execution claim for that release.

New verification: The worked cases were recalculated with Gnumeric 1.12.57 under C.UTF-8 on 17 October 2026 and reconciled against its official source. The historical 1.12.62 registration is retained separately; no identical-behavior or native-test claim is made for that newer version. The selected example below is GUI-verified; a last-supported release is not established.

Documentation and verification

Native application screenshot

The selected cell B2 contains =TRIM(A2) and displays one two. The screenshot preserves the example input positions described above. A2 contains two leading spaces, three spaces between the words, and two trailing spaces. Only this selected example is GUI-verified; the other checks retain their stated engine-test scope.

Gnumeric TRIM selected formula and native result

Actual Gnumeric 1.12.57 application, captured 17 October 2026. GUI locale was not independently recorded.