Difference between revisions of "Tutorials:10 Using MicrosoftŽ ExcelŽ to format GSSHA data"
m (moved Tutorials:10 Using MicrosoftĂâĂÂŽ ExcelĂâĂÂŽ to format GSSHAĂ¢ââŹĹžĂ¢ data to Tutorials:10 Using MicrosoftÂŽ ExcelÂŽ to format GSSHA⢠data) |
(No difference)
|
Latest revision as of 18:24, 9 March 2009
Disclaimer: GSSHA tutorial exercises do not represent real world conditions
Contents
Splitting an ExcelÂŽ column
In this example you will copy a text file from Notepad and paste it into MicrosoftÂŽ ExcelÂŽ where it can be manipulated and formatted. Specifically, you will take information from a single column and split it into multiple columns using two different methods.
- Use Notepad to open the file titled âdate1.txtâ, located in the Excel_Tutorial folder.
- Highlight all the data starting with the first row down to the final row.
- Copy this data by right-clicking on the highlighted data and selecting âcopyâ.
- Open a MicrosoftÂŽ ExcelÂŽ worksheet and select the entire first column by clicking on the âAâ at the top of the column.
- Right-click on the âAâ column and select âFormat Cellsâ.
- In the âCategoryâ box pick text, and then click âOKâ.
- Select cell âA1â, then right-click on the cell, and select âpasteâ.
- Select the entire column by clicking on the letter âAâ directly above the column.
- Select the âDataâ menu and click on the âText to ColumnsâŚâ command (this will bring up the âConvert Text to Columns Wizardâ).
- Because the data is separated by the character â/â, toggle âDelimitedâ and select âNextâ.
- Check the box titled âOtherâ and type the â/âcharacter (without quotation marks) into the box provided to the right of the âOtherâ delimiter.
- Click âFinishâ to exit the wizard.
- Use Notepad to open the file titled âdate2.txtâ, located in the Excel_Tutorial folder.
- Repeat steps 2 â 9 (above.)
- Toggle âFixed widthâ and click âNextâ (because the data is not separated by any distinct characters, we divide the column based on width.)
- In the âData previewâ window, create a break line between the year and the month by clicking between the 2 and the 1 on any row, and then make another break line between month and day by clicking between the 1 and the 0.
- Click âFinishâ to exit the wizard.
You will notice that the data has been pasted so that the year, month, and day values are contained in a single column. To make it so that each value has its own column, you will use the âText to ColumnsâŚâ command.
You should now see three columns that represent values for year, month, and day.
The preceding example shows how data can be separated based on a delimiter such as a comma, space, or other character. However, not all data has a distinct character that divides values. In cases such as these it becomes necessary to divide data based on width. The following steps illustrate how this may be done.
You should now see three columns that represent values for year, month, and day.
Note
When copying and pasting data from Notepad into ExcelÂŽ, it is useful to format the destination column to be âtextâ before you pasteâthe text format will not alter a number or delete zeros that precede a number. Also, make sure the cells to the right of the column you are dividing are empty.
Using the AutoFilter
In this exercise you will be utilizing the AutoFilter option to locate various cells in an ExcelÂŽ spreadsheet and modify them.
- Open the ExcelÂŽ file âfilter.xlsâ.
- Select column âCâ by clicking on the âCâ at the top of the column.
- Click on the âDataâ menu and select âFilterâ, then select âAuto-Filterâ.
- You will see a small box with a black arrow inside (the AutoFilter box) appear in the first cell of the column. Click on the AutoFilter box.
- Scroll to the bottom of the AutoFilter dropdown menu and select â(Blanks)â to display the blanks cells in column âCâ.
- Enter the number â0â in the first blank cell of Column âCâ.
- Repeat step 6 for each cell in column âCâ that has a row number written in blue (you can use the AutoFill capabilities of ExcelÂŽ if you wish).
- Click on the AutoFilter box again and scroll to the top of the menu, then select â(All)â to show all rows.
- Click on the AutoFilter box in the first cell of column âCâ.
- In the AutoFilter dropdown menu select â(CustomâŚ)â to modify which cells you would like to display.
- Click the top-left drop down box and select âis greater than or equal toâ for the AutoFilter to display all rows that are greater than or equal to the value you specify.
- In the next box over (to the right) type â0.1â (without quotation marks.)
- Select âOKâ.
The dropdown menu that appears under the AutoFilter box shows the unique values of all the cells below the AutoFilter box. By selecting one of the values you are determining which rows will be displayed, and which rows will be hidden.
All rows that do not have blank values in column âCâ have been hidden. The row numbers for the remaining rows have been changed to blue in-stead of black.
Now there are no blank cells in column âCâ.
The AutoFilter can be used in a variety of ways, and the following exercise will walk you through additional uses. Letâs say we are only interested in looking at the precipitation values that are larger than 0.1. The following example shows how we can customize the display options of the Auto-Filter.
Now you can view all the cells in column âCâ that have values of 0.1 or lar-ger. If you want to delete the cells smaller than 0.1 you would have to change the custom filter to display the cells less than 0.1, then you could select the displayed rows and delete them.
Find And Replace
The find and replace command can be very useful when formatting data. This tool can be used to delete, replace, or modify cell values. The following exercise will show you how to use the replace command, as well as how it can be applied to formatting data.
- Open the ExcelÂŽ file âreplace.xlsâ.
- Select column âCâ by clicking on the âCâ at the top of the column.
- Select the âEditâ menu, and then click âReplaceâŚâ
- In the text box below âFind what:â type âzâ (without quotation marks.)
- Leave the text box below âReplace with:â empty, which means that the âzâ in each cell will be replaced with nothing.
- Select âReplace Allâ to replace all the zâs in column âCâ with noth-ing.
In column âCâ you will notice that the values are hours of the day, followed by a âzâ which stands for âZuluâ or Greenwich time. If we want to use these numbers in GSSHA⢠we will have to remove the âzâ from each cell. To do this we could split the column, however, using the replace command works equally as well.
Instead of replacing the zâs with nothing, you could have replaced it with a letter or a number. If you wish, try repeating the exercise, and at step 5 enter in a number or word or whatever you would like. The replace com-mand can be used to replace words, letters, or numbers, in rows or in col-umns.
General Information
The following commands can be useful when formatting data in ExcelÂŽ
- Saving an ExcelÂŽ file as a text file
- Make your active sheet the one you would like to save as a text file.
- Select the âFileâ menu, and pick âSave AsâŚâ
- Enter a new name for the file in the box next to âFile nameâ.
- Select the drop down box for the âSave as typeâ and pick: âText (Tab delimited) (*.txt)â.
- Then click âSaveâ.
- Click âOKâ at the prompt.
- Select âYesâ at the next prompt.
- The text file will be saved in whatever folder you specified.
- Moving Columns
- To move an entire column, click on the letter at the top of the column.
- The entire column will be selected, with two heavier black lines on either side of the column.
- Put the pointer over one of these heavier dark lines, then when the cursor changes to an arrow, click on the black line.
- While holding down on the left mouse button, drag the column to the destination of your choice.
GSSHA Tutorials
GSSHA Tutorial Download Website