Excel is normally pretty smart when it comes to importing data, but sometimes the automatic parsing it uses can be a real bother. For instance, you may import information that contains text strings, such as “1- 4- 9” (without the quotes). This is fine, but if you do a Replace to get rid of the spaces, Excel automatically converts the resulting string (1-4-9) to a date (1/4/09).
One potential solution is to copy your information to Word and do your searching and replacing there. The problem with this solution is that when you paste the information back into Excel, it will again be parsed as date information and automatically converted to the requisite date serial numbers.
The only satisfactory solution is to make sure that Excel absolutely treats the resulting strings as just that-strings-and not as dates. This can be done in one of two ways: just make sure that the original text begins with either an apostrophe or a space. This can be ensured by using the Replace feature of Excel (depending on the data you have to work with) or by using the Replace feature of Word (which is much more versatile).
With an apostrophe or space at the beginning of the cell entry, you can remove additional spaces or characters from the cell contents. If the result is text that looks like a date, Excel will not parse it as such because the leading apostrophe or space forces treatment as text.
Another way to perform the task is to follow these steps. (Assume that the original data is in the range A2:A101).
- Insert a column to the right of the original data.
- In cell B2, enter the following formula:
- Copy the contents of B2 into the range B3:B101.
- Select the cells in the range of B2:B101.
- Press Ctrl+C to copy the range to the Clipboard.
- Select cell A2.
- Display the Home tab of the ribbon.
- Click the down-arrow under the Paste tool and then choose Paste Special. Excel displays the Paste Special dialog box. (See Figure 1.)
- Make sure the Values option is selected.
- Click on OK.
- Delete column B.
Figure 1. The Paste Special dialog box.
If you are using Excel 2010 or Excel 2013 you can use a shortcut for steps 8 through 10. When you click the down-arrow under the Paste tool (step 8), you see a small palette of options. Select the Values option in the Paste Values section of the drop-down list. The Values option is the left-most option in the Paste Values section; it looks like a clipboard with the number 123 on it.
These steps work because the output of the SUBSTITUTE function is always treated as text. When you copy and paste text values, they are treated as text with no additional parsing done by Excel.