RIGHTB Function in OpenOffice Calc
Learn RIGHTB in OpenOffice Calc with DBCS suffix examples, partial-character spaces, default length, error cases and official availability evidence.
Verification status: Official release source and independently calculated examples for RIGHTB were reviewed. No new Apache OpenOffice Calc application execution is claimed for this guide; the stated version and example limits still apply. How formula examples are checked
RIGHTB extracts a suffix using DBCS length units. =RIGHTB("A東京";4) returns 東京; requesting only three units returns " 京", including a leading space.
Availability and version history
- First introduced: Apache OpenOffice 4.0. The official release notes explicitly list RIGHTB among the new DBCS functions.
- Current status: supported in Apache OpenOffice 4.1.16 desktop Calc, confirmed in the enabled function registry and implementation at the AOO4116-GA release tag.
- Last supported version: no final version or removal date established. “Supported in 4.1.16” is a checked version, not an endpoint.
- Platform and locale: desktop Calc; DBCS and system-language details can affect counting. This guide does not claim every platform or Unicode edge case was executed.
- Test status: Apache OpenOffice native execution has not been performed. The principal mixed-CJK examples were independently reasoned from Apache’s implementation and cross-checked in LibreOfficeDev 26.8.0.0.alpha0 (build 2c87e51eeaa2b413ff4ae097b2705eea1995d8e5). A LibreOffice check is supplementary, not an OpenOffice test.
- Evidence checked: 2026-10-14.
Sources: Apache OpenOffice 4.0 release notes, RIGHTB registry, RIGHTB implementation.
Syntax and arguments
RIGHTB(Text; [Number])
| Argument | Required? | Meaning |
|---|---|---|
Text |
Required | Text or a cell reference containing text. |
Number |
Optional | DBCS units to return from the right; default 1. |
These examples use semicolons between arguments and English function names. Enter literal text in double quotes; a cell reference does not need quotes.
Worked example: recover a suffix from a mixed-language identifier
- Enter
A東京in A2. - Enter
=RIGHTB(A2;4)in B2. The expected result is東京. - Enter
=RIGHTB(A2;3)in B3. The expected result is" 京". - Enter
="["&B3&"]"in C3. The expected text is[ 京], making the leading space visible.
Counting from the right, 京 uses two units. Only one unit remains for 東, so the incomplete character becomes a space. This can explain why a returned suffix looks right but does not match an unpadded lookup key.
Boundary and default examples
| Formula | Expected result | Reason |
|---|---|---|
=RIGHTB("AB東京";4) |
東京 |
Four units contain the complete suffix. |
=RIGHTB("A東京";3) |
" 京" |
The left edge splits 東. |
=RIGHTB("A東京") |
" " |
Default length 1 splits 京. |
=RIGHTB("東京AB";2) |
AB |
Latin suffix uses one unit per character. |
=RIGHTB("A東京";0) |
Empty text | Zero units requested. |
=RIGHTB("A東京";20) |
A東京 |
Request is longer than the input. |
For codes ending in a fixed two-character region name, RIGHT(A2;2) is usually easier to reason about. RIGHTB is useful when the interface or legacy format specifically defines a DBCS-unit width. Validate the resulting keys before using them in MATCH or VLOOKUP.
What “byte” means here
Calc uses its DBCS text-counting rules: ordinary Latin characters count as one unit and the CJK characters used in these examples count as two. This is not a general UTF-8 file-size calculation. Do not use it to estimate an exported file’s byte length. Use the ordinary character-based function when a requirement is expressed as a number of characters.
A boundary through the middle of a two-unit character produces a space for the incomplete character. The space is part of the returned text and can affect comparisons, concatenation and lookups. In the examples below, quotation marks show the boundaries of returned text; they are not part of the result.
The implementation also has Japanese-system-language handling for the backslash and euro characters. These examples deliberately avoid those locale-sensitive cases. Test representative production text if a workflow depends on a specific language or encoding.
Common errors and practical checks
Negative counts produce an invalid-argument error. Decimal counts are floored before extraction. A value above the implementation string-length limit also fails. Do not diagnose a leading space as data corruption until you have checked whether the requested DBCS boundary split a character.
Before using the result in a lookup or concatenation, compare it with a known small example. Put square brackets around returned text with ="["&B2&"]" when spaces would otherwise be invisible.
Related functions
RIGHT in OpenOffice Calc uses ordinary character positions. The B-suffixed function is a distinct calculation, not a URL alias for that guide.