Contact

RIGHT Function in ONLYOFFICE Spreadsheet Editor: Syntax and Worked Examples

Text and Data Beginner ONLYOFFICE Spreadsheet Editor

Use RIGHT and RIGHTB in ONLYOFFICE with worked ASCII examples and clear byte-contract, source and migration cautions.

Verification status: See the evidence and test scope described in this guide. How formula examples are checked

RIGHT extracts characters from the end of a string. For CA-ON-1047, taking the last four gives text 1047. For US-NY-0052, it gives 0052, preserving the leading zeroes because the extracted field is text.

Availability and version history

  • Introduced: The original introduction version and date are not established by the checked references.
  • Availability: Documented in current ONLYOFFICE Spreadsheet Editor help; no final supported-version endpoint is established.
  • Scope: Desktop and Docs release separately. Older builds, mobile clients, localized parsing and imported-workbook parity remain separately unverified.
  • Checked: October 14, 2026, against the official RIGHT reference, vendor illustration and pinned calculation source. ASCII examples were independently calculated; no native execution of these extraction formulas was performed.

Syntax and the optional count

RIGHT(text, [num_chars])

The official reference requires the source text. The optional count must be nonnegative and defaults to 1 when omitted. Brackets describe an optional argument rather than literal formula characters.

The pinned calculation source selects the requested ending substring. With an explicit zero count, that substring operation produces empty text; this supports the expected zero-length example without claiming a native test.

For the vendor illustration, create VendorRight, enter Online Office in A1 and put =RIGHT(A1,2) in C1. The shown result is ce, the final two characters. RIGHT does not attempt to return the complete word Office.

Build the original serial-code worksheet

Create SerialCodes, reserving A1:H12. Put Code in A1 and enter these exact strings in A2:A7:

Cell Code
A2 CA-ON-1047
A3 US-NY-0052
A4 CA-BC-0318
A5 CA-ON-1048
A6 US-CA-2004
A7 BADCODE

Store them as text, without adding surrounding quotation characters. The first five codes are ten characters long. BADCODE is a deliberately malformed seven-character input.

Enter =RIGHT(A2,4) in C2 and fill through C7:

Row Expected C: text
2 1047
3 0052
4 0318
5 1048
6 2004
7 CODE

The first three preserve the original worked results. CODE in row 7 shows why extracting four characters does not prove that a serial field exists.

In C9 put =RIGHT(A2) for text 7. In C10 put =RIGHT(A2,0) for expected empty text. The latter looks blank but still contains a formula; it is different from deleting C10.

Select everything after the second hyphen

In D2 enter this original formula and fill through D6:

=RIGHT(A2,LEN(A2)-FIND("-",A2,FIND("-",A2)+1))

Expected D2:D6 is 1047,0052,0318,1048,2004. For A2, the first FIND returns 3, the second returns 6, and LEN returns 10. RIGHT therefore takes 10−6=4 characters.

In D7 enter:

=IFERROR(RIGHT(A7,LEN(A7)-FIND("-",A7,FIND("-",A7)+1)),"Check code")

The expected result is Check code, because the first hyphen is absent. IFERROR converts that documented search error into a visible message. It does not establish which part failed or prove that other parsed codes are valid.

Advanced: shorter and longer serial fields

Create VariableSerial, reserving A1:F8. Put Code, Length, Second hyphen, Tail count, Fixed four and Delimited tail in A1:F1. Enter CA-ON-1047, CA-ON-7 and CA-ON-001047 in A2:A4.

Enter these formulas in row 2 and fill B2:F2 through row 4:

B2: =LEN(A2)
C2: =FIND("-",A2,FIND("-",A2)+1)
D2: =B2-C2
E2: =RIGHT(A2,4)
F2: =RIGHT(A2,D2)
Row B C D E: fixed four F: delimited tail
2 10 6 4 1047 1047
3 7 6 1 ON-7 7
4 12 6 6 1047 001047

The four-character rule can include characters from the preceding field or silently discard part of a longer serial. The delimiter count preserves the full tail in both cases. Both outputs remain text; numerical equality would not capture the distinction between 1047 and 001047 as identifiers.

On a copy named ExtraField, change only A2 to CA-ON-1047-OLD. B:D become 14,6,8, E2 becomes -OLD, and F2 becomes 1047-OLD. The formula takes everything after the second hyphen, including any further field. It does not enforce exactly three fields.

Trailing spaces and meaningful source data

Create TrailingSpace. In A2 enter ="CA-ON-1047 ", with one space before the closing quote. Put =RIGHT(A2,4) in B2 for expected 047 followed by a space. Put =LEN(A2) in C2 for 11.

A trailing space consumes a character from the requested count. Inspect the raw value before cleaning it; automatically removing characters may change a meaningful identifier in another dataset. MID extracts an interior field, while LEFT selects a prefix.

The nonnegative-count requirement does not establish every fractional-count, numeric/date-conversion or error-cell outcome. The help’s RIGHTB discussion concerns a separately named byte-oriented function; special Unicode behavior and byte/character parity remain untested. These examples use ordinary ASCII text and English comma separators, with no claim of native import or cross-build equivalence.

RIGHTB: documented byte-oriented variant

RIGHTB(text, [num_bytes])

The text argument is required; num_bytes is optional. The inspected inherited calculation defaults to 1 when omitted. The documented count is byte-oriented, which should not be confused with an encoding guarantee.

Documentation and implementation are different evidence

The official RIGHT/RIGHTB reference describes RIGHTB for byte-oriented or double-byte-character-set language use. However, the pinned RIGHTB implementation directly inherits RIGHT, without a separate calculation override in that definition. This is a documented-contract versus inspected-implementation discrepancy, not proof that all clients implement a separate DBCS byte algorithm.

The added coverage was checked on October 19, 2026. Neither the first supported version nor a last supported version is established. The source revision is evidence about that revision, not native execution, a universal Unicode rule or cross-version compatibility.

Worked ASCII controls for RIGHTB

On a separate RightbControls sheet, enter the following formulas into individual empty cells. They contain their inputs, so they do not overwrite the earlier worksheets. Results are independently reasoned from ordinary ASCII and the inherited calculation, not observations from a running ONLYOFFICE editor. Text results remain text; “empty text” means a formula result of zero length.

Formula Expected text or error Explanation
=RIGHTB("ORD-4821",4) text 4821 The four ending positions are the digits.
=RIGHTB("ABC",1) text C One ending position selects C.
=RIGHTB("ABC",0) empty text Zero positions yield empty text.
=RIGHTB("ABC") text C The inherited default selects one ending position.
=RIGHTB("ABC",20) ABC An oversized count returns the available text.
=RIGHTB("ABC",-1) #VALUE! The inherited calculation rejects a negative count.

The four final positions of ORD-4821 are 4821. A trailing space would consume one requested position, so inspect the exact text before treating the last four positions as a serial number.

Migrating a workbook that uses RIGHTB

Keep a copy of the original formula and its source text. Compare the ASCII controls first, then separately check the real workbook’s Japanese, Chinese or Korean text, mixed-script strings, emoji and combining marks in the intended editor/build and locale. Record actual results instead of deriving them from these ASCII examples.

Do not equate the B suffix with UTF-8 file size, display width or user-perceived characters, and do not silently replace RIGHTB with RIGHT in a workbook whose author depended on byte positions. Matching names and inherited code do not establish import/export parity. Confirm formula separators and language in the destination editor; fractional counts, type conversions and unlisted error cases remain outside this evidence.