Monday 20 January 2014

Text Functions - 'R' to ''S"


REPLACE   - replace part of string with particular string
-------------------------------------------------------------------------------
Syntax: REPLACE(old_text, start_num, num_chars, new_text)

 

Example: =REPLACE("old string",1,5,"eee") returns "eeetring"

Note: here start_pos =1 ,length = 5  => "old s"
          replace with eee => "eeetring"



REPT   -repeats a text given number of times
---------------------------------------------------
Syntax:  REPT(text, number_times)

Example: =REPT("Hi",4) returns "HiHiHiHi"


 RIGHT -  returns last 'n' number of characters from a string
----------------------------------------------------------------
Syntax: RIGHT(text,[num_chars])

Example: =RIGHT("Hello") returns "o"
               =RIGHT("Hello",2) returns "lo"

 Note: [num_chars] is optional , by default it is 1



SEARCH - Searches one text string within a second text string
 ----------------------------------------------------------------------
 Syntax: SEARCH ( find_text , within_text , [start_num] )

Example:  =SEARCH("man","superman returns") returns "6" as man starts at 6th position
               =SEARCH("he","he is a hero") returns 1
               =SEARCH("he","he is a hero",1) returns 1
               =SEARCH("he","he is a hero",2) returns "9"
              as startposition is 2 and "he" in "hero" is a match at 9th position

Note:      it returns "#Value" if the string is not found in this case we can use IFError Method

No comments:

Post a Comment