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

Kutools for Excel - Helps You To Stand Out From Crowd

Would you like to complete your daily work quickly and perfectly? Kutools for Excel brings 300 powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) and save 80% time for you.

  • Designed for 1500 work scenarios, helps you solve 80% Excel problems.
  • Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands.
  • Become an Excel expert in 3 minutes. No longer need to remember any painful formulas and VBA codes.
  • 30-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years.
Ribbon of Excel (with Kutools for Excel installed)

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, Firefox, And New Internet Explorer.
Screen Shot of Excel (with Office Tab installed)
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.

Be the first to comment.