Chapter 14 – Forest of String Functions

There are a group of functions known as string functions. As the name suggested, they were functions that processed strings. Typical examples were LEFT and RIGHT. These functions cut out parts from a string. For example, let’s assume there is an address “Tokyo Minato-ku Roppongi 6-Chome 10-1 Roppongi Hills Mori Tower”

=LEFT(“Tokyo Minato Ward Roppongi 6-Chome 10-1 Roppongi Hills Mori Tower”, 2)

Taking the left two characters from “Tokyo Minato-ku Roppongi 6-Chome 10-1 Roppongi Hills Mori Tower」would leave just “Tokyo (東京)”.

=RIGHT(“Tokyo Minato Ward Roppongi 6-Chome 10-1 Roppongi Hills Mori Tower”, 10)

Doing this would result in “Roppongi Hills Mori Tower (六本木ヒルズ森タワー)” instead. However, the third and sixth characters were problematic. Many prefectures had just two characters, but there were also some with three, such as Kanagawa and Wakayama. If you used LEFT to cut out just the two left characters, you would end up with Kana and Waka and you wouldn’t know what they meant. In those cases, FIND would be used.

=FIND(“Prefecture”, “Kagoshima Prefecture”)

Would return a result of 4, because “Prefecture” was the fourth character (鹿児島県). Combining this with LEFT, you could extract the prefecture considering the number of characters as follows.

=LEFT(“Kagoshima Prefecture Shibushi City Shibushi Municipality Shibushi 2-Chome 1-1 Shibushi City Hall Shibushi Branch”, FIND(“Prefecture”, “Kagoshima Prefecture Shibushi City Shibushi Municipality Shibushi 2-Chome 1-1 Shibushi City Hall Shibushi Branch”)-1)

It was very lazy, but Excel experts often did this kind of thing. In the example above, it would be used to calculate the number of customers by prefecture when given customer address data. If there are only 10 addresses or so, you could just count them and you wouldn’t need this, so this was naturally used for data in the thousands or tens of thousands.

That was why today’s quest was overflowing with such string functions. To be more specific, it was almost like a forest. It seems that string functions were inspired by nature.

Dogs, monkeys, and birds lived among the FIND trees and LEN flowers. They were LEFT, MID, and RIGHT respectively. If you looked closely, VLOOKUP was also mixed in, but felt surprisingly familiar in the environment.

“We need to work together.”

Inoue said that as she handed me a tamo net.

####################

“FIND!”

Inoue processed the FIND and the tree was sucked into a cell. The MID that was on top of the FIND fell to the floor and I caught it with my net as it landed. The MID showed sharp resistance, but when I said ‘MID’ to process it, it was sucked into a cell as well. Inoue took care of the LEFT, which was hiding in the shade of a tree, but let her guard down. A RIGHT that had lost its perch flew at her, but I caught it in my net and dealt with it.

“You’re doing great. Keep up the good work.”

“Yes, thank you very much.”

I was nervous about going on a quest without Saito, but it seems like things had gone off to a good start.

 

※Functions

LEFT https://support.google.com/docs/answer/3094079

RIGHT https://support.google.com/docs/answer/3094087

FIND https://support.google.com/docs/answer/3094126

MID https://support.google.com/docs/answer/3094129

[Previous Chapter] [Table of Contents] [Next Chapter]

Leave a Reply

Your email address will not be published. Required fields are marked *