Excel- RIGHT Function



RIGHT Function

The Excel RIGHT function retrieves a single or more than one character from the rear end of the input string. It is categorized under the Excel TEXT functions list. Unlike the RIGHTB function, whatever preferred language setting in Excel, the RIGHT considers each character in the provided string as a 1. The RIGHT function merges and works sufficiently with other functions like IF, SEARCH, FIND, LOWER, LEN, etc.

This eminent function resolves various complex scenarios. For example, you can extract only the last name of the business tycoons and fetch only the domain of the URLs.

Compatibility

This prominent Excel function is compatible with the following versions of MS-Excel −

  • Excel for Microsoft 365
  • Excel for Microsoft 365 for Mac
  • Excel for the web
  • Excel 2024
  • Excel 2024 for Mac
  • Excel 2021
  • Excel 2021 for Mac
  • Excel 2019
  • Excel 2016

Syntax

The syntax of the RIGHT function is as follows −

RIGHT(text, [num_chars])

Arguments

You can use the following arguments with the RIGHT function −

Argument Description Required / Optional
Text A text string where the specific number of characters are to be fetched from the rear end. Required
Num_chars A numeric value represents how many characters will be extracted from the right side. Optional

Points To Remember

  • The RIGHT function receives the same error if the cell reference points to an error value in the first argument.
  • If the Num_chars is smaller than 0, the RIGHT function will return the #VALUE! error.
  • If the Num_chars exceeds the number of characters in a provided string, then the RIGHT function will return the exact input string.
  • If the "Num_chars" is skipped, its value is 1 by default, meaning the RIGHT function will return only the last character from the rear side of the input string.
  • If the Num_chars is other than the numeric value, then the RIGHT function will retrieve the #VALUE! error.
  • The wild cards are not supported in the RIGHT function.

How to use the RIGHT Function in Excel?

The steps to employ the RIGHT function are written below.

  • Expediate the desired Excel worksheet.
  • Double-click on the designated cell and type the = sign, then type the RIGHT(text/cell reference/cell range, Num_chars).
  • Press the Enter tab to get a certain number of characters from the end of the provided string.

Examples of RIGHT Functions

Practice the following example to learn the use of the RIGHT function in Excel.

Example 1: How to Execute RIGHT Function in Excel?

The RIGHT function in Excel is used to get a certain number of characters from the end (right side) of a text.

Solution

Step 1 − First, assume the sample data set consists of three columns: Text, Number of Characters, and Result. The input text strings are mentioned in the range B2:B8, and different numbers of characters are specified in the range C2:C8. The main goal is to compute the RIGHT function in the D column.

How to Execute RIGHT Function in Excel1

Step 2 − Moreover, select the range D2:D8 cell and type the formula =RIGHT(B2, C2) in the formula bar.

How to Execute RIGHT Function in Excel2

Step 3 − Afterward, once you press the "ctrl+Enter" keys, the resulting values are automatically populated in the D2:D8 cells.

How to Execute RIGHT Function in Excel3

Note − VALUE! error occurred in the D7 cell as the Num_chars value is -2, which is not permissible in the RIGHT function.

Example 2

If the "Num_chars" is skipped, its value is 1 by default, meaning the RIGHT function will return only the last character from the rear side of the input string.

Solution

First, place the cursor on the C2 cell, double-click on it, and write the formula =RIGHT(B2) in the C2 cell.

RIGHT Function Return only Last Character1

After that, press the Enter tab to obtain the result. Therefore, you can notice in the below screenshot that only the last character is extracted from the rear of the string.

RIGHT Function Return only Last Character2

Example 3: Combining IF Statement and RIGHT function in Excel

In Excel, you can use the IF statement with the RIGHT function to check the rightmost characters of a string.

Solution

Let's say you wish to set a constraint, such as whether the customer's first name is valid or invalid; then you can consistently merge the IF statement with the RIGHT function.

Step 1 − First, double-click on the C3 cell and enter the formula =IF(RIGHT(B3,4)="John," "Valid customer name," "Invalid").

Combining IF Statement and RIGHT Function1

Step 2 − After that, press the Enter tab to obtain the result.

Combining IF Statement and RIGHT Function2

Download Practice Sheet

You can download and use the sample data sheet to practice the RIGHT function.

Advertisements