Excel text transformation tricks

By David H. Ringstrom, CPA

Data arrives on your desk from multiple sources, and in many cases it's not quite in the format that you need. For instance, a user may have left the CAPS LOCK on while typing in a series of addresses. Or you've exported data from a program that pads fields with spaces at the beginning or end. Fortunately, there's no need to retype the list. Excel offers four easy-to-use functions that can quickly transform data into just the format that you need.

UPPER – As shown in Figure 1, this function transforms text into all upper case, so the phrase Old McDonald's Farm becomes OLD MCDONALD'S FARM. This function only has one argument, so you simply type =UPPER(x), where x is a cell that contains text you wish to convert.

LOWER – This function transforms text into all lower case letters, so Old McDonald's Farm becomes old mcdonald's farm. As with the UPPER function, you simply use the form =LOWER(x), where x is a cell that you wish to convert to lower case.

PROPER – This function capitalizes the first letter of each word, so the phrase old mcdonald's farm becomes Old Mcdonald'S Farm. This function takes the same form as the other functions: =PROPER(x), where x is the cell to convert. However, as you can see in Figure 1, PROPER can present problems in some cases:


  • The first D in McDonald's doesn't get capitalized.
  • The S in McDonald's is capitalized — in addition to capitalizing the first letter of a word, PROPER also capitalizes the next letter after an apostrophe or single quote.
  • Other items to look for are acronyms or initials, where ABC COMPANY would become Abc Company or BOB'S TV SERVICE would become Bob'S TV Service

You'll have to manually clear up problems like ABC or TV being converted to Abc and Tv, but you can use Excel's Replace function to clear up other problems, as I'll explain in a moment.

TRIM – Sometimes you'll inherit data that has extraneous spaces at the beginning, middle, or end of the string, such as ” Old McDonald's Farm”. In such cases you can use the TRIM function to strip out all extraneous spaces — the function automatically keeps one space between each word. The function takes the form =TRIM(x) where x is a cell reference.

Figure 1: These four functions can quickly transform text without retyping.

Expert tip: Sometimes it's helpful to have white space that the start of certain words, as shown in Figure 2. Rather than manually enter spaces at the start of cells A3 through A5, try this instead:


  1. Press Ctrl-1 to display the Format Cells dialog box.
  2. Click on the Alignment tab, and set the Indent field to 1 or 2.
  3. Click OK and your text will automatically indented, as shown in Figure 3.
  4. You can remove all of the indenting at any time by changing the Indent back to 0.

Figure 2: Use the Indent setting to move text to the right without using the spacebar.

Figure 3: Set the Indent level to 1 or 2 to create a slight indent.


Convert Formulas to Values

Typically when you use these functions you'll have data in one column, such as column A in Figure 1. You'll enter the formula in column B, and then copy it down the length of your list. Presto, your list is transformed, but don't rush off and delete column A just yet. You must first copy the formulas in column B to the clipboard, and then use the Paste Special command to convert the formulas to values:


  1. Copy the formulas to the clipboard.
  2. Right-click on the first cell that you copied, and then choose Paste Special.
  3. As shown in Figure 4, you can double-click on the word Values, or click once on Values and then click OK.

At this point you can delete the data in column A, because your converted data is in column B as text rather than formulas that refer to column A. If you forget to convert the formulas in column B to values before you delete column A, then you'll end up with a series of #REF! errors. Simply press Ctrl-Z to undo the column deletion, and then carry out the Paste Special Values command.

Figure 4: The Paste Special Values command converts formulas to text.


A PROPER Clean-up

Once you've converted your formulas to values, you can use the Replace function to resolve problems like that pesky ‘S in McDonald'S. To do so, press Ctrl-H to display the Replace dialog box. As shown in Figure 5, enter ‘S in the Find field, and ‘s in the Replace With field. Repeat this process for any other issues, like replacing Mcd with McD, Tv with TV, and so on.
Figure 5: Use the Replace command to quickly clean up capitalization problems that PROPER introduces.

A previous version of this article first appeared on www.accountingweb.com .

About the author:

David H. Ringstrom, CPA heads up Accounting Advisors, Inc., an Atlanta-based software and database consulting firm providing training and consulting services nationwide. Contact David at david@acctadv.com  or follow him on Twitter. David speaks at conferences about Microsoft Excel, and presents webcasts for several CPE providers, including AccountingWEB partner CPE Link