In addition to numbers and formulas, key data in Microsoft Excel also includes text entries. A recent posting explored 5 tips to work with text in Excel. In this article, learn more about how you can stop retyping and save time by using functions to work with text in Excel.
Too often, I see Excel users who are retyping or trying to manipulate data within the same cell in order to get the correct format and display. To paraphrase an overused phrase, when you want to transform text in Excel, you will often need to think “outside of the cell,” that is, add extra working columns to your worksheet to store the formulas to give you the results you need. If you already have some form of the data, don’t retype…just automatically recreate with some of the following text functions.
What if you have text in cell A1 (or all of column A) that has a mismatch of upper- and lower-case characters such as chris Edwards and you want all entries to be consistent?
In cell B1, type:
=PROPER(A1) to change the data to initial caps: Chris Edwards
=UPPER(A1) to change to all upper case: CHRIS EDWARDS
=LOWER(A1) to change to all lower case: chris edwards
When working with data originating from other sources, it is common for the data to have leading or trailing spaces which will often affect the success of searches and sorting. To display a text entry without any extra spaces at the beginning or end, use the TRIM function as in =TRIM(A1). This function will not remove spaces between words in a text entry. You can also nest other functions inside of a TRIM function such as: =TRIM(PROPER(A1)).
Another text entry problem is when you only want to work with a portion of a data entry. What do you do when you to sort or search on characters at the beginning, middle, or end of a text entry? Let’s look at the simple example of an accounting code such as MA8-23456-T445 in cell A1:
To extract a portion of the text entry, in cell B1 type:
=LEFT(A1,3) for the result “MA8” of the first 3 characters from the left
=RIGHT(A1,4) for the result “T445” of the last 4 characters from the right
=MID(A1,5,5) to extract the result “23456” from the middle starting at character position 5 for 5 characters
To count the length or number of characters in the cell, use the LEN function. For example, to determine the length of an entry in cell A1, type: =LEN(A1)
Sometimes Excel data includes names, addresses or other entries you might want to split up for easier sorting and searching. To split up a text entry such as “Chris Edwards” in cell A1, use a combination of functions including FIND which is used to locate specific characters such as a space or comma:
=LEFT(A1,FIND(” “,A1)-1) the result is “Chris”-all of the characters to the left of the space
=RIGHT(A1,LEN(A1)-FIND(” “,A1)) the result is “Edwards”-all of the characters after the space
Try these additional tips and tricks to save time and to avoid retyping text in Microsoft Excel.
Discover more Excel shortcuts, tips and tricks here.
By Dawn Bjork, MCT, The Software Pro®
Microsoft Certified Trainer, Technology Speaker, Software Consultant