Leading the way in Microsoft Office Development
 Home|

Excel

|Word|PowerPoint|Consultancy|Feedback|Contact 
 Excel > Functions > Text > RIGHT

 

RIGHT(text [,num_chars])

 
 Returns the last or right most character (or characters) in a text string.

 textThe text string that contains the characters you want to extract.
 num_chars(Optional) The number of characters you want to extract.

 REMARKS
 
  • If "text" is a text string then it must be enclosed in speech marks.
     
  • If "num_chars" > the length of the "text", then "text" is returned.
     
  • If "num_chars" is left blank, then 1 is used.
     
  • If "num_chars" is not numerical, then #VALUE! is returned.
     
  • If "num_chars" < 0, then #VALUE! is returned.
     
  • Any blank spaces are counted as individual characters.
     
  • If the text contains any leading or trailing spaces it may be worth using the TRIM() function to ensure you get the expected result.
     
  • There is also a RIGHTB() function which can be used with languages that use the double-byte character set.
     
  • Example 1 -
     
  • Example 2 -
     
  • Example 3 -
     
  • Example 4 -
     
  • Example 5 -
     
  • Example 6 -
     
  • Example 7 -
     
  • Example 8 -
     
  • Example 9 -
     
  • Example 10 -

     EXAMPLES
     
     A
    1=RIGHT("Better Solutions",9) = Solutions
    2=RIGHT("Better",1) = r
    3=RIGHT("Solutions",1) = s
    4=RIGHT("Be More Productive",15) = More Productive
    5=RIGHT("Be More Productive",100) = Be More Productive
    6=RIGHT("word ",5) = "word "
    7=RIGHT(TRIM("word "),5) = word
    8=RIGHT(BetterSolutions,5) = #NAME?
    9=RIGHT("Better Solutions",-50) = #VALUE!
    10=RIGHT("Better Solutions","Be More Productive") = #VALUE!
     

     Functions - R | Index - R | Text Manipulation | Office Online 2003 | Office Online 2007 

     Copyright © 2010 Better Solutions Limited. All Rights Reserved.Top