MID Function in ONLYOFFICE Spreadsheet Editor: Syntax and Worked Examples
Extract a specified number of characters from the middle 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
MID function in ONLYOFFICE Spreadsheet Editor
Quick answer: MID takes a slice of text starting at a chosen position. For the code CA-ON-1047, MID(A2,4,2) is expected to produce ON, the region between hyphens.
Extract a middle field from a structured product code, batch ID, address fragment or other positional text. 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
=MID(text, start_num, num_chars)
| Argument | Required? | Definition | In the worksheet |
|---|---|---|---|
text |
Required | Source text or cell reference. | A2 |
start_num |
Required | Starting character position within text (the first character is position 1 in these samples). | 4 |
num_chars |
Required | How many characters to extract from the starting position. | 2 |
The official MID 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
Enter in C2:
=MID(A2,4,2)
Expected C2: ON. Count characters: 1=C, 2=A, 3=hyphen, 4=O, 5=N. Starting at 4 and taking two characters gives ON.
In C3 use =MID(A3,4,2); expected NY. In C4 enter =MID(A4,4,2); expected BC. The next segment may also be sliced: =MID(A2,7,4) is expected to return 1047. The original identifier is not changed.
Advanced application
Extract the region between the first and second hyphens without assuming it is always two characters. In D2 enter:
=MID(A2,FIND("-",A2)+1,FIND("-",A2,FIND("-",A2)+1)-FIND("-",A2)-1)
Expected D2: ON. The first hyphen is at character 3; the second is at 6. Start at 4 and take 6−3−1=2 characters. Copying the formula through D6 is expected to give ON, NY, BC, ON, CA. The third argument of FIND is the optional start position documented by ONLYOFFICE.
For malformed A7, a missing delimiter causes FIND to fail with its documented #VALUE! error. This user-facing fallback is simpler to audit:
=IFERROR(MID(A7,FIND("-",A7)+1,FIND("-",A7,FIND("-",A7)+1)-FIND("-",A7)-1),"Check code")
Expected D7: Check code. The formula does not validate letter patterns, permitted region codes or the serial number: those require separate checks.
Common errors, edge cases and limitations
- Unlike
LEFTorRIGHT, all three MID arguments are required by the official syntax. Do not omitnum_chars. start_numis a character position, not a hyphen count. In these samples the string’s first character is position 1.start_num=0, negative start positions, or a negative character count are poor input choices; the official ONLYOFFICE reference excerpt does not specify exact native error outputs for these cases, so they are unverified.MIDextracts characters and does not understand semantic columns or separators. Missing hyphens can make a fixed-position extraction look plausible but wrong.MIDBis listed withMIDin ONLYOFFICE’s documentation and uses byte-oriented counting. Do not transfer byte-dependent or emoji examples into this character-based guide without a verified native test.
Troubleshooting checklist
- 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.
- Confirm the argument order. Use ONLYOFFICE’s function wizard to enter each argument; a comma-delimited example assumes the English reference settings.
- Inspect separators and spaces. The two-hyphen examples rely on exactly
CA-ON-1047-style codes. Import cleanup is an independent step, not somethingMIDautomatically does. - Test simple formulas before nesting. Verify the one-function result, then test
FIND,LEN,SUBSTITUTE,AND, orIFERRORcomponents separately where used. - 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.
- 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 MID documents the same three-argument syntax and one-based starting positions. It also documents particular #VALUE! results for invalid positions, but those Excel-specific error claims have not been natively verified in ONLYOFFICE. Excel also documents compatibility-version and surrogate-pair changes that should not be attributed to ONLYOFFICE without evidence. 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.
Related guides and next topics
- ONLYOFFICE function comparisons across spreadsheet applications
- Related drafted topics: LEFT, RIGHT, MID, LEN (prepared together; their future URLs must not be treated as published until the owner approves them).
- ONLYOFFICE’s official references for FIND, SUBSTITUTE and IFERROR cover the components used in advanced examples.
Official reference and verification
- ONLYOFFICE Spreadsheet Editor — function documentation
- current official ONLYOFFICE Spreadsheet Editor function catalogue
- Docs changelog
- Desktop Editors changelog
- regional settings guide
- FIND
- SUBSTITUTE
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.