Text

RIGHTB Function in Excel

Returns the rightmost characters from a text value based on bytes.

Syntax

  • =RIGHTB(text, [num_bytes])

Arguments

  • text (required): Text string
  • num_bytes (optional): Number of bytes to extract

Examples

  • =RIGHTB(A1, 4) - Last 4 bytes - Result: Characters

Excel RIGHTB function documentation

  • RIGHTB returns ending text from a string based on byte count.
  • Syntax: =RIGHTB(text, [num_bytes]). It is the byte-aware counterpart to RIGHT.
  • Use RIGHTB for legacy integrations where suffix fields are byte-limited.
  • Text function category: [/categories/text/](/categories/text/).

RIGHTB syntax and byte-count extraction

  • text is required and num_bytes is optional, defaulting to 1.
  • Returned visible characters depend on single-byte versus double-byte composition.
  • Combine RIGHTB with LENB to validate exact byte-length outputs.
  • Test sample records from each language group before go-live.

Step-by-step: keep trailing byte-limited code

  • Step 1 - Put full identifier in A2.
  • Step 2 - In B2 use =RIGHTB(A2,16).
  • Step 3 - Verify with =LENB(B2) for boundary compliance.
  • Step 4 - Use B2 in exports that require trailing code segments.

RIGHTB vs RIGHT vs MIDB

  • RIGHTB extracts from the end by bytes for DBCS-aware workflows.
  • RIGHT extracts by characters and is simpler for non-byte-limited use cases.
  • MIDB handles byte-based substrings from internal positions.
  • Use [TEXT](/functions/text/) only for display formatting, not extraction logic.

Worked examples to copy

  • Basic suffix: =RIGHTB(A2,8).
  • Default one-byte suffix: =RIGHTB(A2).
  • Conditional suffix: =IF(LENB(A2)>12,RIGHTB(A2,12),A2).
  • Byte check: =LENB(RIGHTB(A2,10)).

People also ask

  • RIGHTB vs RIGHT in multilingual files? - RIGHTB respects byte limits.
  • Why is output shorter than expected? - Double-byte characters use more byte capacity.
  • Can RIGHTB help with fixed-width exports? - Yes, when specs are byte-based.
  • Should RIGHTB replace RIGHT everywhere? - No, only in byte-constrained scenarios.

Common errors

  • Different from RIGHT for double-byte characters

Use cases

  • Asian text processing
  • Byte-level extraction
  • Data parsing

Frequently asked questions

  • What is the RIGHTB function in Excel? RIGHTB returns the rightmost characters from a text value based on bytes. The syntax is =RIGHTB(text, [num_bytes]). Typical use cases include asian text processing, byte-level extraction, data parsing.
  • How do I use the RIGHTB function? To use RIGHTB, type =RIGHTB( in a cell and provide the required arguments. Excel will show you the syntax and parameter hints as you type. Make sure to close the parentheses and press Enter to execute the function.
  • Can RIGHTB handle different text formats? Yes, RIGHTB can work with various text formats including strings, cell references containing text, and text values returned by other functions. It processes text according to its specific functionality.
  • Why is RIGHTB not working in my Excel? Common issues with RIGHTB include Different from RIGHT for double-byte characters. Start by checking the syntax =RIGHTB(text, [num_bytes]), then verify each referenced cell or range.

Editorial review

  • Reviewed by Excel.Directory Editorial Team. Updated May 2026.

When to use RIGHTB

  • Asian text processing — common Text scenario for RIGHTB.
  • Byte-level extraction — common Text scenario for RIGHTB.
  • Data parsing — common Text scenario for RIGHTB.

RIGHTB in the Text category

  • Browse all Text functions at /categories/text/ for related formulas.
  • RIGHTB syntax: =RIGHTB(text, [num_bytes])
  • text (required): Text string
  • num_bytes (optional): Number of bytes to extract
  • Confirm RIGHTB arguments match the syntax shown above before filling down.
  • Lock table and range references with $ when copying formulas across rows or sheets.

Formula checklist before you copy down

  • Confirm RIGHTB arguments match the syntax shown above before filling down.
  • Lock table and range references with $ when copying formulas across rows or sheets.
  • If results look wrong, check for text stored as numbers and invisible spaces with TRIM.
  • Spot-check three known input rows manually against expected output.

Related Excel functions

  • RIGHT (/functions/right/): Returns the specified number of characters from the end of a text string.
  • LEFTB (/functions/leftb/): Returns the leftmost characters from a text value based on bytes.
  • MIDB (/functions/midb/): Returns a specific number of characters from a text string based on bytes.

Errors to watch for

  • Different from RIGHT for double-byte characters — review causes on linked error pages in the directory.

Copy-paste audit workflow

  • Enter RIGHTB on three test rows with known expected output documented on a QA tab.
  • Fill down only after absolute references are locked on lookup tables and rate tables.
  • Compare against manual calculation or a calculator for financial and statistical functions.
  • Search this directory for comparison guides when choosing between similar functions in the same category.

RIGHTB worked examples to copy

  • =RIGHTB(A1, 4) — Last 4 bytes. Expected result: Characters.

RIGHTB reference summary for crawlers and offline review

  • RIGHTB belongs to the Text category in Excel. Returns the rightmost characters from a text value based on bytes.
  • Full syntax: =RIGHTB(text, [num_bytes]). Open /functions/rightb/ for parameters, FAQs, and related pages.
  • Common mistakes: Different from RIGHT for double-byte characters
  • Pair this function with comparison guides when another Excel formula might fit the same task better.
  • Review fix-excel-formula-errors when unexpected errors appear after upgrading Excel or sharing across locales.