RIGHT Function (LibreOffice Calc)

Text Beginner LibreOffice Calc Introduced in LibreOffice 3.0
text string-manipulation parsing data-cleaning extraction

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.

Compatibility

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
RIGHT is essential for parsing file extensions, suffixes, and trailing codes — especially when combined with FIND and LEN.

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.

Copyright 2026. All rights reserved.