Tuesday, 24 July 2012

Microsoft Excel LEFT Function Syntax and Example

MS Excel LEFT Function
LEFT returns the first character or characters from the left in a text string or number, based on the number of characters you specify.
Ø       LEFT always counts each character, whether single-byte or double-byte, as 1, no matter what the default language setting is.
Syntax:
=LEFT(String, Num_of_chars)
String is the text/number that contains the characters you want to extract from LEFT side of the string.
Num of chars   specifies the number of characters you want LEFT to extract.
Ø      Num_of_chars must be greater than or equal to zero.
Ø       If Num_of_chars is greater than the length of text, LEFT returns all of text.
Ø       If Num_of_chars is omitted, it is assumed to be 1 as shown below the screen shot.

Example:

STRING
LEFT FORMULA
RESULT
Ravi-Teja@Reddy
 =LEFT(A2,5)
Ravi-
Ravi-Teja@Reddy
 =LEFT(A3, LEN(A3)-FIND("-",A3))
Ravi-Teja@
123ABC#cde345
 =LEFT(A4, LEN(A4)-FIND("c",A4)+1)
123ABC
123ABC#cde346
 =LEFT(A5, LEN(A5)-SEARCH("c",A5)+1)
123ABC#c
Explanation :
=LEFT(A2,5)
This function returns the 5 characters from the left side of the string in A2.

=LEFT(A5, LEN(A5)-SEARCH("c",A5)+1)
Here in this case we find the No.of characters to extract with SEARCH Function.

Please be note that Find is a case sensitive function but Search is not.


Thanks,
TAMATAM



No comments:

Post a Comment

Follow Me by Email

ExcelKingdom-Popular Posts

ExcelKingdom-Random Posts