In Excel, you are developing a list of articles that your company sells. The first two characters of each article code represent a specific article group. In preparation for further processing, you want to read those two characters from each article code and insert them in a cell of their own. Excel’s LEFT or RIGHT functions can help you accomplish this.
This learning module shows you how to use Excel’s LEFT and RIGHT functions to read characters from cells containing plain-text values (text strings).
The excel LEFT and RIGHT functions: HOW DOES IT WORK?
You can use the LEFT function to read a specific number of characters in a text string, starting with the leftmost character. The RIGHT function performs the same action, but reads the rightmost characters in the cell. The excel LEFT and RIGHT functionstake two arguments:
- Text contains a reference to a cell containing a text string. (This argument can also contain a text string in quotes, but doing so would make little sense.)
- Num_chars denotes the number of characters to be read. This argument is optional; if left blank, one character will be read. If the number entered here is greater than the total number of characters in the string, all characters will be read. (Negative numbers cause a value error to be reported.)
In the following illustration, you can clearly see how these functions work:
The LEFT function reads and returns the first two characters from B3.
The RIGHT function reads and returns the last four characters from B3.
Now, to solve the problem with the article codes (described above), first click in B4, where the first result is to appear. Then start the Function Wizard by clicking the button to the left of the formula bar. After selecting the LEFT function from the Text category and clicking OK, the Function Arguments dialog box (shown below) appears.
In the Text argument field, enter a cell reference that indicates the cell from which the content is to be read, here: A4. Now, in the Num_chars argument field, enter the number 2, indicating that two characters are to be read.
If you are satisfied with your arguments, click OK. The formula bar now shows the completed function:
This can be read as follows: Read and return the first two characters on the left from cell A4.
You can now use Auto Fill to copy the LEFT function in B4 to the other cells in column B.