LEN Function (OpenOffice Calc)
Learn the LEN function in Apache OpenOffice Calc: Calculates length of a text string.
Verification status: See the evidence and test scope described in this guide. How formula examples are checked
Availability and version history
- Introduced: Documented by Apache OpenOffice 4.1.16; original introduction not established.
- Availability: Supported in Apache OpenOffice 4.1.16, 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.
LEN counts the length of a text string, including spaces. It helps detect unexpected padding and check fixed-width fields. The result is a number; LEN does not tell you whether the text is valid, unique or meaningful.
Syntax and arguments
=LEN(text)
text is one required source string or cell reference. There is no optional mode or byte-encoding argument. Calc can convert a numeric argument to a string, but a count of a numeric value is not a guarantee about the formatted display or the exact original imported digits. The formulas use English function names and Calc’s semicolon argument separator.
Reproducible examples
| Formula | Expected text or number |
|---|---|
=LEN("Calc") |
4 |
=LEN("Good Afternoon") |
14 |
=LEN("A B") |
3 |
=LEN(" A ") |
4 |
=LEN("") |
0 |
=LEN("00127") |
5 |
Here "" denotes zero-length text, not a displayed pair of quotation marks. The first example retains the original guide’s formula. Its comparable LibreOffice 25.2 result was not an OpenOffice test; the new examples are expected results derived from the documented operation and independently checked text mappings.
Practical worksheet: audit five-character identifiers
Enter the text values 00127, AB123, XYZ and A123 in A2:A5. Preserve the leading zeros and the leading space when entering the data. In B2 enter =LEN(A2) and fill down. Expected lengths are 5, 5, 3 and 5.
In C2 enter =IF(B2=5;"Length OK";"Check length") and fill down. Only XYZ is flagged by this test. The leading-space record still has length 5, demonstrating that length alone does not validate the field. Combine a length rule with explicit content and whitespace rules if the receiving system requires them.
Advanced applications
Measure removed ordinary spaces. Put one two in A2. =LEN(A2) returns 13, =LEN(TRIM(A2)) returns 7, and =LEN(A2)-LEN(TRIM(A2)) returns 6. The difference counts the characters removed by that transformation, not every Unicode whitespace character.
Count a one-character delimiter. With A-B-C in A2, =LEN(A2)-LEN(SUBSTITUTE(A2;"-";"")) returns 2. For a multi-character marker, divide by its length only when the replacement operation and overlapping-match policy match the intended count.
Derive an extraction size. =LEFT(A2;LEN(A2)-4) removes a known four-character suffix. Validate that the source is at least four characters long before using the derived count.
Errors, edge cases and troubleshooting
LEN("") is zero even though a formula cell producing that empty string is not genuinely blank. ISBLANK checks cell contents, a separate question. A cell with one ordinary space has length one.
Number formats are not source text: a numeric 127 displayed with leading zeros is not the same input as the text 00127. A date displayed as a long date may still be converted from its stored numerical value. Use TEXT with an explicit format when you need the length of a particular representation.
Do not use LEN as a UTF-8 byte counter or a universal visible-symbol counter. The pinned implementation measures its internal string length. These examples deliberately avoid supplementary characters and combining sequences; their grapheme behavior is not certified here.
For a list of records, enter a scalar helper formula in the first result row and fill down. Check the absolute and relative references before copying. Do not assume that a single multi-cell argument automatically produces a modern spill range in OpenOffice Calc.
Related functions
Documentation and verification
See the Apache OpenOffice LEN reference, 4.1.16 text-function help, and versioned interpreter. The source snapshots were originally retrieved on 2026-10-13 and re-read for this revision. Independent text calculations are not native application or GUI tests. Current support is version-scoped above; introduction and final functioning version remain unestablished.