Sunday, 4 September 2016

Excel Text Functions (II) - Extracting text strings using LEFT, RIGHT and MID

LEFT, RIGHT and MID are the three Excel Functions allow users to extract portions of strings from different positions.

(I) LEFT
LEFT returns a specified number of characters, starting from the left most character of the string:

In this example, we are using a sample text string "SYDNEYNSWAUSTRALIA" which is in cell A1.

First of all, we have to go to "Formulas" tab, select "Text" which activates a drop-down list, from which we highlight and select "LEFT".

Once "LEFT" was selected, the "Function Arguments" dialog box will pop up:
User can either enter the text string directly into the "Text" box or clicking the small box at the right which will activate another dialog box as follows:
By clicking cell A1, Excel will put that cell reference into the "Text" box as shown below:
Next, user have to tell Excel how many characters from the left should be extracted, this is done by entering that number of characters into the "Num_chars" box. In our example, we enter 6 which means we will extract 6 characters from the left, following is the result:
(II) RIGHT

RIGHT returns a specified number of characters starting from the rightmost character of the string.

Similar to LEFT, user also access RIGHT by going to "Formulas" tab, select "Text" which activates the drop-down list, from which highlight and select "RIGHT", which will activate the "Function Arguments" dialog box as follows:

We are still using the text string in A1, the number of characters is 9, following is the result:

(III) MID

MID is the function that will return a specified number of characters starting from a specified position.

MID is also located under "Formulas" tab => "Text". From the drop-down list, we highlight and select "MID", which activates the Mid "Function Arguments" box:

We are still using the sample text in cell "A1" as our text string, the "Start_num" is 7, and the "Num_chars" is 3, following is the result:

No comments:

Post a Comment