LEFT Function (LibreOffice Calc)
The LEFT function in LibreOffice Calc extracts a specified number of characters from the beginning (left side) of a text string. It is essential for text parsing, data cleaning, and string manipulation.
Compatibility
▾| Excel | ✔ |
| Gnumeric | ✔ |
| Google_sheets | ✔ |
| Libreoffice | ✔ |
| Numbers | ✔ |
| Onlyoffice | ✔ |
| Openoffice | ✔ |
| Wps | ✔ |
| Zoho | ✔ |
What the LEFT Function Does ▾
- Extracts characters from the left side of a string
- Works with text, numbers (converted to text), and formulas
- Useful for parsing codes, prefixes, dates, and structured text
- Supports optional length argument
It is designed to be simple, predictable, and widely compatible.
Syntax ▾
LEFT(text; [num_chars])
Arguments
-
text:
The text string to extract from. -
num_chars: (optional)
Number of characters to extract.
Defaults to 1 if omitted.
Basic Examples ▾
Extract the first character
=LEFT("Hello")
Returns "H".
Extract the first 3 characters
=LEFT("Hello"; 3)
Returns "Hel".
Extract from a cell
=LEFT(A1; 2)
Extract from a number (converted to text)
=LEFT(2024; 2)
Returns "20".
Advanced Examples ▾
Extract a prefix from a code
=LEFT(A1; 4)
Useful for SKU codes, IDs, etc.
Extract the first word (with FIND)
=LEFT(A1; FIND(" "; A1) - 1)
Extract year from YYYY-MM-DD
=LEFT(A1; 4)
Extract area code from phone number
=LEFT(A1; 3)
Extract text before a delimiter
=LEFT(A1; FIND("-"; A1) - 1)
Extract variable-length prefixes
=LEFT(A1; FIND("_"; A1) - 1)
Use LEFT with TRIM to clean data
=LEFT(TRIM(A1); 5)
Extract first N characters dynamically
=LEFT(A1; B1)
Where B1 contains the number of characters.
Edge Cases and Behavior Details ▾
num_chars omitted → defaults to 1
=LEFT("ABC") → "A"
num_chars larger than text length
=LEFT("ABC"; 10) → "ABC"
num_chars = 0
=LEFT("ABC"; 0) → ""
num_chars negative → Err:502
=LEFT("ABC"; -1)
text is a number → converted to text
=LEFT(12345; 2) → "12"
text is empty
=LEFT(""); 3 → ""
text is an error → error propagates
=LEFT(#N/A; 2) → #N/A
text is a formula returning ""
=LEFT(A1; 3)
Returns "" if A1 is empty-string.
Common Errors and Fixes ▾
Err:502 — Invalid argument
Occurs when:
- num_chars is negative
- num_chars is non-numeric
- text is missing
LEFT returns fewer characters than expected
Cause:
- Leading spaces
- Hidden characters
- TRIM not applied
Fix:
Use TRIM(A1) or CLEAN(A1).
LEFT returns unexpected characters
Cause:
- Non‑ASCII characters
- Unicode combining marks
- Hidden formatting
Best Practices ▾
- Use LEFT for prefix extraction and structured text parsing
- Combine with FIND/SEARCH for delimiter‑based extraction
- Use TRIM to clean input before slicing
- Use LEN to validate expected lengths
- Use LEFT with MID/RIGHT for full string decomposition
Related Patterns and Alternatives ▾
- Use RIGHT to extract from the end
- Use MID for middle extraction
- Use FIND or SEARCH to locate delimiters
- Use LEN to measure text length
- Use TEXT to format numbers before slicing
By mastering LEFT and its companion functions, you can build clean, powerful, and flexible text‑processing workflows in LibreOffice Calc.