Excel Text Functions
One of Excel’s strengths is the great job it does of working with Text information. As a professional this is truly an invaluable section since dealing with text data is fundamental to most professionals.
In this article I’m going to give an explanation of them, some examples and marks out of 10 for all the formulas.
What Are The Best Excel Text Functions Look At Formulas
First let’s look at formulas that cleanse text data. By cleansing, I mean making the piece of data appropriate to work with.
Removes all unnecessary spaces in the text in a cell (apart from 1 space between words)
Makes the text in a cell lowercase apart from the first character and any character after a full stop
Very useful when you bring data from another source (maybe you've pasted stuff from a website) and Excel doesn't lie some of the characters properly, resulting in nonsense, such as below. Let CLEAN take care of it for you!
A1 contains the following “The correct values can be found at located at the areas in”
So writing =CLEAN (A1) gives us “The correct values can be found at located at the areas in”
So we got rid of the weird symbols but it did leave us with extra spaces, so as a rule when bringing data in, use the following combo:
=TRIM (CLEAN (A1)) which gives “The correct values can be found at located at the areas in”
If you look carefully, this has taken care of the extra spaces around where the symbols were.
SEARCH (8/10) /FIND (5/10)
These two look for a single character or a sequence of characters in a cell, the difference is FIND is case sensitive and SEARCH is case insensitive and this is the main reason I, and so should you, always default to SEARCH.
What you will end up with is the position number of where your character is (or string of characters start) so it acts a bit like the MATCH function, if there is no number you will get an error (#VALUE!).
What Are The Best Excel Text Functions Its structure of SEARCH/FIND is the same:
SEARCH (what character or sequential characters are you looking for?, what/where shall I look?, shall I start looking from a certain number of characters in or if not I’ll start from the beginning)
There are 3 common uses of FIND/SEARCH. First is in combination with the LEFT/RIGHT/MID which I’ll address in a bit. Second is to help rule building with IF again and lastly for quick and dirty analysis, possibly with auto filtering where you create a new column and see if ,
For example : the word "email" exists in some text, then where the formula produces a number rather than an error you can filter and investigate.
This is short for length and it simply gives you a count of characters in a cell including spaces. For example LEN ("Hello") results in 5. LEN ("12/02/2014") results in 9 but LEN (12/02/2014) results in 5 because while Excel perceives "12/02/2014" as text, 12/02/2014 is a date,
so behind the scenes Excel converts it to a serial number (41682) which has a length of 5.
LEFT, MID, RIGHT
These very useful formulas will extract characters from a cell.
Always starts extracting from left to right. Here’s the structure:
LEFT (what/where is your text, how many characters shall I display starting from the left)Let’s say we want to know the first 5 characters of a unique reference number as it implies some useful information, here’s how we do it:
What Are The Best Excel Text Functions MID (8/10)
This is like LEFT in that it extract looking left to right, but the difference is you can decide how many character in you want to start. Here’s the structure:
MID (what/where is your text, how many characters in, how many characters shall I display starting from the left),To keep the example simple, let's say we have some Unique References where the letters always give us region abbreviation and we know they occur 3 characters in.
Always starts extracting from right to left. Here’s the structure:
RIGHT (what/where is your text, how many characters shall I display from the right).This example wants to do a very simple check to see if the word “President” is contained in column A so we set a basic RIGHT formula to look at the last 9 characters and by making the whole thing equal to the word “President” we are creating a check. If they contain the characters “President” it will result in a TRUE, otherwise if not then we will get a FALSE output.
That covers the basics but before moving on I just want to give a simple example how we can manipulate text data to make it fit for our purpose. A classic example, Something I encounter in most weeks at work is around extracting certain words.
What Are The Best Excel Text Functions For example,
we want the first name of a person where names in a cell are in a ‘First Name’ space ‘Second Name’ format. So how can we extract just the first name? What do all the names have in common?
They all have a space between the first and second names. So all we do is to use a formula to search for which number the space occurs:
Now if we put that number into a LEFT formula and say count up to this many characters (-1 since we don’t want to include the space) then we have a way to automatically extract just the first name! Behold.
This is just a basic, but powerful example of some of the cool stuff Excel can do to handle text data.
Before ending this section, I may be lambasted by some for not rating the CONCATENATE function highly, whilst it does something very useful which is to join the contents of two or more cells/text/values, it has zero advantages over the ampersand operator (&) so don't bother with it.