LEN Function in ONLYOFFICE Spreadsheet Editor: Syntax and Worked Examples

Text and Data Beginner ONLYOFFICE Spreadsheet Editor

Count the number of characters in a text value.

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

LEN function in ONLYOFFICE Spreadsheet Editor

Quick answer: LEN counts how many characters appear in text. For CA-ON-1047, the independently checked expected length is 10, including both hyphens.

Check identifier lengths, detect stray spaces and build delimiter-aware extraction formulas. This is a guide to ONLYOFFICE specifically: the formula syntax below is supported by its own official help page, while the example outputs are independently reasoned expected results.

Official syntax and argument definitions

=LEN(text)
Argument Required? Definition In the worksheet
text Required Text to measure, supplied as a literal or cell reference. A2

The official LEN reference supplies the function name, argument order and definitions. text can be supplied through a source cell or a literal text value in quotation marks. If you see [num_chars] in the function signature for LEFT or RIGHT, brackets mark optional syntax rather than literal brackets to type. The MID and LEN references list no optional arguments.

Version, edition, platform and formula-entry notes

The function is present in the current official ONLYOFFICE Spreadsheet Editor function catalogue and has a dedicated unversioned help page. These sources describe the current Docs/web-help function, not the first supported release. The reviewed Docs changelog and Desktop Editors changelog do not establish a first release, identical behavior in every desktop/web version, or implementation in the mobile app for this function. First-supported version: not verified. If the function is absent in your installed version, consult the matching product/version documentation rather than relying on this guide for guaranteed support. No native desktop, web, or mobile test was performed.

The official function insertion instructions specify a leading =, parentheses, double quotes around literal text, and commas between arguments for the English help examples. Brackets in printed syntax signify an optional argument; do not type them. The regional settings guide documents formula-language settings and decimal/thousands separators. It does not conclusively establish the argument separator for every locale; for a localized installation, check the syntax displayed in its own Function Arguments dialog. Avoid claiming that a semicolon always works without testing your chosen locale.

Follow along: sample worksheet

Open a blank spreadsheet in ONLYOFFICE Spreadsheet Editor. Enter the following values in column A, starting with the header in A1. Set the code cells to text before import or typing if your source might otherwise auto-convert identifiers. These codes have exactly two hyphens except the deliberately malformed A7.

Cell Value typed as text Interpretation in this exercise
A1 Code Header, not part of the formulas
A2 CA-ON-1047 Country CA, region ON, serial 1047
A3 US-NY-0052 Country US, region NY, serial 0052
A4 CA-BC-0318 Country CA, region BC, serial 0318
A5 CA-ON-1048 Country CA, region ON, serial 1048
A6 US-CA-2004 Country US, region CA, serial 2004
A7 BADCODE Deliberately missing the two hyphens

Keep your results in free cells, such as C2:C10, not in column A. If a formula contains a quoted text value, keep the quotation marks. Copying the same row references from this table makes it possible to check each step independently.

The expected outputs on this page come from string positions and independent checks, not from any run of ONLYOFFICE.

Step-by-step basic examples

In C2 enter:

=LEN(A2)

Expected C2: 10. CA has 2 characters, the two hyphens contribute 2, ON has 2, and 1047 has 4: 2+2+2+4=10. In C3, =LEN(A3) is expected to return 10 too.

For a deliberately simple boundary, =LEN("") is expected to return 0, and =LEN("A B") is expected to return 3 (the internal space counts as one character). These are short ASCII inputs, not an assertion about how emoji, combining marks or other Unicode graphemes are counted. Use an empty result cell for each check.

Advanced application

Count the number of hyphens in a code. In D2 enter:

=LEN(A2)-LEN(SUBSTITUTE(A2,"-",""))

Expected D2: 2. The original code is length 10; removing the two hyphens leaves eight characters; the difference is two. The official SUBSTITUTE page documents replacing a substring, and the simple difference is independently calculated. On A7 (BADCODE), the expected count is 0.

Check an expected ASCII identifier shape. In E2 enter:

=AND(LEN(A2)=10,MID(A2,3,1)="-",MID(A2,6,1)="-")

Expected E2: TRUE. A2 has length 10 and characters 3 and 6 are hyphens. This is only a lightweight shape check: it does not establish valid country or region codes, or a numeric serial. In E7 the expected output is FALSE because BADCODE lacks the two hyphens. The official AND and MID references support this construction.

Common errors, edge cases and limitations

  • LEN measures text characters, not display width, byte size, numeric magnitude or item count. A visible space contributes to ASCII string length, so unexpected whitespace may cause overlong imported codes.
  • A cell can show a date or formatted number, but underlying typing/formatting and conversion rules can differ; these examples deliberately supply text. No claim is made about date coercion.
  • A valid length alone is insufficient to validate a code: two entirely different strings may both have length 10.
  • ONLYOFFICE provides LENB as a separate byte-oriented function in the same official page. Do not equate character length and byte length for CJK/emoji text. Exact grapheme and surrogate-pair behavior is untested here.
  • If a result seems too large, inspect spaces, punctuation, and imported data; do not change stored values solely to satisfy a length test.

Troubleshooting checklist

  1. Check your actual source cell. Compare A2 with the sample character by character; ensure it is stored as text, not imported as a number/date with a changed display.
  2. Confirm the argument order. Use ONLYOFFICE’s function wizard to enter each argument; a comma-delimited example assumes the English reference settings.
  3. Inspect separators and spaces. The two-hyphen examples rely on exactly CA-ON-1047-style codes. Import cleanup is an independent step, not something LEN automatically does.
  4. Test simple formulas before nesting. Verify the one-function result, then test FIND, LEN, SUBSTITUTE, AND, or IFERROR components separately where used.
  5. Verify your product build. If the formula name is not recognized, confirm the edition, application version and formula language; unversioned online help is not proof of support in every older or mobile build.
  6. Avoid masking errors. Do not accept an IFERROR fallback as proof an identifier is valid; inspect the row that failed.

Cross-spreadsheet compatibility: what is and is not established

Microsoft Excel LEN uses the same LEN(text) syntax and also counts spaces. Microsoft’s note about Unicode surrogate pairs under an Excel compatibility version is specific to Excel; ONLYOFFICE’s unversioned help does not supply an equivalent version guarantee. Use the ASCII examples for cross-program comparison, and test multilingual production text separately. Formula delimiter settings, cell typing and text/byte interpretation may differ. These examples were not imported into Microsoft Excel, Google Sheets or LibreOffice; any simple-portability statement is limited to official syntax and manually verified ASCII text.

Official reference and verification

Verification status: Official documentation checked; example outcomes were independently reasoned or arithmetically checked where applicable. Not executed in ONLYOFFICE Spreadsheet Editor.

  • No genuine ONLYOFFICE Spreadsheet Editor screenshots are included; this guide does not use mock application images.