Contact

MID Function (OpenOffice Calc)

Text Intermediate OpenOffice Calc

Learn the MID function in Apache OpenOffice Calc: Returns a partial text string of a text.

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.

MID extracts a section from a text string using a one-based start position and a requested length. It is suited to fixed-layout codes where the position of each component is known. It returns text and does not alter the original cell.

Syntax and arguments

=MID(text; start; count)

All three arguments are required. text is the source string, start is the position of the first character to extract, and count is the maximum number of characters. Position 1 means the first character. Use start>=1 and count>=0. The 4.1.16 implementation rounds numeric positions/counts down and checks its internal string limits. The formulas use English function names and Calc’s semicolon argument separator.

Reproducible examples

Formula Expected text or number
=MID("Spreadsheet";7;5) "sheet"
=MID("office";2;2) "ff"
=MID("AB-0042-EU";4;4) "0042"
=MID("abc";2;99) "bc"
=MID("abc";4;2) ""
=MID("abc";2;0) ""

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: read the middle field of a fixed code

Enter AB-0042-EU, CD-1050-US and EF-0007-UK in A2:A4. In B2 enter =MID(A2;4;4) and fill down. Expected text results are 0042, 1050 and 0007. Characters 1–2 are a prefix, character 3 is a separator, and characters 4–7 form the field.

Use =LEN(A2)=10 as one preliminary length check, but remember that a correct length does not prove the separators or field contents are correct. For example, ABX0042YEU has the same length. A field-layout audit should check the separators as well as the extracted values.

Advanced applications

Extract between two delimiters. With North/Widget/2026 in A2, put =FIND("/";A2) in B2 and =FIND("/";A2;B2+1) in C2. The positions are 6 and 13. =MID(A2;B2+1;C2-B2-1) returns Widget. Helper cells expose the boundary arithmetic and make a missing delimiter easier to diagnose.

Keep identifiers as text. MID returns 0042 from the fixed-code example. =VALUE(MID(A2;4;4)) deliberately converts it to 42; apply that only when the field is a quantity rather than an identifier.

Errors, edge cases and troubleshooting

A start beyond the string length returns empty text for ordinary valid position arguments; a start below 1 or a negative count is invalid. A count larger than the available tail returns only the remaining text. An omitted count is not supported.

Hidden spaces shift positions. Inspect the original text rather than changing start values until one row happens to work. Do not infer byte lengths or visual-grapheme boundaries from these ASCII examples. In multilingual data, a visual symbol can contain more than one stored character unit.

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.

Documentation and verification

See the Apache OpenOffice MID 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.