TRIM
Quirk foundCategory: Text · Last tested 2026-07-04
Support matrix
| Engine | Documented | Live-tested | Verdict |
|---|---|---|---|
| Excel | Yes | Not yet | n/a |
| Google Sheets | Yes | Not yet | n/a |
| LibreOffice Calc | Yes | Yes (24.2.7.2, 2026-07-04) | Quirk found |
Discovered quirks
- =TRIM(CHAR(160)&"Hello"&CHAR(160)) on LibreOffice Calc returned �Hello�, but the documented/expected result is Hello . Microsoft docs state explicitly: "by itself, the TRIM function does not remove the nonbreaking space character (which has a decimal value of 160 and is commonly used in web pages as the HTML entity )." Source: https://support.microsoft.com/en-us/office/trim-function-410388fa-c5df-49c6-b16c-9e5630b479f9; MISMATCH vs expected: expected '\xa0Hello\xa0', got '�Hello�'
Executed test cases
LibreOffice Calc 24.2.7.2 (tested 2026-07-04)
| Formula | Description | Result | Expected | Verdict |
|---|---|---|---|---|
| =TRIM(" Hello World ") | Leading/trailing spaces are stripped and multiple interior spaces collapse to a single space | Hello World | Hello World | Matched |
| =TRIM(CHAR(9)&"Hello") | TRIM only removes the regular ASCII space character (decimal 32); it does NOT remove other whitespace such as a tab (CHAR(9)), so the leading tab survives untouched | Hello | Hello Microsoft docs: "the TRIM function was designed to trim the 7-bit ASCII space character (value 32) from text" -- it does not generalize to other whitespace. Source: https://support.microsoft.com/en-us/office/trim-function-410388fa-c5df-49c6-b16c-9e5630b479f9 |
Matched |
| =TRIM(CHAR(160)&"Hello"&CHAR(160)) | TRIM does not remove the non-breaking space character (CHAR(160), HTML ) even though it renders as whitespace -- a real, documented, and easy-to-miss cross-engine divergence point since data pasted from web pages is full of CHAR(160) | �Hello� | Hello Microsoft docs state explicitly: "by itself, the TRIM function does not remove the nonbreaking space character (which has a decimal value of 160 and is commonly used in web pages as the HTML entity )." Source: https://support.microsoft.com/en-us/office/trim-function-410388fa-c5df-49c6-b16c-9e5630b479f9 |
Mismatch |
| =TRIM("No Extra Spaces") | A string with only single spaces between words passes through unchanged | No Extra Spaces | No Extra Spaces | Matched |
Docs & syntax
- Excel: official documentation
- Google Sheets: official documentation
- LibreOffice Calc: official documentation