Automating the Name Game

I had a mountain of paperwork to finish up for work, a pile of bills to get entered into the computer, there were a half dozen light bulbs to change around the house, not to mention the Christmas tree was still sitting in the corner of the living room.  I figured this was the perfect time to set up Microsoft Excel to play “The Name Game”.  For those who aren’t in tune to the national zeitgeist, “The Name Game” was a big hit in 1965 for singer and songwriter Shirley Ellis.  It promises “there isn’t any name that you can’t rhyme”.  This is done by selectively changing the first letter of the person’s name.  For example “Daniel” plays out as follows:

“Daniel, Daniel, bo Baniel
Banana fanna fo Faniel
Fee fie mo Maniel

For Excel to play the game, it needs to know the person’s name first.  This is a variable and is stored in the first column: “A”.  I tried to keep things simple by naming this column NAME.  The “B” column also has to be defined to contain the result.  I called this one VERSE.  A lot of the verse is actually the same no matter what the name is.  “Bo”, “fo” and “mo” stay the same.  For every “fee fie” there is a corresponding “banana fanna”.  These are constants in the equation and can just be left as themselves surrounded by quotation marks.

Stripping out the first letter of the name sounds simple enough, but it is a little tricky because we can only tell Excel to start selecting characters in the NAME column from the left or the right.  So, instead of saying “take the first character off the left”, we’re actually saying “keep all the characters from the right except the leftmost one”.  And every name can – potentially – have a different number of characters.  So, we need to count the number of characters in NAME first, subtract one, and then have the computer keep that number of characters from the right.  After that, I need to add a “B”, “F” or “M” at the beginning, depending on the point in the VERSE we’re at.

But there’s a catch.  If the first letter of the name is a “B”, “F” or “M”, then replacing it with the same letter won’t work.  The song says if this occurs, just drop the first letter completely.  So “Meka” would be transformed as follows:

“Fee fie mo Eka.”

To accomplish this, I need to use an IF-THEN-ELSE statement.  If the defined condition is true – in this case, does the first character on the left equal the letter “B” – then just keep all the characters from the right except the leftmost one.  Otherwise, add a “B” to all those characters.  This same syntax can be used for “F” and “M”.

In the end, the VERSE column contains the following equation:

=A2 & “, ” & A2 & “, bo ” & (IF(LEFT(A2,1) = “B”,(RIGHT(A2,(LEN(A2)-1))),(“B”&RIGHT(A2,(LEN(A2)-1))))) & “Banana fanna fo ” & (IF(LEFT(A2,1) = “F”,(RIGHT(A2,(LEN(A2)-1))),(“F”&RIGHT(A2,(LEN(A2)-1))))) & “Fee fie mo ” & (IF(LEFT(A2,1) = “M”,(RIGHT(A2,(LEN(A2)-1))),(“M”&RIGHT(A2,(LEN(A2)-1))))) & A2 & “!”

In reality, “The Name Game” is more complex than this.  Though the song mentions first letter, what Ms. Ellis actually meant was first sound.  “Shirley” is not “Mo Mhirley”.  And names that start with vowel sounds – such as “Anna” – should keep their first letter (i.e., “Banana Fanna Fo Fanna”).  However, what I came up with in Excel was good enough to allow me to play the game with Ruby, Mitch, Bart and Tucker.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s