Pages

Wednesday 10 August 2011

Right Function

To extract the characters from right side from a text string based on the no of character specified
Syntax
RIGHT(text,num_chars)
How to extract last name where last name is having different number of letters in different cells

B
C
D
22
Names
Last name
Formula
23
Rajeev Sharma
Sharma
=RIGHT(B23,LEN(B23)-FIND(" ",B23))
24
Rohit Bansal
Bansal
=RIGHT(B24,LEN(B24)-FIND(" ",B24))
25
Amit shrivastava
shrivastava
=RIGHT(B25,LEN(B25)-FIND(" ",B25))


Len Function returns the length of selected text and finds the position of selected characters (Space)
Now to get no of letters after space just subtract the find length from total length
Let see how we did it

Rajeev Sharma
Sharma
=RIGHT(B23,LEN(B23)-FIND(" ",B23))
Total Length
13
Length till space
7
Last name letters
  13-7 =
6 (Sharma)


Left Function

 
To extract the characters from a text string based on the no of character specify from left
Syntax
LEFT(text,num_chars)
 BCD
8NamesFirst NameFormula
9Rajeev SharmaRajeev=LEFT(B9,FIND(" ",B9)-1)
10Rohit BansalRohit=LEFT(B10,FIND(" ",B10)-1)
11Amit shrivastavaAmit=LEFT(B11,FIND(" ",B11)-1)
Find function which is used with left finds the space and returns the position of space