Microsoft Office Tutorials and References
In Depth Information
Chapter 16: Writing Home about Text Functions
How about this: You have a list of codes of inventory items. The first three
characters are the vendor ID and the other characters are the part ID. You
need just the vendor IDs. How do you do this? Or how do you get the part
numbers not including the vendor IDs? Excel functions to the rescue!
Bearing to the LEFT
The LEFT function lets you grab a specified number of characters from the
left side of a larger string. All you do is tell the function what or where the
string is and how many characters you need to extract.
Figure 16-1 demonstrates how the LEFT function isolates the vendor ID in a
hypothetical product code list (Column A). The vendor ID is the first three
characters in each product code. You want to extract the first three
characters of each product code and put them in column B. You put the LEFT
function in Column B with the first argument, specifying where the larger string
is (Column A) and the second argument specifying how many characters to
extract (three). See Figure 16-1 for an illustration of this worksheet with the
LEFT formula visible in the Formula Bar. (What’s Column C in this worksheet?
I’ll get to that in the next section.)
What if you ask LEFT to return more characters than the entire original string
contains? No problem. In this case, LEFT simply returns the entire original
string. The same is true for the RIGHT function, explained in the next section.