How can we help you?

The RIGHTB function returns a specific number of characters from the end of a string, based on the given amount of bytes.

This function can be useful when working with double-byte characters, such as hieroglyphs or special characters that are larger than one byte.

 

Syntax

RIGHTB(string, [num_bytes])

Argument

Description

Permitted values

string

String from which the right fragment is returned

Text string or reference to a cell containing text

[num_bytes]

(optional)

The number of bytes that need to be returned from the right side of the “string” argument.

By default, 1

Integer 1 or a reference to a cell containing a number

 

Examples of use

RetrievIng bytes from a string

If cell A1 contains the text “Hello” and you want to retrieve the last 3 bytes:

=RIGHTB(A1, 3)

The expression will return “llo” as these are the last 3 bytes of the text.

Retrieving a single byte

If you want to retrieve the last byte from the string:

=RIGHTB(A1)

The expression will return “o”, since this is the last byte of the string.

 

Notes

The RIGHTB function is useful for working with texts in languages that use double-byte characters, as it takes into account the byte length of characters.

If the num_bytes exceeds argument the length of the string, the function will return the entire string.

Was this helpful?
Yes
No
Previous
RIGHT
Next
SEARCH