The RIGHT function returns a specified number of characters from the end of a supplied text string, based on the number of characters you specify. RIGHTB returns a specified number of characters from the end of a supplied text string, based on the number of bytes you specify.

### Syntax

=RIGHT(text,[num_chars])

=RIGHTB(text,[num_bytes])

Note: RIGHTB counts 2 bytes per character only when a double-byte character set (DBCS) language is set as the default language. Otherwise RIGHTB behaves the same as RIGHT, counting 1 byte per character.

#### Arguments

Argument Description
text The original text string
[num_chars] Optional. Specifies the number of characters you want RIGHT to extract
[num_bytes] Optional. Specifies the number of characters you want RIGHTB to extract, based on bytes

Note: the RIGHT & RIGHTB function always returns a text string, even though this may be contain digits and may look like a number. This will be important if you wish to use the result of the function within further functions or formulas.

#### Examples

A B C D
1 Text Formula Result Notes
2 New York City =RIGHT(A2) y [num_chars] argument defaults to 1 when omitted
3   =RIGHT(A2,4) City
4 301-427-5124 =RIGHT(A4,7) 427-5124 Standard phone number without the area code
5 The number 4 =RIGHT(A5,1) 4 Text string containing the digit 5 as text
6   =RIGHT(A2,-1) #VALUE! Occurs if the supplied [num_chars] argument is < 0

Usage note: the example in cell B5 returns the text value “4”. Although the text string contains a number, this is stored as a text string in Excel.

#### Common Function Error(s)

Problem What went wrong
#VALUE! Occurs if the supplied [num_chars] or [num_bytes] argument is < 0
Using RIGHT with a date, time or numbers returns unexpected results Dates are stored in Excel as numbers, and it is only the cell formatting that makes them appear as dates in your spreadsheet. Attempts to use the LEFTMID or RIGHT functions on a date will return the end characters of the number that represents that date

 • Use the DAY, MONTH or YEAR functions to extract individual parts of a date • Use the Text To Columns tool to convert the cells containing dates to text if you are not using the dates in other calculations