[fusion_builder_container hundred_percent=”no” equal_height_columns=”no” menu_anchor=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” class=”” id=”” background_color=”” background_image=”” background_position=”center center” background_repeat=”no-repeat” fade=”no” background_parallax=”none” parallax_speed=”0.3″ video_mp4=”” video_webm=”” video_ogv=”” video_url=”” video_aspect_ratio=”16:9″ video_loop=”yes” video_mute=”yes” overlay_color=”” video_preview_image=”” border_size=”” border_color=”” border_style=”solid” padding_top=”” padding_bottom=”” padding_left=”” padding_right=””][fusion_builder_row][fusion_builder_column type=”1_1″ layout=”1_1″ background_position=”left top” background_color=”” border_size=”” border_color=”” border_style=”solid” border_position=”all” spacing=”yes” background_image=”” background_repeat=”no-repeat” padding_top=”” padding_right=”” padding_bottom=”” padding_left=”” margin_top=”0px” margin_bottom=”0px” class=”” id=”” animation_type=”” animation_speed=”0.3″ animation_direction=”left” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” center_content=”no” last=”no” min_height=”” hover_type=”none” link=””][fusion_text]
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.
First let’s look at formulas that cleanse text data. By cleansing, I mean making the piece of data appropriate to work with.
TRIM (7/10)
Removes all unnecessary spaces in the text in a cell (apart from 1 space between words)
PROPER (6/10)
Makes the text in a cell lowercase apart from the first character and any character after a full stop
CLEAN (6/10)
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!).
The 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.
LEN (8/10)
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.
LEFT (8/10)
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:
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.
RIGHT (8/10)
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.
Enter your text here…
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. 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.
[/fusion_text][/fusion_builder_column][/fusion_builder_row][/fusion_builder_container]