RIGHT Function (LibreOffice Calc)
The RIGHT function in LibreOffice Calc extracts a specified number of characters from the end (right side) of a text string. It is essential for parsing suffixes, codes, file extensions, and structured text.
Verification status: Consult the documentation, examples and any stated test scope below. How formula examples are checked
Availability and version history
- Introduced: Documented by LibreOffice 26.8.1.1; original introduction not established.
- Availability: Supported in LibreOffice 26.8.1.1, 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.
What the RIGHT Function Does
- Extracts characters from the right side of a string
- Works with text, numbers (converted to text), and formulas
- Useful for parsing suffixes, extensions, and trailing codes
- Supports optional length argument
It is designed to be simple, predictable, and widely compatible.
Syntax
RIGHT(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 last character
=RIGHT("Hello")
Returns "o".
Extract the last 3 characters
=RIGHT("Hello"; 3)
Returns "llo".
Extract from a cell
=RIGHT(A1; 2)
Extract from a number (converted to text)
=RIGHT(2024; 2)
Returns "24".
Advanced Examples
Extract a file extension
=RIGHT(A1; LEN(A1) - FIND("."; A1))
Extract the last word (with FIND/SEARCH)
=RIGHT(A1; LEN(A1) - FIND("☼"; SUBSTITUTE(A1; " "; "☼"; LEN(A1)-LEN(SUBSTITUTE(A1;" ";"")))))
(Extracts text after the last space.)
Extract suffix from a code
=RIGHT(A1; 3)
Extract variable-length suffix after a delimiter
=RIGHT(A1; LEN(A1) - FIND("-"; A1))
Extract last N characters dynamically
=RIGHT(A1; B1)
Where B1 contains the number of characters.
Extract trailing digits from mixed text
=RIGHT(A1; LEN(A1) - MATCH(TRUE; ISERROR(VALUE(MID(A1; ROW(INDIRECT("1:" & LEN(A1))); 1))); 0) + 1)
(Advanced pattern for parsing numeric suffixes.)
Use RIGHT with TRIM to clean data
=RIGHT(TRIM(A1); 4)
Edge Cases and Behavior Details
num_chars omitted → defaults to 1
=RIGHT("ABC") → "C"
num_chars larger than text length
=RIGHT("ABC"; 10) → "ABC"
num_chars = 0
=RIGHT("ABC"; 0) → ""
num_chars negative → Err:502
=RIGHT("ABC"; -1)
text is a number → converted to text
=RIGHT(12345; 2) → "45"
text is empty
=RIGHT(""); 3 → ""
text is an error → error propagates
=RIGHT(#N/A; 2) → #N/A
text is a formula returning ""
=RIGHT(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
RIGHT returns unexpected characters
Cause:
- Trailing spaces
- Hidden characters
- Unicode combining marks
Fix:
Use TRIM(A1) or CLEAN(A1).
RIGHT returns fewer characters than expected
Cause:
- Text shorter than expected
- Hidden formatting
Best Practices
- Use RIGHT for suffix 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 RIGHT with MID/LEFT for full string decomposition
Related Patterns and Alternatives
- Use LEFT to extract from the beginning
- 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 RIGHT and its companion functions, you can build clean, powerful, and flexible text‑processing workflows in LibreOffice Calc.
Reproducible example (tested in LibreOffice Calc)
This standalone example was calculated in LibreOffice Calc 25.2.3.2 and matched the expected value. It is a practical cross-check of one usage, not proof that every example elsewhere on this page is correct.
=RIGHT("Spreadsheet";5)
Expected result: sheet.
Extract a specified number of characters from the end of text.
If the result differs, check the referenced cells, argument separators and number formatting. For more information, consult the LibreOffice Calc official help.