- •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 26: Creating and Using Worksheet Outlines
Note
If you select a range of cells (rather than entire rows or columns) before you create a group, Excel displays a dialog box asking what you want to group. It then groups entire rows or columns based on the range that you select. n
You can also select groups of groups to create multilevel outlines. When you create multilevel outlines, always start with the innermost groupings and then work your way out. If you realize that you grouped the wrong rows, you can ungroup the group by selecting the rows and choosing Data Outline Ungroup Ungroup.
Here are keyboard shortcuts you can use that speed up grouping and ungrouping:
•Alt+Shift+right arrow: Groups selected rows or columns
•Alt+Shift+left arrow: Ungroups selected rows or columns
Creating outlines manually can be confusing at first, but if you stick with it, you’ll become a pro in no time.
Working with Outlines
This section discusses the basic operations that you can perform with a worksheet outline.
Displaying levels
To display various outline levels, click the appropriate outline symbol. These symbols consist of buttons with numbers on them (1, 2, and so on) or a plus sign (+) or a minus sign (–). Refer to Figure 26.5, which shows these symbols for a row and column outline.
Clicking the 1 button collapses the outline so that it displays no detail (just the highest summary level of information), clicking the 2 button expands the outline to show one level, and so on. The number of numbered buttons depends on the number of outline levels. Choosing a level number displays the detail for that level, plus any lower levels. To display all levels (the most detail), click the highest-level number.
You can expand a particular section by clicking its + button, or you can collapse a particular section by clicking its – button. In short, you have complete control over the details that Excel exposes or hides in an outline.
If you prefer, you can use the Hide Detail and Show Detail commands on the Data Outline group to hide and show details, respectively.
Tip
If you constantly adjust the outline to show different reports, consider using the Custom Views feature to save a particular view and give it a name. Then you can quickly switch among the named views. Choose View Workbook Views Custom Views. n
587
Part IV: Using Advanced Excel Features
Adding data to an outline
You may need to add additional rows or columns to an outline. In some cases, you may be able to insert new rows or columns without disturbing the outline, and the new rows or columns become part of the outline. In other cases, you’ll find that the new row or column is not part of the outline. If you create the outline automatically, choose Data Outline Group Auto Outline. Excel makes you verify that you want to modify the existing outline. If you create the outline manually, you need to make the adjustments manually, as well.
Removing an outline
After you no longer need an outline, you can remove it by choosing Data Outline Ungroup Clear Outline. Excel fully expands the outline by displaying all hidden rows and columns, and the outline symbols disappear. Be careful before you remove an outline, however. You can’t make it reappear by using the Undo button. You must re-create the outline from scratch.
Hiding the outline symbols
The outline symbols Excel displays when an outline is present take up quite a bit of space. (The exact amount depends on the number levels.) If you want to see as much as possible onscreen, you can temporarily hide these symbols without removing the outline. Use Ctrl+8 to toggle the outline symbols on and off. When the outline symbols are hidden, you cannot expand or collapse the outline.
Note
When you hide the outline symbols, the outline still is in effect, and the worksheet displays the data at the current outline level. That is, some rows or columns may be hidden. n
The Custom Views feature, which saves named views of your outline, also saves the status of the outline symbols as part of the view, enabling you to name some views with the outline symbols and other views without them.
588
CHAPTER
Linking and
Consolidating
Worksheets
In this chapter, I discuss two procedures that you might find helpful: linking and consolidation. Linking is the process of using references to cells in external workbooks to get data into your worksheet. Consolidation
combines or summarizes information from two or more worksheets (which can be in multiple workbooks).
Linking Workbooks
As you may know, Excel allows you to create formulas that contain references to other workbook files. In such a case, the workbooks are linked in such a way that one depends upon the other. The workbook that contains the external reference formulas is the dependent workbook (because it contains formulas that depend upon another workbook). The workbook that contains the information used in the external reference formula is the source workbook (because it’s the source of the information).
When you consider linking workbooks, you may ask yourself the following question: If Workbook A needs to access data in another workbook (Workbook B), why not just enter the data into Workbook A in the first place? In some cases, you can. But the real value of linking becomes apparent when the source workbook is being continually updated by another person or group. Creating a link in Workbook A to Workbook B means that in Workbook A, you always have access to the most recent information in Workbook B because Workbook A is updated whenever Workbook B changes.
Linking workbooks also can be helpful if you need to consolidate different files. For example, each regional sales manager may store data in a separate
IN THIS CHAPTER
Various methods of linking workbooks
Consolidating multiple worksheets
589
Part IV: Using Advanced Excel Features
workbook. You can create a summary workbook that first uses link formulas to retrieve specific data from each manager’s workbook and then calculates totals across all regions.
Linking also is useful as a way to break up a large workbook into smaller files. You can create smaller workbooks that are linked with a few key external references.
Linking has its downside, however. External reference formulas are somewhat fragile, and accidentally severing the links that you create is relatively easy. You can prevent this mistake if you understand how linking works. Later in the chapter, I discuss some problems that may arise as well as how to avoid them. (See “Avoiding Potential Problems with External Reference Formulas.”)
On the CD
The companion CD-ROM contains two linked files that you can use to get a feel for how linking works. The files are named source.xlsx and dependent.xlsx. As long as these files remain in the same folder, the links will be maintained. n
Creating External Reference Formulas
You can create an external reference formula by using several different techniques:
•Type the cell references manually. These references may be lengthy because they include workbook and sheet names (and, possibly, even drive and path information). The advantage of manually typing the cell references is that the source workbook doesn’t have to be open. The disadvantage is that it’s very error prone. Mistyping a single character makes the formula return an error (or possibly return a wrong value from the file).
•Point to the cell references. If the source workbook is open, you can use the standard pointing techniques to create formulas that use external references.
•Paste the links. Copy your data to the Clipboard. Then, with the source workbook open, choose Home Clipboard Paste Paste Link (N). Excel pastes the copied data as external reference formulas.
•Choose Data Data Tools Consolidate. For more on this method, see the section “Consolidating worksheets by using the Consolidate command,” later in this chapter.
Understanding link formula syntax
The general syntax for an external reference formula is as follows:
=[WorkbookName]SheetName!CellAddress
Precede the cell address with the workbook name (in brackets), followed by the worksheet name and an exclamation point. Here’s an example of a formula that uses cell A1 in the Sheet1 worksheet of a workbook named Budget:
=[Budget.xlsx]Sheet1!A1
590
Chapter 27: Linking and Consolidating Worksheets
If the workbook name or the sheet name in the reference includes one or more spaces, you must enclose the text in single quotation marks. For example, here’s a formula that refers to cell A1 on Sheet1 in a workbook named Annual Budget.xlsx:
=’[Annual Budget.xlsx]Sheet1’!A1
When a formula links to a different workbook, you don’t need to open the other workbook. However, if the workbook is closed and not in the current folder, you must add the complete path to the reference. For example
=’C:\Data\Excel\Budget\[Annual Budget.xlsx]Sheet1’!A1
Creating a link formula by pointing
Entering external reference formulas manually is usually not the best approach because you can easily make an error. Instead, have Excel build the formula for you, as follows:
1.Open the source workbook.
2.Select the cell in the dependent workbook that will hold the formula.
3.Enter the formula. When you get to the part that requires the external reference, activate the source workbook and select the cell or range and press Enter. If you’re simply creating a link to a cell, just enter an equal sign (=) and then select the cell and press Enter.
4.After you press Enter, return to the dependent workbook, where you can finish the formula.
When you point to the cell or range, Excel automatically takes care of the details and creates a syntactically correct external reference. When using this method, the cell reference is always an absolute reference (such as $A$1). If you plan to copy the formula to create additional link formulas, you need to change the absolute reference to a relative reference by removing the dollar signs for the cell address.
As long as the source workbook remains open, the external reference doesn’t include the path to the workbook. If you close the source workbook, however, the external reference formulas change to include the full path.
Pasting links
Pasting links provides another way to create external reference formulas. This method is applicable when you want to create formulas that simply reference other cells. Follow these steps:
1.Open the source workbook.
2.Select the cell or range that you want to link and then copy it to the Clipboard.
3.Activate the dependent workbook and select the cell in which you want the link formula to appear. If you’re pasting a copied range, just select the upper-left cell.
4.Choose Home Clipboard Paste Paste Link (N).
591