- •About the Author
- •About the Technical Editor
- •Credits
- •Is This Book for You?
- •Software Versions
- •Conventions This Book Uses
- •What the Icons Mean
- •How This Book Is Organized
- •How to Use This Book
- •What’s on the Companion CD
- •What Is Excel Good For?
- •What’s New in Excel 2010?
- •Moving around a Worksheet
- •Introducing the Ribbon
- •Using Shortcut Menus
- •Customizing Your Quick Access Toolbar
- •Working with Dialog Boxes
- •Using the Task Pane
- •Creating Your First Excel Worksheet
- •Entering Text and Values into Your Worksheets
- •Entering Dates and Times into Your Worksheets
- •Modifying Cell Contents
- •Applying Number Formatting
- •Controlling the Worksheet View
- •Working with Rows and Columns
- •Understanding Cells and Ranges
- •Copying or Moving Ranges
- •Using Names to Work with Ranges
- •Adding Comments to Cells
- •What Is a Table?
- •Creating a Table
- •Changing the Look of a Table
- •Working with Tables
- •Getting to Know the Formatting Tools
- •Changing Text Alignment
- •Using Colors and Shading
- •Adding Borders and Lines
- •Adding a Background Image to a Worksheet
- •Using Named Styles for Easier Formatting
- •Understanding Document Themes
- •Creating a New Workbook
- •Opening an Existing Workbook
- •Saving a Workbook
- •Using AutoRecover
- •Specifying a Password
- •Organizing Your Files
- •Other Workbook Info Options
- •Closing Workbooks
- •Safeguarding Your Work
- •Excel File Compatibility
- •Exploring Excel Templates
- •Understanding Custom Excel Templates
- •Printing with One Click
- •Changing Your Page View
- •Adjusting Common Page Setup Settings
- •Adding a Header or Footer to Your Reports
- •Copying Page Setup Settings across Sheets
- •Preventing Certain Cells from Being Printed
- •Preventing Objects from Being Printed
- •Creating Custom Views of Your Worksheet
- •Understanding Formula Basics
- •Entering Formulas into Your Worksheets
- •Editing Formulas
- •Using Cell References in Formulas
- •Using Formulas in Tables
- •Correcting Common Formula Errors
- •Using Advanced Naming Techniques
- •Tips for Working with Formulas
- •A Few Words about Text
- •Text Functions
- •Advanced Text Formulas
- •Date-Related Worksheet Functions
- •Time-Related Functions
- •Basic Counting Formulas
- •Advanced Counting Formulas
- •Summing Formulas
- •Conditional Sums Using a Single Criterion
- •Conditional Sums Using Multiple Criteria
- •Introducing Lookup Formulas
- •Functions Relevant to Lookups
- •Basic Lookup Formulas
- •Specialized Lookup Formulas
- •The Time Value of Money
- •Loan Calculations
- •Investment Calculations
- •Depreciation Calculations
- •Understanding Array Formulas
- •Understanding the Dimensions of an Array
- •Naming Array Constants
- •Working with Array Formulas
- •Using Multicell Array Formulas
- •Using Single-Cell Array Formulas
- •Working with Multicell Array Formulas
- •What Is a Chart?
- •Understanding How Excel Handles Charts
- •Creating a Chart
- •Working with Charts
- •Understanding Chart Types
- •Learning More
- •Selecting Chart Elements
- •User Interface Choices for Modifying Chart Elements
- •Modifying the Chart Area
- •Modifying the Plot Area
- •Working with Chart Titles
- •Working with a Legend
- •Working with Gridlines
- •Modifying the Axes
- •Working with Data Series
- •Creating Chart Templates
- •Learning Some Chart-Making Tricks
- •About Conditional Formatting
- •Specifying Conditional Formatting
- •Conditional Formats That Use Graphics
- •Creating Formula-Based Rules
- •Working with Conditional Formats
- •Sparkline Types
- •Creating Sparklines
- •Customizing Sparklines
- •Specifying a Date Axis
- •Auto-Updating Sparklines
- •Displaying a Sparkline for a Dynamic Range
- •Using Shapes
- •Using SmartArt
- •Using WordArt
- •Working with Other Graphic Types
- •Using the Equation Editor
- •Customizing the Ribbon
- •About Number Formatting
- •Creating a Custom Number Format
- •Custom Number Format Examples
- •About Data Validation
- •Specifying Validation Criteria
- •Types of Validation Criteria You Can Apply
- •Creating a Drop-Down List
- •Using Formulas for Data Validation Rules
- •Understanding Cell References
- •Data Validation Formula Examples
- •Introducing Worksheet Outlines
- •Creating an Outline
- •Working with Outlines
- •Linking Workbooks
- •Creating External Reference Formulas
- •Working with External Reference Formulas
- •Consolidating Worksheets
- •Understanding the Different Web Formats
- •Opening an HTML File
- •Working with Hyperlinks
- •Using Web Queries
- •Other Internet-Related Features
- •Copying and Pasting
- •Copying from Excel to Word
- •Embedding Objects in a Worksheet
- •Using Excel on a Network
- •Understanding File Reservations
- •Sharing Workbooks
- •Tracking Workbook Changes
- •Types of Protection
- •Protecting a Worksheet
- •Protecting a Workbook
- •VB Project Protection
- •Related Topics
- •Using Excel Auditing Tools
- •Searching and Replacing
- •Spell Checking Your Worksheets
- •Using AutoCorrect
- •Understanding External Database Files
- •Importing Access Tables
- •Retrieving Data with Query: An Example
- •Working with Data Returned by Query
- •Using Query without the Wizard
- •Learning More about Query
- •About Pivot Tables
- •Creating a Pivot Table
- •More Pivot Table Examples
- •Learning More
- •Working with Non-Numeric Data
- •Grouping Pivot Table Items
- •Creating a Frequency Distribution
- •Filtering Pivot Tables with Slicers
- •Referencing Cells within a Pivot Table
- •Creating Pivot Charts
- •Another Pivot Table Example
- •Producing a Report with a Pivot Table
- •A What-If Example
- •Types of What-If Analyses
- •Manual What-If Analysis
- •Creating Data Tables
- •Using Scenario Manager
- •What-If Analysis, in Reverse
- •Single-Cell Goal Seeking
- •Introducing Solver
- •Solver Examples
- •Installing the Analysis ToolPak Add-in
- •Using the Analysis Tools
- •Introducing the Analysis ToolPak Tools
- •Introducing VBA Macros
- •Displaying the Developer Tab
- •About Macro Security
- •Saving Workbooks That Contain Macros
- •Two Types of VBA Macros
- •Creating VBA Macros
- •Learning More
- •Overview of VBA Functions
- •An Introductory Example
- •About Function Procedures
- •Executing Function Procedures
- •Function Procedure Arguments
- •Debugging Custom Functions
- •Inserting Custom Functions
- •Learning More
- •Why Create UserForms?
- •UserForm Alternatives
- •Creating UserForms: An Overview
- •A UserForm Example
- •Another UserForm Example
- •More on Creating UserForms
- •Learning More
- •Why Use Controls on a Worksheet?
- •Using Controls
- •Reviewing the Available ActiveX Controls
- •Understanding Events
- •Entering Event-Handler VBA Code
- •Using Workbook-Level Events
- •Working with Worksheet Events
- •Using Non-Object Events
- •Working with Ranges
- •Working with Workbooks
- •Working with Charts
- •VBA Speed Tips
- •What Is an Add-In?
- •Working with Add-Ins
- •Why Create Add-Ins?
- •Creating Add-Ins
- •An Add-In Example
- •System Requirements
- •Using the CD
- •What’s on the CD
- •Troubleshooting
- •The Excel Help System
- •Microsoft Technical Support
- •Internet Newsgroups
- •Internet Web sites
- •End-User License Agreement
Chapter 9: Printing Your Work
Printing row and column headers
By default, row and column headers for a worksheet are not printed. If you want your printout to include these items, choose Page Layout Sheet Options Headings Print.
Using a background image
Would you like to have a background image on your printouts? Unfortunately, you can’t. You may have noticed the Page Layout Page Setup Background command. This button displays a dialog box that lets you select an image to display as a background. Placing this control among the other print-related commands is very misleading. Background images placed on a worksheet are never printed.
Tip
In lieu of a true background image, you can insert a Shape, WordArt, or a picture on your worksheet and then adjust its transparency. Then copy the image to all printed pages. Alternatively, you can insert an object in a page header or footer. See the sidebar titled, “Inserting a Watermark.” n
Adding a Header or Footer to Your Reports
A header is information that appears at the top of each printed page. A footer is information that appears at the bottom of each printed page. By default, new workbooks do not have headers or footers.
You can specify headers and footers by using the Header/Footer tab of the Page Setup dialog box. This task is much easier if you switch to Page Layout view, though, where you can click the section labeled Click to Add Header or Click to Add Footer.
Note
If you’re working in Normal view, you can choose Insert Text Header & Footer. Excel switches to Page Layout view and activates the center section of the page header. n
You can then type the information and apply any type of formatting you like. Note that headers and footers consist of three sections: left, center, and right. For example, you can create a header that prints your name at the left margin, the worksheet name centered in the header, and the page number at the right margin.
Tip
If you would like a consistent header or footer for all your documents, create a book.xlt with your headers or footers specified. A book.xlt template is used as the basis for new workbooks. See Chapter 8 for details. n
185
Part I: Getting Started with Excel
When you activate the header or footer section in Page Layout view, the Ribbon displays a new contextual tab: Header & Footer Tools Design. Use the controls on this tab to work with headers and footers.
Selecting a predefined header or footer
You can choose from a number of predefined headers or footers by using either of the two dropdown lists in the Header & Footer Tools Design Header & Footer group. Notice that some items in these lists consist of multiple parts, separated by a comma. Each part goes into one of the three header or footer sections (left, center, or right). Figure 9.6 shows an example of a header that uses all three sections.
FIGURE 9.6
This three-part header is one of Excel’s predefined headers.
Understanding header and footer element codes
When a header or footer section is activated, you can type whatever text you like into the section. Or, to insert variable information, you can insert any of several element codes by clicking a button in the Header & Footer Tools Design Header & Footer Elements group. Each button inserts a code into the selected section. For example, to insert the current date, click the Current Date button. Table 9.2 lists the buttons and their functions.
TABLE 9.2
Header & Footer Buttons and Their Functions
Button |
Code |
Function |
|
|
|
Page Number |
&Page] |
Displays the page number |
|
|
|
Number of Pages |
&[Pages] |
Displays the total number of pages to be printed |
|
|
|
Current Date |
&[Date] |
Displays the current date |
|
|
|
Current Time |
&[Time] |
Displays the current time |
|
|
|
186
|
|
Chapter 9: Printing Your Work |
|
|
|
|
|
|
Button |
Code |
Function |
|
|
|
File Path |
&[Path]&[File] |
Displays the workbook’s complete path and filename |
|
|
|
File Name |
&[File] |
Displays the workbook name |
|
|
|
Sheet Name |
&[Tab] |
Displays the sheet’s name |
|
|
|
Picture |
Not applicable |
Enables you to add a picture |
|
|
|
Format Picture |
Not applicable |
Enables you to change an added picture’s settings |
|
|
|
You can combine text and codes and insert as many codes as you like into each section.
Note
If the text that you enter uses an ampersand (&), you must enter the ampersand twice (because Excel uses an ampersand to signal a code). For example, to enter the text Research & Development into a section of a header or footer, enter Research && Development. n
You can also use different fonts and sizes in your headers and footers. Just select the text that you want to change and then use the formatting tools in the Home Font group. Or use the controls on the Mini toolbar, which appears automatically when you select the text. If you don’t change the font, Excel uses the font defined for the Normal style.
Tip
You can use as many lines as you like. Press Enter to force a line break for multiline headers or footers. If you use multiline headers or footers, you may need to adjust the top or bottom margin so the text won’t overlap with the worksheet data. See “Adjusting the page margins,” earlier in this chapter. n
Unfortunately, you can’t print the contents of a specific cell in a header or footer. For example, you may want Excel to use the contents of cell A1 as part of a header. To do so, you need to enter the cell’s contents manually — or write a VBA macro to perform this operation before the sheet is printed.
Other header and footer options
When a header or footer is selected in Page Layout view, the Header & Footer Design Options group contains controls that let you specify other options:
•Different First Page: If checked, you can specify a different header/footer for the first printed page.
•Different Odd & Even Pages: If checked, you can specify a different header/footer for odd and even pages.
•Scale with Document: If checked, the font size in the header and footer will be sized accordingly if the document is scaled when printed. This option is enabled, by default.
•Align with Page Margins: If checked, the left header and footer will be aligned with the left margin, and the right header and footer will be aligned with the right margin. This option is enabled, by default.
187
Part I: Getting Started with Excel
Copying Page Setup Settings across Sheets
Each Excel worksheet has its own print setup options (orientation, margins, headers and footers, and so on). These options are specified in the Page Setup group of the Page Layout tab.
When you add a new sheet to a workbook, it contains the default page setup settings. Here’s an easy way to transfer the settings from one worksheet to additional worksheets:
1.Activate the sheet that contains the desired setup information. This is the source sheet.
2.Select the target sheets. Ctrl-click the sheet tabs of the sheets you want to update with the settings from the source sheet.
3.Click the dialog box launcher in the lower-right corner of the Page Layout Page
Setup group.
4.When the Page Setup dialog box appears, click OK to close it.
5.Ungroup the sheets by right-clicking any selected sheet and choosing Ungroup Sheets from the shortcut menu. Because multiple sheets are selected when you close the Page Setup dialog box, the settings of the source sheet will be transferred to all target sheets.
Note
Two settings located on the Sheet tab of the Page Setup dialog box are not transferred: Print Area and Print Titles. In addition, pictures in the header or footer are not transferred. n
Preventing Certain Cells from Being Printed
If your worksheet contains confidential information, you may want to print the worksheet but not the confidential parts. You can use several techniques to prevent certain parts of a worksheet from printing:
•Hide rows or columns. When you hide rows or columns, the hidden rows or columns aren’t printed. Use the Home Cells Format drop-down list to hide the selected rows or columns.
•Hide cells or ranges.
•You can hide cells or ranges by making the text color the same color as the background color. Be aware, however, that this method may not work for all printers.
•You can hide cells by using a custom number format that consists of three semicolons (;;;). See Chapter 24 for more information about using custom number formats.
•Mask an area. You can mask a confidential area of a worksheet by covering it with a rectangle Shape. Choose Insert Illustrations Shapes and click the Rectangle Shape. You’ll probably want to adjust the fill color to match the cell background and remove the border.
188