Formatting Your Spreadsheets

Problem

You've got data and some calculations, but the spreadsheet looks unpresentable.

Solution

Format your spreadsheet to make it more presentable and better organized.

Discussion

In Recipe 1.3, I discussed how to format cells to specify the type of data (e.g., text, numbers, currency, etc.). In this recipe, I'll show you a few other formatting techniques. Take a look at the spreadsheet in Figure 1-16.

This simple spreadsheet merely calculates values for a function of the form y = xn, where n is the exponent shown on the spreadsheet. It also calculates the cumulative area under the curve from 0 to x. The results are plotted on a chart adjacent to the calculation table. Chapter 4 covers charting in detail, so I won't discuss the chart here. Instead I want to focus on the calculation table.

I could have simply filled in a column of x values, entered formulas for the y and area values, and left it at that. However, that would look messy. More than likely you'll want to include your calculations in reports or share them with others, so making your spreadsheets presentable is a good idea. Formatting also serves as a form of documentation so that you can come back to a spreadsheet weeks or years later and quickly see what you did. There's (almost) nothing worse than opening an old spreadsheet and seeing just a grid of scattered numbers.

Figure 1-16. Formatted spreadsheet

There are many ways to format your spreadsheet. In this example, I added a text label, in italics, in the cell C2 to indicate the purpose of the value in cell D2. I also added some borders around the table of calculations and delineated the column headings with a filled background and bold text. I also centered the column labels above the data instead of using the default left justification for text. If you're a keen observer, you may have noticed that I also changed the column width of several columnsI reduced the width of columns A and B so they wouldn't take up too much space and I increased the width of column E to accommodate the area column label. These are some of the most common formatting tasks I make on virtually every spreadsheet I write. They are simple and effective.

You can access Excel's formatting functions via the Format menu . There you'll find options for formatting cells, whole rows or columns, and even the entire spreadsheet. I personally use the cell formatting options the most. You've already seen how to access the Format Cells dialog box in Recipe 1.3, and as shown in Figure 1-6. You can use the main menu bar or the shortcut key combination, Ctrl-1, to open the Format Cells dialog box.

The Number tab displays the data type formatting options discussed earlier. The other tabs give you control of other cell aspects:

 

Alignment

Set the position, orientation, and justification of text within a cell. You can also specify whether long text should wrap around, creating multiple lines of text in a single cell.

 

Font

Specify the font type, style, and size of text to appear in a cell. For example, you could specify Arial font type with a bold style and a size of 10 points.

 

Border

Add borders to any edge of a cell. You can select from a variety of line styles, including solid, dashed, and dotted, among others, and even set the line thickness.

 

Patterns

Set the background color or pattern for a cell.

 

Protection

Specify whether a cell is protected (meaning it can't be changed without a password) and whether a cell is hidden.

While the Format Cells dialog box presents you with many cell formatting options, I prefer to use the toolbars for quick formatting tasks. If you look closely at Figure 1-16, you'll see the formatting toolbar visible just above the formula bar. This toolbar contains buttons to change a cell's font, justification, data type, number of decimal places, indention, borders, fill patterns, text color, and more. You can customize this toolbar as discussed in Recipe 1.1.

There may be times when you want to clear all the formats applied to a cell. To do so, select the cell whose formats you want to clear and then select Edit images/U2192.jpg border=0> Clear images/U2192.jpg border=0> Formats from the main menu bar.

See Also

The formatting options discussed here are common and useful. There are other formatting options that may come in handy from time to time, although you probably will not use them too often. These options include the row, column, and spreadsheet formatting options mentioned earlier, as well as others such as conditional formatting, which allows you to set formatting for a cell contingent on the value of the cell relative to some criterion you specify. We'll make use of these other formatting options throughout the remainder of the book. For the time being, you can read more about formatting options in Excel's built-in help system. To do so, open Excel Help by pressing Ctrl-F1 and click the "Table of Contents" link. Look for the "Working with Data" topic and click on it to reveal a list of subtopics. Look for the "Formatting Data" subtopic and click it to see a list of specific formatting-related topics.

Using Excel

Getting Acquainted with Visual Basic for Applications

Collecting and Cleaning Up Data

Charting

Statistical Analysis

Time Series Analysis

Mathematical Functions

Curve Fitting and Regression

Solving Equations

Numerical Integration and Differentiation

Solving Ordinary Differential Equations

Solving Partial Differential Equations

Performing Optimization Analyses in Excel

Introduction to Financial Calculations

Index



Excel Scientific and Engineering Cookbook
Excel Scientific and Engineering Cookbook (Cookbooks (OReilly))
ISBN: 0596008791
EAN: 2147483647
Year: N/A
Pages: 206
Authors: David M Bourg

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net