You've learned how to enter text from the previous recipe, but now you want to enter data other than text (e.g., numbers, dates, and currency).
Enter the data just as you would text and let Excel automatically figure out its type, or use the Format images/U2192.jpg border=0> Cells... menu to open a dialog box allowing you to manually format the data type for a cell.
In the previous recipe, I had you simply enter text in cells. Whether you entered a word or a number, Excel automatically figured out what type of data you entered. In general, input starting with letters is automatically interpreted as text, and input starting with numbers is automatically interpreted as numeric. There are some special cases worth noting here. Preceding any string of charactersnumbers or letterswith the ' symbol forces Excel to interpret the data as text. Preceding a string of numbers with the $ symbol forces Excel to interpret the data as currency. Using E (or e) while entering a number in scientific notation forces Excel to interpret the string as a number in scientific notation. Entering numbers with dashes between them will cause Excel to interpret the number as a date. I encourage you to try entering various types of data like those I describe here to see how Excel handles the data. In some cases you'll notice that Excel will reformat your data a little. For example, if you type 1.2345e3 in a cell, it will appear as 1.23E+3 in the cell and 1234.56 in the formula bar (when the cell is selected).
In general, Excel is pretty smart about interpreting the data type you intend; however, sometimes it does need a little help. Also, sometimes you may want to change the format of the data to give it an appearance other than the default appearance assigned to it by Excel. In these cases you can manually specify the type and format of data contained in cells by accessing the Format Cells dialog box . You can do so by selecting Format images/U2192.jpg border=0> Cells... from the menu or by using the shortcut key combination, Ctrl-1.
Figure 1-5 shows the Format Cells dialog box. Notice here I had a cell selected that contained the entry 1.2345e3, which appears in the Sample area of the dialog box. This allows you to preview the results while making format changes.
I find that one of the most common uses of formatting tasks is specifying the number of decimal places to show for numbers. You can specify the number of decimal places to show by entering a value in the "Decimal places" field. Changing this setting is a format change only; it does not change the data itself. For example, if you enter 123.45678 in a cell and set the number of decimal places to 3, the cell will show 123.457 but the actual number is still stored as 123.45678, as can be seen in the formula bar when the cell is selected.
You can also select one of the categories shown in the Format Cells dialog box to set the type of data. If you click each category in the list, a short description and other formatting options will appear in the Format Cells dialog box. For example, if you select the Number category, the Format Cells dialog box will appear (see Figure 1-6).
The new formatting options appear on the right side of the dialog box, just under the "Decimal places" setting.
Format changes affect the currently selected cell and remain in effect until you change the format. If you set a cell to display Currency and then enter a new value in that cell, it will also be interpreted as currency.
Figure 1-5. Format cells dialog box
Figure 1-6. Format Cells with the Number category selected
You need not always use the Format Cells dialog box to change cell formatting. Some of these formatting operations have been assigned to toolbar buttons for convenience. Take a look at Figure 1-7 and notice the toolbar buttons that I highlighted. These specific buttons allow you to change some cell format properties with the click of a button.
Figure 1-7. Cell format toolbar
The $ button changes the cell format to currency while the % button changes the cell format to percentage; e.g., if you enter 0.38, it will show up as 38%. The two other highlighted buttons respectively increase and decrease the number of decimal places to show.
I should also point out that formatting changes take effect for all of the cells currently selected. So far, I've only discussed selecting a single cell; however, there are times when you may want to make changes to multiple cells all at one time. The next recipe explains how to select more than one cell at a time.
I find the Number, Percentage, and Scientific format categories more than adequate for most scientific and engineering computing tasks; however, there may be occasions when you want to set your own specific data format for a unique application. In this case, you can actually specify your own format template in the Format Cells dialog box by setting up format codes using the Custom format category. I won't go into the details here since it's fairly well documented in Excel's online help. To learn more, open the Excel Help task pane and do a search using the key phrase "Custom Formatting." In your search results, look for the topics entitled "Create or delete a custom number format" and "Number format code."
Getting Acquainted with Visual Basic for Applications
Collecting and Cleaning Up Data
Time Series Analysis
Curve Fitting and Regression
Numerical Integration and Differentiation
Solving Ordinary Differential Equations
Solving Partial Differential Equations
Performing Optimization Analyses in Excel
Introduction to Financial Calculations