Going Stellar

Home/Google Sheets reference

Google Sheets function · Text

RIGHT in Google Sheets: syntax and examples

RIGHT returns characters from the end of a text. It is used to cut off codes, extensions and suffixes, often together with LEN and FIND.

Syntax

RIGHT(string, [number_of_characters])

Arguments

ArgumentTypeRequiredWhat it does
stringtextyesThe text to take characters from. A number is turned into text first.
number_of_charactersnumbernoHow many characters to take from the end. Defaults to 1.

Examples

The examples use this table, starting in A1:

ReferenceName
INV-2026-0042Ana Pop
INV-2026-0107Dan Ilie
ORD-9Mia Rus
12345
=RIGHT("Sheets",3)

Result: ets

The last three characters of a text.

Run in a Google Sheet (English US locale) on .

=RIGHT(A2)

Result: 2

Without the second argument you get one character.

Run in a Google Sheet (English US locale) on .

=RIGHT(A2,4)

Result: 0042

The sequence number at the end of an invoice reference, leading zeros kept.

Run in a Google Sheet (English US locale) on .

=VALUE(RIGHT(A3,4))

Result: 107

VALUE turns the extracted text into a number, so the zeros disappear.

Run in a Google Sheet (English US locale) on .

=RIGHT(B2,LEN(B2)-FIND(" ",B2))

Result: Pop

Everything after the first space: the surname from a full name.

Run in a Google Sheet (English US locale) on .

Common errors

  • A negative count returns #VALUE!. Compute the count first and make sure it is not below 0.
  • Asking for more characters than the text has returns the whole text, with no error.
  • A number is converted to text with the locale decimal separator: RIGHT(1.25,3) returns .25 in en_US but ,25 in ro_RO. Do not rely on a fixed separator.
  • The result is always text. "0042" keeps its zeros, and RIGHT(A2,4)=42 is FALSE until VALUE turns it into a number.

Compared with Excel

Same syntax as Excel RIGHT. RIGHTB exists in Sheets too.

Sources

  1. RIGHT (Docs Editors Help)

Markdown version · All functions