As I mentioned last week, the right, left, and middle functions aren’t very glamorous, but they are workhorses. I often use them together, but not always. They’re useful for date handling, and for interpreting MARC records or any other formatted data, as well as for proofreading, generating statistics, and writing code. While left and right are fairly intuitive, the middle function can seem somewhat less so.
As I also mentioned before, the middle function takes characters from inside a string of text, but that doesn’t mean it starts in the middle and works its way outward or something. It takes a specified number of characters, beginning with the character you tell it to start with. If you used middle(“This is a string of text”,9,7) you’d get “a string”. That’s 4 characters for “This”, 1 space, and 2 for “is”, and then another space, making the “a” in “a string” the 9th character. Then there’s the 1 character for “a”, 1 space, and 5 letters in “string”, for a total of 7 characters.
If you tell it to start with the first character of a string it will act just like left(). If you tell it to start with the last character, though, it won’t replace right(), since it starts with the character you specify, and goes right from there. You’d have to tell it to start at the last character minus however many characters you want returned, if you want the middle function to emulate right().
On the flip side, you can use right and left to emulate middle. If you wanted, say, the 4th and 5th characters of a string you could take the left five characters, and then the right 2 characters of that result.
As with any function, you start by selecting the cell you want the function to be in, and then enter it either by typing or by using the menus to retrieve it. The syntax varies slightly by program, but is generally consistent.
Continue reading Specific functions: Middle