Skip to main content

Excel RIGHT function

If you want to extract a specific number of characters from the right side of the text string, the RIGHT function maybe the best choice for you. This article, I will talk about how to use the RIGHT function in Excel workbook.


 Syntax:

The syntax for the RIGHT function in Excel is:

=RIGHT (text, [num_chars])

 Arguments:

  • text: Required. The text string that you want to extract characters.
  • num_chars: Optional. The number of characters to be returned from the end of the given text.
    • If the num_chars is omitted, it will set to 1 by default.
    • If the num_chars is greater than the length of the text string, all characters will be returned.
    • The num_chars must be greater than or equal to zero, if it is a negative number, a #VALUE! error will be returned.

 Return:

Return the text from right of the text string.


 Examples:

Example 1: Extract the last x characters from the text strings with RIGHT function

To extract the last 4 characters from the text strings, please apply the following formula:

=RIGHT(A2,4)

Then, drag the fill handle down to the cells that you want to apply this formula, and all the last 4 characters have been extracted at once, see screenshot:


Example 2: Extract the substring after a specific separator with RIGHT function

For example, I need to extract the substrings after the delimiter-hyphen, comma, space or other separators, the RIGHT function can do you a favor.

Please apply the below formula into a blank cell:

=RIGHT(A2,LEN(A2)-SEARCH("-",A2))

Note: In the above formula, A2 is the cell that you want to extract text, “-” is the specific character that you want to extract substring based on, you can change it to other separators as you need.

Then, drag the fill handle down to fill this formula to other cells, and all the substrings after the specific separator have been extracted as below screenshot sown:

Tips: Sometimes, if there are more than one separators within the text stings, and you want to extract the substring from last occurrence of the delimiter as below screenshot:

To solve this task, please apply the following formula:

=RIGHT(A2,LEN(A2)-SEARCH("#",SUBSTITUTE(A2,"-","#",LEN(A2)-LEN(SUBSTITUTE(A2,"-","")))))

And, you will get the text after the last occurrence of the hyphen, see screenshot:


Example 3: Remove the first n characters from text strings with RIGHT function

With this RIGHT function, you can also remove first x characters from left of the text strings as below screenshot shown.

For solving this job, please use the following formula:

=RIGHT(A2,LEN(A2)-2)

Note: In the above formula, A2 is the cell value that you want to remove characters; The number 2 means the number of characters you want to remove from the beginning of the text string.

Then, drag the fill handle down to the cells you want to apply this formula, and all the first two characters are removed from the right side of the text strings:


 More Functions:

  • Excel MID Function
  • MID function is used to extract the specific characters from the middle of text string.
  • Excel LEFT Function
  • The LEFT function extracts the given number of characters from the left side of a supplied string.
  • Excel SEARCH Function
  • The SEARCH function can help you to find the position of a specific character or substring from the given text string.

The Best Office Productivity Tools


Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)

  • One second to switch between dozens of open documents!
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Edge and Firefox.
Comments (2)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
В какой версии эксель появляется функция вправо, влево, или это надстройка? У меня в 2013 нет.
This comment was minimized by the moderator on the site
Hello,
This RIGHT function is an old function which begins from Excel 2003. But it may not be available in all languages.
The RIGHT function is intended for use with languages that use the single-byte character set (SBCS), so it may be not available in your languages.
Thank you!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations