Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Power excel 2016 with mrexcel Master Pivot Tables, Subtotals, Charts, VLOOKUP, IF, Data Analysis in Excel 2010–2013 (Bill Jelen) (z-lib.org).pdf
Скачиваний:
4
Добавлен:
14.08.2022
Размер:
49.75 Mб
Скачать

92

POWER EXCEL WITH MR EXCEL

 

 

Figure 219 Use Text only when you have to preserve leading zeros.

9. Click Finish.

Results: The original column F has been overwritten with the first portion of the result. Columns G and H contain the second and third segments of the item number.

Figure 220 You’ve parsed column A into three new columns.

Gotcha: The General format will aggressively attempt to convert anything that is remotely similar to a date to a date. For example, a part number of 5-5055 will be imported as May 1, 5055. A fraction such as 1/4 will be imported as January 4 of the current year. If your data includes dashes or slashes, use the Text format.

Gotcha: Avoid using the Text option in step 3 of the wizard unless it is absolutely necessary. In addition to preserving leading zeros, the Text option will change the format of that column to text. When you try to enter a formula in that column, you will get the formula instead of the answer. To solve this problem, you have to select the column, press Ctrl+1 to format cells, and select Number. Then you select any numeric format. You then have to go back and reenter the formulas in order to have them calculate.

EXCEL IS RANDOMLY PARSING PASTED DATA

Problem: Every once in a while, I paste data from a text file to Excel, and Excel will spontaneously parse my data into several columns. I copied the names from the e-mail on the left, but when I pasted to Excel, the names appeared in one, two, or three columns. However, this may not happen tomorrow. It might hap- pen only once every two weeks.

PART 2: CALCULATING WITH EXCEL

93

 

 

Figure 221 Excel parsed this data when I pasted.

 

Strategy: At some point during this Excel session, you used Data, Text to Columns and specified that

 

the data was delimited by a comma. Whatever settings are left in the Step 2 dialog of the Convert Text to

 

Columns Wizard will be applied to external data pasted to Excel for the rest of the Excel session.

 

To prevent this from happening, you could close Excel when you’re done working with the Convert Text to

 

Columns Wizard. Or you could redisplay the Convert Text to Columns Wizard, go to the Step 2 dialog, and

 

turn off the comma and tab settings. Either method will work.

 

On the other hand, you might want Excel to have this behavior. Perhaps you need to paste 100 documents

 

to Excel and convert text to columns on each one. In this case, you can convert text to columns manually

 

2

on the first pasted data, and the rest of the pastes will automatically be parsed using the same delimiter.

 

 

I LOSE LEADING ZEROES FROM CSV FILES

Problem: When I open a CSV file in Excel, I am losing the leading zeroes. I need those leading zeroes. I would like to choose Text in step 3 of the Import Text to Columns Wizard, but I never get to see that wizard when I open a CSV file.

Strategy: Excel will walk you through the Text to Columns wizard when you open a .txt file. However, if you open a .csv file, Excel will automatically open the file without allowing you to choose field types. If you find that you are losing leading zeroes when you open a .csv file, simply rename the file from .csv to .txt in Windows Explorer before you open the file.

OPEN CSV FILE WITH DATES IN D/M/Y FORMAT

Problem: Our European subsidiary send me a CSV file. One of the columns is in DD/MM/YYYY format, but my international settings are expecting the dates in MM/DD/YYYY format.

Strategy: You could change your international settings in the Control Panel. However, an easier solution is to rename the .CSV file to a .TXT file and then open the .TXT file in Excel.

As discussed above, you do not see the Text Import Wizard when you open CSV files. When you change the extension, you will get to go through the wizard. In step 3, choose the column and select

Date: D/M/Y.

Additional Details: After the import, the dates will be displayed according to your international settings. In the figure below, 17/01/2014 is displayed as 01/17/2014 per the U.S. date format.

Figure 222 Choose DMY in Step 3.

94

POWER EXCEL WITH MR EXCEL

 

 

 

HANDLE DATES IN YYYYMMDD FORMAT

Problem: I have a column with dates stored as 8 numbers: 20180123 is January 23, 2018.

Strategy: Amazingly, the Text to Columns function can convert these to real dates. In the previous figure, choose YMD as the date format in Step 3.

MY G/L SOFTWARE USES A TRAILING MINUS FOR NEGATIVE NUMBERS

Problem: I have data where the minus sign appears after the number. Excel treats this as text.

Strategy: Select the column of data. Use Data, Text to Columns. In Step 3 of the wizard, click Advanced and then choose the setting for Trailing Minus.

Figure 223 Convert trailing minus to negative numbers.

PARSE DATA WITH LEADER LINES

Problem: Someone sent me data with leader lines (........) between the columns. How can I parse the data?

Figure 224 Break the data at the leader lines.

Strategy: First, see if the data is fixed width by changing the font to Courier New or Courier. These fonts are fixed width fonts. If the second field lines up in Courier font, then you know that you can use the Fixed

Width version of Text to Columns.

Figure 225 In Courier New font, this data lines up.

Follow these steps:

PART 2: CALCULATING WITH EXCEL

95

 

 

1.Select the data in column A. Use Data, Text to Col- umns.

2.In Step 1, choose Fixed Width. Click Next.

3.In step 2, click in the data preview area where the second field begins.

Figure 226 Choose Fixed Width in step 1.

Figure 227 Click to add a vertical line.

4. Click Finish.

2

The resulting data will still have the leader lines in column A. Use Home, Find & Select, Replace. In the Find What box, type two periods. Leave the Replace With box blank. Click Replace All. Click OK. Click Replace All again. Click OK. Finally, replace a single period with nothing. Click Replace All.

Figure 228 Use Find and Replace to get rid of leader lines.

Alternate Strategy: If there are no periods other than the leader lines, you could do a delimited

Text to Columns. In Step 1, choose Delimited. In Step 2, choose Other and enter a period as the other delimiter. The important difference is to choose Treat Consecutive Delimiters as One. Click Finish.

Gotcha: This method will fail if any entries in the first field contain a period. After completing the text to columns, go to the presumably blank third column, select a cell, and press Ctrl+Down

Arrow. If you run into any data, fix that row

manually. If you end up at row 1048576, then Figure 229 Treat adjacent periods as one. you know the column is blank as expected.