Please note javascript is required for full website functionality.

Blog

A to Z of Excel Functions: The RIGHTB Function

18 November 2024

Welcome back to our regular A to Z of Excel Functions blog.  Today we look at the RIGHTB function.

 

The RIGHTB function

The RIGHTB function returns the last character or characters in a text string, based upon the number of bytes specified.

The RIGHTB function employs the following syntax to operate:

RIGHTB(text, [number_of_bytes])

The RIGHTB function has the following arguments:

  • text: this is required and represents the text string that contains the characters you want to extract
  • number_of_bytes: this argument is optional and specifies the number of characters you want RIGHTB to extract, based upon bytes.

It should be further noted that:

  • number_of_bytes must be greater than or equal to zero
  • if number_of_bytes is omitted, it is assumed to be one (1)
  • this function may not be available in all languages.  RIGHT is intended for use with languages that use the single-byte character set (SBCS), whereas RIGHTB counts two (2) bytes per character only when a DBCS language is set as the default language (the languages that support DBCS include Japanese, Chinese (Simplified), Chinese (Traditional), and Korean
  • otherwise, RIGHTB behaves the same as LEFT, counting one (1) byte per character.

For example, =RIGHTB("中国香港",2) is equal to "".  RIGHTB returns the last character only, because each character is counted as two (2) bytes.

However, =RIGHT("中国香港",2) is equal to "香港" as RIGHT returns the last two (2) characters, because each character is counted as one (1).  RIGHT returns the last two characters no matter what the default language setting is on your computer.

 

We’ll continue our A to Z of Excel Functions soon.  Keep checking back – there’s a new blog post every business day.

A full page of the function articles can be found here

Newsletter