after doing this kind of work for 10 years professionally
it's something incredibly obvious but I was doing it with writing out formulas because I'm too smart for my own good
background:
"upper()" and "lower()" are used on text strings to change the case of the letters. so for example:
upper("apple") = APPLE
lower("Fuck You") = fuck you
and so...
sometimes I would want to make a name like
diane mononym
or
DIANE MONONYM
into
Diane Mononym
and so I would use left() and right() and mid() to pull that shit out carefully and re-assemble it together. I was going to keep it brief because it's a bunch of bullshit but I decided to sit down and write out the formula because the people ought to see bullshit if they really wanted.
below the jump.
before we dive in, let me explain some of the formulas here for your reference.
some stuff with strings:
upper([string])
make the string upper case
lower([string])
make the string lowercase
concatenate([string)
put the contents together as a single string
left([string],[number])
take X-many characters off the left
right([string],[number])
take Y-many characters off the right
trim([string])
remove extra spaces from the string
and some stuff with math:
len([string])
measures how many characters there are in a string
for example: "diane" is five (5) letters long, "mononym" is seven (7) characters long
search([desired character],[string]):
this is used to find a specific character in a string. so like here we'll look for " " the space character. which will denote how far in
number of characters into the string that is
so for example in "diane mononym" the space " " is six (6) characters in, where the name would be split in half
and so the strategy is to split the name into two words, then split the words into two parts, the first letter and the rest of the characters
let me annotate this to explain what's happening here.
here's the formulas, annotated:
A1 ="diane mononym" // I wrote this out
B2 =CONCATENATE( // combine this as one string
UPPER(LEFT(TRIM(LEFT($A$1,SEARCH(" ",A1))))),
// use the space character to find out where the space is and grab the left of the two words, take the first character from the left and make it uppercase
// use the space character to find out where the space is and grab the left of the two words, take the remaining characters from the right and make them lowercase
// use the space character to find out where the space is and grab the right of the two words, take the first character from the left and make it uppercase
// use the space character to find out where the space is and grab the rightof the two words, take the remaining characters from the right and make them lowercase
)
the laborious result:
A1 = diane mononym
B2 = Diane Mononym
This works pretty nicely and with the individual components broken out, you can even do funky stuff like reformat the name to something like
Mononym, Diane
but astute readers will note a specific limitation of this method. what if your person has three names (a middle, naturally),
you are completely shit out of luck.
may as well start this at 9 AM because this is going to take longer than it has to. I am not going today though because getting here writing this has already taken up the better part of an hour.
and I went searching for this because reformatting a name like "KATHERINE HENNESY TEMPO" into "Katherine Hennessy Tempo" would have devoured my soul
but the trick is to use if we're hypothetically tackling this is to be able to count Z-many additional spaces to break up but it's not dynamic. you need to keep adding formulas for each additional segment. hell on earth so let's not
and that's where I arrived at too. hm maybe I'm not too ambitious for my own good.
and so I found it immediately on a brief and mundane stack overflow page. behold. the new formula I did not know existed before today
PROPER()
which does that automatically.
just makes the first letters of a word............ Proper.
Powerpoint and Word are partners, lovers even. Excel is some kind of nerd that gets shoved into a locker. Access and Publisher are the high end couple barely anyone dares to talk to. And Outlook is.. kind of a whore.