Contact

LEFT Function in ONLYOFFICE Spreadsheet Editor: Syntax and Worked Examples

Text and Data Beginner ONLYOFFICE Spreadsheet Editor

Extract a specified number of characters from the beginning of a text string.

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

Quick answer: LEFT returns the first n characters of an identifier, label or other text. Use it for a fixed-length prefix, such as the CA in CA-ON-1047.

Prefixes such as country codes, product families or document types can drive filtering or classification without modifying the source cells. 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

=LEFT(text, [num_chars])
Argument Required? Definition In the worksheet
text Required The text string to read; for these examples, cell A2. A2
num_chars Optional Number of characters to take from the left. Must be at least zero; default 1 when omitted. 2

The official LEFT 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:

=LEFT(A2,2)

Expected C2: CA. The source begins with C then A. Now in C3 enter =LEFT(A3,2); the expected result is US. The source stays unchanged. In C4 enter =LEFT(A4,5); the expected result is CA-BC, including the separating hyphen as the third character.

Optional-argument check: =LEFT(A2) is expected to produce C, because the reference defaults num_chars to 1. =LEFT(A2,0) is expected to produce an empty text string (""), which will look blank; this zero-length result is an independent expectation rather than a native screenshot.

Advanced application

Variable-length prefix before the first hyphen. Fixed LEFT(A2,2) breaks if future country prefixes have different lengths. In D2 enter:

=LEFT(A2,FIND("-",A2)-1)

Expected D2: CA. FIND returns the starting position of the first hyphen (3) and LEFT takes two characters. Copying this formula down through D6 is expected to give CA, US, CA, CA, US. The official FIND help documents the search arguments.

In D7, malformed BADCODE contains no hyphen. FIND documents a #VALUE! when it finds no match; the expected formula error is therefore #VALUE!. If invalid identifiers are routine, use:

=IFERROR(LEFT(A7,FIND("-",A7)-1),"Check code")

Expected D7: Check code. IFERROR has a separate official reference. Be cautious: the fallback hides other formula errors, so investigate unexpected results rather than accepting them as valid codes.

Common errors, edge cases and limitations

  • A negative num_chars violates ONLYOFFICE’s documented nonnegative requirement. The exact native error display for =LEFT(A2,-1) was not tested; do not hard-code an error label in production based on this guide.
  • If the input has leading spaces, those spaces are in its leftmost characters. Use a cleaning step for imports rather than trimming silently.
  • Numbers and dates may be represented differently depending on cell formatting. Keep identifier data as text; these examples use ASCII characters only.
  • The function page separately documents LEFTB, a byte-oriented operation for DBCS scenarios. Do not assume a byte count equals a character count; multi-byte and emoji outcomes remain untested in ONLYOFFICE.
  • A missing delimiter makes the FIND-based advanced example fail; use an explicit validation rule when possible.

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 LEFT 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 documents Excel LEFT with the same basic LEFT(text,[num_chars]) argument shape and a default character count of one. This supports portability of the simple ASCII samples, not guaranteed Unicode/byte semantics across products. Microsoft marks Excel LEFTB as deprecated; that is an Excel-specific statement, not evidence of ONLYOFFICE LEFTB deprecation. 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.