Excel Timesaving Techniques for Dummies

  • Published on

  • View

  • Download


  • ExcelTimesavingTechniques



    00a_574272_ffirs.qxd 10/1/04 10:21 PM Page i

  • 00a_574272_ffirs.qxd 10/1/04 10:21 PM Page ii

  • by Greg Harvey




    00a_574272_ffirs.qxd 10/1/04 10:21 PM Page iii

  • Excel Timesaving Techniques For Dummies

    Published byWiley Publishing, Inc.909 Third AvenueNew York, NY 10022www.wiley.com

    Copyright 2005 by Wiley Publishing, Inc., Indianapolis, Indiana

    Published by Wiley Publishing, Inc., Indianapolis, Indiana

    Published simultaneously in Canada

    No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by anymeans, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted underSections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of thePublisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center,222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 750-4744. Requests to the Publisher for per-mission should be addressed to the Legal Department, Wiley Publishing, Inc., 10475 Crosspoint Blvd.,Indianapolis, IN 46256, (317) 572-3447, fax (317) 572-4355, e-mail: brandreview@wiley.com.

    Trademarks: Wiley, the Wiley Publishing logo, For Dummies, the Dummies Man logo, A Reference for the Rest ofUs!, The Dummies Way, Dummies Daily, The Fun and Easy Way, Dummies.com, Timesaving Techniques andrelated trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates, inthe United States and other countries, and may not be used without written permission. All other trademarksare the property of their respective owners. Wiley Publishing, Inc., is not associated with any product or vendormentioned in this book.


    For general information on our other products and services or to obtain technical support, please contact ourCustomer Care Department within the U.S. at 800-762-2974, outside the U.S. at 317-572-3993, or fax 317-572-4002.

    Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not beavailable in electronic books.

    Library of Congress Control Number: 2004112340

    ISBN: 0-7645-7427-2

    Manufactured in the United States of America

    10 9 8 7 6 5 4 3 2 1


    00a_574272_ffirs.qxd 10/1/04 10:21 PM Page iv

  • About the AuthorGreg Harvey has authored tons of computer books, the most recent being AdobeAcrobat 6 PDF For Dummies and Roxio Easy Media Creator For Dummies. He startedout training business users on how to use IBM personal computers and their attendantcomputer software in the rough and tumble days of DOS, WordStar, and Lotus 1-2-3 inthe mid-80s of the last century. After working for a number of independent training firms,he went on to teach semester-long courses in spreadsheet and database managementsoftware at Golden Gate University in San Francisco.

    His love of teaching has translated into an equal love of writing. For the last ten years ormore, For Dummies books have been his favorites to write because they enable him toaddress his favorite audience, the beginner. They also enable him to use humor (a keyelement to success in the training room) and, most delightful of all, to express an opin-ion or two about the subject matter at hand.

    DedicationTo all the people connected with the For Dummies phenomenon with whom Ive had to thepleasure to work over the last decade, be they in the editing, management, production,or marketing end of the business, starting with IDG Books and extending to Hungry Mindsand all the way up to Wiley Publishing: Thanks for the great memories and many goodtimes!

    Authors AcknowledgmentsI am always so grateful to the many people who work so hard to bring my book projectsinto being, and this one is no exception. If anything, I am even more thankful for the talentsgiven the special task-oriented nature of the Timesaving Techniques series.

    This time, special thanks are in order to Andy Cummings and Tiffany Franklin for giving methis opportunity to write and write and write about Excel in this new Timesaving Techniquesformat. Next, I want to express great thanks to my project editor, Paul Levesque, for allhis ready help and seasoned answers to my questions on the nature of this series and,to my partner in crime, Christopher Aiken (I really appreciate all your encouragementon this one). Thanks also go to Kim Darosett for the great copy edit, Doug Sahlin for thegreat technical edit, Courtney MacIntyre and Erin Smith for coordinating its production,and everybody at Wiley Publishing and TECHBOOKS Production Services for proofread-ing and indexing.

    00a_574272_ffirs.qxd 10/1/04 10:21 PM Page v

  • ProductionProject Coordinators: Courtney MacIntyre, Erin Smith

    Layout and Graphics: Lauren Goddard,Stephanie D. Jumper, Michael Kruzil, Jacque Roth

    Proofreaders: Jennifer Connolly, Carl Pierce,Dwight Ramsey, Brian H. Walls

    Indexer: Joan Griffitts

    Acquisitions, Editorial, and Media DevelopmentProject Editor: Paul Levesque

    Acquisitions Editor: Tiffany Franklin

    Senior Copy Editor: Kim Darosett

    Technical Editor: Doug Sahlin

    Editorial Manager: Kevin Kirschner

    Media Development Manager: Laura VanWinkle

    Media Development Supervisor: Richard Graves

    Editorial Assistant: Amanda Foxworth

    Cartoons: Rich Tennant (www.the5thwave.com)

    Publishers AcknowledgmentsWere proud of this book; please send us your comments through our onlineregistration form located at www.dummies.com/register/.

    Some of the people who helped bring this book to market include the following:

    Publishing and Editorial for Technology DummiesRichard Swadley, Vice President and Executive Group Publisher

    Andy Cummings, Vice President and Publisher

    Mary Bednarek, Executive Acquisitions Director

    Mary C. Corder, Editorial Director

    Publishing for Consumer DummiesDiane Graves Steele, Vice President and Publisher

    Joyce Pepple, Acquisitions Director

    Composition ServicesGerry Fahey, Vice President of Production Services

    Debbie Stailey, Director of Composition Services

    00a_574272_ffirs.qxd 10/1/04 10:21 PM Page vi

  • Contents at a GlanceIntroduction 1

    Part I: Making Excel Work Your Way 5Technique 1: Customizing the Excel Screen

    Display 7

    Technique 2: Customizing the Excel Menusand Toolbars 13

    Technique 3: Perfecting Your SpreadsheetWorkspace 19

    Technique 4: Saving Your Worksheets SoYou Can Find Them 22

    Technique 5: Tailoring Excels ErrorChecking to Your Needs 27

    Technique 6: Utilizing Excels Editing Settings 31

    Technique 7: Streamlining Excel Program Startup 36

    Technique 8: Saving Time with Excel Add-ins 40

    Part II: Quick Worksheet Creation Tricks 45Technique 9: Navigating the Worksheet

    in a Snap 47

    Technique 10: Making the Most EfficientCell Selections 53

    Technique 11: Speeding Through Long DataEntries with AutoCorrect 58

    Technique 12: Data Entry Tricks 62

    Technique 13: Speeding Up Data Entrywith AutoFill 67

    Technique 14: Ensuring Accurate DataEntries with Data Validation 72

    Technique 15: All Aboard the NumericalEntry Express! 78

    Technique 16: Verifying Entries with Textto Speech 82

    Part III: Handy Ways to Format and Present Worksheet Data 85Technique 17: Instant Range Formatting 87

    Technique 18: Style Formatting Magic 92

    Technique 19: Controlling When Certain Formats Are Used 97

    Technique 20: Customizing Number Formats 102

    Technique 21: Dazzling Alignments for DataEntries 111

    Technique 22: Charting Data in a Snap 117

    Technique 23: Chart Customization Tricks 123

    Part IV: Worksheet Formula Timesavers 129Technique 24: Efficient Formula Copying 131

    Technique 25: Speeding Up Table Creationwith Array Formulas 137

    Technique 26: Using Range Names 141

    Technique 27: Smarter Formula Construction 148

    Technique 28: Trapping Those Terrible Errors 154

    Technique 29: Eliminating Errors with ErrorTracing 158

    Technique 30: Creating Efficient Date andTime Formulas 164

    Part V: Worksheet Editing Timesavers 169Technique 31: Quickly Finding the Workbook

    You Want to Edit 171

    Technique 32: Controlling the WorksheetWindow Display 177

    Technique 33: Managing Worksheet Windows 182

    Technique 34: Quick and Easy Insertion andDeletion 187

    00b_574272_ftoc.qxd 10/1/04 10:24 PM Page vii

  • Part VIII: Internet-Related Timesavers 301Technique 50: Saving Worksheets

    as Web Pages 303

    Technique 51: Importing Web Data into the Worksheet 310

    Technique 52: Using Hyperlinks to Make Jumps in Workbooks 317

    Part IX: The Scary (Or Fun) Stuff 323Technique 53: Instant Lists in Excel 2003 325

    Technique 54: Sharing Excel Workbooks and Lists with a SharePoint Web Site 330

    Technique 55: Entering Data andIssuing Commands by Voice 337

    Technique 56: Sprucing Up YourSpreadsheets with Graphics 342

    Technique 57: Doing Automated Table Lookups 349

    Technique 58: Using Text Formulas for Fun and Profit 355

    Technique 59: Creating Queries to ImportData from an External Database 358

    Technique 60: Automating Repetitive Taskswith Macros 365

    Technique 61: Creating Custom Functions to Use in Your Worksheets 374

    Index 379

    Technique 35: Outline and Subtotal Magic 191

    Technique 36: Consolidating Data fromDifferent Worksheets 195

    Technique 37: Editing with Search & Replaceand Spell Check 199

    Part VI: Tips for Printing, Sharing,and Reviewing Workbooks 205Technique 38: Spreadsheet Security 207

    Technique 39: Printing Tricks for Flawless Reports 219

    Technique 40: Sharing Data with OtherOffice Programs 230

    Technique 41: Sharing Workbooks on a Network 238

    Technique 42: Sending Workbooks Out for Review 247

    Part VII: Streamlining Data Listing and Data Analysis 253Technique 43: Adding and Editing Data Lists

    with the Data Form 255

    Technique 44: Sorting Worksheet Data 261

    Technique 45: Quick and Easy Basic DataList Filtering 267

    Technique 46: More Data List Filteringplus Statistical Analysis 272

    Technique 47: Doing What-if Analysisin a Snap with Data Tables 280

    Technique 48: Easy What-if Analysis throughScenarios and Goal Seeking 284

    Technique 49: Summarizing Data with Pivot Tables and Pivot Charts 291

    00b_574272_ftoc.qxd 10/1/04 10:24 PM Page viii

  • Table of ContentsIntroduction 1

    Saving Time with This Book 1Foolish Assumptions 2Whats In This Book 2

    Part I: Making Excel Work Your Way 2Part II: Quick Worksheet Creation Tricks 2Part III: Handy Ways to Format and Present

    Worksheet Data 2Part IV: Worksheet Formula Timesavers 3Part V: Worksheet Editing Timesavers 3Part VI: Tips for Printing, Sharing, and

    Reviewing Workbooks 3Part VII: Streamlining Data Listing and

    Data Analysis 3Part VIII: Internet-Related Timesavers 3Part IX: The Scary (Or Fun) Stuff 3

    Icons Used in This Book 4Where to Go from Here 4

    Part I: Making Excel Work Your Way 5Technique 1: Customizing the

    Excel Screen Display 7Standard Display Settings 8Switching to Full Screen 8Customizing the Worksheet Display 9

    Setting a new standard column width 9Setting a new standard row height 10Modifying the number of sheets in a workbook 10Customizing the worksheet gridlines 11

    Saving Custom Display Settings 11Creating a template 11Using a template 12

    Technique 2: Customizing the Excel Menusand Toolbars 13Showing the Toolbars and Menus

    in All Their Glory 13Toolbars and Menus Made to Order 14

    A Toolbar and Menu of Your Own 16Adding Macros and Links to Toolbars and Menus 17

    Technique 3: Perfecting Your SpreadsheetWorkspace 19Saving Your Workspace 19Opening a Workspace Whenever Excel Launches 20

    Technique 4: Saving Your Worksheets SoYou Can Find Them 22Modifying the Default File Location 23Saving New Files with Summary Information 24Changing the AutoRecover Settings 25

    Technique 5: Tailoring Excels Error Checking to Your Needs 27Modifying the Error Checking Settings 28Suppressing All Error Indicators 29Hiding Error Values On-Screen and in Print 29

    Technique 6: Utilizing Excels Editing Settings 31Putting the Cell Pointer in the Right Direction 32Completely Turned Off to AutoComplete 32Doing the Drag-and-Drop Thing 33

    Please make room for me 33When drag-and-drop flops 33

    Doing Direct Cell Editing 34

    Technique 7: Streamlining Excel ProgramStartup 36Excel Desktop Shortcut 36Adding Excel to the Quick Launch Toolbar 37Pinning Excel to the Start Menu 38Launching Excel on Windows Startup 39

    Technique 8: Saving Time with Excel Add-ins 40Installing Add-ins 40Using the Built-in Add-ins 41Getting Online Add-ins 42

    00b_574272_ftoc.qxd 10/1/04 10:24 PM Page ix

  • Excel 2003 Timesaving Techniques For Dummiesx

    Information Please! 75Warnings to Make Them Wary 76

    Technique 15: All Aboard the NumericalEntry Express! 78Taking Advantage of the Numeric Keypad 78Putting the Decimal Places at Your Service 79Number Please! 80

    Technique 16: Verifying Entries with Textto Speech 82Can You Hear Me Now? 82

    Speak on Enter 83Reading by columns and rows 83

    Modifying the Text to Speech Settings 84

    Part III: Handy Ways to Format andPresent Worksheet Data 85

    Technique 17: Instant Range Formatting 87Head-to-Toe Table Formatting with AutoFormat 87Getting Artistic with the Format Painter 89Cutting and Pasting Formats Only 90

    Technique 18: Style Formatting Magic 92Styling 93

    Applying predefined styles in a spreadsheet 93Customizing predefined styles 94

    Creating Styles of Your Own 94Merging Styles from One Book into Another 95

    Technique 19: Controlling When Certain Formats Are Used 97Formats to Suit Every Condition 97

    When two conditions are better than one 99Finding cells with conditional formatting 100

    Making Your Outstanding Errors Stand Out 100

    Technique 20: Customizing Number Formats 102Creating Custom Number Formats 102

    Custom formats that conditionally format entries 105

    Custom formats that hide certain entries 106

    Part II: Quick Worksheet Creation Tricks 45

    Technique 9: Navigating the Worksheet in a Snap 47Saving the Cell Pointers Position 47Going Direct 48

    Leaping through data ranges and hoppingover blanks 48

    Going right to the last cell in a sheet 49Zipping through the sheets 50

    A Little Go To Magic 51Zooming Out to Get the Big Picture 52

    Technique 10: Making the Most EfficientCell Selections 53AutoSelect at Your Service 54Go To It and Select It 55Going for the Big Selections 56

    Technique 11: Speeding Through LongData Entries with AutoCorrect 58Setting the Correct AutoCorrect Settings 58Losing the Links 59Taming the Smart Tags 60

    Technique 12: Data Entry Tricks 62Making the Same Entry in Many Places 62Putting the Wraps on the Data Entry 63Lets Do It as a Group! 65

    Technique 13: Speeding Up Data Entrywith AutoFill 67Getting Your Fill of AutoFill 67

    Using AutoFill to generate a sequentially numbered series 69

    Copying an entry instead of filling in a series 69Incrementally Speaking 70Fill Lists Made to Order 71

    Technique 14: Ensuring Accurate DataEntries with Data Validation 72Only the Valid Need Apply 72

    Data entries from a list 73Copying data validation settings 74Finding cells using data validation 75

    00b_574272_ftoc.qxd 10/1/04 10:24 PM Page x

  • Table of Contents xi

    Assigning Custom Number Formats to Stylesand Toolbars 107

    Applying Euro Currency Formats 109

    Technique 21: Dazzling Alignments forData Entries 111Line Me Up 111

    Indenting data entries 112Using nonstandard vertical alignment 113Rotating text entries 113

    Getting Your Text under Control 114Making text wrap within a cell 114Shrinking the text to fit within a cell 115Centering a heading across columns 116

    Technique 22: Charting Data in a Snap 117Instant Charts 117Chart Wizard Magic 119

    Technique 23: Chart Customization Tricks 123Getting the Chart Titles and Headings

    in Balance 123Scaling and Formatting the Chart Axes 125Tricks for Making the Plotted Data Easier

    to Decipher 127

    Part IV: Worksheet Formula Timesavers 129

    Technique 24: Efficient Formula Copying 131Going from Relative to Absolute 131When Its Copy Time 133

    Making one-dimensional copies down or across 134

    Making two-dimensional copies both downand across 135

    Technique 25: Speeding Up Table Creation with Array Formulas 137A Quick Look at Array Ranges 137Hurray for Array Formulas! 138Editing Array Formulas 140

    Technique 26: Using Range Names 141Name That Range! 141

    Creating names from row and column headings 142

    Assigning range names that span different sheets 143

    Assigning Range Names to Constants 144Using Your Range Names in Formulas 144

    Using range names in new formulas 145Assigning range names to existing formulas 145

    Technique 27: Smarter Formula Construction 148Pointing Out Cell References in Formulas 148Putting the Insert Function Feature

    at Your Service 150Using Labels Instead of Cell References

    in Formulas 152

    Technique 28: Trapping Those Terrible Errors 154If I Were a Logical Function 154Trapping Division by Zero Errors 155Trapping All Types of Error Values 156

    Technique 29: Eliminating Errors withError Tracing 158Formula Auditing 101 158Tracing Formula Precedents 160Tracing Formula Dependents 161Finding the Original Error and Fixing Its

    Formula 162

    Technique 30: Creating Efficient Dateand Time Formulas 164The Deal with Dates and Times 164You Do the Date Math! 165When Your Time Is Up 166

    00b_574272_ftoc.qxd 10/1/04 10:24 PM Page xi

  • Excel 2003 Timesaving Techniques For Dummiesxii

    Part V: Worksheet Editing Timesavers 169Technique 31: Quickly Finding the

    Workbook You Want to Edit 171Opening Recently Used Files 171Making the Most of the File Search Task Pane 172

    Doing a basic file search 172Conducting the file search and using the results 173Doing an advanced file search 174

    Searching for Files in the Open Dialog Box 175

    Technique 32: Controlling the WorksheetWindow Display 177Zooming In for the Edits 177Frozen Panes in My Windows 179A Worksheet with a Custom View 180

    Technique 33: Managing Worksheet Windows 182Opening Panes in the Worksheet Window 182Comparing Sheets in the Same Workbook 184Comparing Sheets in Separate Workbooks 185

    Technique 34: Quick and Easy Insertionand Deletion 187Inserting and Deleting Cells in an

    Existing Range 187Inserting and Deleting Rows and Columns 188Inserting and Deleting Worksheets 190

    Technique 35: Outline and Subtotal Magic 191Adding Outline Levels to a Table or List 191Subtotaling a Table or List 193

    Technique 36: Consolidating Data from Different Worksheets 195Consolidating Data by Position 195Consolidating Data by Category 197Linking Consolidated Data 197

    Technique 37: Editing with Search &Replace and Spell Check 199Using Find and Replace 199Eliminating Typing Errors with Spell Check 201

    Customizing the Spell Check settings 202Adding words to a custom dictionary 203

    Part VI: Tips for Printing, Sharing,and Reviewing Workbooks 205

    Technique 38: Spreadsheet Security 207Assigning a Password for Opening a Workbook 207

    Opening a password-protected workbook 209Changing or deleting passwords 210

    Protecting the Worksheet Against Unwanted Changes 211

    Unlocking cells for data entry 211Turning on worksheet protection 212Removing protection from a worksheet 213Enabling cell range editing by certain users 214Protecting the structure of the workbook file 216

    Hiding Sensitive Worksheet Data 217

    Technique 39: Printing Tricks for Flawless Reports 219Making Last-Minute Adjustments with

    Print Preview 219Manipulating the margins and column widths 221Manipulating the page settings 221

    Controlling Bad Page Breaks 222Using the Page Break Preview feature 223Changing the scale of the printing 224

    Adding Headings to Your Report 225Headers and footers made to order 225Print titles on every page 226

    Printing the Formulas in the Report 227Printing the Charts in the Report 228

    Technique 40: Sharing Data withOther Office Programs 230Swapping Data via the Clipboard 230Importing Text Files into Excel 232Embedding Excel Data in Other Office

    Documents 235Embedded worksheet data 235Linking worksheet data 237

    Technique 41: Sharing Workbooks on a Network 238Lets All Learn to Share 238

    Editing changes not available to a shared workbook 239

    Sharing a workbook 239

    00b_574272_ftoc.qxd 10/1/04 10:24 PM Page xii

  • Table of Contents xiii

    Setting your sharing options 240Turning on change tracking 241

    Merging Changes from Different Users 243Conflict resolution worksheet style 243Accepting or rejecting highlighted changes 244Turning off file sharing 245

    Merging Different Copies of a Shared Workbook 245Distributing the copies 245Merging the changes 246

    Technique 42: Sending WorkbooksOut for Review 247Getting a Workbook Ready for Review 247

    Getting your two cents in 248Comments: Now you see them, now you dont 248Editing and formatting comments 248Deleting comments in a worksheet 249

    Sending Out a Workbook for Review 250Replying with changes 250Merging changes into the original workbook 250

    Part VII: Streamlining Data Listingand Data Analysis 253

    Technique 43: Adding and Editing Data Lists with the Data Form 255Creating a New Data List and Data Form 255

    Adding new records with the data form 257Finding records with the data form 258Editing records in the data form 259Removing records from the data list with

    the data form 260

    Technique 44: Sorting Worksheet Data 261Dont Be Out of Sorts 261

    Sorting records in a data list 262Sorting on a record number field to restore

    a list to its original order 264Sorting a list on more than three key fields 264

    Sorting the Field Names in a Data List 265

    Technique 45: Quick and Easy Basic Data List Filtering 267AutoFilter Basics 267

    Making it into the top-ten list 268Saving subsets of a data list as custom views 269

    Customizing the AutoFilter Settings 270

    Technique 46: More Data List Filteringplus Statistical Analysis 272Putting the Advanced Filter in Service 272

    Specifying filtering criteria 274Setting up AND and OR filtering criteria 274Setting up calculated filtering criteria 276

    Getting Data List Statistics 277

    Technique 47: Doing What-if Analysis in a Snap with Data Tables 280Creating a One-Variable Data Table 280Creating a Two-Variable Data Table 282

    Technique 48: Easy What-if Analysisthrough Scenarios and Goal Seeking 284Exploring Different Scenarios 284Reaching a Target with Goal Seeking 288

    Performing goal seeking 288Goal seeking graph style 289

    Technique 49: Summarizing Data with Pivot Tables and Pivot Charts 291Creating Pivot Tables 291

    Pivoting the fields in the table 294Formatting the values in the pivot table 295Selecting new summary functions 296Creating a calculated field for the pivot table 297

    Creating a Pivot Chart 298

    Part VIII: Internet-Related Timesavers 301

    Technique 50: Saving Worksheets as Web Pages 303Saving Worksheets as Web Pages 303

    Opening your new Web page at the time you save it 305

    Saving all the worksheets in a workbook 305Saving just part of a worksheet 306Adding data to an existing Web page 306

    Creating Interactive Web Pages 307

    00b_574272_ftoc.qxd 10/1/04 10:24 PM Page xiii

  • Excel 2003 Timesaving Techniques For Dummiesxiv

    Technique 51: Importing Web Data into the Worksheet 310Capturing Information for the Spreadsheet

    with Web Queries 310Importing XML Data into a Worksheet 313

    Technique 52: Using Hyperlinks to Make Jumps in Workbooks 317Adding Hyperlinks to a Worksheet 317Following Links in a Worksheet 320Editing Links in a Worksheet 321Creating Hyperlinks for Custom Menus

    and Toolbars 321

    Part IX: The Scary (Or Fun) Stuff 323Technique 53: Instant Lists in Excel 2003 325

    Creating an Excel 2003 List 325Converting an existing list into an Excel list 326Creating an Excel list from scratch 327

    Sorting and Filtering the List 327Toggling the Lists Total Row On and Off 328Easy List Editing 328

    Inserting or deleting rows and columns 329Converting a list back into a regular cell range 329Deleting a list 329

    Technique 54: Sharing Excel Workbooksand Lists with a SharePoint Web Site 330Adding Excel Spreadsheets to

    the SharePoint Site 330Opening the spreadsheets on

    the SharePoint site 332Adding a list of your spreadsheets to

    SharePoint site home page 333Publishing Lists to the SharePoint Site 334

    Publishing an Excel list on a SharePoint site 334Synchronizing list data 336

    Technique 55: Entering Data and IssuingCommands by Voice 337Hands-Free Data Entry 337Just Tell Me What to Do 339

    Choosing menu items, dialog box options, and toolbar buttons 340

    Telling the cell pointer where to go 340

    Technique 56: Sprucing Up Your Spreadsheets with Graphics 342Jazz It Up with Clip Art 342Adding Images from Graphics Files 343Drawing Objects for the Spreadsheet 344

    Drawing various shapes 345Using text boxes as callouts 346Making a statement with WordArt 346Drawing diagrams and organization charts 347

    Technique 57: Doing Automated Table Lookups 349Looking Up a Single Table Value 349

    Performing a vertical table lookup 350Performing a horizontal lookup 351

    Doing a Two-Way Lookup in a Data Table 352

    Technique 58: Using Text Formulas for Fun and Profit 355Getting Right on the Case 355Joining Separate Text Entries Together 356Replacing Text Formulas with Their Results 357

    Technique 59: Creating Queries to Import Data from an External Database 358Setting Up the Data Source Definition 358Creating the Database Query 360

    Technique 60: Automating Repetitive Tasks with Macros 365Recording and Playing Back Macros 365

    Recording the macro 366Playing back the macro 368

    Editing Macros in the Visual Basic Editor 369Modifying the settings for VBA properties 370Getting user input by adding a custom

    dialog box 371

    Technique 61: Creating Custom Functions to Use in Your Worksheets 374Creating Custom Functions 374Saving Custom Functions in an Excel Add-in 376

    Index 379

    00b_574272_ftoc.qxd 10/1/04 10:24 PM Page xiv

  • Introduction

    Few things are more disappointing to me as a software trainer thanto see people who have just enough basic knowledge to work ina sophisticated program such as Excel waste inordinate amountsof time doing their work the hard way because they dont really knowhow to go about harnessing the programs features. This book is a vehi-cle for taking that next step into efficient use of Microsoft Excel, a programabout which I have written a great deal and am naturally very partial. Itis my sincere hope that it helps you become not only more competent inExcel but also much more confident in your ability to use rather than beused by it.

    Saving Time with This BookThe Timesaving Techniques For Dummies books focus on high-payoff tech-niques that save you time, either on the spot or somewhere down theroad. These books get to the point in a hurry, with step-by-step instruc-tions to pace you through the tasks you need to do, without any of thefluff you dont want. Ive identified more than 60 techniques that Excelusers need to know to make the most of their time. In addition, eachtechnique includes lots of figures that make following along a breeze.Decide for yourself how to use this book: Read it from cover to coverif you like or skip right to the technique that interests you the most.

    In Excel Timesaving Techniques For Dummies, you can find out how to

    Tame time-consuming tasks: Because I demystify the inner workingsof Excel for you, letting you in on more than 60 tips and tricks alongthe way, you can spend more time on creating great results and lesstime on fiddling with a feature so that it works correctly.

    Take your skills up a notch: Youre already familiar with the basicsof using Excel. Now this book takes you to the next level, helping youbecome an even savvier Excel user.

    00c_574272_cintro.qxd 10/1/04 10:20 PM Page 1

  • Introduction2

    you can go after the procedures in the particularpart of the book that really interest you at the time,putting all the rest of the tips and tricks aside untilyou need to have a look at them. In case youre theleast bit curious, heres the lowdown on each partand the types of techniques you can expect to findthere.

    Part I: Making Excel Work Your Way

    These techniques enable you to cut through theExcel screen clutter and get the program to workand look the way you want it. Find out how to cus-tomize everything from the Excel screen display tothe pull-down menus and toolbars. You also find outhow to streamline program startup and save timeby knowing exactly where you saved the spread-sheet you worked on the day before.

    Part II: Quick Worksheet Creation Tricks

    The techniques in this part are dedicated to showingyou more efficient ways not only to build your spread-sheets but also to make them more accurate. Hereyou find out how to quickly navigate the worksheet,make proficient cell selections, and do data entrylike the pros. In addition, you find out how to ensureaccurate entries with Excels data validation andText to Speech features.

    Part III: Handy Ways to Format and PresentWorksheet Data

    This part contains the techniques that you needto easily and quickly make the data in your work-sheet its most presentable. Here you find out howto instantly format tables of data through a com-bination of tips and tricks. You also find out how tocreate and apply custom number formats and selectthe alignment features best suited to the particulardata youre working with. Finally, you find out howto quickly conjure up charts and graphs that candemonstrate trends and analyses otherwise hiddenin the data itself.

    Customize Excel to meet your needs: Spendingsome upfront time customizing Excel so that itworks faster, more reliably, and more like howyou work on a daily basis can save you time(and aggravation) later.

    Automate repetitive tasks: This book showsyou how to lighten your work load by takingfewer steps to do everyday tasks, especiallythose involving data entry and formatting inthe worksheet.

    Foolish AssumptionsIm only going to make one foolish assumption aboutyou and that is that you use Microsoft Excel in yourwork or studies at the basic level. If pushed, I furtherguess that you arent particularly interested in know-ing Excel at an expert level but are terribly motivatedto find out how to do the stuff you need to get donemore efficiently. If thats the case, then this is defi-nitely the book for you. Fortunately, even if you hap-pen to be one of those users whos highly motivatedto become the companys resident spreadsheetguru, youve still come to the right place.

    As far as your hardware and software go, Im assum-ing that you already have a version of Excel betweenExcel 97 and 2003 (the latest) installed on yourcomputer and that youre using a standard instal-lation running on a version of Windows betweenWindows 95 and Windows XP or Windows 2000.Although the figures in this book all show Excel 2003happily running on Windows XP, it makes no differ-ence to most of the written instructions if youreusing an earlier version of Excel on an earlier ver-sion of Windows.

    Whats In This BookExcel Timesaving Techniques For Dummies is dividedinto nine parts that contain loosely related tech-niques for working smarter and faster. That way,

    00c_574272_cintro.qxd 10/1/04 10:20 PM Page 2

  • Whats In This Book 3

    Part IV: Worksheet Formula Timesavers

    The techniques in this part are devoted to enablingyou to create efficient and well-formed formulas inyour Excel spreadsheets. Here you find out how toaccurately copy formulas using all types of cell ref-erences, greatly speed up table creation throughthe use of array formulas, and document formulasthrough the sagacious use of range names. As if thiswerent enough, you also find out how to create for-mulas that trap Excel error values and prevent themfrom spreading far and wide throughout the spread-sheet and, in the event that they do succeed in get-ting out, how to trace their source and eliminatethem on the spot.

    Part V: Worksheet Editing Timesavers

    The techniques in this part center on how to makeefficient editing changes in a completed spread-sheet. Knowing these techniques can save youoodles of time if youre among the more commonworksheet users who spend a majority of the timeadding to and updating existing company work-books. Here you find out how to quickly find theworkbook you want to edit, control the Excel screendisplay so you can see what youre editing at alltimes, use the editing tips and tricks of the pros,as well as consolidate data from several worksheetsand subtotal their data without even breaking asweat.

    Part VI: Tips for Printing, Sharing,and Reviewing Workbooks

    Tops among the techniques in this part is the firstone on spreadsheet security and how to protectyour sensitive data from unwarranted opening oredits without ending up being locked out of the fileyourself. Here you also find out how to produce flaw-less printed reports, share Excel data with the otherprograms you run, share your workbook files on alocal network, and send your files out to coworkersand clients for a formal review.

    Part VII: Streamlining Data Listingand Data Analysis

    This part is dedicated to skillful means for turninggreat quantities of raw data into usable information.Here you find techniques for organizing, searching,sorting, and filtering the data you keep. You are alsointroduced to what-if analysis and data summationin all its glory in the form of data tables, scenarios,goal seeking, and those wonderful pivot tables andpivot charts.

    Part VIII: Internet-Related Timesavers

    The techniques in this part give you the inside trackon sharing Excel data on the World Wide Web. Hereyou find out how to instantly convert your Excelworksheet data and charts into HTML documentsready to publish to your Web pages either on theInternet or your companys intranet. You also findout how to easily import data from Web pagesdirectly into Excel where you can manipulate thedata to your hearts content and how to add hyper-links to your worksheets to make any kind of jumpyou need, from one worksheet to another in thesame workbook all the way to any address on theInternet.

    Part IX: The Scary (Or Fun) Stuff

    This last part contains a potpourri of techniques,some of which are thrown in for the fun of it and oth-ers that you may at first perceive to be somewhat ofa stretch. (I dont actually include techniques herethat you really need to apprehensive of.) Among thefun techniques, you find out how to use Excel 2003lists (which are a real delight and are so easy theyalmost create themselves), how to do worksheetdata entry and issue Excel commands with the powerof your voice, and how to spruce up the look of yourspreadsheets with art images (both those you drawand others you import).

    Among the less instantly comfortable techniquesin this part are creating lookup formulas that returndata from schedules and other data tables, creating

    00c_574272_cintro.qxd 10/1/04 10:20 PM Page 3

  • Introduction4

    This icon denotes a tidbit that you ought topay extra attention to; otherwise, youll besorry. I reserve this icon for those times whenyou can lose data and otherwise mess up yourspreadsheet.

    This icon denotes some extra tip or trick tidbitthat can end up saving you even more time,especially when used in tandem with thegeneral points being made in the currenttechnique.

    Where to Go from HereThe question of where to go from here couldnt besimpler: Head off to read the great Rich Tennant car-toons at the beginning of each of the nine parts, ofcourse. Which part and technique you jump intoafter that is a matter of personal interest and need.Just dont forget to have fun while discovering howto work smarter and faster in Excel.

    text formulas that manipulate text entries that wereentered in the wrong case or which you need to com-bine, setting up queries to the corporate databasethat return data to the Excel worksheet, using macrosto automate all those repetitive tasks, and creatingcustom functions for instantly performing specializedcalculations not covered by any of Excels built-infunctions.

    Icons Used in this BookI have strategically placed the following iconsthroughout all 61 techniques in this book. Theirpurpose is to get you to pay close attention tosomething Im saying, and each has its own wayof doing that.

    This icon denotes some really cool information(in my humble opinion) that, if you pay partic-ular attention to, will pay off by making yourwork more enjoyable or productive (or both).

    This icon denotes a tidbit that you ought topay extra attention to; otherwise, you may endup taking a detour that wastes valuable time.

    00c_574272_cintro.qxd 10/1/04 10:20 PM Page 4

  • Part I

    Making Excel WorkYour Way

    01_574272 pp01.qxd 10/1/04 10:22 PM Page 5

  • 01_574272 pp01.qxd 10/1/04 10:22 PM Page 6

  • 1 Customizing theExcel ScreenDisplayWhat can I say? The Excel program window (shown in Figure 1-1)is a busy place. Filled with all kinds of buttons and bars, its awonder that theres any place left for entering your preciousspreadsheet data. Therefore, the first technique that any dedicated Exceluser needs to know is how to control the look and feel of the Excel dis-play screen.

    Figure 1-1: Is it Grand Central Station? No, just the Excel program screen.


    Save Time By Switching in and out of

    Full Screen view

    Customizing sheet andworkbook settings

    Saving your customsettings in a workbooktemplate

    02_574272 ch01.qxd 10/1/04 10:19 PM Page 7

  • Technique 1: Customizing the Excel Screen Display8

    maximize the number of cells displayed on yourscreen is by switching to Full Screen view (ViewFull Screen). As soon as you choose this command,Excel temporarily hides any open toolbars. The pro-gram also gets rid of the Formula bar at the top andthe sheet tabs, the horizontal scroll bar, and the pro-grams Status bar at the bottom, leaving only theWorksheet menu bar, column and row headers,vertical scroll bar, and Windows taskbar surround-ing the blank worksheet cells (see Figure 1-2).

    In Full Screen view, Excel displays a floating FullScreen toolbar in the lower-right corner of thescreen. To switch back into normal screen view,simply click the toolbars Close Full Screen button.Excel closes the Full Screen toolbar and restoresall the missing toolbars.

    Figure 1-2: Maximizing the worksheet real estate in FullScreen view.

    Working without the benefit of the Formula bar is fineas long as all youre doing is entering scads of spread-sheet data or checking up on your data entries. If,however, youre doing more than this kind of simpledata entry and editing, youll probably need to havethe Formula bar displayed on the screen. To displaythe Formula bar while Excel is in Full Screen view,follow these steps:

    Here you find out how to max out the worksheet dis-play so that you access as many cells and as muchof your spreadsheet data as possible, thus savingyou from having to waste a lot of your precious timejust scrolling up and down and back and forth toview the cells you need to work with. You also findout how to customize the display so that it repre-sents more the type of spreadsheets you create andthen how to save these custom display settings inworksheet templates that enable you to immediatelyutilize all these settings in new workbooks you gen-erate from them.

    Standard Display SettingsControlling the Excel display screen includes notonly hiding unwanted toolbars that surround theworksheet but also modifying the sheets look andfeel. Each time you launch Excel, the program opensa new workbook whose sheets use a whole bunchof standard display settings.

    These standard settings consist of the following:

    Three blank worksheets each identified by theirown sheet tabs.

    256 columns in each sheet with a standard widthof 8.43 characters (64 pixels) and labeled with acolumn header using letters (A through IV).

    65,536 rows in each sheet with a standard rowheight of 12.75 points (17 pixels) and labeledwith a row header (1 through 65536).

    Gridlines demarcating the edge of each sheetscolumns and rows and thereby displaying theoutline of each worksheet cell.

    Switching to Full ScreenThe fastest and simplest way to remove the screenclutter caused by the Excel toolbars and thereby

    02_574272 ch01.qxd 10/1/04 10:19 PM Page 8

  • Customizing the Worksheet Display 9

    1. Choose ToolOptions.2. Select the View tab in the Options dialog box.3. Select the Formula Bar check box and then

    click OK to close the Options dialog box.

    After displaying the Formula bar when the programis in Full Screen view, it continues to appear on thescreen as you switch in and out of Full Screen view.If you decide that you dont need the Formula bar onthe screen in Full Screen view, deselect the FormulaBar check box in Step 3 of the preceding steps.

    Auto-hiding the Windows taskbar gives youa little more worksheet real estate. Just right-click the Start button and choose Properties toopen the Taskbar and Start Menu Propertiesdialog box. Click the Taskbar button in thisdialog box and then select the Auto-Hide theTaskbar check box and click OK. After that,Windows keeps the taskbar hidden until youposition the mouse pointer somewhere alongthe bottom of the screen. As soon as youmove the mouse pointer out of this area,Windows hides the taskbar again.

    Customizing the WorksheetDisplayExcel offers all sorts of ways to customize the appear-ance of the worksheet display. Heres a sampling ofwhat you can do:

    Modify the width of some or all the columns androws in any of the three worksheets.

    Change the number of sheets in the workbook.

    Control whether the worksheet gridlines thatdefine the boundaries of each cell are hidden ordisplayed and determine the color used whenthey are shown on-screen.

    Setting a new standard column width

    If youre working on a spreadsheet that almost uni-versally requires a different standard column width(usually one wider than the 8.43 characters or 64pixels standard), you can easily set a default widthfor every column in the worksheet:

    1. Choose FormatColumnStandard Width.Excel opens the Standard Width dialog box,shown in Figure 1-3.

    Figure 1-3: Designating a new standard width for thecolumns in a worksheet.

    2. Enter the new width in characters (between0 and 255) in the Standard Column Widthtext box.

    Setting a column width to 0 is the equivalentof hiding the column in the worksheet bychoosing FormatColumnHide. You canuse this technique to hide columns you usein calculating certain worksheet formulas butdont necessarily want printed as part of thefinal spreadsheet. However, if you enter 0here as the new standard width, you hideall the columns in the worksheet, making itimpossible to add, edit, or print data in anyof its cells!

    3. Click OK to close the Standard Widthdialog box.

    Changing the value in the Standard Width dialog boxchanges the default column width for all the columns

    02_574272 ch01.qxd 10/1/04 10:19 PM Page 9

  • Technique 1: Customizing the Excel Screen Display10

    3. Enter the new row height in characters(between 0 and 255) in the Row Heighttext box.

    Setting the row height to 0 is the equivalent ofhiding the row in the worksheet by choosingFormatRowHide. You can use this techniqueto hide rows you use in calculating worksheetformulas but dont necessarily want to appearin the printout. However, if you enter 0 herewhen all the rows of the worksheet are selected,standard width, you hide all the rows in theentire worksheet, making it impossible to add,edit, or print data in any of its cells!

    4. Click the OK button to close the Row Heightdialog box.

    Excel changes the height of all the rows in theworksheet.

    To remove the cell selection from all the rows in thecolumn whose heading you clicked, click any singlecell with the mouse pointer.

    Modifying the number of sheets in a workbook

    In the olden days of Excel, when the program firststarted supporting the use of more than one work-sheet in a single spreadsheet file, the program auto-matically provided each new workbook that youopened in the program with 17 blank worksheets.In the more recent versions of Excel (all those in the2000 series), the program default has been loweredto a much more modest three sheets in every newworkbook. For some users, 17 was far too manysheets for their modest spreadsheet needs, and forothers, three sheets are far too few for the typesof complex spreadsheets they routinely create.

    Although Excel makes it easy to insert new work-sheets in a workbook (you simply choose InsertWorksheet to pop a new one in), if you find yourselfhaving to manually add new sheets to many of thenew workbooks you start, you should probably mod-ify the default number of sheets that Excel adds toall new workbooks:

    in only the active worksheet. Using this commandhas no effect on the width of columns that you man-ually resized or resized with the AutoFit feature.

    If you want to change the default columnwidth for all the worksheets in your workbook,select all the sheets (by Ctrl+clicking theirsheet tabs or right-clicking the tab of theactive sheet and then clicking Select All Sheetson the shortcut menu) before you open theStandard Width dialog box and set a newdefault value.

    Setting a new standard row height

    Note that Excel doesnt provide an equivalent com-mand for setting a new default height for all the rowsin a worksheet. This is probably because the programautomatically adjusts the height of the row to accom-modate the data that you enter in its columns. Ifyoure creating a spreadsheet where you wouldbenefit by having a new standard row height (pre-sumably, a taller one), you can set all the rowsin the worksheet to a new height by using this work-around:

    1. Click a letter in the Column header.Clicking a column letter in the Column headerselects all the rows in that column in theworksheet.

    2. Choose FormatRowHeight.Excel opens the Row Height dialog box, shownin Figure 1-4.

    Figure 1-4: Designating a new row height for all theselected rows in a worksheet.

    02_574272 ch01.qxd 10/1/04 10:19 PM Page 10

  • Saving Custom Display Settings 11

    1. Choose ToolsOptions to open the Options dia-log box.

    2. Select the General tab in the Options dialog box.3. Enter a new value between 1 and 255 in the

    Sheets in a New Workbook text box or selectthis value with the boxs spinner buttons; thenclick OK.

    After changing the value in the Sheets in a NewWorkbook text box, Excel adds that number ofsheets to any new workbook you create.

    Customizing the worksheet gridlines

    When creating a standard spreadsheet applicationsuch as the standard profit and loss statement andbalance sheet, the worksheet gridlines that are auto-matically displayed in all new worksheets providea much needed background with which to visuallyalign the data. In other, more nonstandard applica-tions such as online forms and presentations withembedded charts, gridlines not only are often con-fusing to the eye but actually interfere with the pres-entation of the information the sheet contains.

    To give the heave-ho to a worksheets gridlines inthe current worksheet, follow these steps:

    1. Choose ToolsOptions to open the Options dia-log box.

    2. Select the View tab in the Options dialog box.3. Deselect the Gridlines check box and then

    click OK.

    Turning off gridlines in a worksheet displayhas no effect on whether or not the gridlinesappear on paper when the sheet is printed.To prevent Excel from adding gridlines to aprinted report, the Gridlines check box on theSheet tab in the Page Setup dialog box (FilePage Setup) must not be selected before yousend the sheet to the printer. You check this inprint preview.

    When you display the column and row gridlines onthe screen, Excel uses your Windows desktop set-tings to determine what color to assign the gridlines(usually, they appear in light blue). If you want toassign a new, perhaps bolder, color to the gridlines,follow these steps:

    1. Choose ToolsOptions to open the Optionsdialog box.

    2. Select the View tab in the Options dialog box.3. Select the Gridlines Color drop-down list box,

    select the new color in the pop-up color palette,and click OK.

    When you select a new color for the gridlines,it doesnt just affect how the gridlines appearon your screen. Excel also uses this color inprinting the gridlines in a worksheet when theGridlines check box is selected on the Sheettab in the Page Setup dialog box.

    Saving Custom Display SettingsWhile its all well and good that Excel gives you plentyof choices for customizing its screen display, it surewould be a waste of time if you had to manuallymodify all the various screen settings each time youstarted working on a new workbook. Fortunately,you can save your custom display settings as anExcel template, and then any time you need to gener-ate a new spreadsheet that uses those settings, youcan do so simply by opening the template.

    Creating a template

    To create an Excel template with your custom dis-play settings, follow these steps:

    1. Launch Excel and then manually make all thechanges to the display settings that you wantsaved in the new template.

    02_574272 ch01.qxd 10/1/04 10:19 PM Page 11

  • Technique 1: Customizing the Excel Screen Display12

    filename in the workbooks temporary file-name as in 15 Wide Col1, No Gridlines2, and4-Sht Book3.

    5. Click Save to close the Save As dialog box andsave your settings in the new template file.

    Using a template

    To use your template to generate a new workbookwith your custom display settings, follow thesesteps:

    1. If the template is currently open, close it bychoosing FileClose on the menu bar or bypressing Ctrl+W.

    You must close a new template file before youcan generate files from it.

    2. Choose FileNew to open the New Workbooktask pane.

    To use your new template, dont click the Newbutton on the Standard toolbar or press thekeystroke shortcut Ctrl+N. Doing so automati-cally opens a new workbook using the Excelout-of-the-box settings, giving you no oppor-tunity to generate the new book from anyother template. Choose FileNew on themenu bar instead.

    3. Select the On My Computer link under theTemplates section of the New Workbooktask pane.

    The Templates dialog box opens.

    4. Double-click the name of the template you wantto use, or click its name and then click OK.

    Excel opens up a new blank workbook from the tem-plate file, using all the custom display settings thatyou saved as part of it.

    When making changes to display settings fora template, select the settings that you findyourself manually changing over and overagain (such as inserting an additional work-sheet, removing the gridlines, and selecting anew standard column width). When enteringdisplay values (such a new default columnwidth or row height), select the value.

    2. Choose FileSave or click the Save buttonon the Standard toolbar to open the Save Asdialog box.

    3. From the Save as Type drop-down list, chooseTemplate (*.xlt), as shown in Figure 1-5.

    Figure 1-5: Selecting Template (.xlt) as the file type forsaving a new worksheet template.

    4. Highlight the temporary filename (Book1,Book2, and so on) in the File Name combobox (be sure you dont select the .xlt filenameextension) and then type in a descriptive namefor the new template.

    When replacing the temporary filename withone of your own, pick a brief name thatdescribes the new settings, such as 15 WideCol, No Gridlines, or 4-Sht Book. Be awarethat when you generate a workbook from thetemplate youre creating, Excel uses the main

    02_574272 ch01.qxd 10/1/04 10:19 PM Page 12

  • 2 Customizing theExcel Menus andToolbarsThis technique centers on customizing the Excel toolbars and pull-down menus. Taking the time to get the Excel toolbars (especiallythe Standard and Formatting toolbars that Excel automaticallydisplays whenever you launch the program) and the pull-down menusthe way you want them saves you valuable time when creating and edit-ing your spreadsheets. (Just think about how many times you accesstheir buttons and menu items in a single work session, and youll under-stand why.)

    Excel makes it easy to customize the position, behavior, and even contentof its many toolbars and pull-down menus. This customization includesplacing the Standard and Formatting toolbars on two separate rows,always displaying full pull-down menus, and customizing the buttonsand command options found on the built-in bars and menus as well asthose found on the bars and menus you build on your own.

    Showing the Toolbars and Menusin All Their GloryExcel tries to save valuable screen space by automatically placing theStandard and Formatting toolbars on the same row at the top of thescreen. This is fine except for when youre using one a smaller monitorin a relatively low screen resolution (such as 800 x 600 or 1024 x 768)where its impossible to have all the buttons on either toolbar displayat the same time and where youre often forced to waste time in clickingthe Toolbar Options button to have access to options that are currentlyhidden.


    Save Time By Displaying full toolbars

    and menus

    Customizing toolbars andmenus

    Creating your own menus

    Adding macros and linksto toolbars and menus

    03_574272 ch02.qxd 10/1/04 10:23 PM Page 13

  • Technique 2: Customizing the Excel Menus and Toolbars14

    Toolbars and MenusMade to OrderWhen the software engineers at Microsoft puttogether the Excel toolbars and menus, they triedto select the buttons and options that most usersneed most of the time. Of course, you may very wellnot be most users when it comes to using Exceland wish that they had included command optionsthat currently arent there and left out others thatyou rarely use.

    The good news is that you can easily make the pro-gram more efficient by customizing any of the existingtoolbars and pull-down menus so that they consist ofjust the options you use in the order in which youdlike to see them.

    To customize a built-in Excel toolbar, you followthese steps:

    1. Choose ViewToolbarsCustomize to openthe Customize dialog box.

    2. If the toolbar you want to customize is notalready displayed on the screen, select theToolbars tab in the Customize dialog boxand then select that toolbars check box.

    3. To add a new button to the toolbar nowdisplayed, select the Commands tab in theCustomize dialog box and then select thedesired command category in the Categorieslist box. Scroll to the commands icon in theCommands list box and then drag the iconfrom the Customize dialog box to its newplace on the toolbar.

    You can release the mouse button as soon asthe box with the + (plus) appears on the mousepointer. Excel indicates where the new buttonwill be inserted on the toolbar by displayingthe bold I-beam-type indicator on the toolbar.

    To ensure that all the buttons on both the Standardand Formatting toolbars are always displayed, followthese steps:

    1. Choose ViewToolbarsCustomize to open theCustomize dialog box.

    2. Select the Options tab in the Customize dialogbox, as shown in Figure 2-1.

    3. Select the Show Standard and FormattingToolbars on Two Rows check box and thenclick the Close button.

    Figure 2-1: Forcing Excel to display the Standard andFormatting toolbars on two rows.

    To get Excel to display all of a menus optionsthe moment you open it, select the AlwaysShow Full Menus check box on the Optionstab of the Customize dialog box. This stopsthe program from shortchanging you on howmany options you see when you first open aparticular menu. (Menus dont show all theiroptions until the menus are open for severalmoments moments that often seem like alifetime.)

    03_574272 ch02.qxd 10/1/04 10:23 PM Page 14

  • Toolbars and Menus Made to Order 15

    4. To delete a button from the toolbar, drag itsbutton from the toolbar, and then when thebox with the X in it appears at the mousepointer, release the mouse button.

    5. To rearrange the buttons on the toolbar, dragthe button icon to its new position on the bar(indicated by the bold I-beam-type indicator).

    6. To add a vertical separator bar that groups thebuttons, locate the button in front of which theseparator will be inserted and then drag thatbutton slightly to the right. As soon as yourelease the mouse button, the separator barappears.

    To remove a vertical separator, drag the buttonthat the separator is directly in front of to theleft until the bar disappears.

    7. After you finish customizing the toolbar, clickthe Close button to close the dialog box andreturn the functionality to the toolbars andmenus.

    The steps for customizing one of Excels pull-downmenus are the same as those for customizing a tool-bar, except that after opening the Customize dialogbox and selecting the Commands tab, you mustchoose the name of the menu you want to customize.The steps for adding commands, deleting menu items,and rearranging them on a particular menu are thesame as those for doing these things to a toolbar:just keep in mind that the bold, I-beam-type indica-tor shows you where the command you add will beinserted on the pull-down menu.

    You can use the controls in the RearrangeCommands dialog box (see Figure 2-2) toquickly add, delete, or modify the order ofthe buttons on any Excel toolbar or items onany of its pull-down menus. To open this dia-log box, click the Rearrange Commands but-ton on the Commands tab of the Customizedialog box.

    Figure 2-2: The Rearrange Commands dialog box makesit easy to add, delete, or reorder the optionson Excel toolbars and menus.

    To customize a menu or toolbar in the RearrangeCommands dialog box, follow these steps:

    1. If youre customizing a pull-down menu, clickthe Menu Bar option button and then select thepull-down menu name in its drop-down listbox. If youre customizing a toolbar, click theToolbar option button and then select the tool-bar name in its drop-down list box.

    Excel displays all the menu items or toolbarbuttons for the menu or toolbar you selectedin their current order.

    2. To add an item or button, click the menu itemor button in front of which you want to insertthe new button and then click the Add button.In the Add Command dialog box that appears,select the option you want added and click OK.

    3. To delete an item or button, select it in theRearrange Commands dialog box and thenclick the Delete button.

    03_574272 ch02.qxd 10/1/04 10:23 PM Page 15

  • Technique 2: Customizing the Excel Menus and Toolbars16

    Excel adds the custom toolbars name to theToolbars list box in the Customize dialog boxand displays a blank floating toolbar that showsonly the first few letters of its name.

    4. To add a tool to the new toolbar, select theCommands tab in the Customize dialog box,click the desired command category in theCategories list box, scroll to the commandsicon in the Commands list box, and then dragthe commands icon from the Customize dia-log box to the new toolbar.

    Excel automatically expands the toolbar toaccommodate the buttons you add.

    5. Repeat Step 4 until you have added all the toolsyou want to appear on your new toolbar.

    6. If you want to group the buttons on the newtoolbar, locate the buttons in front of whichyou want the separators to appear and thendrag the buttons slightly to the right.

    You can also reposition the buttons you addto a new toolbar simply by dragging them totheir places.

    7. When you have the new toolbar exactly the wayyou want it, click the Close button to close theCustomize dialog box.

    After creating a custom toolbar, be sure to test out itsbuttons by clicking them at the appropriate momentsin building or editing your spreadsheet (not all Excelcommands can be executed on a blank worksheet).

    The process for creating a custom menu is the sameas for a toolbar except that to start the custom menu,you select the New Menu item at the bottom of theCommands tab of the Customize dialog box. Thenyou drag this New Menu item from the Customizedialog box to the place where you want it to appearon the Excel menu bar. To rename the menu to some-thing besides New Menu, right-click New Menu on theExcel menu bar and choose Name from the shortcutmenu. Then replace New Menu with the new nameyouve chosen.

    4. To modify the position of an item or button,select it in the Rearrange Commands dialogbox and then click the Move Up or Move Downbutton until the item or button appears inthe desired position.

    5. After you finish customizing your menu or tool-bar, click the Close button in the RearrangeCommands dialog box and then click the Closebutton in the Customize dialog box.

    A Toolbar and Menuof Your OwnSometimes it makes more sense to create your owntoolbar or pull-down menu rather than fool aroundcustomizing the ones that come with Excel. By build-ing your own custom toolbar or menu, you can bringtogether just the commands that you normally relyon. For example, you can concoct a Calculation tool-bar or pull-down menu that contains only the optionsthat you frequently use in building your spreadsheetformulas.

    To create a custom toolbar, follow these steps:

    1. Choose ViewToolbarsCustomize to open theCustomize dialog box.

    2. Click the Toolbars tab and then click the Newbutton to open the New Toolbar dialog box,shown in Figure 2-3.

    Figure 2-3: You name your new custom toolbar in theNew Toolbar dialog box.

    3. Enter your name for the custom toolbar in theToolbar Name text box and then click OK.

    03_574272 ch02.qxd 10/1/04 10:23 PM Page 16

  • Adding Macros and Links to Toolbars and Menus 17

    If you want to assign a hot key to the nameyou give your new custom menu, type anampersand (&) immediately in front of theletter in the menu name. (Just make sure thatit isnt already assigned to one of the otheritems on the same menu.)

    To add an item to your new menu, drag the com-mand from the Customize dialog box to the tabunder the menu. (Dont release the mouse buttonuntil the bold, I-beam-type indicator appears on thetab and the box with the plus sign (+) appears nextto the mouse pointer.) Removing and repositioningitems on your custom menu is no different from mak-ing these types of modifications to a standard pull-down menu.

    Adding Macros and Linksto Toolbars and MenusBuilt-in commands are not the only things you canadd to the toolbars and pull-down menus you cus-tomize or create from scratch. You can also addmacros youve recorded and hyperlinks to particulardocuments, folders, and even favorite Web sites. Todo this, you attach the macro or link to a custombutton that you add to a toolbar or to a custommenu item that you add to a pull-down menu.

    To attach a macro or hyperlink to a custom buttonthat you add to a toolbar, follow these steps:

    1. Choose ViewToolbarsCustomize to open theCustomize dialog box.

    2. If the toolbar to which you want to add thecustom button is not already open, select theToolbars tab and then select the toolbarscheck box to display it in the Excel screen.

    3. Select the Commands tab and then selectMacros near the bottom of the Categories listbox, as shown in Figure 2-4.

    When you select the Macros category, theCommands list box gives you a choice betweena Custom Menu Item and a Custom Button.

    Figure 2-4: The Macros category contains two choices:Custom Menu Item and Custom Button.

    4. Drag the Custom Button (with the Happy Faceicon) and drop it into position on the toolbarfrom which you want to be able to run themacro or select the hyperlink.

    5. Right-click the Custom Button you just addedto the toolbar and then click either the AssignHyperlinkOpen item (to attach a hyperlink toit) or the Assign Macro item (to attach a macroto it) on the shortcut menu, shown in Figure 2-5.

    If you choose Assign HyperlinkOpen, Excelopens the standard Assign Hyperlink dialog boxwhere you can select an existing file or Web pageor e-mail address to link to. If you choose AssignMacro, the program opens the Assign Macro dia-log box where you can select the macro to runwhen the button is clicked.

    03_574272 ch02.qxd 10/1/04 10:23 PM Page 17

  • Technique 2: Customizing the Excel Menus and Toolbars18

    You can use the Button Editor which youcan open by selecting Edit Button Image onthe buttons shortcut menu to modify theicon that you choose on the Change ButtonImages icon palette. This editor lets you makepixel-by-pixel changes to the image, either byerasing pixels or by painting with new colors.

    8. Click the Close button in the Customize dia-log box.

    The process for assigning a hyperlink or macro to amenu item is almost the same, except that you selectCustom Menu Item in the Macros category on theCommands tab of the Customize dialog box. Thenyou drag this Custom Menu Item to the place on thepull-down menu where you want it to appear. Next,you assign either a hyperlink or macro to it by right-clicking the Custom Menu Item on its pull-downmenu and then choosing either Assign HyperlinkOpen or Assign Macro on its shortcut menu.

    After assigning the link or macro, you will want torename the menu item. To do this, right-click CustomMenu Item on its pull-down menu and then click theName option and replace Custom Menu Item with aname of your own. If you want to assign a hotkey toone of the characters in the new name, be sure totype an ampersand (&) immediately in front of thecharacter in the custom menu name that you wantto so designate.

    6. Select the link to the hyperlinks destination inthe Assign Hyperlink dialog box or the macroto run in the Assign Macro dialog box; thenclick OK.

    Figure 2-5: Select the Assign Hyperlink or Assign Macroitem to attach a link or macro to the newbutton.

    7. To select a new icon for the button, right-clickthe custom button and choose Change ButtonImage. From the icon pop-up palette thatappears, choose the new icon you want to use.

    03_574272 ch02.qxd 10/1/04 10:23 PM Page 18

  • 3 Perfecting YourSpreadsheetWorkspaceAn Excel workspace (sometimes known as an arranged workspace)is really just a special file that keeps a record of all the workbooksopen at the time you save the workspace, as well as all the work-books screen attributes things like window sizes and arrangement,screen magnification, and any other display settings in use at the time.(See Technique 1 for details.) Workspaces are real timesavers becausethey enable you to immediately resume work the next day on whateverworkbooks you had open the day before. All you have to do is open theworkspace file, and Excel does all the heavy lifting: opening the individ-ual workbooks and arranging their windows and setting up the screenattributes so theyre in the same condition you left them in.

    When youre involved with a particularly complex spreadsheet projectthat requires you to work with the same workbook files over the courseof several work sessions, you can save even more time by having Excelautomatically open the workspace file when you launch the program.That way, you have all the spreadsheets open and arranged so thatyoure ready to go the moment you start working with Excel.

    Saving Your WorkspaceCreating a workspace is literally as simple as choosing FileSave Workspace, naming the workspace file, and selecting a placein which to save the new workspace file (which is automaticallygiven the filename extension .xlw) in the Save Workspace dialogbox, shown in Figure 3-1. The hard part is actually opening the work-books you want to work with in the workspace and arranging theirwindows and display settings the way you want them prior to savingthis workspace file. But then, this is the stuff that you have to doanyway to be able to work with more than one Excel workbook at a time.


    Save Time By Creating a workspace

    with all the spreadsheetsyoure working on

    Opening the workspacewhen Excel launches

    04_574272 ch03.qxd 10/1/04 10:21 PM Page 19

  • Technique 3: Perfecting Your Spreadsheet Workspace20

    Opening a Workspace WheneverExcel LaunchesWhen you know that youll be using a particularworkspace for some time in your Excel work, youcan speed up the process of setting up your workenvironment by having Excel automatically openthe workspace file when you launch the program.The process for doing this is twofold: You need todesignate a folder on your computer as the alter-nate startup folder, and then you have to save theworkspace file in that folder.

    Any Excel file that you save in the XLSTARTfolder provided by Microsoft (and saved in theC:\Program Files\Microsoft Office\Office11folder when youre using Excel 2003) automati-cally opens when you launch the program.

    Excel enables you to designate an alternatefolder (which you must create with WindowsExplorer) for automatic startup. I recommendsaving the workspace file you want automati-cally opened in the alternate startup folderthat you specify because no matter where youput this folder it just has to be easier to findthan Microsofts XLSTART folder!

    To designate a folder (which youve already createdon your system with Windows Explorer) as the alter-nate startup folder, follow these few steps:

    1. Choose ToolsOptions and then select theGeneral tab in the Options dialog box.

    2. Select the At Startup, Open All Files In text boxand then enter the path to the folder whereyoure going to save your workspace file.

    Figure 3-1: Saving the information about the currentwork environment in a new workspace file.

    To re-create the workspace environment, all youhave to do is open the workspace file. When lookingfor the workspace file in the Open dialog box (FileOpen), remember that workspace files use the .xlw(for Excel workspace) file extension rather than thenormal .xls filename extension.

    To have the workspace in your next Excelwork session exactly the way you left it at theclose of business, dont save the workspace fileuntil after you have saved all your changes tothe open Excel workbooks and are ready toexit Excel.

    If youve already created the workspace file ina previous work session and want to save anydisplay changes to it under the same filename,choose FileSave Workspace and then clickSave in the Save Workspace dialog box. WhenExcel displays an alert dialog box warning youthat youre about to replace the existing file,just click Yes to save your changes to the sameworkspace file.

    04_574272 ch03.qxd 10/1/04 10:21 PM Page 20

  • Opening a Workspace Whenever Excel Launches 21

    Unfortunately, Excel doesnt provide a Browsebutton here that enables you to locate this foldervisually, so you have to tough it out and type thefolders pathname in this text box. Rememberthat the pathname consists of the drive letterfollowed by a colon and the names of all thesubfolders separated by backslashes, as in C:\XL Alt Start shown in Figure 3-2.

    3. Click OK to close the Options dialog box.

    Figure 3-2: Designating the alternate startup folder in theOptions dialog box.

    After you designate your alternate startup folder,follow these steps to save the workspace file thatyou want Excel to automatically open on startup:

    1. Choose FileSave Workspace to open the SaveWorkspace dialog box.

    2. From the Save In drop-down list box, select thefolder you designated as the alternate startupfolder, as shown in Figure 3-3.

    Figure 3-3: Saving the workspace file in the alternatestartup folder in the Save Workspacedialog box.

    3. Click Save to close the Save Workspace dialogbox.

    After you save the workspace file in your Excel alter-nate startup folder, each time you start Excel theprogram opens the file and uses its information toload your workbook files, arrange their windows,and invoke their display settings.

    When you finish your work with the workbooksopened in the workspace and no longer want tosee them every time you launch Excel, you needto move the workspace file out of the alternatestartup folder into another folder on your harddisk, or, if youre really sure that you have no needfor the workspace, you can delete it by moving itinto the Windows Recycle Bin.

    04_574272 ch03.qxd 10/1/04 10:21 PM Page 21

  • 4 Saving YourWorksheets SoYou Can Find ThemNothing is as frustrating as knowing that youve saved a workbookfile only to discover later that you havent the foggiest idea whereon your great big humongous hard disk you saved it. Excel triesto guard against this type of aggravation by automatically saving everynew workbook in the My Documents folder. Many times, however, savingall the different types of workbooks you create in the same generic MyDocuments folder on your local disk just isnt practical. This is especiallytrue in a network environment where spreadsheets are not normallysaved locally.

    This technique concentrates on ways you can minimize the annoyanceof not knowing where you saved a new workbook file. These includechanging the default folder from the generic My Documents to a morespecific folder and setting up the Save command so that youre auto-matically prompted to fill in summary information on the new workbookfile. Although the latter procedure does not itself guard against saving anew workbook in the wrong folder, it does help you more quickly andeasily find the file if you forget where you saved it.

    The final procedure in this technique covers the use of the AutoRecoverfeature to guard against losing unsaved data if Excel becomes unrespon-sive and needs to be shut down or your computer experiences a suddenshutdown that prevents you from manually saving your edits. By settingAutoRecover to a comfortable interval, you can be assured of losing asfew worksheet edits as possible in such an event. You can also set thefolder location where Excel saves your recovered workbook.


    Save Time By Changing the default file


    Saving each new file withsummary information

    Changing theAutoRecover settings

    05_574272 ch04.qxd 10/1/04 10:25 PM Page 22

  • Modifying the Default File Location 23

    of the folder at the end of the new pathname appearsin the Save In drop-down list box. (If you want tocheck that the path to this folder is correct, selectthe Save In drop-down list to display it.) Then allyou have to do to complete the save operation isto edit the temporary filename and click Save.

    Figure 4-1: To change where Excel automatically saves itsfiles, enter the pathname in the Default FileLocation text box.

    Figure 4-2: After designating a new default file location,Excel automatically selects that folder for allnew files you save.

    Modifying the DefaultFile LocationIf your Excel work habits are anything like mine,you tend to find yourself at certain times havingto build several workbooks of the same type (timecards, financial statements, expense reports, andso on) that all need to be saved in the same folder.For those times, you can streamline this processand guard against saving the new workbook in thewrong location by changing the default file location.That way, when you first save the workbook, youdont have to bother with changing the folder, andyou dont have to worry about saving the workbookin an unintended place.

    To change the default file folder location to a folderthat youve already created with Windows Explorer,follow these steps:

    1. Choose ToolOptions to open the Options dia-log box.

    2. Select the General tab in the Options folder.3. In the Default File Location text box, enter the

    pathname to the folder you want as the default,as shown in Figure 4-1.

    This assumes that youve planned ahead andalready used Windows Explorer to create sucha folder.

    The pathname consists of the drive letterfollowed by a colon and the names of allsubfolders separated by backslashes, as inC:\Accounting\Expenses.

    4. Click OK to close the Options dialog box.

    After changing the default file location in the Optionsdialog box, the next time you open the Save As dialogbox (shown in Figure 4-2) to save a new workbook(by choosing FileSave, clicking the Save button onthe Standard toolbar, or pressing Ctrl+S), the name

    05_574272 ch04.qxd 10/1/04 10:25 PM Page 23

  • Dont forget to change the Default File Locationon the General tab of the Options dialog boxwhen you finish creating all the files that shouldbe saved in that location. Otherwise, youll endup saving files that dont belong there, defeat-ing the purpose of modifying this location inthe first place.

    Saving New Files withSummary InformationEven if you never mess up and save a new workbookin the wrong folder, you might as well admit that even-tually youll end up forgetting where you intentionallyput some of them. This next procedure can go a longway in helping you quickly find and open any work-book that youve temporarily misplaced, regardlessof the reason.

    Microsoft programs such as Word and Excel 2003enable you to save summary information on everydocument you create as part of the documents fileproperties (see Figure 4-3). (You can display the prop-erties by choosing FileProperties.) This summaryinformation can include data such as the documentstitle, subject, author, company, category, keywords,and comments. The great thing about this summaryinformation is that its searchable from the Excel FileSearch task pane (FileFile Search), so you can usewhatever summary data you know about a lost work-book to find and open it. (See Technique 31 fordetails.)

    The bad thing is that Excel doesnt automaticallyprompt you to enter this summary informationwhen you first save the file, so more likely than not,you dont end up entering the facts and keywordsthat may some day prove vital to your being ableto locate and reopen the file. Fortunately, you canchange this situation so that Excel automaticallydisplays the Properties dialog box and selects itsSummary tab every time you save a new workbookfile. (This dialog box appears after you designate thefolder and filename and click the Save button in theSave As dialog box.)

    Figure 4-3: You can use the data entered on theSummary tab of the File Properties dialogbox in searching for misplaced workbooks.

    To get this going, you follow these simple steps:

    1. Choose ToolsOptions to open the Option dia-log box.

    2. Select the General tab and then select thePrompt for Workbook Properties check box, asshown in Figure 4-4.

    3. Click OK to close the Options dialog box.

    When entering summary data for new work-books, get in the habit of assigning standardgeneral data to the Subject or Category fields(such as Invoice or Expense Report) along withinformation specific to the spreadsheet in theTitle and Keywords fields. That way, you cannarrow down the field to files of a certain typeeven if you dont have specifics on the file.

    Technique 4: Saving Your Worksheets So You Can Find Them24

    05_574272 ch04.qxd 10/1/04 10:25 PM Page 24

  • Changing the AutoRecover Settings 25

    If youre not comfortable with the ten-minuteAutoRecover save interval, you can shorten orlengthen it. For some users, this interval is too longbecause they would never want to have to reenterten minutes worth of data. For others, its too shortbecause it seems like Excels always interruptingtheir work by saving their data changes. To modifythe AutoRecover settings, follow these steps:

    1. Choose ToolsOptions to open the Options dia-log box.

    2. Select the Save tab to display the AutoRecoversettings for the program, as shown in Figure 4-5.

    Figure 4-5: Access the Save tab of the Options dialogbox to modify the programs AutoRecoversettings.

    3. To modify the AutoRecover save interval, enterthe new time value (between 1 and 120) in theMinutes text box or use the spinner buttons toselect it.

    4. To select a new folder into which to save recov-ery backup files, select the AutoRecover SaveLocation text box and then enter the pathnamefor this new folder.

    Normally, you dont have to worry about thisfolder location because the Document Recoverytask pane (discussed later in this section) finds

    Figure 4-4: Setting up Excel to automatically display theSummary tab of the Options dialog box whenyou first save a file.

    Changing the AutoRecoverSettingsThe AutoRecover feature is turned on when youinstall Excel so that every ten minutes the programautomatically saves any editing changes made sincethe workbook was last saved. The program saves allthe edits youve made since the last AutoRecoversave in a special document-recovery backup filelocated in the folder designated as the AutoRecoversave location. Then if your computer experiencessome sort of power failure or Excel unexpectedlygoes comatose on you (a very rare occurrence butnot completely unheard of) before you can save theworkbook yourself, you can open this recoverybackup file and use it instead of the original file.

    AutoRecover doesnt operate on a new work-book that youve never manually saved withFileSave, so be sure to save your new work-book before you enter a bunch of formulasand data in it, or you could end up losing it all.

    05_574272 ch04.qxd 10/1/04 10:25 PM Page 25

  • the backup file for you and enables you to com-pare the recovered file to the original and, if youso desire, replace the original with the recoveredversion.

    5. Click OK to close the Options dialog box andput your new settings into effect.

    Select the Disable AutoRecover check box onthe Save tab of the Options dialog box at yourown peril. In disabling this feature, you run therisk of losing all your data should you have asoftware or hardware mishap before you takethe time to manually save the file.

    If your software freezes up or your computercrashes when the AutoRecover feature is enabledand in use during a work session, the next time youlaunch Excel, the program displays the DocumentRecovery task pane. This pane identifies both theoriginal and recovered versions of the workbook file.You can open the recovered version (by clicking itsbutton and then selecting Open on its pop-up menu)

    to see how much of the data was recovered. If youdecide that you want to retain the recovered versionof the file and replace the original version, chooseFileSave and choose Yes in the alert dialog boxthat warns you that youre about to replace theexisting file.

    If you know that you want to replace the origi-nal with the recovered version, you dont haveto bother with opening the recovered file. Justclick the drop-down button for the file marked[Recovered] and select Save As on the pop-upmenu. If you dont want to replace the original,be sure to enter a new filename in the Save Asdialog box.

    In the odd event that you want to discard the recov-ered version and retain only the original (and pre-sumably less complete) version of the file, simplyclick the Close button in Document Recovery taskpane and then select the No (Remove These Files. IHave Saved the Files I Need) option button in thealert dialog box that appears.

    Technique 4: Saving Your Worksheets So You Can Find Them26

    05_574272 ch04.qxd 10/1/04 10:25 PM Page 26

  • 5Technique Tailoring ExcelsError Checkingto Your NeedsAnyone with any experience building Excel worksheets knowsthat formula errors, the bane of all spreadsheets, are inevitable.Whenever Excel cannot successfully calculate one of your formu-las according to its internal rules, the program returns an error value toits cell, indicated by the error name in all caps punctuated by a numbersign at the beginning (#) and an exclamation point (!) or question mark(?) at the end, as in #VALUE!, #NAME?, and #DIV/0!, to name but a few.

    Not only are these error values ugly as sin, but they also tend to propa-gate themselves all over the worksheet, spreading to all formulas thatrefer to the cells that contain them. (See Techniques 31 and 32 for tipson how to stop error values from spreading all over the place and elimi-nate them from the worksheet.)

    In an attempt to help you identify what in the blazes has caused yourformula to go haywire and return an error value rather than the resultyou wanted, Excel now adds error indicators to cells. These indicatorsappear as tiny green triangles in the upper-left corner of the cells con-taining the error values, as shown in Figure 5-1. When you position themouse pointer over an error indicator, a Smart Tab icon (the exclama-tion point in a diamond) appears with a ToolTip containing an explana-tion of the problem.

    Figure 5-1: Errors, errors everywhere and indicators telling you whats wrongto boot!

    Save Time By Modifying the Error

    Checking settings

    Hiding error indicatorsin cells

    Hiding error valuesin cells

    06_574272 ch05.qxd 10/1/04 10:25 PM Page 27

  • Technique 5: Tailoring Excels Error Checking to Your Needs28

    When youre new to Excel, the ToolTips connectedto the error indicators are a godsend because theyreinforce the rules and start to make sense of thoselargely inexplicable error values. As you become amore experienced user, they lose their luster andcan become downright annoying (obscuring datayou want to see and otherwise getting in your wayas you inadvertently pass the mouse pointer overthem).

    Fortunately, Excel makes it easy to control whenerror indicators appear in cells containing errorvalues. You can also temporarily suppress the dis-play of all error indicators in the worksheet. As partof this technique on cleaning up the error indicatorsin your worksheet, I give you tips on temporarilysuppressing the display of those unsightly errorvalues both on-screen and in your printouts.

    Modifying the Error CheckingSettingsThe Error Checking tab of the Options dialog box(ToolsOptions), shown in Figure 5-2, contains a listof check-box options that correspond to conditionsin which Excel adds an error indicator to a cell. Notethat in this list, only the first check box option has todo with actual error values in the cells. All the otheroptions have to do with conditions that might beproblematic to the spreadsheet even though theydont result in blatant error values.

    Here is the entire list of Error Checking options:

    Evaluates to Error Value: Adds error indicatorsto cells whose formulas return error values andincludes ToolTips that try to explain the reasonfor the particular error value.

    Text Date with 2 Digit Years: Adds an error indi-cator to cells that contain two-digit dates enteredas text, as in 89 or 76.

    Number Stored as Text: Adds an error indicatorto cells that contain numbers entered as text, asin 1123 or 45.67.

    Inconsistent Formula in Region: Adds an errorindicator to any cells containing formulas whosestructures dont match the prevailing pattern inthe rest of those in a particular table.

    Formula Omits Cells in Region: Adds an errorindicator to any cells containing formulas thatdont refer to cells within a particular table whenmost of the others do.

    Unlocked Cells Containing Formulas: Adds anerror indicator to any unlocked cells containingformulas (you can unlock cells by pressing Ctrl+1,clicking the Protection tab, and deselecting theLocked check box).

    Formulas Referring to Empty Cells: Adds anerror indicator to any cells containing formulasreferring to empty cells. (This is the only ErrorChecking option not selected by default.)

    List Data Validation Error: Adds an error indica-tor to cells that contains entries that dont followthe data validation condition applied to them.

    Figure 5-2: The Error Checking options enable you tomodify when error indicators appear.

    As you can see from the list of Error Checkingoptions, error indicators often dont representan error per se but simply an anomaly in theprevailing pattern. If youre not particularly

    06_574272 ch05.qxd 10/1/04 10:25 PM Page 28

  • Hiding Error Values On-Screen and in Print 29

    Hiding Error Values On-Screenand in PrintSometimes, youll want to suppress the display ofthose nasty-looking error values in a worksheet untilyou get all the data entered that you need to makeall the error values really disappear. (Error valuesrunning throughout the worksheet can tend to makethe client a little nervous.) When it comes to sup-pressing their display, you have a couple choices:

    You can nip them in the bud so to speak bybuilding formulas that suppress the displayand trap any possible errors before theyspread anywhere else in the worksheet(see Technique 28 for details).

    You use the Conditional Formatting featureto blank them out.

    Follow these steps to use the Conditional Formattingfeature:

    1. Select the cell or range of cells containing theerror values you want to blank out.

    2. Choose FormatConditional Formatting.3. Click the drop-down button in the box that

    reads Cell Value Is and select Formula Isfrom its pop-up menu.

    4. Type =ISERROR( in the text box to the right.5. Reselect the cell or range of cells containing

    the error values you want blanked out or typetheir addresses.

    If you want to drag through the cells to selectthis range but the Conditional Formatting dia-log box gets in the way, minimize the dialogbox by clicking its Condense button (the onewith the tiny worksheet icon).

    6. Type ) to close the parentheses for the ISERROR function.

    concerned about inconsistencies in your spread-sheets, you can simply deselect their check boxoptions to prevent Excel from cluttering the work-sheet with these types of indicators.

    Dont disable the Evaluates to Error Valueoption unless youre a real spreadsheet acewho can immediately tell whats causing aformula to return an error value. Youll becheating yourself out of the ToolTip infotelling you whats wrong so you can quicklyeliminate the error.

    You can make the error indicators more or lessprominent in the worksheet by selecting a newcolor for their triangles on the Error IndicatorColor pop-up palette.

    Suppressing All Error IndicatorsWhen youre dealing with a worksheet that for what-ever reason is riddled with error values and theirattendant error indicators, you can get rid of theindicators in one fell swoop by following thesesimple steps:

    1. Choose ToolsOptions.2. Select the Error Checking tab in the Options

    dialog box.

    3. Deselect the Enable Background ErrorChecking box and then click OK.

    As soon as you close the Options dialog box, Exceltemporarily removes all the error indicators fromthe entire worksheet. To restore them, all you haveto do is open the Error Checking tab of the Optionsdialog box and then select the Enable BackgroundError Checking box again.

    Suppressing the display of the error indicatorshas no effect on the display of error values inthe worksheet. To do that, you either have tofix the problem or use one of the techniquesin the following section for hiding their display.

    06_574272 ch05.qxd 10/1/04 10:25 PM Page 29

  • Technique 5: Tailoring Excels Error Checking to Your Needs30

    7. Click the Format button to open the FormatCells dialog box.

    8. On the Font tab, click the Color drop-down but-ton and then select the white square on thepop-up palette that appears. ( The white squareis at the intersection of the very last columnand row of the upper palette.) Then click OK.

    When you close the Format Cells dialog box, theConditional Formatting dialog box resembles theone shown in Figure 5-3.

    9. Click OK to close the Conditional Formattingdialog box.

    Figure 5-3: Setting up a conditional format to blank outthe display of error values in a range.

    As soon as you click OK, Excel replaces all the errorvalues in the cell or cell range you selected withwhite, effectively blanking out their error valueresults without disturbing their formulas.

    If all you want to do is suppress the display of errorvalues in a printout of the worksheet, you dont haveto go to all that trouble of first blanking out their dis-play by setting up a conditional format. All you have

    to do is follow these simple steps prior to sendingthe worksheet to the printer:

    1. Choose FilePage Setup to open the Page Setupdialog box.

    2. On the Sheet tab, click the Cell Errors As drop-down button to open its drop-down list, shownin Figure 5-4.

    Figure 5-4: Replacing the error values in the printout ofa worksheet with blanks, N/A, or dashes.

    3. From the drop-down list, select , --(dashes), or #N/A (the Not Available value)to replace the default value displayed inthe Cell Errors As box.

    4. Click OK to close the Page Setup dialog boxor click Print if youre ready to print yourworksheet.

    Click the Print Preview button rather than thePrint button if you want to make sure that allthe error values are really gone from the print-out before you send the job to the printer.

    06_574272 ch05.qxd 10/1/04 10:25 PM Page 30

  • Technique6 Utilizing ExcelsEditing SettingsExcels Edit settings, found on the Edit tab of the Options dialog box(shown in Figure 6-1), offer a wide array of editing options, most ofwhich are selected by default and seldom, if ever, need changing.Therefore, instead of focusing solely on how to change these options tosuit your work habits, this technique also covers how to more efficientlyuse of a few them when modifying your spreadsheets.

    This technique begins by covering how and when to change the directionin which the cell pointer moves when you press Enter and then gives youthe lowdown on why you might want to disable the AutoComplete fea-ture. You then discover how to efficiently use Excels drag-and-drop edit-ing (and when its best to stick with the old cut-and-paste standby). Thetechnique concludes by giving you pointers on when to edit a cells con-tents directly in the cell and when to rely on the old tried-and-true cellediting on the Excel Formula bar.

    Figure 6-1: The Edit settings offer a wide array of editing options that seldomneed changing.


    Save Time By Selecting new cell

    pointer directions

    Dumping AutoComplete

    Using cell drag-and-drop

    Direct editing in cells

    07_574272 ch06.qxd 10/1/04 10:22 PM Page 31

  • Technique 6: Utilizing Excels Editing Settings32

    Putting the Cell Pointerin the Right DirectionAs youre probably well aware, Excel attempts tomake the drudgery of data entry in the worksheetscells as efficient as possible by setting it up so thatthe program automatically moves the cell pointerdown one cell in the same column when you finishwhat youre doing and press Enter. (Of course, youcan always click the Enter button on the Formulabar to complete an entry or edit rather than pressthe Enter key.)

    What you may not be aware of is that you can easilyalter the behavior of the Enter key so that it movesthe cell pointer in another direction or doesnt movethe cell pointer at all. To change the direction that thecell pointer moves when you press Enter, open theEdit tab of the Options dialog box and select any ofthe following options in the Direction drop-down listbox to replace the default Down option:

    Right to move the cell pointer to the cell in thenext column to the right in the same row

    Up to move the cell pointer to the cell in the rowimmediately above in the same column

    Left to move the cell pointer to the cell in theprevious column to the left in the same row

    To prevent Excel from moving the cell pointer outof the current cell when you press Enter, deselectthe Move Selection After Enter check box on theEdit tab.

    The best reason for changing the direction that thecell pointer moves upon pressing Enter is when youfind yourself editing a data list or table of spread-sheet data in that particular direction. Here are afew examples:

    If you find that youre editing the entries acrossthe rows of a table from left to right (the direc-tion we read), you would select Right as theDirection option.

    If youre doing the editing across the rows of atable from right to left (a direction I tend to favordue to my left-handiness), you would select Leftas the Direction option.

    If you were editing the columns of an Excel datalist (also known by the misnomer, database) fromthe last record (at times, the most recent record)at the bottom upwards towards the first record,it would make perfect sense for you to select Upas the Direction option.

    The only reason I ever disable the Move SelectionAfter Enter check box is to keep the cell pointer sta-tionary is when I need to enter master formulas inblank cells that I intend to copy down the columnor across the row with the AutoFill feature. In thatsituation, I dont want Excel to move the cell pointeroff of the master formula when I press Enter to com-plete its entry, and I also dont want to interrupt theentry sequence by having to click the Enter buttonon the Formula bar.

    Completely Turned Offto AutoCompleteIm sure that the Microsoft engineers who inventedthe AutoComplete feature for the Office suite of pro-grams must have thought they had come up with theslickest thing since sliced bread. However, I find thisfeature particularly noxious when entering spread-sheet data because I seldom need to enter the sameentry several times in the same column or row ofa table. (And if I do run into this situation, I haveenough sense to use the AutoFill feature to copy therepeated entry down the column or across the row.)

    As a result, I find it much better for my health(especially my blood pressure) to disable theEnable AutoComplete for Cell Values option imme-diately after installing Excel. Therefore, I suggestthat you live a little longer as well and stop readingthis book long enough to disable this editing optionon your copy of Excel as well. (Its easy to do: Justdeselect its check box on the Edit tab of the Optionsdialog box.)

    07_574272 ch06.qxd 10/1/04 10:22 PM Page 32

  • Doing the Drag-and-Drop Thing 33

    Figures 6-2 and 6-3 illustrate this kind of insertionwhen moving a cell range with drag-and-drop. InFigure 6-2, I selected the cell range A12:R12 (notethat many columns are hidden) in preparation formoving it up a row so that it comes in between theRock and Jazz rows without overwriting any existingdata. This figure shows the heavy insertion I-beamindicating where the selected range will be insertedwhen I release the mouse button.

    Figure 6-2: Getting ready to move data in betweenexisting rows of a table.

    Figure 6-3 shows the worksheet after releasing themouse button. As you can see, Excel inserts theselected range into row 11 while at the same timemoving the Jazz cassette sales data down to row 12.

    When drag-and-drop flops

    Drag-and-drop provides a simple, easy, and, aboveall, direct way of editing the contents of a worksheet.It does, however, have a big limitation: Its only goodwhen you have direct screen access to both thesource range and destination range. This doesntmean that you have to be able to see both ranges atthe same time on the screen (although thats alwaysnice). It does mean that you have to be able to gobetween the two ranges either by scrolling tothem on the same worksheet or by moving betweentwo windows that youve created on the screen.

    Doing the Drag-and-Drop ThingDrag-and-drop editing in the worksheet is greatas long as you never disable the Alert beforeOverwriting Cells option which appears imme-diately beneath the Allow Cell Drag and Drop optionon the Edit tab of the Options dialog box. Otherwise,you can too easily obliterate parts of your spread-sheet by replacing data you dont want disturbedwith the data youre moving. At least when the Alertbefore Overwriting Cells option is enabled, you geta warning that youre about to mess up and replacedata that you might need. Of course, if you do messup and end up replacing entries with the data youremoving or copying (see the warning on copying withdrag-and-drop that follows), you can always putsthings back to right by using the Undo feature(Ctrl+Z).

    When you hold down the Ctrl key to copy(rather than move) the cell selection with drag-and-drop, Excel doesnt display the ReplaceContents alert box the one that still givesyou the chance to abort the procedure evenafter you release the mouse button.

    Please make room for me

    Drag-and-drop spreadsheet editing is most effectivewhen you not only need to move or copy a rangeof cells to a new (blank) place in the worksheet butalso want to insert the cells into an existing tableof data. To do this kind of insert moving or copying,you must hold down the Shift key as you drag thecell selection to its new position. Excel indicateswhere the selected data will be inserted at the timeyou drop it by displaying an I-beam-type indicatorin front of the mouse pointer:

    When the I-beam pointer runs horizontallybetween rows, you know that the selectionwill be inserted as a new row in the existingtable of data.

    When it runs vertically between columns, youknow that the selection will be inserted as newcolumn in the table.

    07_574272 ch06.qxd 10/1/04 10:22 PM Page 33

  • Technique 6: Utilizing Excels Editing Settings34

    Figure 6-3: The worksheet after moving the selected datain the table.

    For example, you cant use drag-and-drop to move orcopy a range of cells from one worksheet to anotherin the same workbook unless youve taken the timeto set up separate windows for the sheets before-hand. And unless you have other reasons for settingup the windows, using drag-and-drop to make themove or copy just wastes valuable time.

    In such a case, using the standard cut-and-pastemethod to make the move or copy is much moreefficient. After cutting or copying the cell selectionto the Clipboard (Ctrl+X or Ctrl+C, respectively),click the new sheet and select the first cell in therange in which you want the data moved or copied,and then press Enter to complete the procedure.(You can also press Ctrl+V to do this.)

    Doing Direct Cell EditingDirect cell editing offers you an alternative to editingthe data or formula youve entered into a cell on theFormula bar above the sheets work area. To directlyedit the contents of a cell, you double-click the cell or press F2 to place the Insertion point in its con-tents, and then you edit its characters as you wouldon the Formula bar (or in a Word document). Whenyou finish modifying the cells contents, you complete

    the edit by pressing the Enter key or by clicking theEnter button on the Formula bar (the button withthe green check mark). To bail on the edit andrestore the original contents, press Esc.

    Pressing F2 to direct edit always positionsthe Insertion point at the very end of the cellentry. When you double-click the cell, Excelplaces the Insertion point as close as possibleto the position of the white cross in that cell.

    The question inevitably arises as to when its moreefficient to edit a cell entry directly versus editing iton the Formula bar. For me, this decision dependsupon the length of the cell entry and its position inthe spreadsheet. When dealing with really long andcomplex formulas in a cell (like the one shown inFigure 6-4), editing them directly in the cell can endup obscuring the cells in the surrounding region tothe right and below the cell, which is okay unlessyou need to refer to these cells in your edit. In sucha case, you would find it much more beneficial toedit the cells formula on the Formula bar. This leavesmost of the worksheet unconcealed except at thevery top where the multiple lines for the Formulabar obscure the column header and the first rowsof the sheet, as shown in Figure 6-5.

    Figure 6-4: Editing a really long formula like this one inits cell obscures any data in cells in the regionto its right.

    07_574272 ch06.qxd 10/1/04 10:22 PM Page 34

  • Doing Direct Cell Editing 35

    Figure 6-5: Editing a really long formula on theFormula bar leaves most of the work-sheet unconcealed.

    07_574272 ch06.qxd 10/1/04 10:22 PM Page 35

  • 7 Streamlining ExcelProgram StartupLucky Technique 7 is all about quick-and-easy ways to launch theExcel program. Although the procedures outlined in this techniquemay seem really simple, when you think about how many timesyou launch Excel even in a weeks time, let alone a months, I think youllagree that theyre worth their weight in gold.

    In this technique, all the ways for streamlining the Excel startup aredesigned so that you never have to go through that clumsy StartAll Program FilesMicrosoft OfficeMicrosoft Office Excel 2003 routine(the Microsoft engineer that came up with that one should be ashamed ofhimself)! The most obvious way to completely avoid this utterly Byzantinecommand sequence is to put the Excel program icon at your fingertips,either by placing it on the desktop as a shortcut or as an icon on theWindows taskbar or Start menu. And if all you ever seem to do on yourcomputer is run Excel, you can even go the final step of having Windowsautomatically launch the program as part of the computer startupprocedure.

    Excel Desktop ShortcutThe most basic procedure for putting the Excel startup at your fingertipsis to put an Excel shortcut icon pointing to the Excel programs executablefile on your computers desktop. To do this, follow these steps:

    1. Click the Start button on the Windows taskbar and then selectSearch on the Start menu.

    2. Select the All Files and Folders link in the Search Companion taskpane.

    3. Type excel.exe in the All or Part of the File Name text box and thenclick the Search button.

    4. Right-click EXCEL.EXE in the main pane of the Search Results dialogbox and then choose Send ToDesktop (Create Shortcut) from thefiles shortcut menu, as shown in Figure 7-1.


    Save Time By Adding an Excel desktop


    Adding Excel to the QuickLaunch toolbar

    Pinning Excel to theStart menu

    Launching Excel onWindows startup

    08_574272 ch07.qxd 10/1/04 10:24 PM Page 36

  • Adding Excel to the Quick Launch Toolbar 37

    Adding Excel to the QuickLaunch ToolbarThe only problem with launching Excel from a desk-top shortcut is that you have to have access to theWindows desktop in order to use it. This means thatyou cant use it to launch Excel when, for example,youre working in another application full screensuch as Microsoft Word or PowerPoint.

    To be able to launch Excel without accessing theWindows desktop, you can add your Excel desktopshortcut to the Windows Quick Launch toolbar. Thistoolbar resides to the immediate right of the Startbutton on the Windows taskbar and is readily avail-able at all times.

    If the Quick Launch toolbar doesnt appearafter the Start button on your Windowstaskbar, its display is turned off. To turnit back on, right-click the taskbar, selectProperties and then select the Show QuickLaunch check box on the Taskbar tab of theTaskbar and Start Menu Properties dialog boxbefore you click OK.

    To add your Excel desktop shortcut to the QuickLaunch toolbar, follow these few steps:

    1. Display the Windows desktop by clicking theShow Desktop button on the Quick Launch tool-bar (if the desktop is not already displayed).

    If the Quick Launch toolbar isnt displayed onyour computers taskbar, display it by right-clicking on a blank area on the taskbar andthen choosing ToolbarsQuick Launch.

    2. Drag the Excel desktop shortcut icon to theplace on the Quick Launch toolbar whereyou want it to appear.

    Excel indicates the place where the Excel iconwill be inserted by displaying a heavy, I-beam-type pointer in between the existing buttons onthe Quick Launch toolbar.

    Figure 7-1: Creating a desktop shortcut for the Excelprogram file in the Search Results dia-log box.

    5. Click the Close button in the upper-right cornerof the Search Results dialog box to close it.

    As soon as you close the Search Results dialog box,you will see that Windows has added a MicrosoftOffice Excel 2003 desktop shortcut. (See Figure 7-2.)You can, if you wish, rename this icon to somethingmore manageable such as Excel 2003 by right-clicking the icon and then deleting the redundantMicrosoft Officepart.

    Figure 7-2: The Microsoft Excel 2003 shortcut icon.

    To launch Excel from your computers desktop, sim-ply double-click the (Microsoft Office) Excel 2003desktop shortcut icon.

    08_574272 ch07.qxd 10/1/04 10:24 PM Page 37

  • 3. Release the mouse button to create a new Excelbutton on the Quick Launch toolbar, as shownin Figure 7-3.

    Figure 7-3: The Quick Launch toolbar after adding theExcel desktop shortcut to it.

    You dont have to double-click the Excel but-ton that you add to the Quick Launch toolbarto launch Excel. You only need to click it once,just as you would any of the buttons on thenumerous Excel toolbars.

    You may have to enlarge the Quick Launchtoolbar to display all its icons. To do this, posi-tion the mouse pointer on the right edge ofthe bar (marked by a double line of dots) anddrag the double-headed arrow pointer untilall the icons are shown. If the double-headedarrow pointer doesnt appear, the taskbar islocked. Right-click the taskbar and then clearthe Lock the Taskbar item on the pop-upmenu to unlock it. After enlarging the QuickLaunch toolbar to display all its icons, you canonce again lock the taskbar by selecting thisitem.

    Pinning Excel to the Start MenuWhat if youre one of those users who never displaythe Quick Launch toolbar on the Windows taskbarbecause you dont want to waste all that precioustaskbar real estate on a few crummy launch buttons?Well, for you, I suggest making Excel a permanentpart of the Start menu. That way, you can alwayslaunch Excel by clicking the Start button (somethingyou cant remove from the Windows taskbar) or bypressing Ctrl+Esc and then selecting the MicrosoftOffice Excel 2003 menu item on the Start menu.

    To make Microsoft Office Excel 2003 a permanentitem on your computers Start menu, follow thesesteps:

    1. Launch Excel and then immediately close itsprogram window.

    You must manually start Excel in order to addits menu item to the Recently Opened sectionof the Start menu. To launch Excel, double-clickthe Excel desktop shortcut or click the Excelbutton on the Quick Launch toolbar. If you haveneither, you have to do this by choosing StartAll ProgramsMicrosoft OfficeMicrosoft OfficeExcel 2003. (Doing that should give you a realincentive to complete the rest of these steps!)

    2. Click the Start button on the Windows taskbaror press Ctrl+Esc to open the Start menu.

    3. Right-click the Microsoft Excel 2003 item on theStart menu and then choose the Pin to StartMenu option, as shown in Figure 7-4.

    4. Click anywhere outside the Start menu or pressEsc to close the menu.

    If a Microsoft Excel 2003 item doesnt appearon your Start menu after following these steps,the Number of Programs on Start Menu optionhas been set to 0. Right-click the taskbar andthen select Properties. Next, select the StartMenu tab in the Taskbar and Start MenuProperties dialog box and then click theCustomize button. Finally, enter a value greaterthan 0 (and not more than 30) in the Numberof Programs on the Start menu text boxbefore you select OK.

    After pinning Microsoft Excel 2003 to the Start menu,you can always launch Excel by clicking the Start but-ton on the taskbar (or by pressing Ctrl+Esc) and thenselecting this menu. This menu item now appears inthe permanent programs section of the Start menu(which is the top-left portion of the menu) alongwith the other permanent programs, including yourInternet and e-mail applications.

    Technique 7: Streamlining Excel Program Startup38

    08_574272 ch07.qxd 10/1/04 10:24 PM Page 38

  • Launching Excel on Windows Startup 39

    1. Click the Start button on Windows taskbar orpress Ctrl+Esc to open the Start menu.

    2. Choose All ProgramsMicrosoft Office to openthe submenu.

    3. Drag the Microsoft Office Excel 2003 menu itemfrom this submenu to the Startup menu on theAll Programs menu.

    4. Drop the Microsoft Office Excel 2003 menuitem anywhere on the Startup submenu, asshown in Figure 7-5.

    Figure 7-5: Dragging Microsoft Excel 2003 to theWindows Startup menu.

    After moving Microsoft Office Excel 2003 to theWindows Startup menu, Windows launches theprogram every time you start or restart Windows.

    To stop having Excel launch every time youstart your computer, drag the Microsoft OfficeExcel 2003 item back to its original home onthe Microsoft Office submenu.

    Figure 7-4: Pinning the Microsoft Excel 2003 menu itemto the Start menu.

    Launching Excel onWindows StartupFor you real hardcore Excel users, the only real solu-tion to the Excel launch problem is to have Windowsautomatically launch Excel for you every time youstart your computer! The procedure is easy: All youhave to do is drag the Microsoft Office Excel 2003menu item from the Microsoft Office submenu tothe Startup submenu:

    08_574272 ch07.qxd 10/1/04 10:24 PM Page 39

  • 8 Saving Time withExcel Add-insExcel add-in programs provide a quick-and-easy way to extend thebasic features of Excel. Most of the add-in programs created for Exceloffer you some kind of specialized function or group of functionsthat extend Excels computational abilities. For example, Excel includesan Analysis ToolPak that gives you immediate access to some fifteenadditional sophisticated statistical functions, including such things asAnova, Covariance, F-Test: Two-Sample for Variances, Fourier Analysis,Histogram, Rank and Percentile, t-Test, and z-Test, among others. It alsoincludes a Conditional Sum Wizard, Lookup Wizard, and Solver Add-inthat you can use to perform other types of analysis.

    As part of the Excel program, Microsoft offers you a group of spread-sheet-type add-ins that you can start using right away. In addition, youcan search the Microsoft Web site for additional add-ins that you candownload for free as well as a number of other third-party Web siteswhere you can purchase the Excel add-ins for download.

    Installing Add-insBefore you can use any add-in program, the add-in must be installed in theproper folder on your hard drive, and then you must select the add-in inthe Excel Add-Ins dialog box. Excel add-in programs are saved in a specialfile format identified with the .XLA (for Excel Add-in) filename extension.These XLA files are normally saved inside the Library folder (sometimesin their own subfolders) that is located in the Office11 folder. The path tothis folder on most computers is C:\Program Files\Microsoft Office\Office11\Library.

    After an add-in program is installed in the Library folder, its name thenappears in the Add-Ins dialog box, which you open by choosing ToolsAdd-Ins. To activate an add-in program (and thereby put it into the com-puters memory), select the check box in front of its name in the Add-Insdialog box (see Figure 8-1), and then click OK.


    Save Time By Installing add-ins

    Using the add-insincluded with Excel

    Finding add-ins online

    09_574272 ch08.qxd 10/1/04 10:22 PM Page 40

  • Using the Built-in Add-ins 41

    Figure 8-1: Activating add-in programs that have alreadybeen installed on your computer.

    If you ever copy an XLA add-in program to a folderother than the Library folder in the Office11 folder,its name wont appear in the Add-Ins dialog box.You can, however, activate the add-in by clickingthe Browse button in the Add-Ins dialog box tonavigate to the add-in file and then clicking OK.

    Using the Built-in Add-insYou can start enhancing the power of Excel rightaway by making use of the add-in programs Microsoftprovides as part of Excel. The add-ins that Microsoftmake available for your use include

    Analysis ToolPak: Adds extra financial, statisti-cal, and engineering functions to Excels poolof built-in functions. To access these functions(and get help on using them), choose ToolsData Analysis after activating this add-in.

    Analysis ToolPak VBA: Enables VBA program-mers to publish their own financial, statistical,and engineering functions for Excel.

    Conditional Sum Wizard: Helps you set up formu-las that sum data only when the data meets thecriteria you specify. To use this wizard, chooseToolsConditional Sum after activating this add-in.

    Euro Currency Tools: Enables you to formatworksheet values as euro currency and adds aEUROCONVERT function for converting othercurrencies into euros. To access these tools,choose ToolsEuro Conversion after activatingthis add-in.

    Internet Assistant VBA: Enables VBA program-mers to publish Excel data to the Web.

    Lookup Wizard: Helps you set up formulas thatreturn data from an Excel list by using knowndata in that list. (See Technique 57 for details.)

    Solver Add-In: Calculates solutions to what-ifscenarios based on cells that both adjust andconstrain the range of values.

    The first time you activate any of the add-ins includedwith Excel, the program immediately displays an alertdialog box telling you that the add-in is not currentlyinstalled and asking you if you want to install it. Allthe add-ins included as part of Excel show up in thelist box in the Add-Ins dialog box but dont actuallytake up disk space until youre ready to use them.Select Yes in this alert dialog box to install the add-ins selected in this list. Keep in mind that Excelneeds to access your Office CD-ROM or its files onyour network in order to install any of theseincluded add-in programs.

    To save computer memory (RAM) that may beneeded for doing calculations in the workbookyoure editing, you can deactivate any of the add-inprograms that youre not currently using. Just openthe Add-Ins dialog box, deselect the check box infront of the add-in programs name, and click OK.

    Deactivating an add-in does not uninstall theprogram; it only removes the add-in from thecomputers RAM memory. If you deactivateadd-ins to save memory, remember to openthe Add-Ins dialog box and activate themwhen you again need access to their functions.

    09_574272 ch08.qxd 10/1/04 10:22 PM Page 41

  • Technique 8: Saving Time with Excel Add-ins42

    To find third-party vendors and get information ontheir add-ins, launch your Web browser and then do asearch for Excel add-ins. This brings up a Web pagefull of links to various outfits that make and sell alltypes of Excel add-ins, as shown in Figure 8-3. Notethat many of these sites offer specialized templatesand Excel training along with their add-ins.

    Figure 8-3: Searching for freebie Excel add-ins on theWorld Wide Web.

    Even before you do this Web search, you may wantto pay a visit to the Macro Systems Web site at www.add-ins.com (see Figure 8-4). Macro Systems offersa wide variety of Excel add-ins, sold both in collec-tions and as single items. The Macro Systems add-ins are divided into categories that include TimeSaving Add-ins, Charting Add-ins, Data Related Add-ins, Financial Add-ins, and so on.

    When visiting the Macro Systems Web site, besure to download its free add-in, Time SavingMicrosoft Excel Solutions. This online book is inthe Microsoft help file format and is chockedfull of hints on how to work smarter and faster.To get this book, scroll down the Add-ins.comhome page until you see the Free Add-ins sec-tion and then click the Free DownloadableBook link.

    Getting Online Add-insThe add-ins that Microsoft includes as part of theExcel program arent the only ones that you can layyour hands on. You can find additional free Exceladd-ins on the Microsoft Office Web site, and manythird-party vendors sell Excel add-ins that you canoften purchase online and then immediately down-load onto your hard drive.

    To locate free Excel add-ins from Microsoft, goonline to the Office Web site at


    You can get to this Web page quicklyfrom within Excel by choosing HelpMicrosoft Office Online.

    Once there, click the Excel link, enter add-ins asthe search text in the Search text box, and click Go.Doing this brings up a Web page similar to Figure 8-2,listing pages of free add-ins that you can downloadand use with your version of Excel. (Note that add-ins are very version-specific, so be sure that youonly download those that are compatible with theversion of Excel that youre using.)

    Figure 8-2: Looking for freebie Excel add-ins on theMicrosoft Office Web site.

    09_574272 ch08.qxd 10/1/04 10:22 PM Page 42

  • Getting Online Add-ins 43

    Figure 8-4: Its a veritable add-in heaven for Excel usersat Macro Systems Add-ins.com.

    09_574272 ch08.qxd 10/1/04 10:22 PM Page 43

  • 09_574272 ch08.qxd 10/1/04 10:22 PM Page 44

  • Part II

    Quick WorksheetCreation Tricks

    10_574272 pp02.qxd 10/1/04 10:36 PM Page 45

  • 10_574272 pp02.qxd 10/1/04 10:36 PM Page 46

  • 9 Navigating theWorksheet in a SnapNothing is quite as time-consuming and tedious as having to scrollthrough column after column or row after row of data and blankcells to find the place in your spreadsheet where you need to con-tinue entering data or make some editing changes. In my Excel trainingclasses, I make it a real point to thoroughly cover the most efficient waysto navigate the spreadsheet. Here, in this technique, I give the same tipsand tricks for getting where you need to go as quickly as possible.

    This technique on effectively navigating the spreadsheet andTechnique 10 on making the most efficient cell selections are proba-bly the most important timesavers in this part of the book; so, listen up!

    Saving the Cell Pointers Position Many Excel users forget the simple fact that the program always savesthe cell pointers current position in the workbook as part of the file. Thismeans that when youre working on a spreadsheet over a period of sev-eral days, you want to make sure that at the end of your work sessionyou set yourself up in the workbook so youre immediately ready to gothe next time you open the workbook file.

    To do this, I always make a conscious effort to position the cell pointer inthe cell at the beginning of the range where I will continue working thenext time I open the spreadsheet. Then I save the workbook file one lasttime before exiting the Excel program. That way, the next time I work onthe spreadsheet, Im ready to resume entering the remaining data or tocontinue making my edits without having to waste any time scrolling orfinding that position.


    Save Time By Saving the cell pointer

    where you need to worknext

    Zipping to the end of atable, sheet, or workbook

    Using Go To

    Zooming out on the worksheet

    11_574272 ch09.qxd 10/1/04 10:37 PM Page 47

  • Technique 9: Navigating the Worksheet in a Snap48

    When I press Ctrl+, the cell pointer just jumpsdown three rows to cell A5, the first occupied cellbelow it (see Figure 9-2).

    Figure 9-1: Starting in the cell pointer in blank cell A2and moving downward by pressing Ctrl+.

    Figure 9-2: The cell pointer jumps down to A5 the firstoccupied cell after the blanks in that column.

    However, when I press Ctrl+ a second time (seeFigure 9-3), the program jumps the cell pointer downto cell A9 because this is the last occupied cell

    Going DirectAs even the most novice of Excel users is well aware,a worksheet covers an awfully big area of which onlythe smallest bit is ever displayed on-screen at anyone time. Many times when making editing changesto a particularly large worksheet or in an especiallycomplex workbook (that is, whose data is flungacross several worksheets), you have to movedirectly to the place you need to go. This can involvemoving from one end of a table or list of data to theother, from one cell range to the next, or even fromone sheet to the next. Scrolling through the columnsand rows of any given sheet or clicking sheet tabafter sheet tab to find your place in these kinds ofspreadsheets is just plain inefficient.

    Leaping through data ranges and hopping over blanks

    This first procedure enables you to

    Leap from end to end in a long table or list ofdata.

    Hop from the end of one occupied cell range tothe next over all the blanks in between.

    How this works is that if the cell pointer is locatedon a blank cell and you hold down Ctrl as you pressan arrow key, the cell pointer jumps to the next cellin the direction of the arrow key that contains anytype of entry. (You can also do this by pressing theEnd key and an arrow key the only difference hereis that you have to release the End key before youpress Enter.) Alternately, if the cell pointer is locatedon a cell that has some sort of entry and you pressCtrl plus an arrow key (or End, arrow key), the cellpointer jumps in the direction of the arrow to thelast cell containing an entry followed by a blank cell.

    Figures 9-1 through 9-4 illustrate this kind of blank-to-occupied, occupied-to-occupied leapfrogging. InFigure 9-1, the cell pointer is in cell A2, a blank cell.

    11_574272 ch09.qxd 10/1/04 10:37 PM Page 48

  • Going Direct 49

    before the blank cell in A10. When I press Ctrl+again, Excel jumps the cell pointer down to cell A16(see Figure 9-4), the first occupied cell after theblanks in that column.

    Figure 9-3: Pressing Ctrl+ again moves the cell pointerdown to A9 the first occupied cell before ablank.

    Figure 9-4: Pressing Ctrl+ again moves the cell pointerdown to A16 the first occupied cell afterthe blanks.

    In navigating the sample worksheet shown in Figures 9-1 through 9-4, I could go on in this manner leaping from one occupied cell to the next and hopping over all the blanks in between.

    Of course, if you happen to be in the very last occu-pied cell in a particular column or row and then usethe Ctrl+arrow key combination again, Excel jumpsto the very last worksheet cell in that direction inthat column or row (that is, column IV when youpress Ctrl+, column A when you press Ctrl+, row65536 when you press Ctrl+, and row 1 when youpress Ctrl+).

    Before inserting new rows or columns in aworksheet with which youre not totally famil-iar, press Ctrl plus the appropriate arrow keyto make sure that no hidden data ranges willbe split by your insertion. If the cell pointershoots to the very first or last column or rowof the sheet, you know the way is clear.

    Going right to the last cell in a sheet

    When youre building a new spreadsheet that hasonly one table in it, you can use the keystroke short-cut Ctrl+End to zip right to the last cell in the sheet.This keystroke shortcut jumps you right to the endof the occupied regions in your worksheet, enablingyou to identify open areas in the sheet where youcan build new tables and lists of data.

    Understand, however, that the last cell of a work-sheet can be, and often is, itself blank. This isbecause Excel defines the last cell in any given work-sheet as the one that lies at the intersection of thelast occupied row and column and considers a rowor column to be occupied if any of its cells have datain them.

    As Figure 9-5 illustrates, the last cell of the sheet isblank whenever youve made any entries in the lastoccupied column even when your data entries dont

    11_574272 ch09.qxd 10/1/04 10:37 PM Page 49

  • Technique 9: Navigating the Worksheet in a Snap50

    To help you get quickly to the sheet you need in aspreadsheet that utilizes many sheets (more thanthe default three), you can rely on the Sheet Tabscrolling buttons (see Figure 9-6) to bring the work-sheet you want to work with into view so you canactivate it:

    Click the Next Group button to bring the nextgroup of sheet tabs into view in the area betweenthe Sheet Tab scrolling buttons and the horizon-tal scroll bar.

    Click the Last Tab button to bring the last groupwith the books final sheet tab into view in thisarea.

    Figure 9-6: Using the Sheet Tab scrolling buttons to scrollthrough the sheets of a workbook.

    You can display more sheet tabs by decreasingthe size of the horizontal scroll bar; just posi-tion the mouse pointer at the beginning of thehorizontal scroll bar and then, when thepointer takes the shape of a split double-headed arrow, drag to the right.

    Dont forget that scrolling a sheet tab intoview is not the same as selecting it: You stillneed to click the sheet tab to activate thesheet.

    If you dont need to make a big jump between thesheets in your workbook, you can move quickly fromsheet to sheet by pressing the Ctrl+Page Down andCtrl+Page Up keystroke shortcuts. Press Ctrl+Page

    First tab

    Previous group

    Next group

    Last tab

    yet extend down to the last occupied row. The lastcell also is blank if youve made any entries in thelast occupied row of the sheet but havent made itall across to the last occupied column.

    Whereas the last cell that Excel takes you to when you press Ctrl+End constantlychanges when you expand the data ranges inthe sheet, the first cell the program takes youto when you press Ctrl+Home is always A1 ofwhatever sheet is active.

    Figure 9-5: Pressing Ctrl+End takes you directly to thelast cell in the sheet.

    Zipping through the sheets

    Its bad enough trying to find your place in a spread-sheet containing data spread all over a single work-sheet, but its even worse when youre dealing with aspreadsheet whose data is parsed out over severalworksheets. (Dealing with more than two worksheetscan be a real nightmare.) Nevertheless, many spread-sheets benefit greatly from a multisheet layout especially those that consolidate data from manytime periods or that contain schedules of data thatare used as lookup tables referred to by formulas inthe main sheet.

    11_574272 ch09.qxd 10/1/04 10:37 PM Page 50

  • A Little Go To Magic 51

    Down to activate the next sheet in the workbook,and press Ctrl+Page Up to activate the previous one.The great thing about these keystroke combinationsis that they not only bring the sheet tab into viewbut also automatically activate the sheet at the sametime!

    A Little Go To MagicI find that a lot of users forget that the Excel Go Tofeature is a great way to go directly to a particularcell range in the spreadsheet. This is probablybecause many users dont bother to assign names totheir cell ranges see Technique 26 for details which is really what makes using Go To worthwhile.

    To use the Go To dialog box, follow these steps:

    1. Press F5 or Ctrl+G (or choose EditGo To).Excel opens a Go To dialog box similar to the oneshown in Figure 9-7.

    2. Enter the address of the cell you want to go to(such as E150 or AB20) in the Reference textbox, or if your spreadsheet contains rangenames, select the name of the range in the Go To list box. Then click OK.

    If you enter a cell address, Excel positions thecell pointer in that cell. If you select a rangename, the program selects all the cells in therange, making the first cell in that range theactive one.

    After you use the Go To feature to jump to a particu-lar cell or cell range, the Reference text box showsthe address of the active cell from which youjumped. This means that if you decide that you wantto return to the cell you originally came from, all youhave to do is press F5 (or Ctrl+G) and then immedi-ately press Enter you dont even need to take timeto examine the contents of the Go To dialog box.

    Figure 9-7: Using the Go To dialog box to jump directlyto a new cell in the worksheet.

    After you use the Go To feature to return to the cell that marked your original starting point, theReference text box shows the address of the cell orrange that you originally jumped to. This meansthat, if you change your mind yet again and decidethat you want to revisit the cell or range you origi-nally jumped to, you can do so by pressing F5 (orCtrl+G) and then immediately pressing Enter.

    You can, in fact, bounce back and forth from sourceto destination and then from destination back tosource with F5, Enter, F5, Enter, as long as you needto compare and go back and forth between the tworegions of the spreadsheet. And whenever you needto head over to a new region, just enter a new celladdress in the Reference text box or select a newrange name for it.

    The great thing about using Go To with cellrange names is that Excel whisks you backand forth not only between separate regionsin the same worksheet but also betweenregions on separate worksheets.

    11_574272 ch09.qxd 10/1/04 10:37 PM Page 51

  • Technique 9: Navigating the Worksheet in a Snap52

    Figure 9-8: Zooming out to 15% magnification revealsthe location of a second table of data and anembedded chart.

    Figure 9-9: Resetting the cell pointer and zooming backto 100% magnification.

    Zooming Out to Get the Big PictureThe last procedure for finding your desired place ina worksheet and getting there is a visual one. Hereare the general steps you follow:

    1. Use the Zoom feature to zoom out on the work-sheet until you can see the cell range or embed-ded chart you want to work with.

    2. Click somewhere in the range or chart to setthe cell pointer in it.

    3. Use the Zoom feature to zoom in on the newregion so you can read and work with its data.

    Figures 9-8 and 9-9 illustrate how you can make thiswork. First, I zoomed out on the work by setting themagnification to 15% of normal (by entering 15 intoZoom buttons text box on the Standard toolbar). Asyou see in Figure 9-8, doing this made all the data inthe table in the initial cell range A1:R15 completelyillegible while at the same time revealing the loca-tion of two additional items on the worksheet anembedded chart in the cell range J92:P112 andanother table of data in the cell range R92:AJ104.

    To get directly to the table in the range R92:AJ104and be able to edit its data, I clicked the cell pointeron cell U104 while the sheet was still in 15% magnifi-cation. Then I increased the magnification back tonormal (by selecting 100% in the Zoom buttons pop-up menu on the Standard toolbar), as shown inFigure 9-9.

    After hunting a cell range in this manner, I immediately assign a name to the range (see Technique 26) so that afterwards I canreturn to the range with the Go To feature(see A Little Go To Magic, earlier in this tech-nique, for details).

    11_574272 ch09.qxd 10/1/04 10:37 PM Page 52

  • 10 Making the MostEfficient CellSelectionsBecause cell selection is one of the most basic and regularly per-formed worksheet task, knowing how to efficiently select ranges ofcells in the spreadsheet can go a long way toward making you atruly effective worker. Cell selection, while rudimentary, is still veryimportant to taking a lot of the drudgery out of spreadsheet work. Afterall, selecting cells is the thing you have to do before you can assign newformatting and alignment; move, copy, or reorient the data; and print spe-cific parts of the spreadsheet.

    Before going over some of the fancier and more grandiose procedures for selecting cells in a worksheet, you might want to review the two basic procedures for using a mouse to select single cell ranges in theworksheet:

    Click the first cell in the range and then drag the thick, white-crosspointer to the last cell.

    Click the first cell in the range, and then hold down the Shift key asyou click the last cell you want to select (a procedure known asShift+clicking).

    To select multiple, nonadjacent cell selections at a time (also known as anoncontiguous cell selection), you follow these steps:

    1. Select the first cell range with your mouse as usual.2. Hold down the Ctrl key as you use your mouse to select the second


    When you hold down the Ctrl key as you start to select the secondrange, Excel does not deselect the first range as it normally would so this first range continues to be highlighted (shaded) in the worksheet, as shown in Figure 10-1.

    3. Repeat Step 2 as needed to select all additional ranges that need tobe included in the noncontiguous cell selection and then releaseboth the Ctrl key and the mouse button at the same time.


    Save Time By Selecting ranges with


    Selecting ranges with Go To

    Selecting entire columns,rows, or sheets

    12_574272 ch10.qxd 10/1/04 10:37 PM Page 53

  • Technique 10: Making the Most Efficient Cell Selections54

    4. Repeat Steps 2 and 3 until you select all theranges you want included in the noncontiguouscell selection.

    AutoSelect at Your ServiceAutoSelect is a great timesaving feature that enablesyou to select an entire table of data as a single cellselection in a couple of double-clicks of the mouse.To use AutoSelect to select your table, follow thesefew steps:

    1. Position the mouse pointer in the first cell inthe table of data you want to select.

    Note that for this procedure to work, the columnsand rows of the table must not contain blanks.

    2. Position the mouse pointer somewhere alongthe bottom border of the cell pointer and then,when the mouse pointer changes to an arrow-head pointing to crisscrossed double-headedarrows (as shown in Figure 10-2), hold downthe Shift key and double-click the mouse.

    Figure 10-2: Getting ready to select the first column ofthe table.

    If you forget to hold down the Shift key beforeyou double-click, the cell pointer just jumps tothe last occupied cell in the column withoutextending the cell selection.

    Figure 10-1: Selecting two cell ranges as part of anoncontiguous cell selection.

    Keep in mind that you can also use the keyboard toselect cell ranges. After moving the cell pointer tothe first cell in the range, hold down the Shift key asyou press the appropriate cursor key (an arrow keyor Page Up or Page Down). Holding down the Shiftkey anchors the cell range on the first cell andenables the program to extend the range when youpress a cursor key. If you find holding down the Shiftkey too tiring, you can anchor the cell range on thecurrent cell by pressing F8 that puts the programinto EXT (Extend) mode.

    When selecting a range of cells that containsequential data via the keyboard, you canreally save time by combining the Ctrl+arrowkey trick to hop from one end of a table ofdata to the other with the Shift key. By press-ing Ctrl+Shift+arrow key, Excel selects fromthe current cell all the way to the last occupiedcell in the arrows direction in one fell swoop.

    To select a noncontiguous range with the keyboard,you follow these steps:

    1. Position the cell pointer in the first cell of thefirst range to select, press F8 to put the pro-gram in EXT mode, and then select the rangewith the cursor keys.

    2. Press Shift+F8 to switch the program into ADDmode and then move the cell pointer to thefirst cell of the second range you want to select.

    3. Press F8 again to switch back into EXT modeand then select this second range with the cur-sor keys.

    12_574272 ch10.qxd 10/1/04 10:37 PM Page 54

  • Go To It and Select It 55

    3. Position the mouse pointer somewhere alongthe right edge of the current cell selection andthen, when the mouse pointer changes to anarrowhead pointing to crisscrossed double-headed arrows as shown in Figure 10-3 hold down the Shift key and double-click themouse a second time.

    Figure 10-3: Extending the cell selection down the firstcolumn of the table with AutoSelect.

    After you double-click the right edge of the firstcell selection (while holding down the Shift keyto extend it), Excel extends the cell selection toinclude all the columns of data in the table, stop-ping automatically at the first blank row in theworksheet (see Figure 10-4).

    Figure 10-4: Extending the cell selection across the tablewith AutoSelect.

    Go To It and Select ItIn Technique 9, I outline how you can use ExcelsGo To feature to jump instantly to anywhere in the

    current worksheet. At that time, I also suggest thatyou go out of your way and give names to the cellranges (as outlined in Technique 26) that you rou-tinely use in a spreadsheet.

    One reason why I keep harping about this is becausegiving names to cell ranges enables you to use theGo To feature to instantly select the entire rangewhenever you need to refer to it. (This little tidbit isworth its weight in gold when it comes to a cellrange in a spreadsheet that you routinely need toprint out.) For example, in the table of data shown inthe cell range B3:E8 shown in Figure 10-5, I assignedfive range names:

    data_table to the cell range B3:E8 to select theentire table of data

    first_col to the cell range B3:B8 to select only thefirst column of data

    second_col to the cell range C3:C8 to select justthe second column of data

    third_col to the cell range D3:D8 to select justthe third column of data

    fourth_col to the cell range E3:E8 to select onlythe last column of data

    Figure 10-5: Selecting a cell range by choosing its rangename in the Go To dialog box.

    12_574272 ch10.qxd 10/1/04 10:37 PM Page 55

  • Technique 10: Making the Most Efficient Cell Selections56


    Current worksheet Press Ctrl+A or click thesquare formed by the inter-section of the column androw headers.

    All worksheets in the Right-click the tab of the workbook active worksheet and then

    choose Select All Sheets.

    Sequential worksheets Click the tab of the first sheetand then hold down the Shiftkey as you click the tab of thelast worksheet to select.

    Nonsequential worksheets Click the tab of the first sheetand then hold down the Ctrlkey as you click the tabs ofthe other worksheets toselect.

    Single column Click the letter of the columnin the column header.

    Sequential columns Click the first columns letterin the column header. Thendrag through the letters ofthe other columns to the leftor right, or press Shift+ orShift+.

    Nonsequential columns Click the first columns letterin the column header andthen hold down the Ctrl keyas you click the letters of theother columns.

    Single row Click the rows number in therow header.

    Sequential rows Click the first rows number inthe row header. Then dragthrough the other numbers ofthe other rows up or down, orpress Shift+ or Shift+.

    Nonsequential rows Click the first rows number inthe row header and then holddown the Ctrl key as you clickthe numbers of the otherrows.

    After assigning the range names, selecting the entiretable of data (for printing or for formatting) fromanywhere in the workbook (I dont have to be on thesame worksheet), takes only two steps:

    1. Press F5 or Ctrl+G to open the Go To dialog box.2. Select the range name you want (data_table,

    for example) in the Go To list box and thenclick OK.

    Note that although using the Go To feature to selectnamed cell ranges is by far the easiest way to do it,you can use this feature to select a range of cells byentering the address of the first and last cell in therange in the Go To dialog box as follows:

    1. Press F5 or Ctrl+G, and then enter the addressof the first cell in the range to be selected inthe Reference text box and click OK.

    2. Press F8 to switch Excel into EXT (Extend)mode.

    3. Press F5 or Ctrl+G, and then enter the addressof the last cell in the range to be selected in theReference text box and click OK.

    4. Press F8 to switch Excel out of EXT mode andback into Ready mode.

    Dont forget the last step of this Go To proce-dure, or youll really think Excel has gone haywire when any move you make in theworksheet continues to highlight interveningcells.

    Going for the Big SelectionsIn addition to being able to select single and multiplecell ranges in a worksheet, you also need to beaware of some tricks for quickly making big selec-tions, including selecting entire columns, rows, and,yes, even the entire worksheet. Table 10-1 gives youan overview of this very handy information.

    12_574272 ch10.qxd 10/1/04 10:37 PM Page 56

  • Going for the Big Selections 57

    When you select multiple worksheets, Excelgoes into Group mode (indicated by [Group]after the filename on the title bar). In Groupmode, all the data entry, formatting, and edit-ing you do in the active sheet is simultane-ously performed in the other selected sheetsas well.

    12_574272 ch10.qxd 10/1/04 10:37 PM Page 57

  • 11Save Time By Setting your AutoCorrect


    Turning off the hyperlinksto Internet and networkpaths

    Modifying the smart tagsettings


    Speeding ThroughLong Data Entrieswith AutoCorrect

    AutoCorrect is Excels attempt to save you time when doing dataentry in a spreadsheet. It anticipates what you enter and, if neces-sary, corrects it or converts it into special types of data such aslive hyperlinks and smart tags data recognized as being of a particularkind, such as Wall Street financial symbols and personal names. TheAutoCorrect feature in Excel encompasses three areas:

    AutoCorrect: Automatically corrects common spelling errors when-ever you make them in cell entries

    AutoFormat As You Type: Automatically turns Web addresses and net-work paths into live hyperlinks and expands data lists when you add anew record to them

    Smart Tags: Enables you to control all the smart tag settings, includingchecking the workbook for data that Excel identifies as a type of smarttag, controlling the appearance of the Smart Tag indicator in the work-sheet cells, looking online for more smart tag applications, and makingthe smart tags identified in your spreadsheet a permanent part of theworkbook file by embedding them in it

    Setting the Correct AutoCorrect SettingsThe AutoCorrect options can save you a great deal of spell-checking time,especially if you go to the trouble of adding your own common typos tothe ones that the feature is already set to take care of. When you firstopen the AutoCorrect dialog box (ToolsAutoCorrect Options) andselect its AutoCorrect tab (see Figure 11-1), Excel activates all the checkbox settings that dispose of many common typing errors such as typingwith the Caps Lock key on or failing to capitalize the days of the week orthe beginning of a sentence.

    13_574272 ch11.qxd 10/1/04 10:27 PM Page 58

  • Losing the Links 59

    Figure 11-1: Entering new replacements for theAutoCorrect feature.

    The program also selects the Replace Text As YouType check box that activates all the automatic cor-rections contained in the list box below. If you dontwant to use one of these readymade corrections(such as automatically turning three periods in arow into a real live ellipsis), simply select the entryin the list box and then click the Delete button to getrid of it.

    If you have a tendency to make a certain typo thatsnot already included on the list, you can add it byentering the typo in the Replace text box and theautomatic replacement in the With text box and thenclicking Add.

    If you have certain abbreviations that shouldntbe capitalized or special terms with more thanone capital letter at the beginning that youroutinely use in your spreadsheets, instead ofdeactivating the AutoCorrect settings that oth-erwise change them, use the Exceptions but-ton to add the particular abbreviations orterms to either the lists of First Letter or INitialCAps exceptions that the program then leavesalone.

    Losing the LinksExcel has this nasty tendency to automatically turnany cell entry that looks like a Web address, ane-mail address, or a path to a network folder into alive hyperlink. If you then click this link (even byaccident), Excel attempts to open the Web page,e-mail message program, or Windows Explorer withthe network folder. Now, this is not good, becauseyou can end up online (especially if your computeris connected to the Internet as part of its network oruses some sort of wireless connection) when all youintended to do was click a cell to select it!

    Fortunately, you can stop Excel from making allthese addresses hot by taking these steps:

    1. Choose ToolsAutoCorrect Options to open theAutoCorrect dialog box.

    2. Select the AutoFormat As You Type tab.3. Deselect the Internet and Network Paths with

    Hyperlinks check box (as shown in Figure 11-2)and then click OK.

    Figure 11-2: Turning off the automatic hyperlinks setting.

    13_574272 ch11.qxd 10/1/04 10:27 PM Page 59

  • Technique 11: Speeding Through Long Data Entries with AutoCorrect60

    the Smart Tag Actions button (the one with the ienclosed in a circle) that appears to the right of theindicator and click its drop-down button.

    If smart tags sound like something that would onlycomplicate your life unnecessarily, you simply needto make sure that the smart tags option is turned off.To do this, select the Smart Tags tab in theAutoCorrect dialog box (ToolsAutoCorrectOptions), and then make sure that the Label Datawith Smart Tags check box is deselected before youclick OK.

    If, however, smart tags seem like something thatmight well enhance your work, you do just the opposite:

    1. On the Smart Tags tab of the AutoCorrect dia-log box, select the Label Data with Smart Tagscheck box, and then in the Recognizers listbox, select the check boxes for the smart tagprograms you want to activate. (See Figure 11-3.)

    Figure 11-3: Modifying the smart tag settings.

    If you have a worksheet that already containshot links and you want to deactivate them,you need to right-click each link and chooseRemove Hyperlink from the menu thatappears.

    Taming the Smart TagsDepending upon the type of work you do with Excel,the Smart Tags feature may appear to you to beeither one of the most brilliant or one of the mostuseless program features. The way smart tags workin Microsoft Office applications such as Word andExcel is that the programs scan their documentslooking for particular types of entries (called recog-nizers) to which it can affix a specific type of smarttag program. For example, Excel comes with threesmart tag programs, one for dealing with dates,another for dealing with financial symbols used byWall Street, and a third for dealing with personalnames:

    The Date smart tag program enables you to openyour Microsoft Outlook calendar right to thedate contained in the cell (assuming the date isone that the calendar program covers).

    The Financial Symbol smart tag program enablesyou to get an online stock quote for the companyin question from MSN Money.

    The Person Name smart tag program enablesyou to add people to your Outlook Contacts list,send an e-mail message to them, or schedule ameeting with them.

    When Excel identifies an entry for a particular smarttag program, it inserts a Smart Tag indicator in thelower-right corner of its cell the indicator initiallyappears as a small purple triangle. To select one ofthe actions offered by a particular smart tag pro-gram, position the mouse pointer over its smart tagindicator and then position the mouse pointer over

    13_574272 ch11.qxd 10/1/04 10:27 PM Page 60

  • Taming the Smart Tags 61

    2. If you want to suppress the appearance of thesmart tag indicators in the recognized cells,choose None or Button Only from the ShowSmart Tags As drop-down list.

    3. If you want to be able to save smart tags as partof the workbook file, select the Embed SmartTags in This Workbook check box.

    4. When youre finished making your selections,click OK.

    13_574272 ch11.qxd 10/1/04 10:27 PM Page 61

  • 12Save Time By Entering the same value

    in multiple cells

    Constraining entries to asingle range

    Working in Group mode


    Data Entry Tricks

    Lets face it: Data entry, while one of the most important spreadsheettasks you do, is also often one of the most tedious. The tips in thistechnique (especially when coupled with those in Techniques 13,14, and 15) are designed to take some of the drudgery out of doing dataentry by helping you work more efficiently and, at the same time, moreaccurately.

    These tips include

    Taking advantage of Excels ability to enter the same entry in multiplecells or cell ranges in one operation.

    Constraining data entry to a preselected cell range. (This one appliesonly when youre creating a standard table of data and you knowbeforehand how many columns and rows it takes up.)

    Doing simultaneous data entry in multiple worksheets of the sameworkbook by working in Group mode. (This one applies only tospreadsheets that use multiple worksheets, all of which share a com-mon layout and data.)

    Making the Same Entry in Many PlacesMany spreadsheets use the same column or row headings even thesame values over and over again. When you know ahead of time thatyou need to enter the same label or value in many cells in the same work-sheet, you can do this by following these simple steps:

    1. Select all the cells and cell ranges that require the same entry as anoncontiguous cell selection. (See Technique 10 if you need helpdoing this.)

    2. Type the label or value into the active cell of the noncontiguous cellselection.

    14_574272 ch12.qxd 10/1/04 10:38 PM Page 62

  • Putting the Wraps on the Data Entry 63

    Pause for a second after entering the data in theactive cell and resist the natural temptation tocomplete this entry by pressing the Enter key orclicking the Enter box on the Formula bar.

    The third and last step in this procedure is crit-ical to entering the data in all the selected cellsrather than in just the active one.

    3. Press Ctrl+Enter to complete the data entry,entering it in every cell in the noncontiguouscell selection.

    Figures 12-1 and 12-2 illustrate how this procedureworks. In Figure 12-1, I need to enter Rock as the firstmusic category for both CDs and Cassettes in cellsA4 and A10. To make this entry at the same time inboth cells, I first select them as a noncontiguous cellselection and then type Rock into the active cell A10.

    Figure 12-1: Getting ready to make the same entry in thetwo selected cells by pressing Ctrl+Enter.

    To complete the data entry in both cells A4 and A10,I must remember to press Ctrl+Enter rather than justpress the Enter key alone or click the Enter buttonon the Formula bar. Figure 12-2 shows the worksheetafter I press Ctrl+Enter to insert Rock in both cellsA4 and A10.

    Figure 12-2: The worksheet after entering the samecategory entry in both selected cells in oneoperation.

    Before collapsing the cell selection containingthe same entry, apply any formatting commonto the entries. In my example, I indented bothRock category entries by clicking the IncreaseIndent button on the Formatting toolbarbefore dispensing with the noncontiguous cellselection.

    Putting the Wraps on the Data EntryOne of the most efficient ways to enter data into anew table in your spreadsheet is to preselect therange with the blank cells where you need to enterthe data before you start doing any data entry. Thereason that preselecting the blank cell range worksso well is that in so doing, you constrain the cellpointer to that range provided you press only thekeystrokes shown in Table 12-1 to complete the dataentries and to move the cell pointer within therange. This frees you from having to pay any atten-tion to repositioning the cell pointer when enteringthe table data. That way, you can keep all your atten-tion where it should be on the printed copy fromwhich youre taking the data.

    14_574272 ch12.qxd 10/1/04 10:38 PM Page 63

  • Technique 12: Data Entry Tricks64

    enter the last column heading Sales Price in cell E3.To get to this point, Ive already entered the tableheading in A2 (the first cell of the selected cellrange) by pressing the Enter key. Doing so reposi-tioned the pointer down one row in cell A3. I thencompleted each column heading entry in cells A3,B3, C3, and D4 across row 3 by pressing the Tab key,which automatically advances the cell pointer onecolumn to the right upon data entry completion.

    Figure 12-3: Entering column headings across the rowwith Tab in the preselected cell range A2:E9.

    When I press Tab again to insert the Sales Price col-umn heading in cell E3 the last column of theselected cell range Excel automatically advancesthe cell pointer down one row to cell A4 (see Figure12-4), the first column of the selected range.

    Figure 12-4: Sales table after entering the last columnheading in E3 and pressing Tab.

    At this point, I want to switch the direction of mydata entry, preferring to enter the Code numbersdown each column by pressing Enter (instead of


    When You Press This The Cell Pointer Moves Here

    Enter Down each row and then rightacross the remaining columns ofthe selected range. (Moves one column to the right, same as Tabwhen the selection consists of asingle row.)

    Shift+Enter Up each row and then left acrossthe remaining columns of theselected range. (Moves one columnto the left when the selection con-sists of a single row.)

    Tab To the next column right and thento the beginning of the next rowdown in the selected range. (Movesdown one row when the selectionconsists of a single column, sameas Enter.)

    Shift+Tab To the next column left and then tothe beginning of the row above inthe selected range. (Moves up onerow when the selection consists ofa single column, same asShift+Enter.)

    Ctrl+period (.) From one corner to the next cornerof the selected range, in a clock-wise direction.

    When entering data in a preselected range,you must not press an arrow key to completeany of the entries, or youll end up collapsingthe cell selection at the same time you put thenew entry in the current cell.

    Figures 12-3 and 12-4 illustrate how doing data entryin a preselected cell range works. In these figures,Im constructing a simple table that will list the salesprices for furniture in the upcoming spring sale.

    In Figure 12-3, I have reached the end of the dataentry for the second row of the table the one con-taining the column headings and Im just about to

    14_574272 ch12.qxd 10/1/04 10:38 PM Page 64

  • Lets Do It as a Group! 65

    Tab) to complete their entries. When I reach cell A9in the last row of the cell selection and press Enterto complete its entry, Excel automatically advancesthe cell pointer to B2 the top row of the next col-umn. After pressing the Enter key twice to movedown this row to the blank cell in B4, Im all set toenter the description of the piece given the CodeNumber 12-305 (its a 36-inch round table).

    I continue along in this manner entering the furni-ture descriptions down the rest of column B, theretail prices down column C, and the discount per-centages down column D. After that, to complete the table, I click E4 (which collapses the cell selec-tion to just that cell) and enter the master formulathat calculates the spring sale price (using thetables retail price and discount amount), which I then copy down the rest of the column usingAutoFill. (See Technique 13.)

    Lets Do It as a Group!When you select more than one worksheet at a time(see Technique 10), Excel goes into what is calledGroup mode (indicated by the appearance of[Group] after the filename on the title bar of theExcel window). When the program is in Group mode,any entry you make in the active worksheet is alsomade in all the other selected sheets.

    You can put this Group feature to good use whenbuilding spreadsheets that naturally use multipleworksheets and which require the same entries inthe same cells of each sheet. For example, supposeyoure creating a spreadsheet that tracks sales overthe 12 months of the current fiscal year and youwant to put each of the 12 monthly sales tables on aseparate worksheet (because this makes it so mucheasier to consolidate their data when you want tocreate a table showing the total annual sales). Eachtable requires the same row and column headingsand will occupy the same region of cells on its sheet.

    Rather than enter all the column and row headingsfor the initial sales table on the first worksheet andthen copy these headings to the other 11 worksheets,a quicker way is to select all 12 worksheets, and thenjust by entering the headings in the active worksheet,youre also entering them in all the other selectedsheets.

    Figure 12-5 illustrates how this works. To begin thisnew workbook, I added nine additional worksheetsto the default three. Next, I selected all 12 sheets (by right-clicking the tab of Sheet1, the active sheet,and then selecting Select All Sheets on its shortcutmenu). This puts the program into Group mode sothat the common worksheet title and all row head-ings that you see in this figure are not only enteredinto cell B1 and the range A3:A14 in Sheet1 but in allthe other 11 selected sheets as well.

    Figure 12-5: Entering the same column and row headingsin each of the selected sheets in Groupmode.

    Figure 12-6 confirms the fact that Group editing reallyworks. (I swear no special effects were used in thetaking of this screen shot.) For this figure, I clickedthe tab for Sheet10. Doing this not only immediatelydeselected all the other sheets and switched the pro-gram out of Group mode but instantly revealed that

    14_574272 ch12.qxd 10/1/04 10:38 PM Page 65

  • Technique 12: Data Entry Tricks66

    Figure 12-6: Sheet10 now contains the same entries that Imade in Sheet1 (refer to Figure 12-5) thanksto Group editing.

    this worksheet contains exactly the same headingsthat I entered in Sheet1. (Refer to Figure 12-5.) Theonly difference between the two screen shots is that,before taking Figure 12-6, I had the good sense tostop and save the workbook so that there was nodanger that I could lose this data and have to gothrough this Group editing procedure again.

    Selecting another worksheet while in Groupmode immediately deselects all but the newactive worksheet and switches you back intonormal, single-sheet editing mode. Therefore,dont stop to check the entries on anothersheet until youve completed all the commondata entry, at which time you can ungroup thesheets (by right-clicking a sheet tab in thegroup and selecting Ungroup Sheets). Thenselect the individual sheets to display theirdata by selecting their sheet tabs.

    14_574272 ch12.qxd 10/1/04 10:38 PM Page 66

  • 13 Speeding Up DataEntry with AutoFillOnce in a blue moon, a software feature comes along thats sohandy that you wonder how you ever got along without it. ExcelsAutoFill feature is that kind of spreadsheet innovation for me.Here, for once, is some Microsoft Intelli-sense that actually does makesome sense because it is a real timesaver.

    With AutoFill, you can fill out a sequential series of entries (such asmonths of the year or days of the week) across a row or up or down acolumn simply by entering the first entry in the series and then draggingthe cell pointer by its Fill handle the tiny black square that appears inthe lower-right corner of the active cell. In addition, you can have Excelincrement the entries in the series by values other than just one (be itone day, one month, or one number). And as if that isnt enough, Excelalso enables you to create your own custom fill lists that tell Excel howto fill in a list whenever you enter one of its unique members and then gofor the Fill handle.

    All three of these procedures are covered in this technique on AutoFill,which is undoubtedly one of my favorite Excel features.

    You also use this same AutoFill feature to extend formulas in thetables in your spreadsheet. When using AutoFill to copy formulas, thefeature naturally adjusts its cell references instead of generating asequential series see Technique 24 for details.

    Getting Your Fill of AutoFillStraight out of the box, AutoFill is about as versatile and easy to use asany Excel feature can be. Table 13-1 shows the kinds of initial entries youcan make with examples of the kind of series that they generate when you drag the Fill handle across or down new cells. As you can seefrom the examples shown in this table, Excel can create a fairly widearray of sequential date and time series as well as some highly individualones (for item and code numbers), all of which dont require you to cus-tomize the feature whatsoever.


    Save Time By Filling in commonly used


    Filling with differentincrements

    Creating custom fill lists

    15_574272 ch13.qxd 10/1/04 10:39 PM Page 67

  • Technique 13: Speeding Up Data Entry with AutoFill68

    Figure 13-1: Using AutoFill to generate the series ofmonths from an initial January entry incell A2.

    Figure 13-2 shows the new worksheet with the 12-month series after I released the mouse button.Notice the appearance of the AutoFill Options but-ton to the right of the Fill handle.

    Figure 13-2: Series of months created after dragging theFill handle down to cell A13 and releasingthe mouse button.


    Initial Value Series Created by AutoFill in the NextThree Cells

    September October, November, December

    Sep Oct, Nov, Dec

    Monday Tuesday, Wednesday, Thursday

    Fri Sat, Sun, Mon

    3/13/1999 3/14/1999, 3/15/1999, 3/16/1999

    4-Jan 5-Jan, 6-Jan, 7-Jan

    Dec-04 Jan-05, Feb-05, Mar-05

    8:00 AM 9:00 AM, 10:00 AM, 11:00 AM

    11:03 12:03, 13:03, 14:03

    Quarter 1 Quarter 2, Quarter 3, Quarter 4

    Qtr 4 Qtr 1, Qtr 2, Qtr 3

    Q2 Q3, Q4, Q1

    40 Mill Road 41 Mill Road, 42 Mill Road, 43 Mill Road

    00945 00946, 00947, 00948

    L17-800 L17-801, L17-802, L17-803

    When you drag the Fill handle over the nextcell, you can tell right away what kind ofsequential series your initial entry will gener-ate. The ToolTip trailing the mouse pointershows you right away the next item in thesequence that Excel is creating.

    Figures 13-1 and 13-2 illustrate the use of the AutoFillfeature to generate a sequential series from an initialentry. In Figure 13-1, I entered January into cell A2and then dragged the Fill handle down column Auntil I reached cell A13. Note that Excel displays aToolTip next to the black cross pointer, which indi-cates that dragging down to cell A13 takes me fromJanuary through July and September all the way tothe month of December.

    15_574272 ch13.qxd 10/1/04 10:39 PM Page 68

  • Getting Your Fill of AutoFill 69

    The AutoFill Options button gives you accessto menu options that enable you to convert aseries in the fill range into copies of the initialvalue (and vice versa to convert copies into afilled series) as well as to fill the range with for-matting only or to fill the series without copy-ing the formatting of the initial cell. To suppressthe display of this button, deselect the ShowPaste Options check box on the Edit tab of theOptions dialog box (ToolsOptions).

    Using AutoFill to generate a sequentially numbered series

    As you may have noticed in the last two examples inTable 13-1, in initial entries that mix numbers andtext as in 40 Mill Road or entries whose num-bers are entered as labels rather than values as in00945 or L17-800 Excel is really good at identify-ing what number to increment.

    As a result, youd probably expect Excel to be an acewhen it comes to generating a sequentially num-bered series such as 1, 2, 3, 4, and the like (useful innumbering your data list records so that you canrefer to them and sort them by record number).Unfortunately, AutoFill falls flat on its face (can asoftware feature have a face?) when it comes todoing this. To prove it, all you have to do is enter thenumber 1 in any blank cell and then drag the Fillhandle over just a few blank cells in columns to theright or below to prove this point: Instead of generat-ing the simplest of sequentially numbered series (1, 2, 3, 4 . . .), Excel just stupidly copies the number1 to all the cells you drag through.

    Fortunately, Excel does provide a way to forceAutoFill (however reluctantly) to create a sequentialseries from an initial value rather than just copyingit everyplace you drag the Fill handle. The only prob-lem is that it requires the use of the Ctrl key, whichis used in other mouse operations (cell drag-and-drop, for instance) to switch to making a copy of theselected cells or objects. In this case, however,

    depressing the Ctrl key as you drag the Fill handleprevents Excel from copying the number and forcesit to generate a true sequentially numbered series.

    If you, like me, routinely forget to hold downthe Ctrl key and therefore end up with thesame number copied into a range of cells,select Fill Series on the pop-up menu attachedto the AutoFill Options button (which auto-matically appears on the cell pointers Fill han-dle as soon as you release the mouse button)to convert the copies into a bona-fide numericsequence, as shown in Figure 13-3.

    Figure 13-3: Converting a range filled with copies of thesame number into a sequential series.

    Copying an entry instead of filling in a series

    You can also use the Ctrl key to force Excel to copyan initial entry in the cell range you drag through inthose situations where Excel would otherwise usethe entry as the starting point for generating asequential series. Here, the association of the Ctrlkey with copying in drag-and-drop operations makesperfect sense (reinforced by the appearance of a tinyplus sign that appears above and to the right of theblack cross mouse pointer).

    Figure 13-4 illustrates how you can force Excel tocopy an initial entry in a cell range rather than use itto generate a new series. In this new worksheet, Ientered the column heading Module 5 in cell A2. Tocopy this heading across row 2 to the cell rangeB2:D2 (rather than generate the series Module 5,Module 6, Module 7, and Module 8), I hold down the

    15_574272 ch13.qxd 10/1/04 10:39 PM Page 69

  • Technique 13: Speeding Up Data Entry with AutoFill70

    to increment the months by three units rather thanone.) With that out of the way, I select both cells A2and B2 and then drag the Fill handle to the right tocell D2. As you can see from the ToolTip thatappears to the left of the black cross pointer in thisfigure, Excel will enter Mar in cell D2. If I release themouse button at this point, Excel will generate theseries Jun, Sep, Dec, Mar in the cell range A2:D2.

    Figure 13-5: Generating a series that uses every thirdmonth as its increment.

    Well, what about a sequential series that decreasesrather than increases (in other words, one that usesa negative increment)? To generate this kind ofseries with AutoFill, all you have to do is enter thelarger value in the first cell of the range to be filled,the smaller value (the one that exemplifies the nega-tive increment) in the next cell (either in the cell inthe column to the right if you want to generate theseries across the row or in the row below if you wantto generate it down the column). Select both cells the one with the entry showing the starting valueand the next one showing the amount of decrease and then drag the Fill handle to extend the series asfar as you want to go.

    For example, suppose I want to create a numericalseries going down column A starting in cell A2 witha value of 1000 that decreases by 100 units in eachcell below. To generate this decreasing series, youenter 1000 in cell A2 and 900 in cell A3. Then selectthe range A2:A3 before you drag the Fill handle downthe rows of the column. Excel then enters 800 in cellA4, 700 in cell A5, 600 in cell A6, and so on. (Notethat when you select the cells that demonstrate theincrement to use, Excel knows right away that youwant to generate a series, even when your entriesare purely numerical.)

    Ctrl key as I drag the Fill handle through this range.Note the presence of the plus sign above the blackcross mouse pointer, here correctly indicating thatExcel will make a copy rather than generate a series.

    Figure 13-4: Pressing Ctrl while dragging the Fill handleto force Excel to make copies rather thangenerate a series.

    You dont have to press the Ctrl key beforeyou drag the range of cells. You can convert afilled range into copies of the initial cell valueby pressing Ctrl after youve selected the fillrange as long as its before you release themouse button. After that, you have to click theAutoFill Options button and select Copy Cellson its pop-up menu to make this conversion.

    Incrementally SpeakingAs you may have noticed, whenever Excel gener-ates a series from an initial entry, it automaticallyincreases the series by an increment of one (be it by one day, one month, one hour, one minute, onewidget, you name it). Fortunately, the AutoFill featureis very teachable so that you arent stuck with alwaysgenerating a series that increases the base value byone. As long as you provide at least two entries thatexemplify how many units Excel is to increase (ordecrease) the entries in the series, you can generateseries with almost any kind of increments.

    Figure 13-5 illustrates how you generate a series thatuses an increment other than one unit. In this exam-ple, the increment is three, so Excel generates aseries that enters every third monthbeginnig withJune. To do this, I have to enter two samples: Jun incell A2 and Sep in cell B2. (This gives Excel the idea

    15_574272 ch13.qxd 10/1/04 10:39 PM Page 70

  • Fill Lists Made to Order 71

    Fill Lists Made to OrderExcel is quite capable of generating a new series onits own when the initial entry in the series (or firsttwo entries, when using an increment besides one)contains a numerical component that it can increaseor decrease. However, to have the program generatea series containing no numerical elements (such asthe days of the week: Monday, Tuesday, Wednesday,and so on), Excel needs to know beforehand all theitems in the series and their order.

    To do this, you create a custom list. When creating acustom list, you can have Excel generate it from acell range in a worksheet that already contains theitems, or you can enter the items manually. I suggestthat you have Excel create a new list from existingentries in the spreadsheet whenever possible. Thatway, you have a chance to proof the entries in theworksheet before you turn them into a custom list.

    To create a custom list from existing worksheetentries, follow these steps:

    1. Enter the entries for the custom list in theirproper sequence down a column or across arow of the active worksheet.

    2. Select the cell range containing the entries forthe custom list.

    3. Choose ToolsOptions to open the Options dialog box and then select the Custom Lists tab.

    When you open the Custom Lists tab after select-ing the cell range with these entries, this cellrange (in absolute values) appears in the ImportList from Cells text box. If this range is not cor-rect or you forgot to select it before opening theOptions dialog box, click in this text box andthen select the range in the worksheet. (Excelautomatically collapses the Options dialog boxas you drag through the cells.)

    4. Click the Import button.As soon as you click Import, Excel adds the listto the Custom Lists pane on the left and displaysall its entries in the List Entries pane on the

    right, as shown in Figure 13-6. You can then editthe individual entries in the List Entries box ifnecessary. (This is where you would type theentries for a new list that you create fromscratch before clicking the Add button.)

    5. Click OK to close the Options dialog box.

    After creating a custom list, you can then generatethe list across any row or up or down any columnsimply by entering the initial entry in a cell and thendragging the Fill handle in one of the four directions.Figure 13-7 illustrates how this works. Here, I gener-ated the custom list of cities created earlier from arange of cell entries (refer to Figure 13-6) in a newworksheet by entering the first city (Seattle) in cellA2 and then dragging the Fill handle to cell F2.

    Figure 13-6: Creating a custom AutoFill list from a rangeof existing entries.

    Figure 13-7: Generating the series of cities across row 2.

    15_574272 ch13.qxd 10/1/04 10:39 PM Page 71

  • 14Technique Ensuring AccurateData Entries withData ValidationThis technique acquaints you with a very versatile and, in the longrun, great timesaving feature that Excel calls data validation. Youuse this nifty feature to prevent the users of your spreadsheetsfrom ever getting a chance to enter the wrong type of data entry or atype thats not on your list (when dealing with labels) or within a tolera-ble range (when dealing with numbers) in critical cells of its worksheets.

    Not only can you restrict the types of data entries that you or any otherspreadsheet user can make, you can also add input messages to your val-idated cells that indicate what types of entries are permissible there. Asif this werent enough, you can also tag the validated cells with erroralerts that flash an alert symbol along with a custom message indicatingthe data entry rules for the current cell!

    Only the Valid Need ApplyThe heart and soul of the data validation feature is the Settings tab of theData Validation dialog box (DataValidation). The Settings tab, shown inFigure 14-1, is where you specify the criteria under which Excel considersany data entry made in the current cell to be kosher.

    The first control on the Settings tab is the Allow drop-down list box. Bydefault, this box is set to Any Value to allow you to do any type of dataentry in the current cell. To change all that anything-goes stuff by makingonly a certain type of entry permissible, select one of the other Allowoptions:

    Whole Number restricts data entry to a whole number that is equal to,greater than, less than, or within a range of numbers that you thenspecify.

    Decimal restricts data entry to a decimal number that is equal to,greater than, less than, or within a range of values that you then specify.

    Save Time By Setting up data validation


    Creating input messages

    Using error alerts

    16_574272 ch14.qxd 10/1/04 10:39 PM Page 72

  • Only the Valid Need Apply 73

    Figure 14-1: The Settings tab of the Data Validationdialog box is where you set the validationcriteria.

    List restricts data entry to one of the items on alist (whose items must already have been enteredin a range of cells in the worksheet). When usingthis Allow option, Excel enables you to createan in-cell drop-down list (with its very own tinydrop-down button) from which you or your userscan select the entry.

    Date restricts data entry to a date that is equalto, before, after, or within a range of dates thatyou then specify.

    Time restricts data entry to a time that is equalto, before, after, or within a range of times thatyou then specify.

    Text Length restricts data entry to a number ofcharacters that is equal to, greater than, lessthan, or within a range of numbers that you thenspecify.

    Custom restricts data entry to the parametersspecified by a Logical formula (one that evalu-ates to TRUE for allowable entries or FALSE forinvalid ones) thats already been entered into a

    cell of the worksheet to which you then refer.(See Technique 15 for an example of data valida-tion using the Custom setting.)

    By default, all data validation settings regardblank cells as valid. If you want to preventusers from leaving a cell blank, while at thesame time making their entries conform toyour other data validation criteria, clear theIgnore Blank check box on the Settings tab.

    Data entries from a list

    Enabling users to do data entry by selecting the datafrom an in-cell drop-down list is one of the most pop-ular uses for the data validation feature. Not onlydoes this type of data validation prevent users fromselecting an invalid entry, but it also enables them tomake a correct entry without having to do any typing.

    Figures 14-2 and 14-3 illustrate how you would usethe data validation List setting to create an in-cell drop-down list. In Figure 14-2, I started a newworksheet by entering a list of cities in cell rangeJ2:J7 (with the help of the AutoFill feature seeTechnique 13). This list represents the only validentries for the City column of my new Account RepAssignments table.

    Figure 14-2: Setting up a list of valid city entries for thenew table of account rep assignments.

    16_574272 ch14.qxd 10/1/04 10:39 PM Page 73

  • Technique 14: Ensuring Accurate Data Entries with Data Validation74

    Copying data validation settings

    After assigning your data validation criteria to a par-ticular cell, you can then copy these criteria to allthe cells in the vicinity that need to use the samerestrictions. To do this, you follow these steps:

    1. Copy the cell with the data validation to theClipboard.

    (Choose EditCopy or press Ctrl+C.)

    2. Select the cell range into which to copy thedata validation criteria.

    3. Choose EditPaste Special or to open the PasteSpecial dialog box.

    4. Click the Validation option button (see Figure 14-4) and click OK.

    Figure 14-4: Copying the data validation criteria down thecolumn with Paste Special.

    For example, to copy the data validation criteria thatcause the cell to display the cities drop-down listbox from the original cell B3 down the column to the range B4:B15, I copied the contents of B3 to theClipboard and then selected the range B4:B15. Next,I opened the Paste Special dialog box, clicked theValidation option button, and clicked OK. As a result,

    To use the data validation List setting to restrict thedata entry in this new table to any of the cities onthis list, I then followed these steps:

    1. Position the cell pointer in the first blank cellto use this data validation setting (B3 in thisexample).

    2. Choose DataValidation to open the DataValidation dialog box with the Settings tabselected.

    3. Select List in the Allow drop-down list box.4. Put the Insertion point in the Source text box

    and then drag through the range of cells con-taining the list of valid entries (J3:J7 in thiscase).

    Because Excel automatically selects the In-cellDropdown check box, the program will add adrop-down button that reveals this list of citieswhenever the user selects the cell.

    To force users to select one of the cities making it invalid to leave the cell blank clearthe Ignore Blank check box.

    5. Click OK to close the Data Validation dialog box.

    After the Data Validation dialog box closes, Exceladds a drop-down button to the right side of the cur-rent cell. To select one of the cities on the list fromits menu, click this button and then click the name ofthe city to enter in cell B3, as shown in Figure 14-3.

    Figure 14-3: Selecting a city from the cells new drop-down list.

    16_574272 ch14.qxd 10/1/04 10:40 PM Page 74

  • Information Please! 75

    all the cells from B3 down B15 use the same data val-idation criteria. When you put the cell pointer in anyof those cells, a drop-down button appears on theright side of the cell. When clicked, this buttonreveals the city drop-down list.

    Finding cells using data validation

    Most data validation settings that you assign to cellsare invisible. (Okay, the List setting may be theexception here, but even the List setting is invisiblewhen the cell pointer isnt in the cell.) To help youlocate the cells in the active worksheet that usesome sort of data validation criteria, you can use theGo To feature to find (and select) them:

    1. Press F5 or Ctrl+G to open the Go To dialog box.2. Click the Special button to open the Go To

    Special dialog box.

    3. Click the Data Validation option button andclick OK, as shown in Figure 14-5.

    Figure 14-5: Finding all the cells in the worksheet that usedata validation.

    Because the All option button underneath theData Validation option is automatically selectedby default, Excel selects all the cells and cellranges in the worksheet that have some type ofdata validation criteria assigned to them.

    4. Use the Enter or Tab key to move the cellpointer around the selection from cell to celland from cell range to cell range.

    5. To find out what type of data validation a par-ticular cell in the selected range uses, chooseDataValidation and check out its criteria onthe Settings tab.

    In a spreadsheet that uses many differenttypes of data validation settings, you can findall the cells that use the same criteria. To do so,position the cell pointer in a cell that you knowuses the criteria you want to find, open the Go To Special dialog box, click both theData Validation and Same option buttons, and click OK.

    Information Please!The only problem with data validation is thatbecause its invisible to spreadsheet users, manytimes the only way they know theyve hit a cell thatuses it is when they try to make what the cell nowconsiders an invalid entry. When anybody tries tocomplete an entry with text or a value that is ver-boten in the cell, Excel beeps at them and then dis-plays an alert dialog box with the followingunhelpful message:

    The value you entered is not valid.A user has restricted the value that can

    be entered into this cell.

    The user can then click the Retry button and try toput something in the cell that Excel does find accept-able, or he or she can click the Cancel button andforget the whole thing.

    16_574272 ch14.qxd 10/1/04 10:40 PM Page 75

  • Technique 14: Ensuring Accurate Data Entries with Data Validation76

    Figure 14-7: Text box with input message that appearswhen the user selects cell A2.

    Warnings to Make Them WaryAs the old saying goes, You can lead a horse towater, but you cant make him drink. Sometimes,flashing an input message just isnt enough to keepusers on the right path. (The numb nuts go aheadand still try to enter forbidden data.) If youre in dan-ger of this happening, its time to bring out the heavyartillery by adding an error alert message as well.(You can always forgo the input message and justadd the error alert message letting users knowexactly what kind of behavior will and wont be toler-ated in that cell.)

    To add an error alert message that appears when-ever the user tries to make an entry that violates thecells data validation criteria, open the DataValidation dialog box and select the Error Alert tab,shown in Figure 14-8. The settings on this tab enableyou to

    Select a type of indicator to display in the alertdialog box (Stop, Warning, or Information) fromthe Styles drop-down list box.

    Enter a title for the warning in the Title text box(which appears in bold in the title bar of the cus-tom alert dialog box).

    Type the text of the message in the ErrorMessage list box (which appears in the body ofthe alert dialog box).

    To give users a fighting chance at rectifying theirerror by making an acceptable entry in the cell, Iheavily suggest (actually, Im begging you on bendedknee) that you assign an input message to the cellexplaining to the poor user what kind of entry is nowvalid. To do this, open the Data Validation dialog box (DataValidation) and then click the InputMessage tab.

    There, you can enter a title for the message in theTitle text box (this appears in bold at the top of thetext box displaying the input message) as well as theexplanatory message text you want displayed in theInput Message list box, as shown in Figure 14-6.

    Figure 14-6: Adding an input message explaining to theuser the data validation settings in effect incell A2.

    Figure 14-7 shows you how the input messageexplaining the data validation settings in cell A2 (see Figure 14-6) appears when the cell pointer is inthis cell. Now, theres no excuse for the user notknowing what entries are allowed in this cell.

    16_574272 ch14.qxd 10/1/04 10:40 PM Page 76

  • Warnings to Make Them Wary 77

    Figure 14-8: Adding a warning message that appears inplace of the standard alert dialog box.

    Dont select the Warning or Information typeof error alert message unless you want it to bepossible for your users to sidestep the valida-tion settings and enter invalid data in the cell.(The Warning type allows this with its Yes but-ton and the Information type with its OK but-ton.) Only the default Stop type prevents usersfrom going ahead and making invalid entriesin the cell.

    After adding an error alert message, whenever theuser tries to enter something outside the bounds setby the cells data validation settings, Excels beeps atthem and then displays your custom error alert dia-log box. Figure 14-9 shows you how the custom erroralert dialog box (defined in Figure 14-8) appearswhen you try to enter an invalid number (in thiscase, any whole number less than 5 or greater than15 or any decimal number at all). When this Stoptype of error alert appears, your users have twochoices:

    Click Retry to have another go at entering thedata (in hopes that the user can get it right thistime).

    Click Cancel to clear the aberrant entry from thecell (and thus forget about the whole thing).

    Figure 14-9: Custom alert dialog box that appears whenthe user attempts to make an invalid entry.

    16_574272 ch14.qxd 10/1/04 10:40 PM Page 77

  • 15Save Time By Using the numerical


    Fixing your decimalplaces

    Restricting data entry tonumbers only


    All Aboard theNumerical EntryExpress!

    Numbers, numbers, numbers. Spreadsheets are full of them, andbecause they dont get there by magic, it behooves you to know allthe tricks of the trade for entering them as efficiently as possible.The first trick is the most obvious use your computers 10-key pad (orthe equivalent thereof) to make all your numerical entries. The secondtrick is to let Excel set the decimal places in your numerical entries thatall use a set number of places (that way, you can concentrate on justentering the correct digits). The third trick is not to allow any errant textentries into a cell range that should only contain numbers.

    Taking Advantage of the Numeric KeypadSeeing that pressing the Enter key automatically advances the cellpointer to a new cell in the next row down conveniently getting you inplace for your next entry I dont see that you have any excuse for notentering ranges of numerical entries from your keyboards numeric key-pad. (After all, your keypad does have an Enter key nearby even if itsembedded in the standard keyboard, as is the case on almost all lap-tops.) When it comes to entering spreadsheet numbers with any speed,using the number keys along the top row of the standard QWERTY key-board just doesnt cut it.

    Unfortunately, the numeric keypad on your computer is not really theequivalent of the old adding machines 10-key number pad. On the com-puter keyboard, the keypad mostly does double-duty with other keys(cursor keys when the pad stands apart from the standard keyboard, andother letter and punctuation keys when its embedded within the key-board itself).

    As a result of this double functioning, you have to engage the numerickeypad in Excel by pressing the Num Lock key before you can use thepad to enter your spreadsheet numbers. This locks in the number func-tion and simultaneously locks out the secondary cursor or letter-keyfunction. (Excel lets you know when the number function is engaged bydisplaying the NUM indicator on the status bar.)

    17_574272 ch15.qxd 10/1/04 10:29 PM Page 78

  • Putting the Decimal Places at Your Service 79

    Always look for the NUM indicator on the sta-tus bar before using the numeric keypad. Thatway, you save yourself from a lot of wastedtime and unnecessary aggravation that comesfrom entering errant letters and punctuation init or from having the cell pointer move off thecell.

    If youre using a laptop computer, you mayhave to do more than just engage Num Lockto produce numbers from your embeddednumeric keypad. Some laptops also make youhold down a special Fn (Function) key to acti-vate the numeric pad.

    Putting the Decimal Places at Your ServiceRemember to use the Fixed Decimal setting whenyou need to do heavy-duty numerical data entry in aspreadsheet. When you turn on this setting, Excelautomatically enters a decimal point using the num-ber of decimal spaces you specify for numericentries. This speeds up your numeric data entryenormously (especially when youre doing the dataentry from the keyboards numeric keypad) becauseyou no longer have to take time to type the periodfor the decimal point (you just type digits and pressEnter).

    To toggle on the Fixed Decimal setting, follow thesesteps:

    1. Choose ToolsOptions to open the Options dialog box.

    2. On the Edit tab, select the Fixed Decimal checkbox, as shown in Figure 15-1.

    The moment you activate the Fixed Decimalcheck box, the Places text box below and to itsright becomes available.

    3. Specify the number of decimal places that youwant Excel to fix in all the numbers you enter.

    Figure 15-1: Fixing the number of decimal places in allnumerical entries.

    By default, the Places text box selects 2 as thenumber of decimal places to fix in your numbers(which makes sense given that much numericdata entry represents financial figures in dollarsand cents). To modify the number of decimalplaces, enter a new value in the Places text box(between 300 and 300) or use its spinner but-tons to select it.

    4. Click OK to close the Options dialog box.

    Enter a negative number in the Places textbox to have Excel pad the digits you type withtrailing zeros equal to this numbers absolutevalue. For example, enter 2 in the Places textbox to have all your entries automaticallyincreased by a factor of 100. (For example, ifyou type 789, Excel enters 78900 in the cell.)

    Excel lets you know when the Fixed Decimal settingis turned on by displaying FIX on the far right of theStatus bar. While this setting is active, the only timeyou have to be concerned with decimal points iswhen the numbers youre entering dont conform tothe number of decimal places you set. For example,if you use the two-decimal-place default for entering

    17_574272 ch15.qxd 10/1/04 10:29 PM Page 79

  • Technique 15: All Aboard the Numerical Entry Express!80

    To ensure numerical data entry, you need to useExcels ISNUMBER function in a formula as part of aCustom type of data validation setting. ISNUMBER isan Information-type function that returns a logicalTRUE value when its argument is numerical and alogical FALSE value when its not numerical. Thisfunction uses the following syntax:


    Whenever the ISNUMBER function returns a TRUEvalue as a part of a Custom-type data validation set-ting, Excel finds the data entry to be valid and allowsthe data entry. However, whenever the functionreturns a FALSE value, the program finds the entry tobe invalid and rejects the data entry.

    Figures 15-2 through 15-4 illustrate how you set upthis type of numerical data validation for a cell rangein your spreadsheet. For this example, I want toinoculate the cell range C4:E9 with this type of pro-tection. This range contains all the numerical valuesin my little sales table.

    I start this process by selecting cell C4, the first cellof the range to be protected. Its here that I definethe numerical data validation that I then copy withPaste Special to the rest of the range:

    1. Choose DataValidation to open the DataValidation dialog box.

    2. On the Settings tab, select Custom in the Allowdrop-down list.

    3. In the Formula text box, type =ISNUMBER (andthen click cell C4 to enter it as the argumentbefore typing a close parenthesis [ )] to close offthe function. (See Figure 15-2.)

    For this data validation setting, you dont need toadd an input message. (Here, you already knowwhat kind of entry you intend to make.) All youneed to add is a custom error alert message thathelps the user identify the nature of his or hererror.

    4. Select the Error Alert tab.

    financial figures in the worksheet, you enter all stan-dard dollar-and-cents numbers simply by typingtheir digits. (For example, you enter the value$150.24 into a cell by typing the digits 15024 andthen pressing Enter dont you dare take time totype a dollar sign.)

    When, however, you come upon a whole dollaramount that has zero cents and therefore doesntreally require any decimal places (theyre purelyoptional), you have to make a choice. Either you cantell Excel where to put the decimal place or end upentering extra trailing zeros. Suppose that you needto enter the value $200.00 and the Fixed Decimal set-ting with the default two decimal places in turnedon. If you type 200 in the current cell, Excel reducesit to 2 when you press Enter. To get the program toput 200 in the cell, either you have to type 200 andthen press the period (.) key before Enter, or youhave to type 20000 (which looks nothing like thevalue $200.00).

    Dont forget to turn off the Fixed Decimal set-ting (by clearing its check box on the Edit tabof the Options dialog box) as soon as you fin-ish with your numeric data entry marathon.Otherwise, you or a coworker may be com-pletely thrown off when Excel stubbornlyrefuses to enter your numbers as you typethem!

    Number Please!When it comes to numerical data entry, efficiency iskey but not if it comes at the expense of accuracy.This procedure covers a way that you can use thedata validation feature (see Technique 14 for details)to make it impossible for users to enter anything butnumerical entries in a cell range. The downside ofadding this type of data entry safeguard is that it canpossibly stop the flow of your data entry cold. Theupside is that you dont have to worry about errantpunctuation and letter keystrokes converting cellentries into text that later spawns error values in for-mulas that reference those cells.

    17_574272 ch15.qxd 10/1/04 10:29 PM Page 80

  • Number Please! 81

    Figure 15-2: Setting up a custom validation formula thatrejects anything but numerical entries.

    5. Leave the default Stop style selected, enter aheading for the messages title in the Title textbox, and enter the text for the message in theError Message list box. (See Figure 15-3.)

    6. Click OK to close the Data Validation dialog box.

    Before copying the Custom data validation setting toother cells in the range, you need to test it out andmake sure that its truly bulletproof when it comesto text entries. Figure 15-4 shows you what hap-pened when I tried to enter my name in cell C4.When testing the cell, be sure to try entering all man-ner of numerical entries (whole numbers, decimalnumbers, negative numbers, and zero). Also try tosneak a value in as text in the cell (as you might dowhen entering zip codes and the like) by prefacingthe digits with an apostrophe ().

    When youre convinced that your data validationsetting is airtight, you can copy the setting to allthe other cells in the range where you intend to do

    numerical data entry. To do this, you first copy thecell with the original data validation setting to theClipboard (Ctrl+C) and then select the cell range(C4:E9 in my example). Finally, you click theValidation option button in the Paste Special dialogbox (EditPaste Special) and then click OK.

    Figure 15-3: Adding an error alert to the numeric customdata validation setting.

    Figure 15-4: Illegal text entry foiled by the numericcustom data validation settings.

    17_574272 ch15.qxd 10/1/04 10:29 PM Page 81

  • 16Save Time By Using Speak on Enter as

    you make data entries

    Having the computer readback entries in a cellrange

    Selecting the perfectvoice and speed


    Verifying Entrieswith Text to Speech

    Excel includes a powerful feature known as Text to Speech that canhelp you through the drudgery of checking and verifying the accu-racy of your data entries. By using Text to Speech, you can haveyour computer read out loud your data entries either as you make themor afterwards. As you listen to the computer read the data entries, youcan check the hard copy from which they came to ensure that youhavent made any typos. If you notice a discrepancy between a spokendata entry and whats on the paper copy, you can stop Text to Speechand make the necessary corrections before continuing with the reading.

    To use the Text to Speech feature, your computer must be equipped witha sound card and have access to speakers or headphones (minimalrequirements that Ill bet every computer that can run Excel 2003 caneasily meet). Note that you can use Text to Speech without havinginstalled and set up Excels Speech Recognition feature for entering dataentries by voice and issuing voice commands.

    Can You Hear Me Now?To use the Text to Speech feature, choose ToolsSpeechShow Text toSpeech Toolbar. If the Text to Speech feature isnt already installed onyour computer, Excel asks if you want to install this feature. You then follow the prompts to install this feature. (Make sure that you have theOffice 11 CD-ROM handy when you do this or make sure that you can provide the Windows Installer with the path to the Office program fileson your network.) When Text to Speech is installed, Excel displays theText to Speech toolbar, shown in Figure 16-1.

    18_574272 ch16.qxd 10/4/04 8:33 AM Page 82

  • Can You Hear Me Now? 83

    Figure 16-1: Use the tools on the Text to Speech toolbarto verify the data entries you make.

    Speak on Enter

    One of the most effective ways to use Text to Speechis its Speak on Enter mode. When you click theSpeak on Enter button on the Text to Speech toolbar,the Text to Speech feature reads every data entryyou make back to you. (The program actually saysthe words, Cells will now be spoken on Enter, themoment you click this button.)

    When the program is in this speaking mode, the Textto Speech feature speaks every data entry you com-plete. Note that, in the world of Excel, complete inthis case means youve either pressed the Enter keyor pressed a cursor-movement key such as an arrowkey, Tab, or Page Down. The feature does not speakthe entry if you complete it by clicking the Enter button on the Formula bar.

    Note that the Speak on Enter button is a toggle; youturn off this speaking mode by clicking the button asecond time. When you click the button to turnSpeak on Enter mode off, Text to Speech says, Turn off Speak on Enter.

    Reading by columns and rows

    Text to Speech is not just useful when entering newdata in your spreadsheet. You can also use it to ver-ify the accuracy of ranges that have already beenentered into a worksheet. To have the program readback the entries in a cell range, follow these steps:

    Speak Cells

    Stop Speaking By Columns

    By Rows Speak On Enter 1. Position the cell pointer in the first cell of therange whose values you want to verify withText to Speech.

    2. If the Text to Speech toolbar is not displayed inExcel, choose ToolsSpeechShow Text toSpeech Toolbar.

    3. Click the Speak Cells button (the first one) inthe Text to Speech toolbar.

    As soon as you click this button, Excel automati-cally selects all the cells it can identify as a singlerange in the region around the cell pointer. Itthen starts reading the entries out loud acrossthe rows of the range as it moves down thecolumns.

    4. (Optional) To change Text to Speechs directionfrom across rows to up and down columns,click the By Columns button.

    If you catch a mistake, click the Speak Cells buttonto temporarily halt the reading of the rest of therange and then move the cell pointer to the appro-priate cell and edit its contents. To resume readingthe remaining cells in the range, click the Speak Cellsbutton again.

    Dont use the arrow keys to move the cellpointer, or youll collapse the cell selection,reducing it from the current range down tothe current cell. Instead use Tab, Shift+Tab,Enter, or Shift+Enter to move the cell pointerand to complete the cell edit. (Refer to Table12-1 for more on using Tab, Shift+Tab, Enter,or Shift+Enter to move the cell pointer.)

    When Excel reaches the last cell in the selectedrange and reads its contents, Text to Speech auto-matically stops and takes the program out of SpeakCells mode. If you want to turn off Text to Speechbefore it reaches the last cell, click the StopSpeaking button.

    18_574272 ch16.qxd 10/4/04 8:33 AM Page 83

  • Technique 16: Verifying Entries with Text to Speech84

    4. Select the name of the voice that you want touse from the Voice Selection drop-down list.

    You can select LH Michael, LH Michelle, orMicrosoft Sam as the voice. LH stands for Lernedand Hauspie (the creator of Michaels andMichelles voices). To me, LH Michael soundslike the voice used by the eminent physicist,Stephen Hawking, and LH Michelle sounds likethe female equivalent of that voice. AndMicrosoft Sam sounds like the voice of HAL 9000in Stanley Kubricks 2001: A Space Odyssey, whenDave was disconnecting his memory circuits!

    5. Select the Use the Following Text to Previewthe Voice text box and then edit the text thatyou want the voice to say to you.

    For example, when previewing the Microsoft Samvoice, you can enter the text whether Im afraidDave. Dave, Im afraid, to see whether you thinkthis voice sounds like HAL 9000 as well.

    6. Click the Preview Voice button to have thevoice that you selected read back the textshown in the Use the Following Text to Previewthe Voice text box.

    7. If you want to adjust the voice speed, drag theVoice Speed slider toward Slow or Fast to eitherslow down the speaking or speed it up.

    After adjusting the speed, be sure to click thePreview Voice button again to make sure thatyou havent slowed or sped up the rate of speak-ing too much.

    If you drag the slider toward Slow when theMicrosoft Sam voice is selected, you definitelyhave a dead ringer for HAL 9000 in his famousdisconnection scene.

    8. Click OK to close the Speech Properties dialogbox and then click the Close button in theSounds, Speech, and Audio Devices window toclose it.

    Modifying the Text to Speech SettingsWhen using Text to Speech, you can modify thespeaking voice used as well as the speed at whichthe program reads your data entries. To changethese Text to Speech settings, follow these steps:

    1. Click the Start button on the Windows taskbarand then select Control Panel.

    2. If youre in Category view, click the Sounds,Speech, and Audio Devices link and then clickthe Speech link. Otherwise, in Classic view,double-click the Speech icon.

    3. Select the Text to Speech tab in the SpeechProperties dialog box. (See Figure 16-2.)

    Figure 16-2: Selecting the voice and specifying the speedfor Text to Speech.

    18_574272 ch16.qxd 10/4/04 8:33 AM Page 84

  • Part III

    Handy Ways toFormat and Present

    Worksheet Data

    19_574272 pp03.qxd 10/1/04 10:28 PM Page 85

  • 19_574272 pp03.qxd 10/1/04 10:28 PM Page 86

  • 17 Instant RangeFormattingRight after data entry comes formatting. As I hope you know, whenbuilding a new spreadsheet, you dont stop to take the time toassign formats to the data entries you make (by typing dollarsigns, commas, and the like). Instead, you enter all the raw data and thenassign the required formatting to the various cell ranges.

    When formatting cells in a standard table of data, you can usually rely onthe AutoFormat feature to apply the various types of formatting to all thedifferent elements in one fast-and-easy operation. When formatting indi-vidual ranges of cells that arent part of a standard table of data, you canuse Excels handy-dandy Format Painter to quickly copy an existing formatto unformatted ranges that need it. Finally, you can preformat a blank cellrange by copying just the formatting assigned to any formatted cell andpasting that formatting into the cell range.

    Head-to-Toe Table Formattingwith AutoFormatUsing Excels AutoFormat feature to format a table of data is a real no-brainer. Simply position the cell pointer in any cell of the table andchoose FormatAutoFormat to open the AutoFormat dialog box, shownin Figure 17-1. Excel then automatically selects all the cells in the table(including the one with the tables title). All you have to do is select thetable format in the AutoFormat dialog box that you want to apply to theselected range and then click OK.

    The list box in the AutoFormat dialog box offers 16 distinct table formatsfrom which you can choose. Excel gives descriptive names to these tableformats, which are arranged by category in two columns in this list box.At the very bottom of the list box, you find a None table format that youcan select to remove any previously selected table formatting from theselected range.


    Save Time By Applying an AutoFormat

    to your table of data

    Using the Format Painterto copy a format

    Cutting and pasting formats

    20_574272 ch17.qxd 10/1/04 10:41 PM Page 87

  • Technique 17: Instant Range Formatting88

    to the table in the cell range A2:E9, it formats thetable and column headings and the financial data incolumns C, D, and E, as well as widens columns Bthrough E using its AutoFit feature. Unfortunately,the program misapplied the Currency and CommaStyle number formats to the Discount data in therange D4:D9. Because AutoFormat couldnt tell thatthese numbers represent percentages and not dol-lars and cents, I still need to apply the Percent Stylenumber format to this range.

    Figure 17-2: Furniture sales price table automaticallyformatted with the Accounting 1 table format.

    Excel makes it easy to customize any of its 16 built-intable formats:

    1. Click the Options button in the AutoFormat dia-log box.

    The dialog box expands to display individualcheck box format options in the Formats toApply area along the bottom.

    2. To customize a particular table format, selectits thumbnail in the AutoFormat list box andthen clear all the individual format checkboxes in the Formats to Apply area that youdont want to use.

    For example, in Figure 17-3 I selected Classic 3table format and then removed its borders byclearing the Border check box in the Formats toApply area.

    Figure 17-1: Selecting the table format to apply to theselected table of data.

    When choosing the table format to apply to the cellrange containing your data, use the thumbnails ofthe different formats as a guide. These thumbnailsattempt to show what alignment, attributes (such asbold or italics), number formatting, borders, andpatterns will be applied to the selected cell range.Also, all the table formats (except for None) auto-matically widen the columns and heighten the rowsof the table as needed to display all the data afterapplying these various attributes to their cells.

    The None table format removes all formattingfrom the cells of the table, including any attrib-utes manually assigned to individual cells orcell ranges prior to applying table formats withAutoFormat. Selecting None does not, however,restore column widths that Excel changed aspart of previously selecting one of the othertable formats.

    Figure 17-2 shows how the furniture sales price table(shown selected in Figure 17-1) appears after applyingthe Accounting 1 table format to its cells. As you cansee in this figure, when Excel applies this formatting

    20_574272 ch17.qxd 10/1/04 10:41 PM Page 88

  • Getting Artistic with the Format Painter 89

    Figure 17-3: Customizing a table format by limiting whichformats it applies.

    Getting Artistic with the Format PainterAutoFormat is perfect for those times when you havea discrete table of data that needs formatting and youwant to use one of its prefab table formats through-out. For the other times when you just need to applya few different attributes to a cell range or two, seri-ously consider using the Format Painter to get the jobdone. As the name implies, the Format Painter enablesyou to copy the formatting from one prototypical cellto all the others that you drag through in essencepainting them with all its attributes.

    Oh that all painting were as easy as painting withthe Format Painter! The steps for copying a cellsformatting are as simple as can be:

    1. Select the cell that already contains the format-ting that you want to copy.

    This cell can be manually formatted with severaldifferent attributes such a new cell alignment,font attribute, and number format.

    2. Click the Format Painter button on the Standardtoolbar (the one with the paintbrush icon).

    After you click the Format Painter button, Exceldisplays a marquee in the cell pointer in the cur-rent cell, and a paintbrush icon appears next tothe white cross mouse pointer, as shown inFigure 17-4.

    Figure 17-4: Using the Format Painter to copy all theformatting applied to a cell.

    3. Drag through the cells to which you want toapply the same formatting as in the currentcell.

    When you release the mouse button, Excel appliesall the formatting in the prototype cell to the rangeyou selected with the Format Painter mouse pointer.Figure 17-5 illustrates this: Here, I copied the PercentStyle number format plus the bold and italics attrib-utes applied to cell D4 to this range by draggingthrough the cell range D5:D9 with the Format Paintermouse pointer.

    20_574272 ch17.qxd 10/1/04 10:41 PM Page 89

  • Technique 17: Instant Range Formatting90

    sheet with the same exposure problems. You canthen use the Format Painter to copy the contrastand brightness settings applied to the first photoonto the second one. All you do is click the editedphoto to select it, click the Format Painter button,and then click the second unedited photo. Excelthen immediately copies the same contrast andbrightness exposure settings to it.

    Cutting and PastingFormats OnlyAs Im sure youre aware, whenever you move or copyformatted cells from one part of the worksheet toanother, Excel automatically copies the formattingalong with the cell contents. What you may not beaware of is that you can copy just the formattingapplied to a cell or cell range and leaving behindthe contents paste that formatting into a newrange.

    The range into which you copy the formatting canbe blank or can contain cell entries. If the range isblank, all cell entries that you make there take on thecopied formatting. If the range already contains cellentries, the copied formatting is immediately appliedto them, replacing any existing formatting.

    To copy just the formatting from a cell or cell rangeto a new place in the worksheet, follow these steps:

    1. Select the cell or range that contains the for-matting you want to copy.

    2. Choose EditCopy or press Ctrl+C to copy thecells to the Clipboard.

    Excel copies both the cell contents and the for-matting in the selected cell(s) to the WindowsClipboard.

    3. Select the cell or cell range into which youwant to copy the formatting now residing onthe Windows Clipboard.

    Figure 17-5: Cell range D5:D9 after using the FormatPainter to copy all the formatting appliedto cell D4.

    To format more than one range, double-clickthe Format Painter button instead of single-clicking it. That way, the Format Painter staysengaged until you next click the Format Painterbutton to disengage it. In between, you canuse the mouse pointer to paint through asmany cells and cell ranges as your little heartdesires.

    Although the Format Painter makes copying fromone cell to another range a real breeze, copying for-mats is not its only claim to fame. You can also usethe Format Painter to copy column widths in a work-sheet. To do this, you click the letter of the columnwhose width you want to copy in the column headerand then double-click the Format Painter button toengage it. Finally, click or drag through the letters ofthe columns that need to be the same width andthen click the Format Painter to disengage it.

    As if this werent enough, you can also use theFormat Painter to copy the attributes of one graphicobject (such as a piece of WordArt, an AutoShape, aClip Art image, or a graphics file inserted into theworksheet see Technique 56) to other objects ofthe same type.

    For example, suppose that you insert a photo into aworksheet and then edit that photo with the MoreContrast and Less Brightness buttons in the Picturetoolbar. After a bit, you add another photo to the

    20_574272 ch17.qxd 10/1/04 10:41 PM Page 90

  • Cutting and Pasting Formats Only 91

    4. Choose EditPaste Special to open the PasteSpecial dialog box.

    Be sure you dont choose EditPaste insteadof EditPaste Special. Otherwise, Excel willplunk down not only the formatting but thecontents of the cells as well. And if youre past-ing into a cell range with entries, these entrieswill be replaced. If you mess up, press Ctrl+Zuntil you put everything right in the range.

    5. Click the Formats option button in the Pastearea of the Paste Special dialog box (shown inFigure 17-6) and then click OK button.

    Excel closes the Paste Special dialog box and imme-diately applies all the formatting applied to the origi-nal cell or cell range and copied to the Clipboardto the cell range thats currently selected in theworksheet.

    Figure 17-6: Using the Formats option in the Paste Specialdialog box to paste only the formatting onthe Clipboard.

    20_574272 ch17.qxd 10/1/04 10:41 PM Page 91

  • 18 Style FormattingMagicWhen it comes to looks, everyone wants to be in style. When itcomes to getting your worksheets to look their best, you canfacilitate their formatting by using Excels styles. Styles are per-fect for applying standard formatting to many cell ranges across thespreadsheet. What makes them so great is that should you need to tweaktheir formatting a bit, you simply make the changes to the style itself andthose changes are instantly updated in every cell to which that style isapplied.

    Excel styles can regulate any of the following formatting attributes ina cell:

    Number to determine which number format is used. (If the cell con-tains a text entry, the Number aspect of the style is ignored.)

    Alignment to determine what kind of horizontal and vertical text align-ment, text control (wrap text or shrink to fit), or text direction is used.

    Font to determine what font, font style, font size, attributes (underline,strikethrough, superscript, or subscript), or font color is used.

    Border to determine what kind of border (including line style andcolor), if any, is used.

    Patterns to determine what kind of cell shading, if any, is used.

    Protection to determine the status (on or off) of the Locked andHidden cell protection attributes.

    This technique gives you vital information on how to use and customizethe six predefined styles that are immediately available to you in anyworkbook you open as well as how to create your own custom styles.Finally, you find out how to copy your favorite custom styles from oneworkbook to another so that you dont have to waste time reinventing astyle.

    Save Time By Using the built-in styles

    Creating and usingcustom styles

    Copying custom stylesfrom one workbook tothe next


    21_574272 ch18.qxd 10/1/04 10:29 PM Page 92

  • Styling 93

    Applying predefined styles in a spreadsheet

    You can always apply any of the predefined stylesto a cell selection by opening the Style dialog box(FormatStyle), selecting the name of the style toapply in the Style Name drop-down list box, and thenclicking OK. But Excel offers a much more direct pro-cedure when applying the Comma, Comma (0),Currency, Currency (0), and Percent styles.

    To apply these styles, select the cells to be format-ted and then click the appropriate button(s) on theFormatting toolbar, shown in Figure 18-2. In the caseof the Comma, Currency, and Percent styles, all youhave to do is click the corresponding toolbar but-tons. In the case of the Currency (0), which doesntdisplay any decimal places, you need to first clickthe Currency Style button (which displays two deci-mal places) and then click the Decrease Decimal but-tontwo times (which takes the decimal places away).Likewise, when you want to apply the Comma (0)style to a cell selection, you click the Comma Stylebutton and then click the Decrease Decimal buttontwice to remove its two decimal places.

    Figure 18-2: Applying the Currency, Percent, and Commastyles from the Formatting toolbar.

    To be able to select any style from a drop-downlist on the Formatting toolbar (see Figure 18-3),customize this toolbar by adding the com-mand that displays a Style drop-down list box.This command is located in the Format cate-gories on the Commands tab. (See Technique2 for details on customizing toolbars.)

    Currency Style

    Percent Style

    Comma Style

    Decrease Decimal

    Increase Decimal

    StylingEach Excel workbook you open comes with six pre-defined styles. The Normal style is the default styleapplied to every cell of every new workbook. Figure18-1 shows you the Style dialog box (FormatStyle)displaying the different formatting attributes that theNormal style uses. Keep in mind that anytime youmanually apply new formatting attributes to a cell,either with the buttons on the Formatting toolbar orthe options in the Format Cells dialog box (Ctrl+1),these attributes are applied to the basic settings ineffect from the cells current style. If any of thesemanually selected attributes conflict with attributesset by the current style, they override and replacethem.

    Figure 18-1: The Normal style is automatically applied toall the cells in a new workbook.

    The other predefined styles Comma, Comma (0),Currency, Currency (0), and Percent are all usedto format cells containing numeric values with themost common number formats. As such, their par-ticular styles define only a new Number setting these styles dont change the Alignment, Font, Border,Patterns, or Protection settings. When you apply anyof these styles, they replace the General number for-mat set by the Normal style with that of their own.

    21_574272 ch18.qxd 10/1/04 10:29 PM Page 93

  • Technique 18: Style Formatting Magic94

    3. On the Font tab, select Times New Roman inthe Font list box and 12 in the Size list box andthen click OK.

    4. Click OK in the Style dialog box to close thisdialog box and put the new attributes in effect.

    After changing the font and font size for the Normalfont, all the cells in the blank workbook now useTimes New Roman 12-point type instead of the usualArial 10 point.

    Modifications that you make to a predefinedstyle such as Normal are saved as part of thecurrent workbook file. However, these changesdont carry over to new workbook files; theycontinue to open with the original, unmodifiedstyles. To make use of your customized styles,you need to copy them into the new work-book. (For more on copying styles, see theMerging Styles from One Book into Anothersection, later in this technique.)

    Creating Styles of Your OwnExcel makes it extremely easy to create new stylesfor your spreadsheet. When creating a new style,you can either

    Build it by modifying the attributes of one ofthe predefined styles. You select the basic stylein the Style dialog box and then make all the necessary changes to the number format, font,alignment, borders, shading, and protectionattributes in the Format Cells dialog box (see thepreceding section, Customizing predefinedstyles) required by the new style.

    Create it from an example cell. To create a styleby example, you choose a sample cell (whichshould contain a typical data entry) and then for-mat it with all the attributes (number format,font, alignment, borders, shading, and protec-tion) that you want used in the new style.

    Figure 18-3: The Formatting toolbar after customizing itby adding a Style drop-down list box.

    Customizing predefined styles

    Excel makes it a snap to customize any of its six pre-defined styles. Of the six, most users end up cus-tomizing the Normal style in order to quickly andeasily make basic formatting changes to all the cellsof a new workbook. For example, suppose your com-pany prefers to use Times New Roman 12 point asthe default font and font size for all its spreadsheets.To accomplish this in a new workbook, you wouldmodify the Normal style using the following steps:

    1. Open a new workbook and then ChooseFormatStyle to open the Style dialog box.

    2. Select Modify to open the Format Cells dialogbox, shown in Figure 18-4.

    Figure 18-4: Customize the style by making changes toits attributes in the Format Cells dialog box.

    21_574272 ch18.qxd 10/1/04 10:29 PM Page 94

  • Merging Styles from One Book into Another 95

    I personally favor the second method because itenables me to see how the new attributes for thenew style actually affect the appearance of typicaldata in the sample cell before I create it. To see howthis works, follow along with the steps for creating anew Title Style for instantly formatting the headingsfor tables of data in a new spreadsheet:

    1. Select a cell to use as the sample cell in a newworkbook, make a typical data entry in it, andthen manually format the cell with all theattributes you want the new style to assign.

    To format the cell with the desired attributes,use the buttons on the Formatting toolbar or thecontrols in the Format Cells dialog box (Ctrl+1).

    2. Choose FormatStyle to open the Styledialog box.

    3. Select the Style Name text box and replaceNormal with the unique name you want to givethe new style, as shown in Figure 18-5.

    As soon as you begin typing in the new stylename, the Style Includes area in the Style dialogbox changes to a Style Includes (By Example)area that lists all the attributes that your newstyle will use.

    Figure 18-5: Creating a new style from a sample formatted cell.

    4. Click OK to close the Style dialog box and com-plete the creation of your new style.

    After creating a new style, you can apply its format-ting to a cell selection (single range or noncontigu-ous selection) in the worksheet by opening the Styledialog box (FormatStyle), selecting the name of thestyle in the Style Name drop-down list box, and click-ing OK. Of course, you can make applying a style aheck of a lot easier by adding a Style drop-down listbox to the Formatting toolbar. (See Technique 2 fordetails on customizing Excel toolbars.)

    If you create a custom style that you rely on allthe time, consider assigning it to a button thatyou add either to the Formatting toolbar or tosome custom toolbar. That way, you can formata cell selection with the style by clicking itsbutton. To do this, create a keystroke macrothat selects the custom style (see Technique60) and then assign this macro to a Custombutton and add this button to one of the tool-bars (see Technique 2).

    Merging Styles from OneBook into AnotherThe only problem with styles as far I can see is thatthey are available only in the workbook in which youcreate them. To get around this, you need to knowhow to copy custom styles (as well as any prede-fined styles that youve customized) into a newworkbook file. To accomplish this type of stylemerge, follow these straightforward steps:

    1. If the new spreadsheet into which you want tocopy existing styles has not yet been saved,make a data entry in one of its cells.

    Doing this prevents Excel from closing theunsaved workbook the moment you open theworkbook with the styles you want to merge.

    21_574272 ch18.qxd 10/1/04 10:29 PM Page 95

  • Technique 18: Style Formatting Magic96

    2. Open the existing workbook (Ctrl+O) contain-ing the styles you want to use in your newspreadsheet.

    3. Switch back to the blank workbook making thisspreadsheet active.

    You can do this either by clicking its button onthe Windows taskbar or by selecting it at the bot-tom of the Window pull-down menu.

    4. Choose FormatStyle to open the Styledialog box.

    5. Click the Merge button near the bottom of theStyle dialog box to open the Merge Styles dia-log box.

    6. Select the name of the open workbook file thatcontains the styles you want copied into yournew workbook, as shown in Figure 18-6.

    Figure 18-6: Merging styles from another openworkbook.

    If the open workbook you selected contains mod-ifications to the predefined styles (which alsoexist in the new workbook), an alert dialog boxappears asking you to confirm the merging ofstyles that have the same names.

    7. If the confirmation alert dialog box appears,click Yes to have the predefined styles in theactive workbook overwritten or No to preventthem from being copied into the new work-book. If this confirmation dialog box does notappear, click OK in the Merge Styles dialog boxto close it.

    8. Click OK in the Style dialog box to close it andreturn to the active spreadsheet.

    9. Switch back to the workbook whose styles youjust merged and then close it (Ctrl+W).

    After merging styles from an open workbook, youhave immediate access to all the styles that youcopied in your new spreadsheet.

    If you have a bunch of custom styles that youwant available in all workbooks of a certaintype (such as invoices or balance sheets),merge those styles into a new workbook andthen save the workbook as an Excel templatefile. (See Technique 1.) When you generatenew spreadsheets from this template, they willautomatically contain your custom styles.

    21_574272 ch18.qxd 10/1/04 10:29 PM Page 96

  • 19 Controlling WhenCertain FormatsAre UsedExcel includes a nifty little feature called conditional formatting thattells the program to format a cell range in one way when the rangecontains one type of data entry and in a completely different man-ner when it doesnt. Conditional formatting can go a long way in helpingyou keep tabs on very significant or potentially disastrous conditionsthat crop up in your spreadsheet.

    Most of the time, you apply conditional formatting to cells that containformulas whose evaluated values are key in the spreadsheet (such assubtotals or grand totals). Applying conditional formatting to these cellscan help you flag any potential errors that result from goof-ups made inthe input cells referenced in the formulas. You can also use conditionalformatting to flag unexpected formula results, such as totals that exceedyour wildest expectations as well as totals that are way below your mostpessimistic projections.

    This technique looks at ways you can use conditional formatting to alertyourself when certain key values change in your spreadsheet (for betteror worse). It begins by looking at how you can use conditional formattingto select one type of cell format when normal conditions exist in the celland another special formatting when some sort of abnormal conditioncrops up. You also find out how to use conditional formatting to warnyou when certain kinds of errors have crept into the spreadsheet.

    Formats to Suit Every ConditionConditional formatting enables you to set up two types of criteria thatdetermine when the program applies the conditional formatting youdesignate:


    Save Time By Using conditional format-

    ting to flag significantdata entries

    Using conditional format-ting to flag bad entries orformula flub-ups

    22_574272 ch19.qxd 10/1/04 10:41 PM Page 97

  • Technique 19: Controlling When Certain Formats Are Used98

    3. Select Less Than in the second drop-down listbox (the one that now contains Between).

    4. Press Tab to select the last text box and thentype 0, as shown in Figure 19-2.

    After setting up the condition for the special for-matting, you must specify what formatting attrib-utes to use. The Font attributes that you can setfor conditional formatting are limited to fontstyle, underlining, strikethrough, and color. Forthis example, I turn on strikethrough and boldand select red as the font color.

    Figure 19-2: The Conditional Formatting dialog box afterspecifying the first condition.

    5. Click the Format button in the ConditionalFormatting dialog box to open the Format Cellsdialog box.

    6. On the Font, Border, and Patterns tabs, selectthe attributes to be used when the condition istrue. When youre finished selecting yourattributes, click OK. (See Figure 19-3.)

    When you close the Format Cells dialog box, theConditional Formatting dialog box shows yourfirst condition along with a preview of the for-matting that Excel will apply when the conditionis true. At this point, you can either add anothercondition (see the next section, When two con-ditions are better than one), or if you need onlythe one condition as is the case here youcan close the dialog box.

    7. Click OK to close the Conditional Formattingdialog box and put the conditional formattinginto effect in the current cell.

    Cell Value Is: Compares the value (constant) youspecify in the Conditional Formatting dialog boxagainst the value entered in the cell. When Excelcompares this constant to the cell value and thecriteria you specify for them is met (is between,equal to, greater than, less than, greater than orequal to, or less than or equal to), Excel appliesthe conditional formatting to the cell. When thecondition is not met, Excel uses the regular for-matting applied to the cell.

    Formula Is: Evaluates the logical formula youenter in the Conditional Formatting dialog box.When this formula evaluates to TRUE, Excelapplies the conditional formatting you define tothe cell. When the formula evaluates to FALSE,Excel applies the regular formatting to the cell.

    When you want to be warned when a cell contains aparticular value or exceeds or falls below a certainnumber, the Cell Value Is type of conditional format-ting is the way to go. To get an idea of how you woulduse this type of conditional formatting, follow alongwith the steps for displaying the entry in a cell in redwith bold and strikethrough whenever it contains anegative value:

    1. Position the cell pointer in the cell where youwant to apply conditional formatting.

    2. Choose FormatConditional Formatting toopen the Conditional Formatting dialog box,shown in Figure 19-1.

    When Excel opens this dialog box, the Cell ValueIs option is automatically selected along withBetween as the comparison operator.

    Figure 19-1: The Conditional Formatting dialog box whenyou first open it.

    22_574272 ch19.qxd 10/1/04 10:41 PM Page 98

  • Formats to Suit Every Condition 99

    Figure 19-3: Selecting the attributes for the first conditionin the Format Cells dialog box.

    Figure 19-4 shows how the conditional formattingassigned to cell C4 at the top of the Retail Price col-umn of the Spring Sales table appears when it kicksin. For this figure, I intentionally entered -1200 in thecell rather than the correct 1200 figure (negative val-ues make no sense in this price column). Becausethis cell now contains a value less than zero (that is,a negative value), the conditional formatting kicks in(because the basic condition is true), and as a result,the red, boldface, and strikethrough attributes areadded to the regular cell formatting.

    Figure 19-4: Table displaying the conditional formattingwhen a negative value is entered in the cell.

    To copy the conditional formatting you see appliedto cell C4 down to the other cells in the Retail Pricecolumn (you dont want to have to pay to have cus-tomers take any of your furniture), follow these steps:

    1. Copy cell C4 to the Clipboard (Ctrl+C) and thenselect the cell range C5:C9.

    2. Choose EditPaste Special to open the PasteSpecial dialog box.

    3. Select the Formats option button and thenclick OK.

    Excel then pastes the conditional formatting for cellC4 to all the other Retail Price cells, so they will alsoalert you with the same kind of in-your-face formattingshould any errant negative entries come their way.

    When two conditions are better than one

    When setting up conditional formatting for a cell,youre not limited to a single condition. You can setup several conditions, each with its own uniqueattributes that are used when its particular condi-tion is true. Most of the time, you find that two con-ditions are completely adequate to cover all thepossible contingencies.

    To set up a second condition in the ConditionalFormatting dialog box (FormatConditionalFormatting), you click the Add button after definingthe first condition and the formatting to use whenthis condition is true. Clicking this button expandsthe Conditional Formatting dialog box by adding aCondition 2 area with identical controls for definingthe second condition and the formatting that itapplies.

    Figure 19-5 illustrates how this works. For this figure,I added a second condition to cell C4 in the SpringSales table. It adds bold to the font and garish yellowshading to the cell if it ever contains a value above1,250. Now, Excel not only alerts me with red, bold,and strikethrough type if the value in cell C4 is

    22_574272 ch19.qxd 10/1/04 10:41 PM Page 99

  • Technique 19: Controlling When Certain Formats Are Used100

    Figure 19-6: Selecting the cells in the worksheet that useconditional formatting.

    Making Your OutstandingErrors Stand OutAlthough conditional formatting is most useful foralerting you to anomalies that crop up in yourspreadsheet data, you can also use it to warn youwhen certain types of errors crop up that arentrelated to errors in the formulas themselves. Forexample, you can use conditional formatting to flagerrors in a typical sales table one that totals thecolumns and rows of figures to ensure that the sumof the column subtotals and the sum of the rowsubtotals are always equal to the grand total at theintersection of the two.

    Note that the only way the subtotals wouldnt equalthe grand total is when you or a coworker acciden-tally deletes or replaces one of the SUM formulasthat calculate a columns or rows subtotal. If you

    negative but also alerts me with bold type and brightyellow shading if the value exceeds 1,250.

    Figure 19-5: Adding a second condition that applies adifferent formatting when the value isabove 1,250.

    Finding cells with conditional formatting

    Excel makes it easy to locate and select the cells inyour worksheet that use conditional formatting. Thismakes it quick work of finding particular conditionalformatting that you want to reuse by copying toother parts of the spreadsheet.

    Open the Go To dialog box (F5 or Ctrl+G) and thenclick the Special button. Excel opens the Go ToSpecial dialog box (see Figure 19-6) where you selectthe Conditional Formats option button and thenclick OK.

    Excel then selects all the cells in the worksheet thatcontain some type of conditional formatting. You canuse the Enter or Tab key or Shift+Enter or Shift+Tabkeys to move from one selected cell to anotherthroughout all the ranges.

    To save time and select only the cells that con-tain a certain type of conditional formatting,position the cell pointer in a cell that uses thetype you want to locate. Then open the Go ToSpecial dialog box, select both the ConditionalFormatting option button and the Same optionbutton, and click OK. (See Figure 19-6.)

    22_574272 ch19.qxd 10/1/04 10:41 PM Page 100

  • Making Your Outstanding Errors Stand Out 101

    dont protect your formulas against this type of unin-tentional editing (as I suggest in Technique 38), youcan at least set up this type of conditional formattingto notify you if such an error occurs.

    Figure 19-7 illustrates a situation where you couldapply this type of conditional formatting. Here, youhave a typical table of data that calculates the subto-tals and grand total of the quarterly sales for abunch of different stores. E12 contains the formulathat returns the grand total (by summing the rowsubtotals in the cell range E3:E11).

    To alert me if this sum of the row subtotals everbecomes unequal to the sum of the column totals (inthe cell range B12:D12), I set up conditional format-ting for this grand-total cell E12. In the ConditionalFormatting dialog box, I select Formula Is as thetype and then enter the following formula in theaccompanying text box:


    As for the formatting to be applied when the inequal-ity set up by this formula is true, I go with bold andred as the font attributes and bright yellow shadingfor the cell background. That way, if cell E12 everlights up like a Christmas tree with this garish for-matting, I know right away that some knucklehead(probably me) has gone and messed up one of theSUM formulas that calculates the column and rowsubtotals.

    Figure 19-8 shows you how this conditional format-ting appears in cell E12 when just such a thingoccurs. For this figure, I intentionally replaced the

    SUM formula in cell C12 with 0. As a result, the totalfor cell range B12:D12 no longer is equal to that ofthe cell range E3:E11, and the conditional formattingis immediately applied to cell E12.

    Figure 19-7: Table where the sum of the column subtotalsshould always equal the sum of the rowsubtotals.

    Figure 19-8: Conditional formatting applied to the grandtotal cell when the inequality condition istrue.

    22_574272 ch19.qxd 10/1/04 10:41 PM Page 101

  • Save Time By Creating custom number


    Assigning custom formatsto toolbars

    Using euro currencyformats

    CustomizingNumber Formats

    Excel includes a wide variety of number formats designed to makethe values in your spreadsheets easy to decipher for anyone whouses them. For those times when the program doesnt hand you aready-made number format that fits the bill, you can quickly customizeone of the existing formats to suit your needs.

    This technique covers how to create custom number formats for yourspreadsheets and how to assign them to Excel custom styles and tool-bars for easy access. This technique also covers how to use the EuroCurrency add-in to format currency expressed in euros.

    Creating Custom Number FormatsThe easiest way to create a custom number format is to format a samplenumber with the built-in number format whose attributes most closelymatch the ones you want in the new custom format. Continue by openingthe Format Cells dialog box (Ctrl+1), selecting the Custom category on theNumber tab to display the built-in formats codes, and then building thecustom number format by editing its number format codes, as necessary.

    Excels number formats can consist of up to four sections:

    First section specifies how to format positive numbers

    Second section specifies how to format negative numbers

    Third section specifies how to format zeros

    Fourth section specifies how to format text

    Each part of the format is separated by semicolons (;). If a particular for-mat doesnt specify formatting for negative numbers or zeros, Excel for-mats them like it does positive numbers. If the format doesnt specifywhat to do with text, text is formatted as it normally is with the default,Normal format. Table 20-1 shows the codes youd use in the various sec-tions of the custom number format youre creating.

    20Technique23_574272 ch20.qxd 10/1/04 10:43 PM Page 102

  • Creating Custom Number Formats 103

    TABLE 20-1: NUMBER FORMAT CODESCode What It Signifies

    # Digit placeholder that displays only significant digits and does not display insignificant zeros so that####.# displays 2450.48 as 2450.5 in the cell.

    0 (zero) Digit placeholder that displays insignificant zeros if a number has fewer digits than the number of places inthe format so that the code #.00 displays 4.5 as 4.50 in the cell.

    ? Digit placeholder that adds spaces for insignificant zeros on either side of the decimal point to align num-bers on the decimal point so the code 0.?? ensures that 10.5 and 12.75 line up because the program pads10.5 with an extra space.

    \ (backslash) Displays the character that immediately follows as text.

    * (asterisk) Repeats the character that immediately follows to fill the column width.

    text Displays whatever text you enclose in the double quotes as text. Note that the following characters donot have to be enclosed in quotes: $, -, +, /, (, ), :, !, ^, &, (open single quote), (close single quote), ~, {, },=, , and a space.

    @ Text placeholder. By itself, it converts whatever number is entered in the cell into a text entry. When fol-lowed by text enclosed in quotation marks, it appends that text onto the number so that the format code@ estimate appends the word estimate to each number.

    % Percentage that adds a percent sign at the end of the number to indicate that its value is a multiple of ahundred.

    . (period) Decimal point.

    , (comma) Thousands separator.

    ( ) Enclosing the code for the negative numbers in the second section of the format displays negative num-bers in parentheses as (4.50) instead of -4.50. Add a hyphen (-) to negative fo rmat code to have a nega-tive number preceded by a minus sign.

    E-, E+, e-, e+ Converts number into scientific notation.

    _ (underscore) Inserts space equal in width to the character that immediately follows, as in _) to pad values with a spaceequal to the close parenthesis.

    m When not following the h or hh code, inserts the month as a number without leading zeros, as in 7-4-05.

    mm Inserts the month as a number with leading zeros, as in 07-4-05.

    mmm Inserts the month as a three-letter abbreviation, as in Jan, Feb, Mar, and so on.

    mmmm Inserts the full name of the month, as in January, February, March, and so on.

    d Inserts the date as a number without leading zeros, as in 4-1-04.

    dd Inserts the date as a number with leading zeros, as in 4-02-04.

    ddd Inserts the day of the week with a three-letter abbreviation, as in Mon, Tue, or Wed.

    dddd Inserts the full day of the week, as in Monday, Tuesday, or Wednesday.

    yy Inserts the last two digits of the year, as in 2-15-05.

    yyyy Inserts all four digits of the year, as in 2-15-2005.


    23_574272 ch20.qxd 10/1/04 10:43 PM Page 103

  • Technique 20: Customizing Number Formats104

    To get an idea of how you create your own customnumber format, follow these steps for building aformat that displays your financial values in thespreadsheet like you do when writing a check, asin 1,234 and 56/100 dollars:

    1. Enter 1234.56 in a blank cell of the currentworksheet to create a sample amount and makesure that this cell is current.

    2. Choose FormatCells (Ctrl+1) to open theFormat Cells dialog box, shown in Figure 20-1.

    3. On the Number tab, select Fraction in theCategory list box and then scroll down theType list and select As Hundredths (30/100).

    The Sample area now shows the number in thecurrent cell as 1234 56/100.

    4. Select Custom in the Category list box.The Type text box now contains the code #??/00, your starting point for creating yourcustom format.

    When defining custom formats for currency, you enterthe currency signifier, as in $ for dollars, (Alt+0163)for pounds, (Alt+0165) for yen, and (Alt+0128)for euros. Use a comma (,) to indicate the presence ofthe thousands separator and a period (.) to indicatethe decimal point. When defining custom date for-mats, you can separate the parts of the date witheither a hyphen (-) or a slash (/). When defining timeformats, you separate each part with a colon (:).

    To find out the keystroke numeric code thatinserts special characters such as the centsymbol or degree symbol into a customformat, open the Character Map program(StartAll ProgramsAccessoriesSystemToolsCharacter Map) and then select thecharacters. Windows displays the Alt+key-stroke combination, if one exists, in the lowerright of the Character Map dialog box. To usethis numeric code, enter the code from thenumeric keypad while holding down theAlt key.

    TABLE 20-1 (continued)Code What It Signifies

    h Inserts the number of the hour without leading zeros, as in 9:15.

    hh Inserts the number of the hour with leading zeros, as in 09:15.

    m When immediately following the h or hh code, inserts the number of minutes without leading zeros (0-59),as in 5:5.

    mm Inserts the number of the minutes with leading zeros (00-59), as in 5:05.

    s Inserts the number of seconds without leading zeros (0-59), as in 5:05:7.

    ss Inserts the number of seconds with leading zeros (00-59), as in 5:05:07. For fractions of a second, use aformat that includes fractions such as h:mm:ss.00.

    [ ] Displays hours greater than 24 and minutes or seconds greater than 60.

    AM/PM Inserts AM or PM after time numbers depending upon whether the time is before or after noon, as in 10:15PM. (Otherwise Excel formats the time using a 24-hour clock as in 22:15.)

    [Color] Specifies the font color for the section of the format as specified by the color name, as in [BLACK], [BLUE],[CYAN], [GREEN], [MAGENTA], [RED], [WHITE], or [YELLOW]. Note that [Color] must precede the othercodes in the section, as in [RED](#,##0) in the negative section, to have negative values displayed in redand enclosed in parentheses.

    [Colorn] Specifies a font color for the section of the format as specified by a number (n) between 1 and 56. Note thatthis [Colorn] code must precede all other code in the section.

    23_574272 ch20.qxd 10/1/04 10:43 PM Page 104

  • Creating Custom Number Formats 105

    5. Position the Insertion point at the very begin-ning of the Type list box and then type #,##.

    The Type text box now contains the code #,###??/00, and the sample reads 1,234 56/100. Now,all you have to do is add the stock text andbetween the whole and fractional digits and thedollars text at the end.

    6. Position the Insertion point after the last poundsign (#) and then type (open quote), press thespacebar, type and, and then type (closequote).

    The Type text box now contains the code #,###and??/00, and the sample reads 1,234 and56/100.

    7. Position the Insertion point at the very end ofthe code (after the last 0) and type (openquote), press the spacebar to insert a space,type dollars, and then type (close quote).

    The Type text box now contains the code #,###and??/00 dollars, and the sample reads1,234 and 56/100 dollars, as shown inFigure 20-2.

    Figure 20-1: Selecting the Fraction category to apply aclose format to the base number.

    Figure 20-2: The Number tab of the Format Cells dialogbox showing the custom number formatcodes.

    8. Click OK to close the Format Cells dialog boxand apply the new custom format to the cur-rent cell in the worksheet.

    When you close the Format Cells dialog box, Excelapplies the custom format to the 1234.56 samplenumber in the current cell. To apply this custom for-mat to other cells in the worksheet, you need toselect the cells, open the Number tab of the FormatCells dialog box, select Custom in the Category listbox, select the #,### and??/00 dollars code atthe very bottom of the Type list box, and click OK.

    Custom formats that conditionally format entries

    You can use Excels number format codes to createcustom number formats that do conditional format-ting (much like the conditional formatting featurediscussed in Technique 19). To create a conditionalformat, you set up the condition inside square brack-ets using the same comparative operators (=, >, =,

  • Technique 20: Customizing Number Formats106

    zeros, and text) that determine how specific types ofentries are formatted, you can easily create customformats that hide a particular type of entry by leavingits section blank.

    For example, to create a number format that hidesthe contents of a cell only when it contains text,open the Format Cells dialog box, select the Customnumber category on the Number tab, and enter thefollowing number codes in the Type text box:

    _(* #,##0.00_);_(* (#,##0.00);0;

    In this custom number format, Excel applies thestandard Comma style formatting to positive andnegative numbers, while at the same time displays 0for cells that contain zero. However, because I failedto add a number format code in the fourth section(after the third semicolon), Excel hides any textentry.

    To create a custom format that does just the oppo-site that is, hides all numbers and displays onlytext you simply enter two semicolons with nonumber format codes whatsoever:


    In this custom number format, the two semicolonsdelineate three of the possible four sections: the pos-itive number before the first semicolon, the negativenumber immediately following the first semicolon,and the zero section of the format immediately fol-lowing the second semicolon. However, because allthree sections are empty, Excel hides the display ofpositive, negative, and zero values, displaying onlytext entries. If you want to create a custom formatthat hides the display of all entries in a cell, just addthe third semicolon to these other two with no codes(and no spaces) as in:


    Because all four sections of the number format arenow delineated and empty, Excel suppresses the dis-play of all types of entries in the cells to which thiscustom number format is applied.

    For example, you can create a conditional customformat that displays a cent sign () after all valuesthat are less than a dollar and displays a normal dol-lar sign and two decimal places for all values over orequal to one dollar. To do so, open the Number tabof the Format Cells dialog box, select the Customnumber category on the Number tab, and enter thefollowing code in the Type text box:


  • Assigning Custom Number Formats to Styles and Toolbars 107

    Assigning Custom NumberFormats to Styles and ToolbarsFrankly, the only problem with custom number for-mats is that theyre just not that easy to use. Toapply them to a cell selection, you have to open theNumber tab of the Format Cells (Ctrl+1) dialog box,select Custom in the Category list box, and then findthe darned number format codes in the Type list boxcontaining that long listing of codes.

    To make your custom number formats much moreaccessible, I suggest that, at the very least, you assignthe custom number formats to styles that you canthen select from the Style dialog box (or Style drop-down list if you follow my advice and add this littlegem to the Formatting toolbar or one of your owndesign refer to Figure 18-3 in Technique 18).

    To hitch one of your custom number formats to anew style, follow these steps:

    1. Apply the custom number format you wantto assign to a style to a sample entry in yourworksheet.

    To do this, select the cell, open the Number tabof the Format Cells dialog box (Ctrl+1), selectCustom in the Category list box, select the for-mats codes in the Type list box, and click OK.

    2. Choose FormatStyle to open the Styledialog box.

    3. Enter the new name for your style in the StyleName text box.

    When you type the new style name, the Style dia-log box displays the number codes for the cus-tom number format in the Style Includes (ByExample) area, as shown in Figure 20-3.

    4. Click OK to close the Style dialog box.Be sure to save your worksheet after assigningyour custom number formats to new styles.Keep in mind that styles are saved only as part

    of the current workbook. To use these stylesand their custom number formats in otherworkbooks you build, you have to merge thestyles into them. (See Technique 18 for moreon merging styles.)

    Figure 20-3: Assigning a custom number format to a newstyle.

    If you start using a custom number format on a fre-quent basis, you may want to do more than justassign the format to a style that you can apply fromthe Style dialog box or drop-down list box that youadd to a toolbar. You can add the style to a buttonthat you add to the Formatting toolbar or a toolbarof your own design.

    To add a style that applies a number format to a but-ton, follow these three steps:

    1. Assign the custom number format to a customstyle (as described in the preceding steps).

    2. Record a keystroke macro (see Technique 60)that selects that style.

    3. Assign the keystroke macro to a custom buttonon one of your toolbars. (See Technique 2.)

    To see how easy this is, follow along with the stepsfor assigning a custom number format one thathides all types of entries in a cell to a new buttonon my Custom Formats toolbar (a toolbar of my owndesign):

    23_574272 ch20.qxd 10/1/04 10:43 PM Page 107

  • Technique 20: Customizing Number Formats108

    Figure 20-5: Assigning the custom number format to anew style called All Hidden.

    Figure 20-6: Recording a keystroke macro All_hiddenthat selects the All Hidden style.

    5. Choose ViewToolbarsCustomize to open theCustomize dialog box. If the toolbar to whichyou want to add the custom button isntalready visible, click the Toolbars tab andselect this toolbars check box.

    6. Click the Commands tab, select the Macros inCategories list box, and then drag the custombutton from the Customize dialog box to thedesired position on the toolbar, as shown inFigure 20-7.

    7. Assign the keystroke macro to the custom but-ton by right-clicking on the button and thenselecting Assign Macro on its shortcut menu.

    1. Create the custom number format that hides alltypes of entries. To do so, open the Number tabof the Format Cells dialog box, select Custom inthe Category list box, enter ;;; in the Type textbox, and click OK. (See Figure 20-4.)

    Figure 20-4: Creating the custom number format thathides all types of cell entries.

    2. Assign the new custom format to a new style bychoosing FormatStyle, entering All Hiddenin the Style Name text box, and clicking OK.(See Figure 20-5.)

    3. Begin recording a keystroke macro that selectsthis new All Hidden style. To do so, chooseToolsMacroRecord New Macro, enterAll_hidden in the Macro Name text box, selectPersonal Macro Workbook in the Store MacroIn drop-down list box, and click OK. (SeeFigure 20-6.)

    4. To finish recording the macro, chooseFormatStyle, select All Hidden in the StyleName drop-down list box, click OK, and thenclick the Stop button in the Stop Recordingtoolbar.

    23_574272 ch20.qxd 10/1/04 10:43 PM Page 108

  • Applying Euro Currency Formats 109

    Figure 20-7: Adding a custom button to the CustomFormats toolbar to which to assign theAll_hidden macro.

    8. Select the All_hidden macro in the Macro Namelist box and click OK, as shown in Figure 20-8.

    Figure 20-8: Assigning the All_hidden macro to thecustom button.

    9. (Optional) Change the button image and buttonname (see Technique 2) and then click theClose button in the Customize dialog box.

    After you close the Customize dialog box, you cantest your new button. Select a cell that containssome sort of data entry and then click the All Hiddenbutton on your toolbar. The entry should immedi-ately disappear from the cell (while still being visibleon the Formula bar). To redisplay the cell entry,apply another format, such as General, to it.

    The All Hidden button will work in any work-sheet that you build provided that you mergethe All Hidden style into the new workbookbefore clicking the button. If you dont do themerge, youll get a Run-time error 450 whenyou click the button; Excel is caught running amacro that tries to apply a style that doesntyet exist in the new file!

    Applying Euro CurrencyFormatsBefore leaving the subject of custom number formats,theres one more custom number format that I wantyou to be aware of. This is the Euro Currency numberformat that is supplied as part of the Euro CurrencyTools add-in program that comes with Excel. Thisadd-in is heaven sent if you deal with currency fromthe countries in the European Union that haverecently adopted the euro as their basic currency.

    When you activate this add-in (see Technique 8),Excel adds a Euro button to the Formatting toolbarthat automatically formats your cell selection with theeuro currency symbol () and two decimal places. Inaddition to this formatting button, the add-in also pro-vides you with a EuroValue toolbar (see Figure 20-9)that you can use to convert the euro currency valuesto the former currency of a particular member coun-try and a members former currency into euros. Tomake this type of conversion, all you have to do isclick the appropriate conversion on its drop-downlist.

    23_574272 ch20.qxd 10/1/04 10:43 PM Page 109

  • Technique 20: Customizing Number Formats110

    TABLE 20-2: EURO CONVERSION ISO CODESISO Code Country/Region Unit of Currency

    ATS Austria Schilling

    BEF Belgium Franc

    EUR Euro member state Euro

    FIM Finland Markka

    FRF France Franc

    DEM Germany Deutsche mark

    GRD Greece Drachma

    IEP Ireland Pound

    ITL Italy Lira

    LUF Luxembourg Franc

    NLG Netherlands Guilder

    PTE Portugal Escudo

    ESP Spain Peseta

    Figure 20-9: Use the EuroValue toolbar to convert eurocurrency to and from a members pre-eurocurrency.

    The conversion options on this drop-down list makeextensive use of the three-letter ISO codes that referto particular countries and their former currencieswithin the union. (Refer to Table 20-2 to decodethese abbreviations.)

    In addition to the EuroValue toolbar, the EuroCurrency Tools add-in attaches a Euro Conversioncommand to the Tools pull-down menu. Selectingthis command opens a Euro Conversion dialog boxthat also enables you to convert from one euro mem-ber currency to another.

    23_574272 ch20.qxd 10/1/04 10:43 PM Page 110

  • 21 DazzlingAlignments forData EntriesMost of the time, the Formatting toolbars Align Left, Center, AlignRight, and Merge and Center buttons are all you need to put yourspreadsheets data entries into good order. You should, however,keep in mind that Excel has much more to offer than these four standardformatting buttons when it comes to properly aligning and orienting yourdata.

    Using these other less standard alignment options can often go a long waytowards making the tables in your spreadsheet read better by enabling youto keep their data more compact in their columns. More importantly, theycan save you from later having to waste time dealing with paging problemscaused by tables that unnecessarily split across more than one page ofthe report.

    This technique looks at several of these less standard alignment optionsthat you can apply to both text and numeric entries in the tables in yourspreadsheets. It also covers text options that enable you to efficientlyformat long text entries such as the titles and column and row headingsfor your tables.

    Line Me UpThe Alignment tab of the Format Cells dialog box (opened by pressingCtrl+1 see Figure 21-1) contains four sections with options that enableyou to control the positioning of the data entries in their cells:

    Text Alignment to change the horizontal and vertical alignment of theentries in their cells. In addition to the normal left, center, and righthorizontal alignment, you have a choice between using left or rightindent, filling the cell with the characters in the entry, justifying thecharacters to fill the width of the cell, and centering the entry across aselection of cells.

    Vertical alignment options include aligning the entries with the top edgeof the cells, bottom edge, or centered between the two edges. Or youcan wrap the entry on different lines that are either justified betweenthe top and bottom cell edges or evenly distributed between the two.


    Save Time By Using unusual horizontal

    and vertical alignments

    Indenting data entries

    Wrapping text withincells

    Centering an entry acrosscells

    24_574272 ch21.qxd 10/1/04 10:44 PM Page 111

  • Technique 21: Dazzling Alignments for Data Entries112

    Figure 21-1: Use the options on the Alignment tab of theFormat Cells dialog box to select unusualalignments.

    Figure 21-2: Sales table showing the breakdown of salesby media and category.

    To do this, you could just select all the ranges withthe subheadings as a single cell selection and thenclick the Increase Indent button on the Formatting

    Orientation to reorient the data entries by rotat-ing up or down the angle of the baseline that theircharacters rest on or by setting the entries so thecharacters appear one over the other in a singlethin column.

    Text Control to wrap the text in the entries on asmany lines as needed to stay within the currentcolumn width (thereby automatically increasingthe row heights), reduce the font size of theentries so that they fit on one line within theircurrent column widths, or to merge the currentcell selection into one large cell within which theentry on the leftmost cell is aligned.

    Right-to-Left to change the normal left-to-rightreading order of the characters to right to left, asrequired when using a language such as Hebrewor Arabic whose characters are read in that order.

    Indenting data entries

    Normally when it comes to horizontal alignment,Excel either automatically sets the first character ofthe entry flush with the left edge of the cell (the leftalignment default for all text entries) or the last char-acter of the entry flush with the right edge (the rightalignment default for all numeric entries). If you cen-ter a data entry (by clicking the Center button on theFormatting toolbar), Excel attempts to make thespace between the left edge and the first characterin the entry equal to the space between the lastcharacter and the right edge.

    Instead of relying on centering to set off particularentries in a worksheet, many times you can justindent the entries from the left edge to set them offfrom the others. For example, Figure 21-2 shows asales table that contains sales figures for three kindsof recording media: CDs, cassette tapes, and LPs.Each of these three groups has it own subheadingsthat list the same four music categories (Rock, Jazz,Classical, and Other). You can improve the legibilityof the row headings for this table by indenting thesecategory subheadings.

    24_574272 ch21.qxd 10/1/04 10:44 PM Page 112

  • Line Me Up 113

    toolbar. However, if you want to indent the headingsmore than a single character (which is the defaultwhen you click the Increase Indent button), yourebetter off doing this from the Alignment tab of theFormat Cells dialog box.

    Figure 21-2 shows you how. Select the Alignment tabin the Format Cells dialog box (Ctrl+1). Select Left(Indent) in the Horizontal drop-down list, select 2 inthe Indent text box (either by typing 2 or selecting itwith the spinner buttons), and click OK. Figure 21-3shows you the results. Here, I have indented the cellranges A4:A7, A10:A13, and A:16:A:19 two charactersin one operation.

    Figure 21-3: Sales table after indenting each row categorysubheadings two characters.

    Using nonstandard vertical alignment

    By default, Excel vertically aligns the baseline of allyour data entries with the bottom edges of theircells. In certain cases, you can improve the look ofthe spreadsheet by increasing the height of rows byusing other vertical alignment options. When youselect the Top or Center vertical alignment options,you often have to manually increase the height ofthe rows before you can see the effect that theseoptions have on the vertical positioning of the dataentries. When you select the Justify option or theDistributed vertical alignment option, Excel automat-ically increases the height of the rows as needed to

    wrap the text onto several different lines in order tomaintain the current column widths.

    Figure 21-4 illustrates this situation. For this figure, Iapplied the Justify Vertical alignment option to cellA1 the cell containing the spreadsheet title. (Referto Figure 21-3 to see how this title originally lookedwhen its long text entry spilled over into the blankcolumns B, C, and D to the right.) After applying thisvertical alignment option, Excel wraps the title ontofour separate lines. The program does this by auto-matically increasing the height of line 1 from 15.75characters (21 pixels) to 63 characters (84 pixels)while at the same time leaving the width of columnat 20.14 characters (146 pixels).

    Figure 21-4: Applying the Justify Vertical alignment optionto cell A1 with the long spreadsheet title.

    Instead of using a blank row to separate yourtable titles from the first row of data, apply theTop or Center Vertical alignment option to thecells with the titles and then manually increasethe height of their rows. If you dont want tochange the vertical alignment of the titles, youcreate a sense of vertical space simply byincreasing the height of the first row of data.

    Rotating text entries

    Long column headings tend to inflate the width ofthe individual columns in order to display all theircharacters. These are the leading culprits in makingtables of data much wider than they need to be often preventing an otherwise manageable tablefrom fitting on the page when printed. Instead of

    24_574272 ch21.qxd 10/1/04 10:44 PM Page 113

  • Technique 21: Dazzling Alignments for Data Entries114

    Figure 21-6: Schedule after rotating the column headingsup to narrow their columns.

    To squeeze columns down to one characterwide for forms that just use check boxes,rotate the column headings 90 degrees coun-terclockwise or select the orientation whereinthe characters appear one over the other. (Todo the latter, select the Alignment tab of theFormat Cells dialog box and click the samplethat shows the word Text with the charactersaligned this way.)

    Getting Your Text under ControlThe Alignment tab on the Format Cells dialog boxprovides you with three methods for managing thetext entries in your spreadsheet. The first two con-trols are specifically designed to manage extra-longtext entries so that they fit within a column widththats considerably narrower than would otherwisebe required to display all the text. The last methodenables you to center a text heading over severalcolumns as you might want to do with a title for atable of data.

    Making text wrap within a cell

    When you want to maintain a set column width bywrapping long text entries in a cell selection onto

    widening the columns just to display long headings,you can often keep those column widths down to areasonable size simply by rotating their columnheadings. Youd be surprised how much real estateyou can save by rotating column headings up evenas little as 45 degrees.

    Figures 21-5 and 21-6 illustrate how this rotating-col-umn-headings trick can save on overall table width.In Figure 21-5, you see the column headings for theproduction schedule right before rotating their base-lines up (technically counterclockwise) by 60degrees. As you can partially see in columns H, I,and J, displaying the headings for these columnsmakes them much wider than they really need to be.

    Figure 21-5: Getting set to rotate the column headings45 degrees counterclockwise.

    To make this project schedule more compact with-out having to shorten the text for the column head-ings, I simply use the Orientation control on theAlignment tab of the Format Cells dialog box torotate the headings up 60 degrees. Figure 21-6 showsthe same schedule after rotating the column head-ings and then choosing FormatColumnAutoFitSelection. As you can see in this figure, rotatingthese headings up and then narrowing the columnwidths really compact this table.

    24_574272 ch21.qxd 10/1/04 10:44 PM Page 114

  • Getting Your Text under Control 115

    several lines, select the Wrap Text check box in theText Control section of the Alignment tab. You canuse this control to break up a long table heading thatwould normally spill over several blank columns sothat all its text fits within the current column widthset for the data in rows below. You can also use it toeffectively control long column headings that wouldotherwise force you to widen the columns of datamuch more than is necessary to just display theirnumerical entries.

    Figures 21-7 and 21-8 illustrate this kind of situationand solution. Figure 21-7 shows a sales table whosecolumn headings are extra long. Theyre so long infact that it would require widening their columnsway beyond what is necessary just to display thefinancial data.

    Figure 21-7: Sales table with really long column headingswhose text needs to be wrapped.

    To remedy this situation and make this table muchmore compact, follow these steps:

    1. Select the columns that contain the long col-umn headings.

    In this example, I selected the letters B through Jin the column header.

    2. Manually narrow the selected columns to thewidth necessary for displaying the data entries.

    For this example, with the help of the WidthScreenTip, I narrowed the selected columns to awidth of 12.86 characters (95 pixels) by draggingthe right border of one of the selected columns.(Here, narrowing one column automatically nar-rows all the other selected columns.) Doing this,

    of course, truncates the long column headings inthe second row.

    3. Select the range of cells with the long columnheadings that you want wrapped to the newnarrower column widths.

    For this example, I selected the cell range B2:J2.

    4. Open the Format Cells dialog box (Ctrl+1),select the Alignment tab, select the Wrap Textcheck box, and click OK.

    Figure 21-8 shows the results of this operation. Excelautomatically wraps the column headings so thattheyre entirely displayed within the current columnwidths. At the same time, the program automaticallyincreases the height of row 2 to accommodate thesewrapped lines of text.

    Figure 21-8: Sales table after wrapping the columnheadings to display on several lines in thenarrower columns.

    Shrinking the text to fit within a cell

    The second way of getting long text entries to fitwithin a certain cell width is to shrink their textdown to size with the Shrink to Fit check box option.This option is a lot less successful than Wrap Textbecause Excel often ends up shrinking your textentries so much that theyre illegible without the useof a magnifying glass. (See Figure 21-9 for a primeexample of this.)

    Reserve the Shrink to Fit option to those textentries that almost fit within the current col-umn width to guard against reducing them somuch that theyre no longer legible.

    24_574272 ch21.qxd 10/1/04 10:44 PM Page 115

  • Technique 21: Dazzling Alignments for Data Entries116

    The Center option in the Horizontal drop-downlist box in the Text Alignment section

    The Merge Cells check box option in the TextControl section

    Figure 21-10 illustrates the most common use for theMerge and Center button. Here, I have centered thespreadsheet title entered into cell A1 over columnsA through I by first selecting the cell range A1:I1 andthen clicking the Merge and Center button on theFormatting toolbar.

    Figure 21-10: Sales table after centering the spreadsheettitle across columns A:I.

    The Merge and Center button is a toggleswitch. The first time you click it, Excel mergesthe selected cells and centers the text within it.The second time you click it with the mergedcell selected, the program restores the cellsthat were merged into one and returns thetext entry to its original alignment.

    Figure 21-9: Sales table after making the columnheadings illegible by shrinking them to fitthe various column widths.

    Centering a heading across columns

    The Merged Cells check box on the Alignment tab ofthe Format Cells dialog box enables you to meshtogether separate cells of a single range to create amega cell. The purpose for doing this is so you canchange the horizontal or vertical alignment of itsdata entry with regard to the new mega cells bor-ders. (The data can be either a text or numeric entryas long it was made in the first cell of the erstwhileseparate cell range.)

    Because your purpose in merging a cell range into amega cell often is to be able to center a headingwithin it so that the heading spans several columns,the Formatting toolbar contains a Merge and Centerbutton. By clicking this button, you combine two dif-ferent controls on the Alignment tab of the FormatCells dialog box:

    24_574272 ch21.qxd 10/1/04 10:44 PM Page 116

  • 22 Charting Data in a SnapOne of the most effective ways to present your worksheet data is ingraphic form using one of Excels chart formats. By representingthe numbers in your spreadsheet in graphic form, users can spottrends and anomalies in the data much more quickly than when perusingthe raw figures (no matter how well youve formatted them).

    Excel makes it a snap to turn the tables of data in your spreadsheets intovibrant, inspiring charts. When charting data, you can either create thechart on its separate chart sheet or embed the chart as a graphic objecton one of the regular worksheets in the workbook. If you choose toembed the chart as a graphic object, you can then modify the charts sizeand position as you would a photo or piece of clip art that you add to theworksheet. You can also easily print the chart along with its substantiat-ing data in a report. If you create a chart on a separate chart sheet, youcan easily print the chart on a separate page of your report without hav-ing to worry about fitting it in with surrounding data.

    Instant ChartsIf you want your data graphed on a separate chart sheet, you can do thisin as little as one keystroke, two tops. If youre dealing with a table ofdata where you want all the data graphed, you simply position the cellpointer somewhere in the table of data and press F11. If, however, youredealing with a table of data that includes numbers you dont want graphed(subtotals or grand totals in the table), you need to take the extra stepof selecting the range of cells to be graphed (column and row headingsincluding the numbers to be represented) before you press F11.

    Figures 22-1 and 22-2 illustrate just how incredibly quick and easy it is togenerate a chart on its own sheet. Figure 22-1 shows a production sched-ule of projected units to be produced in the last nine months of the calen-dar year (April through December) arranged by part number. When I firstopen the workbook with the cell pointer automatically saved in cell A1, Ijust press F11 to graph this table of data.


    Save Time By Creating an instant chart

    on a new chart sheet

    Making efficient use ofthe Chart Wizard

    25_574272 ch22.qxd 10/1/04 10:45 PM Page 117

  • Technique 22: Charting Data in a Snap118

    (In the column chart, these totals are representedby the last data series the tallest bars in eachmonthly category.)

    To prevent Excel from graphing the subtotals row, allI needed to do was to select the cell range A2:J6before I pressed F11. To eliminate this total dataseries and have Excel redraw the chart without it, Ijust click any one of the columns representing indi-vidual data points of this total data series and thenpress the Delete key. Figure 22-3 shows you the col-umn chart after eliminating the totals data seriesfrom the chart.

    Figure 22-3: Clustered column chart after deleting thetotals data series.

    After making sure that you have just the data youwant represented in the chart, you can get downto the business of enhancing it. Because Excel auto-matically displays the Chart toolbar (shown inFigure 22-4), you can use its buttons to make manyof these chart improvements. For those options thatare not readily available from the Chart toolbar, lookto the options on the Chart pull-down menu whichis automatically added to the Excel menu bar when-ever you make a chart sheet active or select anembedded chart on a regular worksheet.

    Figure 22-1: Data table with production schedulearranged by part number.

    Figure 22-2 shows you the result of pressing F11.As you can see, Excel instantly creates a clusteredcolumn chart on its own chart sheet using the rowsof data in the production schedule as the dataseries. This chart sheet is named Chart1 and isplaced in front of all the other worksheets in theworkbook.

    Figure 22-2: Clustered column chart created fromproduction schedule on its own chart sheet.

    Because I didnt preselect the range of data to begraphed, Excel automatically selects all the rows ofdata in the table and represents them as the differ-ent data series in the chart. This includes the lastrow the one containing the monthly subtotals.

    25_574272 ch22.qxd 10/1/04 10:45 PM Page 118

  • Chart Wizard Magic 119

    Figure 22-4: Use the buttons on the Chart toolbar toenhance the basic chart.

    Typical enhancements that you can make to yournew chart include

    Change the orientation of the data series in thechart. By default, Excel generates the data seriesin the chart from the rows of data. To generatethe data series from the columns of data, clickthe By Column button on the Chart toolbar.

    Change the chart type. By default, Excel repre-sents the data as a Clustered Column chart. Toselect a new chart type, click the Chart Type drop-down button and then select the new chart typefrom the pop-up palette. If this palette doesnthave the chart type you want, choose ChartChart Type to open the Chart Type dialog boxcontaining all the chart types supported by Excelas well as any custom chart types you create. (SeeTechnique 23 for more on custom chart types.)

    Add chart titles. By default, the new chart has notitles. To add titles, choose ChartChart Optionsand then enter the Chart title, the Category (X)axis title, and the Value (Y) axis title as needed.

    Format the chart titles and headings. To do this,select the chart object you want to format (ChartTitle, Category Axis Title, Value Axis Title, andso on) in the Chart Objects drop-down list boxand then click the Format - button on the Charttoolbar.

    Add a data table to the chart that displays thegraphed data beneath the chart itself. Click theData Table button on the Chart toolbar.

    Chart Object


    Chart Type

    Data Table By Column

    Angle Counterclockwise


    By Row

    Angle Clockwise

    Figure 22-5 shows you the same chart as originallyshown in Figure 22-3 after changing the chart typefrom the default Clustered Column type to aClustered Bar chart. In addition, I added a data tableto the chart to show the underlying values repre-sented in the chart.

    If you decide that youd like to convert yourfully enhanced chart to an embedded chart,choose ChartLocation, select the As ObjectIn option button in the Chart Location dialogbox along with the worksheet in which toembed it in the As Object In drop-down listbox and click OK. Excel then converts thechart into a graphic object and adds it to theoriginal worksheet and at the same timedeletes the chart sheet.

    Figure 22-5: Changing the chart type to Clustered Barand making suggested enhancements.

    Chart Wizard MagicIf youre somewhat impatient like me, you probablyreally appreciate the immediacy of generating a newchart (albeit a somewhat rough one) at literally thepress of a button. For those of you who are not quiteas impetuous and therefore dont require quite asmuch immediate gratification, Excel offers a more

    25_574272 ch22.qxd 10/1/04 10:45 PM Page 119

  • Technique 22: Charting Data in a Snap120

    2. Select the general type of chart in the ChartType list box, select the specific type in theChart Sub-type palette, and then click the Nextbutton.

    To get an idea of how your data will look dressedup in the selected chart type, click and hold downthe Press and Hold Down to View Sample button.

    When you click the Next button, Excel opens theStep 2 of 4 - Chart Source Data dialog box, shownin Figure 22-7.

    Figure 22-7: Designating the data range and data seriesto be used in the second Chart Wizarddialog box.

    3. Check that both the range shown in the DataRange text box and the selected worksheetcharting are correct. If need be, click theColumns option button to have the data seriesrepresented by the columns in the selectedrange rather than the rows. Then click the Nextbutton.

    If you need to change the values used for a par-ticular data point in the series or add or delete

    studied, step-by-step way to generate your chartsvia its Chart Wizard.

    Although creating a new chart with the Chart Wizardis a little slower process, its also one that gives youthe opportunity to make basic enhancements selecting a new chart type, adding chart titles, andso on as you create the chart. So, when yourefinished, you have a chart that requires much lessfutzing on your part. When looked at from this per-spective, you may find that the Chart Wizard, whilenot nearly as flashy, may actually prove to be moreefficient.

    To graph your data with the Chart Wizard, followthese general steps:

    1. Select the data in the spreadsheet that youwant represented in the chart and then clickthe Chart Wizard button (the one sporting thecolumn chart icon) on the Standard toolbar orchoose InsertChart.

    Excel opens the Step 1 of 4 - Chart Type dialogbox, shown in Figure 22-6.

    Figure 22-6: Selecting the type of chart in the first ChartWizard dialog box.

    25_574272 ch22.qxd 10/1/04 10:45 PM Page 120

  • Chart Wizard Magic 121

    data points, select the Series tab and then adjustthe range assigned to a particular data point orremove or add new ones.

    When you click the Next button, Excel opens theStep 3 of 4 - Chart Options dialog box, shown inFigure 22-8.

    Figure 22-8: Adding the chart titles in the third ChartWizard dialog box.

    4. Enter the titles for the chart in the appropriatetext boxes on the Titles tab and then make anyother desired enhancements to the chart usingthe other tabs in this dialog box. When yourefinished, click Next.

    As you enter the titles for the chart, they appearin the preview area on the right side of the dialogbox. Use the options on the other tabs Axes,Gridlines, Legend, Data Labels, and Data Table to make further enhancements to the basic chart.

    When you click Next, Excel opens the Step 4 of 4 - Chart Location dialog box, shown in Figure 22-9.

    5. To place the new chart on a separate chartsheet, select the As New Sheet option buttonand then click the Finish button. Otherwise, toembed the new chart as a graphic object in aworksheet, leave the default As Object Inoption button selected and then click Finish.(To embed the chart on another sheet in theworkbook, select it on the As Object In drop-down list before you click Finish.)

    Figure 22-9: Designating the location of the new chart inthe fourth Chart Wizard dialog box.

    Figure 22-10 shows you how the embedded chartappears in the worksheet after you click Finish toclose the Step 4 of 4 - Chart Location dialog box.Note that Excel automatically selects this newgraphic object (indicated by the presence of theblack square sizing handles at the corners and mid-points of the perimeter of the Chart Area).

    Figure 22-10: Embedded chart created with the ChartWizard.

    Excel also selects the ranges of cells that contain thetext and numbers used in the chart. The programencloses the rows or columns of numerical data in ablue rectangle with sizing handles at the four corners.

    The program identifies the text entries that, in thecase of this type of Clustered Bar chart, contain thedata points in each cluster and appear in the legend

    25_574272 ch22.qxd 10/1/04 10:45 PM Page 121

  • Technique 22: Charting Data in a Snap122

    the chart title, legend, and so on) and then dragit to its new position. (The mouse pointer changesfrom the white cross arrowhead to a four-headedarrow as you drag the dashed outline of thechart.)

    Most of the time youll find that you need to do bothsome chart resizing and repositioning. Excel has atendency to draw embedded charts rather small inrelation to its identifying elements the chart title,legend, and Category Axis and Value Axis titles.Often, the chart area is so small that not all of thedata elements represented in the chart are even visi-ble. (This is the case in Figure 22-10, where onlythree of the nine months that have been charted arevisible.) The program also tends to place the newembedded chart below the table of supporting databut not directly below so that even if you want thechart beneath the table of data, you often still needto nudge it in slightly to the left.

    The only problem with increasing the sizeof the embedded chart to make the dataelements read better is that Excel makes thetext elements proportionately bigger. To dealwith this, you need to modify the formattingfor these text elements. See Technique 23 forideas on how to make these modificationsmost efficiently.

    by enclosing them within a green rectangle with siz-ing handles at its corners. Excel also identifies thetext entries that contain the various clusters alongthe Category (X) Axis by enclosing them within acyan-colored rectangle with its own sizing handles.

    You can directly manipulate the contents ofthe embedded chart simply by dragging thesizing handles for these different chart compo-nents. For example, to include an extra row orcolumn of data in the chart, all you have to dois to drag the sizing handles attached to theblue rectangle to include the new row or col-umn within its boundaries.

    You should note that whenever an embedded chartis selected in a worksheet, the program displays thefloating Chart toolbar and adds the Chart menu tothe Excel menu bar. You can use the buttons on theChart toolbar or menu items on the Chart menu tomake any needed modifications to the chart itself.

    While the embedded chart is selected in the work-sheet, you can resize it and reposition it as needed:

    To resize the chart area, drag the appropriatesizing handle.

    To move the chart, position the mouse pointerwithin the confines of the chart area (just notdirectly over a particular component such as

    25_574272 ch22.qxd 10/1/04 10:45 PM Page 122

  • 23 Chart CustomizationTricks No one can deny that creating the basic chart in Excel is a fast busi-ness. The only problem is that this swiftness comes at the price oftruly disproportionate and oftentimes illegible charts. (You onlyhave to take a gander at the charts shown in Figures 22-2 and 22-10 ofTechnique 22 to bear this out.) This means you spend the bulk of yourchart-making time after the fact doing much needed modifications andenhancements.

    This technique looks at three different chart areas titles and headings,axes, and plot area that often require some attention in a new chartand shows you how you can efficiently make the needed modifications.In terms of the chart titles and headings and axes, these modificationsusually entail basic formatting changes. In terms of the chart plot area,these modifications often entail enhancing the legibility of the datathrough the additions of elements such as data tables, data labels, andadditional gridlines and sometimes adjusting the scale of one or moreof the chart axes.

    Getting the Chart Titles andHeadings in BalanceThe first big problem with most Excel charts is that their text elementsare way out of balance in relation to the plot area (which is actually theheart of the chart). This is especially true of embedded charts where rel-atively gigantic titles and legends tend to dwarf the plot area, often mak-ing it impossible for the program to display all the data points.

    Figure 23-1 is a good example of this kind of problem. Here the plot areaof the Clustered Bar chart is so compressed that only three of the ninemonths plotted can be displayed, and all color differentiation betweenthe individual data points (clearly visible in the huge chart legend) iscompletely lost.


    Save Time By Efficiently formatting the

    charts text elements

    Scaling and formattingthe chart axes

    Making the chart plotarea read better

    26_574272 ch23.qxd 10/1/04 10:28 PM Page 123

  • Technique 23: Chart Customization Tricks124

    Indeed, the only real answer to this problem is toreduce the size of the chart text. The most efficientway to make this kind of change is to follow thesesteps:

    1. Select a text element in the chart. You can either do this by clicking the element inthe chart itself or by selecting its name on theChart Objects buttons drop-down list on theChart toolbar.

    2. Click the Format button on the Chart toolbar.Doing this opens a Format dialog box specificallyfor the particular object.

    3. Use the Size option on the Font tab of this dia-log box to select a smaller size font (and, per-haps even select a new font and apply otherattributes such as bold and italics to it whileyoure at it). When youre finished, click OK.

    4. Repeat these steps for each additional textelement.

    Figure 23-3 shows what a difference just reducing thefont size of the charts various text elements has onthe plot area and the legibility of the entire chart.This figure is identical to Figure 22-2 shown earlierexcept that I reduced the font size for the chart title,legend headings, Value Y-axis title and headings, andthe Category X-axis title and headings.

    Now that the sizes of the text elements are in pro-portion with the size of the chart area, Excel is ableto display all the graphed data in the center plotarea. Note that the Value (Y) axis now containsseven tick marks (from 0 to 1200) as opposed to justthe four in the original chart (0, 500, 1000, and 1500).Also, the Category (X) axis can display clusters forall nine months (April to December) rather than thefive months (April, June, August, October, andDecember) in the original chart.

    Figure 23-1: This plot area of this embedded chart isdwarfed by the large text elements.

    Although increasing the size of the chart area canhelp this problem, making the chart bigger overall isno real answer. As you can see in Figure 23-2, Excelmaintains the same proportions between plot areaand the chart titles and headings so that what wasoriginally big text in the chart becomes huge text.

    Figure 23-2: Increasing the size of the chart area inflatesthe size of the text elements as well.

    26_574272 ch23.qxd 10/1/04 10:28 PM Page 124

  • Scaling and Formatting the Chart Axes 125

    Figure 23-3: Embedded chart after reducing the font sizeof all the chart titles and axis and legendheadings.

    Scaling and Formattingthe Chart AxesAnother problematic area in new Excel charts one that often requires your tender touch is theformatting (or lack thereof) of the chart axes. Mostof the two-dimensional column and bar charts thatyoull encounter use a numerical scale only for thevertical (Value) Y axis. Other chart types such as XY(Scatter) and Line charts use numerical scales bothfor the horizontal (Category) X axis and the verticalY axis.

    When Excel generates a new chart, it uses the highand low values in the spreadsheet data to determinethe minimum and maximum values used by the Y-axisscale (and sometimes used by the X-axis scale aswell). These high and low values also determine thenumber of tick marks on the scale, the incrementbetween the tick marks, and the headings that eachtick mark displays.

    Very often, youll find that reducing the font size ofthe Y-axis or X-axis headings is not enough; you mayalso need to select a more truncated number formatfor your numerical scales, Occasionally, you mayeven find it beneficial to modify the scale that thechart uses so that your worksheet data are betterrepresented in the plot area.

    Figure 23-4 illustrates such a situation. This ClusteredColumn chart shows the dollar amounts of CG Mediasfirst quarter 2004 sales for CDs and cassette tapesbroken down by music category. Excel automaticallyformatted the Value (Y) axis using the Accountingnumber format with two decimal places. For thischart (and most of the others you generate), younever need to give up precious chart area real estateto decimal places (no ones concerned about theextra cents), and if you add a Value axis title as I didfor indicating the currency, you have no need toselect a number format that displays the dollar sign.

    Figure 23-4: Embedded Clustered Column chart with aValue (Y) axis that needs some help.

    To modify the scale or format for the Value (Y) axisor Category (X) axis, you simply click the axis in thechart area or select it in the Chart Object buttonsdrop-down list. Then click the Format (Axis) button

    26_574272 ch23.qxd 10/1/04 10:28 PM Page 125

  • Technique 23: Chart Customization Tricks126

    Excel then uses this spread to establish theincrements for the major and minor tick markson this scale. (Only the major tick marks are dis-played by default.)

    Figure 23-6: Modifying the Value (Y) axis scale.

    To help enlarge the plot area for my Area chart, Idecided to fine-tune the Minimum and Maximumvalues for this charts Y-axis scale. To do this, I cre-ated two formulas in the worksheet: one that usesExcels MIN function to calculate the lowest value inthe cell ranges represented in this chart and anotherthat uses the MAX function to calculate the highestvalue in these ranges. For my example, the lowestsales value turns out to be $350.00 while the highestis $2,382.82.

    I then opened the Scale tab of the Format Axis dialogbox and took the Y axis scale off autopilot by makingthe following changes:

    I entered 200 as the new Minimum and 2500 asthe new Maximum (Excel automatically selected0 as the Minimum and 3000 as the Maximum).

    on the Chart toolbar to open the Format Axis dialogbox. Here are some modifications you can make inthis dialog box:

    To assign a new number format to the selectedchart axis, select the Number tab (see Figure 23-5)and then choose a new built-in category ordevelop a custom format of your own. (SeeTechnique 20 for details on developing customnumber formats.)

    Figure 23-5: Modifying the new number format used bythe Value (Y) axis.

    To make modifications to the Value (Y) axisscale, select the Scale tab (shown in Figure 23-6).This tab contains a number of options that con-trol the scales display. The most importantamong these options are the Minimum andMaximum scale values that Excel selects:

    The Minimum value determines the bottomtick mark (where the Y axis crosses the X axis).

    The Maximum value determines the top tickmark.

    26_574272 ch23.qxd 10/1/04 10:28 PM Page 126

  • Tricks for Making the Plotted Data Easier to Decipher 127

    I increased the Minor Unit from Excels auto-matic increment of 100 up to 250. (The MinorUnit determines where Excel draws tick marksshould you choose to display the minor gridlinesfor the Y axis.)

    Figure 23-7 shows you the results of all this tinkeringwith both the number formatting of the headings onthe Value (Y) Axis and as well as its scale. As you cansee, these headings are much cleaner and easier toread without the unnecessary decimal places. Also,modifying where the Y-axis scale begins and endsgives you a much clearer vision of the top and lowsellers among the CDs and cassettes.

    Figure 23-7: Clustered Column chart after formatting theY-axis headings and adjusting its scale.

    Tricks for Making the PlottedData Easier to DecipherThe last area that often needs improvement is theplot area itself. What you can do to make this areaeasier to understand is heavily dependent upon thetype of chart youre working. Some chart types suchas those in the Pie chart category allow for very lit-tle improvement to their plot areas, whereas otherssuch as Clustered Column and Clustered Bar chartsallow for a great deal.

    For charts that use both an X-axis and a Y-axis,sometimes the easiest thing you can do to improvethe legibility of the chart is simply to add minor grid-lines. Depending upon the type of chart, these extralines can guide the eye from the tick marks displayingthe closest values on the Y-axis to the actual datapoints in the chart.

    To add (or remove) gridlines from a chart that usesthem, follow these steps:

    1. Choose ChartChart Options to open the ChartOptions dialog box.

    You need to select the chart to add the Chartmenu to the menu bar when working with anembedded chart.

    2. On the Gridlines tab (see Figure 23-8), select (ordeselect) the Major Gridlines and/or MinorGridlines check boxes for the appropriate axis.

    3. When youre finished, click OK.

    Figure 23-8: Displaying major X-axis and major andminor Y-axis gridlines for the chart.

    Figure 23-9 shows the Clustered Column introducedin the previous section after adding both the minorgridlines to the Value (Y) axis and the major gridlinesto the Category (X) axis. Note how well the addition

    26_574272 ch23.qxd 10/1/04 10:28 PM Page 127

  • Technique 23: Chart Customization Tricks128

    When Excel adds a data table or displays val-ues as data labels in a chart, it formats thesevalues exactly as they are in the worksheetitself. To apply a more compact number for-mat in these chart elements, you must assignthe new truncated number format to the cellsin the worksheet that contain the actuallygraphed numbers.

    Figure 23-10 shows the final version of the embed-ded Clustered Column chart. Here, along with themajor X-axis gridlines and the minor Y-axis gridlines,I added a data table and removed the charts legend.Because the data table automatically includes thelegends color keys as part of its row headings, thereis no longer any need to give up any precious chartreal estate to the legend. The final version of thisembedded chart maintains a balance between thegraphic and textual elements while at the same timeis easy to read and to interpret.

    Figure 23-10: Final Clustered Column chart after adding adata table and removing the legend.

    of the major vertical gridlines for the X axis clearlydelineates the clusters with each data series.

    Figure 23-9: Clustered Column chart after adding majorX-axis and minor Y-axis gridlines.

    When youre dealing with a chart where displayingthe underlying numerical data visually representedin the plot area is important to its understanding,you have a couple of choices:

    Display a data table that shows all the graphednumbers in a standard row-and-column table for-mat appearing immediately beneath the chartarea. To add a data table to a chart, just click theData Table button on the Chart toolbar.

    Add data labels that display the numbers rightnext to each data point in the graph. To displaythe values as data labels, select the Data Labelstab of Chart Options dialog box (ChartChartOptions) and then select the Value check boxoption.

    26_574272 ch23.qxd 10/1/04 10:28 PM Page 128

  • Part IV

    Worksheet FormulaTimesavers

    27_574272 pp04.qxd 10/1/04 10:46 PM Page 129

  • 27_574272 pp04.qxd 10/1/04 10:46 PM Page 130

  • 24 Efficient FormulaCopyingCopying formulas is undoubtedly one of the most basic and impor-tant functions that you perform when creating a new worksheet.Given that, knowing how to make efficient copies of the formulasyou construct goes a long way towards making you an efficient spread-sheet designer.

    Whether you use the AutoFill feature or the cut-and-paste method to copyyour formulas, you dont save any time if your basic formula doesnt usethe correct type of cell references for the kind of copy youre making.Therefore, before revealing some tricks of the trade in making efficientcopies of your formulas, I think a quick review of the basic functions ofthe types of cell references and when theyre used may be in order.

    Going from Relative to AbsoluteOne reason why electronic spreadsheet programs such as Excel are sopopular is that theyre able to handle the cell references in formulas whenyou make copies. The ability to populate the cells of your worksheet withthe appropriate calculations based on a single model formula copied in afew seconds time is a tremendous boon to businesspeople everywhere.

    As Im sure youre well aware, when you reference cells when building aformula, Excel automatically makes those cell references relative, meaningthat both the row number and column letter of each cell address can beadjusted in formula copies. Although the relative cell reference is the pro-gram default, you can override this setting by making the cell referenceabsolute so that neither the row number nor the column letter is adjustedin formula copies. You can also convert to a mixed form of cell addresswhere the row number cant be adjusted but the column letter can or onein which the row number can be adjusted but the column letter cant.

    Excel indicates absolute elements in a cell reference by prefacing itwith a dollar sign so that $C$79 designates absolute column and row,C$79 relative column and absolute row, and $C79 absolute columnand relative row. Use F4 to cycle a cell reference from relative toabsolute and through the two mixed modes.


    Save Time By Reviewing Excels differ-

    ent cell references forformulas

    Making efficient one-dimensional copies

    Making two-dimensionalcopies when possible

    28_574272 ch24.qxd 10/1/04 10:47 PM Page 131

  • Technique 24: Efficient Formula Copying132

    current column. When I copy the formula acrossrow 8 to the February column (3) and March column(4), you see that in R1C1 notation Excel doesntreally adjust anything. The program simply copiesthe original R1C1 version of the formula to each cellin the columns on the right. There, the exact copy ofthe original formula performs the same function:summing the values in its column that are four rowsup through and including one row up.

    Figure 24-2 confirms this fact. After copying the origi-nal formula in cell R8C2 (B8) to the cells R8C3, R8C4,and R8C5 (C8, D8, and E8), I moved the cell pointerone column to the right. As you can verify by lookingat the Formula bar in Figure 4-2, Excel really didmake an exact copy of the original formula to thiscell. When viewed in R1C1 notation, you can under-stand why the copy calculates the correct sum.

    Figure 24-2: Verifying that a copy of the SUM formulais exactly the same as the original in theR1C1 notation.

    Next, take a look at a formula that sums the valuesacross different columns in the same R1C1 notation.In Figure 24-3, you see the original formula that sumsthe three-month CD sales in the Rock category forthe first quarter. In R1C1 notation, this SUM formulareads:


    In English, this formula says sum from the cell thatis three columns to the left (C[-3]) to and includingthe cell one column to the left (C[-1]) in this row.When I copy this formula down column 5 (E) to rows5, 6, and 7, the exact copies of this formula sum the

    The easiest way to understand whats going on whenExcel adjusts a cell references row number or col-umn letter is to switch the program out of its rownumber/column letter default style of cell referenc-ing to the alternate (and much more logical) R1C1style. With this style, both the rows and columns ofthe worksheet are numbered so that what you com-monly call cell A1 becomes cell R1C1.

    To switch into R1C1 cell addressing, open theGeneral tab of the Options dialog box andselect the R1C1 Reference Style check box. To switch back into the normal row number/column letter style, clear this check box.

    To see how viewing cell references in the R1C1 stylecan help you understand how Excel makes formulacopies, consider the simple SUM formula shown inFigure 24-1. This formula in cell B8 (R8C2 in R1C1notation) totals the January 2004 CD sales by sum-ming the range of the four cells immediately above.

    Figure 24-1: Viewing a simple SUM formula in theR1C1 cell reference notation.

    In normal row number/column letter notation, thisformula reads:


    When you switch into R1C1 notation, this same for-mula appears as:


    All this says in English is sum the cell thats fourrows up from the current row (-4) through andincluding the cell that is one row up (-1) in the

    28_574272 ch24.qxd 10/1/04 10:47 PM Page 132

  • When Its Copy Time 133

    monthly sales for the Jazz, Classical, and Other cate-gories, respectively.

    Figure 24-3: Copying a SUM formula in R1C1 notationthat totals across the columns of a row.

    You may be curious about how formulas that containabsolute references work in R1C1 notation. Figure24-4 shows you the original formula that calculateswhat percentage of the entire quarters sales eachmonths total sales represents. It does this by divid-ing the January monthly total in row 8 by the quar-terly total in cell R8C5 (E8). Because each copy ofthis formula for the February and March percent-ages need to divide their specific monthly totals inrow 8 by the same quarterly total in cell R8C5 (E8),the reference to this cell needs to be absolute.

    Figure 24-4: Copying a formula that uses an absolute cellreference in R1C1 notation.

    In R1C1 notation, the original percentage formulawith the absolute cell reference appears as:


    You can see that the first cell reference is relative (it says simply to take the value in the cell two rows

    above in the current column). You know that the sec-ond cell reference following the divisor is absolutebecause it simply contains the R1C1 cell referenceitself. When I copy this formula to the February andMarch columns in row 10, these copies will performthe proper division, dividing the February monthlytotal in cell R8C3 (C8) by the quarterly total in R8C5(E8) and the March monthly total in cell R8C4 (E8)by the quarterly total in R8C5 (E8) as well.

    Even if you dont want to work regularly withExcel in R1C1 notation, you can use this sys-tem when you want to verify that all yourcopies of a formula are correct. With R1C1turned on, all the copies you make of a givenformula should appear identical to the originalon the Formula bar as you move the cellpointer through the range.

    When Its Copy TimeWhen it comes to copying your spreadsheet formu-las, you have a choice between using AutoFill or cutand paste. Which method I use depends entirelyupon where the formula needs to be copied to.

    If Im copying a formula in one dimension that is,down the rows of a single column or across thecolumns of a single row I will use AutoFill if I justhave to drag the Fill handle down a few blank rowsor across a few blank columns. If I have to make agazillion copies in one or the other dimension, I usu-ally switch to cut and paste.

    When copying a formula in two dimensions that is,down the rows of the same column and then acrossthe columns of the selected rows to fill out a sched-ule or table of data that uses the basic formula tocompute all its values I almost never use AutoFillbecause this requires two drag operations: the firstto copy the formula down the rows and the secondto copy it across the columns.

    Instead, I cut corners: I copy the formula cell to theClipboard, select the entire range of the table (includ-ing the current cell with formula), and press Enter to

    28_574272 ch24.qxd 10/1/04 10:47 PM Page 133

  • Technique 24: Efficient Formula Copying134

    Figure 24-5: Copying a SUM formula down a blankcolumn by using the occupied column tothe left.

    To see how this works, follow along with my steps:

    1. Position the cell pointer in the cell that con-tains the original formula to be copied (E4) andthen copy it to the Windows Clipboard (Ctrl+C).

    2. Press the key to move the cell pointer onecolumn to the left (D4) and then press Ctrl+.Excel moves the cell pointer to the last occupiedcell in this column (D8 in this example).

    3. Press the key to move the cell pointer onecolumn to the right to the last cell where theformula is to be copied (E8).

    4. Hold down the Shift key and press Ctrl+ toextend the range up to the cell with the originalformula and then press the Enter key.

    When you press Enter, Excel copies the formula toall the cells that you selected with this little sleightof hand. To apply this technique to copying a for-mula across the columns of a single row, copy theformula to the Clipboard and then press andCtrl+ to reach the end of the occupied row. Thenpress and Shift+ to extend the range back to theoriginal formula cell whereupon you press Enter.

    This trick may not seem like much in thisexample, but when you have to copy a formuladown 400 rows instead of 4, it really pays off.And besides, with a little practice, you can makehundreds of copies in seconds. Just remember

    paste the formula into the entire range (this takes allof three seconds flat). And, of course, whenever copy-ing a formula from one worksheet to another or oneworkbook to another, I always use cut and pastebecause this is the only way you can do it!

    Making one-dimensional copies down or across

    By far the most common formula copying that youdo is one dimensional, either down a single columnor across a single row. Formulas that subtotal thecolumns and rows of values in a simple rectangulartable or schedule use this type of one-dimensionalcopying.

    To copy in one dimension, position the cell pointerin the cell with the original formula and then doeither of the following:

    Drag the Fill handle down the column or acrossthe row.

    Copy the formula to the Clipboard and thenselect the range of blank cells into which youwant to paste it. (The pasting itself is the easypart; simply press the Enter key, and your past-ing is complete.)

    When copying a formula down lots and lots of rowsor across bunches and bunches of columns, I wantto share a trick with you that can make this entireprocedure a whole lot easier. In order for this littletrick to work, however, you need to use cut andpaste (AutoFill is out), and the row immediatelyabove the one with the formula or the column to theimmediate left must be full of data entries all the waydown the rows or across the columns into which thecopies must be made.

    Figure 24-5 illustrates this situation. Here, I want tocopy the SUM formula in cell E4 down to the bottomof the sales table to range E5:E8. In order to do so, Iuse the occupied column to the immediate left (D inthis example) to quickly extend the range into whichthe formula is then pasted.

    28_574272 ch24.qxd 10/1/04 10:47 PM Page 134

  • When Its Copy Time 135

    that you shouldnt press Shift until youre readyto extend the range in the blank column orrow back to the cell with the original formula.

    Making two-dimensional copies both down and across

    Two-dimensional formula copies that go down rowsand then across columns (or vice versa) are notnearly as common as one-dimensional copies downthe rows of a single column or the columns of a sin-gle row. However, when the chance to make a two-dimensional copy comes along, its the best becauseyou virtually create an entire table of data in a singleoperation (and you cant beat that for efficiency).

    Figure 24-6 shows you a situation that calls for copy-ing a formula in two dimensions: down rows 7through 16 in column B and across columns C, D, E,F, and G in all these rows. Cell B7 contains the mas-ter formula that needs to be copied throughout thisrange. This formula uses Excels PMT function todetermine a monthly loan payment based on a groupof principal amounts in the cell range A7:A16 andannual interest rates in the cell range B6:G6.

    Figure 24-6: Getting ready to copy the formula with thePMT function to the entire data table.

    To populate this formula throughout the table, Ifollow these four simple steps:

    1. Position the cell pointer in the cell containingthe formula to be copied (B7).

    2. Copy the formula to the Clipboard (Ctrl+C).3. Select the cell range into which to paste the

    copied formula (B7:G16).

    4. Press the Enter key.

    Thats all there is to it. Figure 24-7 shows the sametable after pressing the Enter key. Excel copies themaster formula in one operation, filling the tablewith the monthly mortgage payments based on vary-ing principal amounts and annual interest rates.

    Figure 24-7: Mortgage table after copying the masterformula with the PMT function throughout.

    Please note that the key to the successful copying ofthe master formula throughout this table lies in theproper blend of absolute and mixed cell referencesin it. The PMT function requires three arguments:rate (interest rate per annum), nper (number of peri-ods), and pv (present value, also known as the prin-cipal). For the master formula, cell B6 contains therate argument, B4 the nper argument, and A7 the pvargument. For purposes of copying the formuladown the rows and across the columns of the table,the following combination of absolute and mixed cellreferences has to be used:


    28_574272 ch24.qxd 10/1/04 10:47 PM Page 135

  • Technique 24: Efficient Formula Copying136

    reference so that Excel uses the same loan term(in the input cell B4) in every copy of the master for-mula, regardless of whether this formula is copieddown rows 7 through 16 or across columns Bthrough G.

    Just in case youre interested, this is how the masterformula in cell B7 (er, R7C2) appears in R1C1 notation:


    If you were to switch to the R1C1 cell notation andthen move the cell pointer through all the columnsand rows of the table, you would see that every cellcontains an exact copy of this master formula.

    The rate argument cell uses a mixed cell referencewhere the column is relative and the row is absoluteso that Excel adjusts the rate as you copy the for-mula across columns B through G but does notadjust off row 6 when you copy down rows 7through 16. Likewise, the pv argument cell (the lastone in the PMT function) uses the opposite mixedcell reference wherein the column is absolute andthe row relative. This allows Excel to adjust the prin-cipal when you copy the formula down rows 7through 16 but not adjust off column A when youcopy across columns B through G.

    Finally, the nper argument cell (in the second argu-ment in the PMT function) uses an absolute cell

    28_574272 ch24.qxd 10/1/04 10:47 PM Page 136

  • 25 Speeding Up TableCreation with ArrayFormulasIn Technique 24, I make a big deal about making efficient copies ofyour spreadsheet formulas. In this technique, I make a big deal aboutusing array formulas in tables of data so that you dont have to botherwith making a single formula copy. Instead, you input all the formulasyou need in a particular cell range in a single operation. Not only doesthis significantly reduce the amount of formula copying you have to doin a worksheet, but you also get the added benefit of saving computermemory array formulas take less memory to store than copies of asingle formula. (This savings can be significant when youre dealing withhuge spreadsheets.)

    The key to array formulas is the array, a concept that isnt quite as for-eign as it may first sound. In Excel, with its row and column grid, youwork with arrays all the time. In fact, you could even go as far as to saythat the Excel worksheet itself is nothing more than a humongous 65536(row) x 256 (column) array!

    A Quick Look at Array RangesArray formulas that you build in a spreadsheet use one of two types ofarray ranges:

    One-dimensional array range that occupies a single row or column

    Two-dimensional array range that occupies more than one row andcolumn

    Figure 25-1 illustrates these two types of ranges with four sample arrayranges. Each sample range contains a list of simple numerical valuesknown as array constants.


    Save Time By Using array formulas to

    populate a table

    Knowing how to properlyedit an array

    29_574272 ch25.qxd 10/1/04 10:47 PM Page 137

  • Technique 25: Speeding Up Table Creation with Array Formulas138

    Hurray for Array Formulas!Array formulas are easy to build. Just keep in mindthat youre creating computations that use completeranges of cells rather than just individual cells.Because you want to insert the array formula into anentire range of cells rather than just the current one,you cant complete the formula entry either by click-ing the Enter button on the Formula bar or by press-ing the Enter key. Instead, you must complete theentry by pressing Ctrl+Shift+Enter. This is the only, Irepeat, only way to enter the array formula in all thecells of the array range.

    Figure 25-2 illustrates a situation where you canuse array formulas to good advantage. This figurecontains a table that tracks wages for a group ofemployees in the month of February. These wagesare calculated for two periods the 1st to the 15thand the 16th to the 28th and then summed to pro-duce monthly totals. To compute the wages for eachperiod, you need to multiply the hours worked by theemployee in that period by his or her hourly wage.(Note that, in this figure, columns C through Q andcolumns S through AH the columns that record thedaily hours worked by each employee within eachpay period are hidden for the purpose of creatingthe array formulas that calculate their totals.)

    Figure 25-2: A worksheet for computing wages that canbenefit from array formulas.

    Figure 25-1: Sample one- and two-dimensional arrayranges.

    The first one-dimensional array in this figure islocated in the cell range B3:D3. This array range isa 1 x 3 range (one row across three columns) withthree array constants. In an array formula, theseconstants would appear as:


    The second one-dimensional array is in the cellrange F2:F4. This array range is a 3 x 1 range (threerows in one column) with three array constants. Inan array formula, these constants would appear as:


    The first two-dimensional array in Figure 25-1 is inthe cell range B6:D7. This array range is a 2 x 3 range(two rows in three columns) with six array constants.In an array formula, these constants would appear as:


    The second two-dimensional array is in the cellrange F6:G8. This array range is a 3 x 2 range (threerows in two columns) with six array constants. In anarray formula, these constants would appear as:


    When listing the contents of an array range,the entries are listed across columns and thenby rows. Commas are used to separate thecolumns of a row, and semicolons separate therows. The entire contents list is enclosed in aclosed pair of curly braces.

    29_574272 ch25.qxd 10/1/04 10:47 PM Page 138

  • Hurray for Array Formulas! 139

    If you were to perform this computation with regularformulas, you would create the following master for-mula in cell R10:


    You would then copy this formula down to the rangeR11:R13. Next, you would perform a similar proce-dure, creating this type of formula in cell AI10 andthen copying it down to the range AI11:AI13. Finally,you would create a master formula in cell AJ10 thatsummed cells R10 and AI10 and then copy this for-mula down to the cell range AJ11:AJ13.

    Instead, you can accomplish the same thing withthree array formulas. In the cell range R10:R13, youcreate the following array formula that calculatesthe first-period wages for all the employees:


    Next, in the cell range AI10:AI13, you create thisarray formula to compute the second-period wagesfor everyone:


    Finally, in the cell range AJ10:AJ13, you create thisarray formula to compute the monthly wages for allthe employees:


    To see how quick and easy it is to build these arrayformulas, follow along with these steps:

    1. Select range R10:R13.Instead of selecting a single cell, you select theentire range into which the array formula will beentered.

    2. Type = (equal sign) and then select the cellrange R4:R7.

    The equal sign followed by the address of thecell range R4:R7 appears in the first cell of therange you selected in step 1.

    3. Type * (asterisk), select the cell range A4:A7,and then press F4 to make the range absolute($A$4:$A$7).

    When specifying the operations to be performedbetween array ranges, you use the normal opera-tor (+, -, *, /, ^). You make the second array rangeabsolute so that when you copy the array for-mula from range R10:R13 to AI10:AI13, Excel doesnot adjust this range and continues to use thehourly rates established in this range.

    4. Press Ctrl+Shift+Enter.To complete the entering of the array formula inthe entire selected range (rather than in just thecurrent cell), you must press Ctrl+Shift+Enter.Excel then inserts the array formula enclosed inbraces in every cell in the selected range. (SeeFigure 25-3.)

    Figure 25-3: Worksheet after entering the first arrayformula in the cell range R10:R13.

    5. Press Ctrl+C, select cell AI10, and press Enter.Excel copies the array formula into the rangeAI10:AI13, adjusting the first range from R4:R7 toAI4:AI7, without affecting the hourly wage range,$A$4:$A$7 (see Figure 25-4).

    29_574272 ch25.qxd 10/1/04 10:47 PM Page 139

  • Technique 25: Speeding Up Table Creation with Array Formulas140

    section). Therefore, dont use array formulas intables that are subject to frequent additionsand deletions. Reserve them for tables whosestructures are fixed.

    Editing Array FormulasWhen it comes to editing array formulas, you need tothink of the Three Musketeers motto of all for one,and one for all. Because the formula was entered asa unit, Excel does not allow you to edit any individualcell in that range. If you try to move, delete, insert, orclear individual cells in a range containing an arrayformula, Excel displays an alert dialog box that saysYou cannot change part of an array.

    If you need to make these kinds of editing changes toan array range, you first need to select all its cells(that is, all the cells containing the array formula).Only then can you complete your editing operation.

    To edit the contents of an array formula, youdont have to select the entire range that con-tains it. Just double-click one of its cells, orselect a cell and press F2. However, in orderfor you to complete the change you make tothe array formula, you must still pressCtrl+Shift+Enter.

    If you want to be able to manipulate the cells individ-ually, you need to convert the array formula in thecells to their individual calculated values. To do this,follow these steps:

    1. Select the array range and copy the cells intothe Clipboard (EditCopy or Ctrl+C).

    2. Open the Paste Special dialog box (EditPasteSpecial), click the Values option button, andclick OK.

    Excel not only replaces the array formula with thecalculated values (constants) but also no longertreats the cell range as an array, enabling you to editits individual cells.

    Figure 25-4: Worksheet after copying the first arrayformula to the cell range AI10:AI13.

    6. Press Ctrl+C, select cell AJ10, and press Enter.Excel copies the array formula in the rangeAI10:AI13 to the array range AJ10:AJ13 (seeFigure 25-5).

    Figure 25-5: Worksheet after creating the array formulathat computes the total monthly wages.

    Array formulas are great: They save time andcomputer memory. The only downside istheyre not easy to edit (see the following

    29_574272 ch25.qxd 10/1/04 10:47 PM Page 140

  • 26 Using RangeNamesWhen working with spreadsheets, naming cell ranges you need tofind quickly or print routinely is a really important way to savetime. So too, naming cells that are referenced in your masterformulas is a really efficient way to document their functioning. Finally,assigning range names to constants that you refer to in formulas (suchas a fixed discount rate or rate of growth) is a really resourceful way tohave access to a stable value without having to stick it in some cell in theworksheet.

    In this technique, you find out how to use all three of these procedures tosave time in a worksheet that you access and edit on a somewhat regularbasis. As part of this timesaver, I also review the different ways you canname cell ranges and hints on when to use one method over another.

    Name That Range!At the most basic level, naming a range in Excel is no harder than select-ing the range of cells (this can be a single cell, cell range, or nonadjacentcell selection), clicking the Name Box (on the same row as the Formulabar that contains the current cell address), typing a unique descriptivename for the range, and then pressing Enter.

    Remember these range name conventions: All range names mustbegin with a letter of the alphabet, contain no spaces (use under-scores, please), and not duplicate any other name in the workbook(keep those names unique).

    In fact, I always name single-cell ranges or nonadjacent ranges from theName Box on the Formula bar. You never see me taking the time to openthe Define Name dialog box (InsertNameDefine) and enter thedescriptive range name there.


    Save Time By Naming ranges that you

    routinely use

    Naming constants forformulas

    Using range names inyour formulas

    30_574272 ch26.qxd 10/1/04 10:48 PM Page 141

  • Technique 26: Using Range Names142

    When the Left Column check box is selected, theprogram assigns the row headings in the first col-umn of the cell selection to the rows of the table.( It also assigns the row heading in the top row ofthe leftmost column to all the rows of data in theentire table.)

    If the top row of your table doesnt contain columnheadings, clear the Top Row check box. Likewise, ifits first column doesnt contain row headings, clearthe Left Column check box. Also, if your table usesan unusual layout in which the bottom row containsthe column headings, clear the Top Row check boxand select the Bottom Row one instead. Finally, if therightmost column of your table contains the rowheadings, clear the Left Column check box andselect the Right Column one in its place.

    The table shown in Figure 26-2 illustrates a situationwhere you can use the Create Names feature to goodadvantage. To assign range names to the table (whichin turn I can use to assign names to the formulas inthe Sales Price column [E]), I select the table includingthe row headings in column A and the column head-ings in row 2. Then I open the Create Names dialogbox ( InsertNameCreate) and accept the defaultsettings (Top Row and Left Column). Note that Idont bother to select the tables title in cell A1.

    The range names you assign with the CreateNames feature refer only to cells that containdata of the table and do not include the rowand column headings at the top and left orbottom and right of the cell selection.

    Figure 26-3 shows a list of the range names (and thecell references to which they refer) created with theCreate Names feature. I pasted this list into the cellrange B10:C20 by selecting cell B10, choosing InsertNamePaste, and clicking the Paste List button.

    All the range names you assign with CreateNames are added to the Name Box drop-down list (on the Formula bar), meaning thatyou can select their ranges in the worksheetsimply by clicking their names on this drop-down list.

    To quickly select a cell range or nonadjacentselection after naming it, click the drop-downbutton on the Name Box and then select theselections name in the drop-down list. To printthe cell selection, choose FilePrint, click theSelection option button in the Print dialog box,and click OK.

    Creating names from row and column headings

    Instead of taking the time to use individual descrip-tive names to assign names to ranges in a standarddata table, its almost always more efficient to haveExcel do all the naming for you by using a tablesexisting row and column headings.

    To do this, select the table (including the cells withthe row and column heading you want assigned) andthen choose InsertNameCreate to open theCreate Names dialog box (shown in Figure 26-1).

    Figure 26-1: The Create Names dialog box enables youto assign names from column and rowheadings.

    When you first open the Create Names dialog box,Excel automatically selects both the Top Row andLeft Column check boxes:

    When the Top Row check box is selected, Excelassigns the column headings in the first row ofyour cell selection to the columns of data in thetable.

    30_574272 ch26.qxd 10/1/04 10:48 PM Page 142

  • Name That Range! 143

    Figure 26-2: Getting ready to create range names for atable by using its row and column headings.

    Figure 26-3: Worksheet after pasting a list of the namescreated with the Create Names feature.

    As you can see from the range name list shown inFigure 26-3, when Excel assigns a range name, notonly does the program use absolute cell referencesto specify the cell range that the name references,but it also prefaces the cell range with the sheetname. So, for example, the Sales_Price range name(referring to the cell range E3:E8) is listed at the bot-tom of the range name table as


    Note that the sheet name is always separated fromthe cell range by an exclamation point.

    When assigning descriptive names to cellranges in the Define Name dialog box, younever have to include the sheet name; justmake sure that the descriptive names areunique. Likewise, when referring to rangenames in formulas, dont take time to add thesheet reference because Excel keeps track ofthis automatically.

    Assigning range names that span different sheets

    The only time that sheet names are really required aspart of the range name is when the cell range it refersto spans different sheets of the workbook. In order toname these so-called 3-D references (that is, the samecell range that spans multiple adjacent worksheets),you need to specify the different worksheets involved.

    The easiest way to do this is by specifying the sheetsin the Define Name dialog box as follows:

    1. Make the first worksheet included in the 3-Dreference active.

    2. Choose InsertNameDefine to open theDefine Name dialog box.

    3. In the Names in Workbook text box, type thedescriptive name for the range that spans morethan one sheet.

    4. Press the Tab key until the Refers To text box isselected and then type = (equal sign).

    5. Select the tab of the active sheet and then holddown the Shift key as you select the tab of thelast worksheet to be included.

    When you select the tab of the active sheet, Excelinserts its sheet reference in the Refers To textbox. When you Shift+click the tab of the last sheetin the 3-D reference, Excel inserts its sheet refer-ence after that of the active sheet separatedby a colon.

    6. Select the range of cells in the active sheet to beincluded in all the sheets in the 3-D reference.

    30_574272 ch26.qxd 10/1/04 10:48 PM Page 143

  • Technique 26: Using Range Names144

    To assign a constant to a range name, follow thesesteps:

    1. Choose InsertNameDefine to open theDefine Name dialog box.

    2. Type the descriptive name for the new constant(observing the same range-naming conventions)in the Names in Workbook text box.

    3. Press Tab until the Refers To text box is selected.Then type = (equal sign) and enter the constantvalue you want to assign to this name. (SeeFigure 26-5.)

    4. Click OK to close the Define Name dialog box.

    Figure 26-5: Defining the 25% constant in a range namecalled discount_25.

    If you need to define several constants atonce, click Add instead of OK in Step 4 toinsert each name in the Names in Workbooklist box. When youre finished defining theconstants, click OK.

    Using Your Range Namesin FormulasThe great thing about using range names in yourformulas is that they automatically document theirfunction. This is especially helpful to coworkers whohave to use your spreadsheets but who had no part

    As you drag through the cells in the active work-sheet, Excel automatically collapses the DefineName dialog box so that you can see what youredoing. As you select the cell range, Excel insertsits range reference (using absolute cell references)after the sheet range, as shown in Figure 26-4.

    7. Click OK to close the Define Name dialog box.

    Figure 26-4: Selecting the sheets to be included in therange name.

    After naming a 3-D reference, you can use itsrange name in formulas instead of having togo to the trouble of manually selecting theindividual cell range in each sheet. This is areal timesaver when building formulas thataccumulate values from different sheets.

    Assigning Range Namesto ConstantsNot only are range names great for selecting andreferring to cell ranges in the worksheet, but you canalso use them to good advantage by naming constantvalues that you need to use in your formulas. Forexample, in the sample spring sale furniture table(refer to Figure 26-3) instead of listing the 15% and25% discount rates in column D, you can create arange name that holds these constants and thenrefer to them in formulas that compute the dollaramount of the discount in the cell range D3:D8.

    30_574272 ch26.qxd 10/1/04 10:48 PM Page 144

  • Using Your Range Names in Formulas 145

    in their design. When using names in your formulas,you can assign the names as you construct new for-mulas in the worksheet, or you can add them afterthe fact to existing formulas.

    Using range names in new formulas

    If you named a cell range or constant that you needto refer to in a new formula, you can use its namewhen building a formula. To enter the name, you caneither type it (risky business if you have any troubleremembering the exact name), or you select itsname from the Paste Name dialog box, as shown inFigure 26-6.

    Selecting the name from the Paste Name dia-log box is much easier especially when deal-ing with constants that dont show upanywhere on the worksheet unless youvepasted a list of range names somewherewithin it (InsertNamePaste, Paste List).

    Figure 26-6 illustrates how you go about using a rangename in a new formula. In this example, I want tomultiply the retail price in cell C3 by the discount_25constant to compute a 25% discount in cell D3. To dothis, I follow these steps:

    1. Start the formula by typing = (equal sign),select cell C3, and then type * (asterisk) to indi-cate multiplication.

    2. Open the Paste Name dialog box ( InsertNamePaste), select discount_25 in the PasteName list, and click OK.

    Excel inserts discount_25 into the formula, andthen I have to click the Enter button on theFormula bar to complete it.

    Figure 26-7 shows the sales table after I finish addingthe discount formulas in the cell range D3:D8 thatcompute the discount amount using either the dis-count_25 or the discount_15 constant. By adding therange name, I can tell in an instant which percentageIm using for each item as I move the cell pointerthrough these cells.

    Figure 26-6: Inserting a range name into a new formula.

    Figure 26-7: Worksheet table with formulas usingconstants saved as range names.

    Assigning range names to existing formulas

    Excel doesnt automatically replace cell referenceswith the range names that you assign to them. Toreplace cell references with their names, you needto use the InsertNameApply command. Then inthe Apply Names dialog box that appears, you selectthe range names that you want applied in your work-sheet formulas by selecting them in the Apply Nameslist box.

    When you first open the Apply Names dialog box,it contains just two check boxes: Ignore Relative/Absolute and Use Row and Column Names (bothof which are checked). When you click the Optionsbutton, Excel expands the Apply Names dialog boxto display additional options that you can use whenapplying your range names, as shown in Figure 26-8.

    30_574272 ch26.qxd 10/1/04 10:48 PM Page 145

  • Technique 26: Using Range Names146

    Figure 26-9 illustrates how the Apply Names featureworks. First, I created range names for the sales tableby selecting the range A2:E8, opening the CreateName dialog box, and using the Top Row and LeftColumn defaults (see Creating names from row andcolumn headings earlier in this technique). Next, Iselected the cell range D3:E8, which contains all thecells with formulas in this table, and then openedthe Apply Names dialog box ( InsertNameApply).

    Figure 26-8: Applying range names to the selectedformulas in the table.

    Figure 26-9: Worksheet table after assigning rangenames to its formulas.

    Because I wanted the row headings included inthe formulas range, I clicked the Options buttonto expand the Apply Names dialog box and thencleared the Omit Row Name if Same Row check boxand clicked OK. As a result, Excel inserted the code

    The complete Apply Names options include the following:

    Ignore Relative/Absolute: Select this check boxto replace cell references with the names thatyouve selected in the Apply Names list boxregardless of the type of reference used in theirformulas. Clear this check box if you want toreplace only those cell references that use thesame type of references as your names (absolutefor absolute, mixed for mixed, and relative forrelative).

    Most often, you want to leave this check boxselected because Excel automatically assignsabsolute cell references to the names that youdefine and relative cell references in the formulasthat you build.

    Use Row and Column Names: Select this checkbox to have the names appear in your formula thatyou created from row and column headings withthe Create Names feature. Clear this check box ifyou dont want these row and column names toappear in the formulas in your worksheet.

    Omit Column Name if Same Column: Select thischeck box to prevent Excel from repeating thecolumn name when the formula is in the samecolumn. Clear this check box if you want the pro-gram to display the column name even in formu-las in the same column as the heading used tocreate the column name.

    Omit Row Name if Same Row: Select this checkbox to prevent Excel from repeating the row namewhen the formula is in the same row. Clear thischeck box if you want the program to display therow name even in formulas in the same row asthe heading used to create the row name.

    Name Order: You have two choices here:

    Row Column: Click this option button (thedefault) to have the row name precede thecolumn name when both names are displayedin the formulas.

    Column Row: Click this option button to havethe column name precede the row name.

    30_574272 ch26.qxd 10/1/04 10:48 PM Page 146

  • Using Your Range Names in Formulas 147

    range name in the formulas. For example, the formulain cell D3 now contains

    =_12_305 Retail_Price*discount_25

    If I had left the Omit Row Name if Same Row checkbox selected in the Apply Names dialog box, the for-mula in D3 would instead read


    The problem with omitting the row heading from theformulas is that all the formulas in column D wouldthen read the same as the one in D3. By adding therow heading, anyone using the spreadsheet can eas-ily verify the precise function of each discount for-mula. For example, when the cell pointer is in cell D6of the sales table shown in Figure 26-9, the formulaon the Formula bar reads

    =_10_234 Retail_Price*discount_15

    The only problem with including the row or columnheadings is that, in formulas that refer to more than

    one cell in the same row or column, the repeatingof these headings can make the formulas long andcumbersome to decipher (thus defeating the goal ofusing range names to document their function).

    For example, the formula in cell E3 that computesthe sales price for the 36-inch round table with thecode 12-305 now reads

    =_10_235 Retail_Price-_10_235 Discount

    In such cases, you may be better off using the ApplyNames default settings that omit all repeated head-ings to create a much cleaner, albeit generic form ofthe formula. In the case of E3, the sales price formulacreated by omitting the row heading would be muchsimpler:


    Just keep in mind that this is how all the rest of thesales price formulas in cells D4, D5, D6, D7, and D8appear.

    30_574272 ch26.qxd 10/1/04 10:48 PM Page 147

  • Save Time By Pointing to cell references

    when building formulas

    Using the Insert Functionfeature

    Using labels insteadof cell references informulas

    Smarter FormulaConstruction

    Formulas are the lifeblood of spreadsheets. When building new for-mulas, accuracy always trumps speed because few things can be as time-consuming as trying to clean up a bunch of errors that youvespread everywhere when copying bad formulas. And by far the worst for-mulas are not those that result in outright error values (the origins ofwhich can be tracked down and eliminated) but those that look fine eventhough they arent accurate because they either refer to the wrong cellsor are performing the wrong calculations.

    To help you to avoid this kind of invisible but nevertheless detrimentalerror, this technique covers ways you can work smarter in building for-mulas. These tricks include the basic methods of pointing to formula cellreferences rather than typing their ranges, relying on the Insert Functionfeature to find and enter all but the most basic of Excels built-in functions,and finally, using the row and column table headings in constructing mas-ter formulas to ensure that they perform the intended calculations.

    Pointing Out Cell References in FormulasOver my many years as a software trainer, I wish I had a nickel for everystudent I encountered who wanted to rush into completing a formula bytyping in the addresses of the cells and cell ranges used in a new formula.(If I did, I probably would have retired long ago, and I wouldnt be writingthis book.) I must say that Ive had to work to convince some of the effi-cacy of always adding cell references to formulas by selecting their cellsdirectly in the worksheet. These are usually those students who, becausetheyre whiz-bang typists, dont want to take the time to point to theaddresses that they can type into the formula so much quicker.

    The problem with these folks typing in the cell addresses is that they caneasily type in the wrong addresses, and if this doesnt result in an outra-geous computation or an outright error value, they can speed on theirway not realizing that their formula is referring to the wrong cells and thattheyre results are worthless or, worse, harmful. The chances of this kindof thing happening when you point out the cells or cell range by takingthe time to select them is miniscule by comparison.

    27Technique31_574272 ch27.qxd 10/1/04 10:49 PM Page 148

  • Pointing Out Cell References in Formulas 149

    After nearly 20 years of using electronicspreadsheets, you never see me typing in cellreferences rather than pointing them outwhen creating a new formula. The only time Iever type them is on the rare occasion whenIm editing a formula and just need to changea row number or column letter in one ofaddresses.

    Believe me when I say that you can save yourself a lotof heartache (and explaining to the boss) by alwayspointing out the cell references in the master formu-las you build. And just in case your pointing tech-nique has gotten a little rusty, check out Figures 27-1through 27-4 for a quick refresher.

    Figure 27-1 shows the lower part of a balance sheetwhere I need to enter a master formula that com-putes the ratio of the gross profit for the Northernregion by subtracting the cost of goods sold fromthe gross sales (B4-B12) and then dividing that resultby gross sales. To construct that formula by pointingto the cell references, I follow these steps:

    1. I begin by typing = (equal) followed by theopen parenthesis.

    I need to enclose the subtraction in parenthesesso that Excel computes this result before doingthe division, an operation that has a higherprecedence.

    Excel evaluates all operations in a formula fol-lowing a strict left-to-right order of precedenceunless you interrupt that order with the use ofparentheses. To refresh yourself on this order,press F1 and then search for calculation oper-ators and follow the About CalculationOperators link.

    2. Now Im ready to select the first cell reference.I scroll up and click cell B4 the cell contain-ing the Northern sales.

    After I click this cell, Excel encloses it in a mar-quee and enters its cell reference in the formulashown on the Formula bar.

    3. Then I type - (minus) to indicate a subtractionoperation.

    Excel responds by removing the marquee fromcell B4 (although it remains surrounded by a bluebounding box, indicating that this cell is the firstvariable in the formula).

    Figure 27-1: Starting the new formula that computes theratio of gross profit on sales.

    4. Next, I click cell B12, the cell containing thecost of goods sold for the Northern region.

    Excel encloses cell B12 in a marquee and addsthis cell reference to the formula on the Formulabar. (See Figure 27-2.)

    5. Next, I type a closed parenthesis to close off thesubtraction operation.

    When I do this, Excel removes the marquee fromcell B12 (while at the same time encloses this cellin a green bounding box to indicate that this cellis the second variable in the formula).

    6. All that remains is to type / (slash) to indicate adivision operation and click cell B4 again.

    Once again, the program encloses cell B4 in amarquee and adds its cell reference to theFormula bar. (See Figure 27-3.)

    31_574272 ch27.qxd 10/1/04 10:49 PM Page 149

  • Technique 27: Smarter Formula Construction150

    To do this, I click the Enter button on theFormula bar.

    I dont press Enter because I dont want to keepthe cell pointer on this cell for copying purposes.

    Figure 27-4 shows the computed ratio in cell B39,ready to be formatted with the Percent Style buttonand then copied across row 39.

    Figure 27-4: Worksheet after completing the formulain cell B39.

    Putting the Insert FunctionFeature at Your ServiceAs youre undoubtedly aware, Excel offers hundredsof built-in functions that perform all sorts of special-ized calculations that you can incorporate into yourspreadsheet formulas. To help you with all but thesimplest functions (that is, SUM, AVERAGE, COUNT,MAX, and MIN, all of which are available from theAutoSum button on the Standard toolbar), Exceloffers the Insert Function button the one markedfx at the beginning of the Formula bar.

    Figure 27-2: Selecting the cells for the subtractioncalculation.

    Figure 27-3: Selecting the cell for the division calculation.

    7. After checking the final formula on the Formulabar, Im ready to enter the formula in cell B39.

    31_574272 ch27.qxd 10/1/04 10:49 PM Page 150

  • Putting the Insert Function Feature at Your Service 151

    When you click this button, Excel opens the InsertFunction dialog box, similar to the one shown in Fig-ure 27-5. When the Insert Function dialog box firstopens, it displays a list of the functions that youveused most recently (not that thats any indicator of thefunction you want to use in the present). You can then

    Select one of the listed functions. If you knowthe function you want to use, enter its name in the Search for a Function text box and thenclick the Go button to have Excel list this func-tion at the top of the Select a Function list boxand select it for use.

    Select a new function category. To list all thefunctions, select All on the Or Select a Categorydrop-down list.

    Search for a function that performs the type ofcalculation you need done. If you dont know thename of the function and need to search for it,enter a brief description of the kind of computa-tion you need to do and then click the Go button.

    For example, in Figure 27-6, I instigated a searchfor a function that calculates your mortgage pay-ment. As you can see in this figure, Excel recom-mended a list of financial functions ranging fromPV to FV in the Select a Function list box. As soonas I selected the PMT function in this Recom-mended list, the Insert Function dialog boxshowed the syntax of the PMT function with allits arguments and also described the purpose of the function below it.

    After you select the function you want to insert inthe formula youre building and click OK in the InsertFunction dialog box, the program opens a FunctionArguments dialog box. This dialog box shows all thearguments for the function you selected. (The manda-tory arguments are shown in bold, and any optionalarguments are shown in regular type.)

    Each argument text box enables you to select the cell,cell range, or cell ranges for that argument directlyin the worksheet. When you do, the program auto-matically collapses the Function Arguments dialogbox down to the argument text box to make thisprocess as easy as possible.

    Figure 27-5: Use the Insert Function dialog box to selectthe proper function and indicate itsarguments.

    Figure 27-6: Searching for a function in the InsertFunction dialog box.

    Figure 27-7 shows the Function Arguments dialogbox after I selected the three mandatory argumentsfor the PMT function. I was able to select all threecells B6 for the rate, B4 for the nper, and A7 forthe pv argument (see Technique 24 for informationon the reason for the different mixed and absolute

    31_574272 ch27.qxd 10/1/04 10:49 PM Page 151

  • Technique 27: Smarter Formula Construction152

    When selecting a sizeable range of cells for aformula or the argument of a function, dontforget the tricks for quickly selecting larger cellranges covered in Technique 10.

    Using Labels Instead of CellReferences in FormulasThis final method for building formulas with the correct cell references doesnt actually use any cellreferences at all. This method enables you to buildformulas for a data table by using row and columnheadings that havent been assigned as actual rangenames in the sheet (as described in Technique 26).

    Before you can use this trick of referring to cells informulas by their row and column labels, you haveto change one of the calculation program options.Open the Calculation tab of the Options dialog box(ToolsOptions) and then select the Accept Labelsin Formulas check box.

    If you dont activate the Accept Labels inFormulas check box before you create a for-mula that uses row and column labels to referto cells, the formula will return the #NAME?error value as soon as you complete its entry.

    Figure 27-9 illustrates how labels work in formulasafter you activate the Accept Labels in Formulaoption. Here, you see the beginnings of a simpletable that calculates the total wage due in column Dby multiplying the hours worked in column B by thehourly rate in column C. To create the formula thatcomputes Gregs wage in cell D3, I can now use thecolumn headings Hours and Rate in place of B3 andC3, respectively.

    In other words, instead of creating in cell D3 the non-descript formula


    cell references) by selecting these cells directly inthe worksheet.

    Figure 27-7: Entering the arguments for the PMT functionin the Function Arguments dialog box.

    If youve defined a range name (see Technique26) that you want to insert into an argumentof a function, select the appropriate argumenttext box in the Function Arguments dialog boxand then select the range name to use in thePaste Name dialog box (InsertNamePaste).

    Figure 27-8 shows the worksheet after entering thePMT master formula into the first cell of that LoanPayments table. Thanks to the Insert Function fea-ture, I was able to quickly and easily locate this func-tion and add the necessary arguments direct fromthe worksheet.

    Figure 27-8: Worksheet after entering the formula withthe PMT function.

    31_574272 ch27.qxd 10/1/04 10:49 PM Page 152

  • Using Labels Instead of Cell References in Formulas 153

    Figure 27-9: Using column labels to document a formulascalculation.

    I can create a formula that documents its function,as in


    In fact, I can go even further in documenting thefunction of the original master formula by using notonly the column headings but the row heading aswell. In this case, the master formula would read

    =Greg Hours*Greg Rate

    By adding the row label that identifies the employee,I can tell at a glance whose wage is being computed.Adding the row heading to each formula referencealso enables me to ensure that Excel performs theright calculation.

    Another nice thing about adding both the row andcolumn labels to the master formula is that Excelthen automatically adjusts the labels as neededwhen you copy the formula. For example, if I enterthe master formula that includes the Greg row labeldown a row to cell D4 for Chris, the program auto-matically adjusts the row heading so that the copyreads

    =Chris Hours*Chris Rate

    This type of formula not only documents itself butalso ensures the spreadsheet user of its accuracy.And the best part is that you can do it all on the fly:You dont have to take the time to first assign rangenames to the cells before you create these types ofself-documenting and self-checking formulas.

    31_574272 ch27.qxd 10/1/04 10:49 PM Page 153

  • 28Save Time By Trapping division by zero

    errors before they occur

    Trapping all types of errorvalues


    Trapping ThoseTerrible Errors

    Most of the error values returned by the formulas you put in yourworksheets represent bona-fide calculation errors that you needto take care of. (See Technique 29 for some ideas on how to traceand eliminate their source.) Other error values are unavoidable at differ-ent stages in spreadsheet development (most notably when you lack cer-tain input values) or in the bare-bones template stage.

    One of the most common of the latter type of error values is the #DIV/0!error value. This error crops up whenever you have a division formulathat attempts to divide by a cell that either contains the value 0 or is stillblank (the equivalent of 0 to Excel) because you havent had time toinput any value into the cell. Another is the #NA (not available) errorvalue. If it gets entered into a cell with the NA function, it spreads to allthe other formulas that refer to it either directly or indirectly, giving thefaulty impression that not much of anything is currently available in thespreadsheet.

    This technique covers ways you can construct formulas that stop thesekinds of errors dead in their tracks, preventing them from spreading else-where in your worksheet. As part of this technique, I cover the use of thegranddaddy of all logical functions: the IF function. If youre already famil-iar with the working of this function, feel free to skip the next section anddive right into the procedure for stopping those ugly division-by-zeroerror values.

    If I Were a Logical FunctionExcel includes a bunch of logical functions that you can use. The hall-mark of a logical function is that it returns only one of two answers whencalculated:

    Logical TRUE (also given the value 1)

    Logical FALSE (also given the value 0)

    32_574272 ch28.qxd 10/1/04 10:49 PM Page 154

  • Trapping Division by Zero Errors 155

    In other words, taking a page from Ebert and Roeper,with a logical function its either thumbs up orthumbs down.

    The most important logical function, especially interms of trapping error values, is the basic IF func-tion. The syntax of the IF function is as follows:


    The logical_test argument sets up some kind ofequality (A=B), inequality (AB), or comparison(A>B, A

  • Technique 28: Trapping Those Terrible Errors156

    its argument contains any type of error value, includ-ing the special #N/A value. (Note that if you useISERR instead of ISERROR, the program checks forall types of error values except for #N/A.)

    Figure 28-3: Worksheet template after #NA values haveinfected the percent-of-total formulas.

    To add the ISERROR function, you insert it into the IFfunction as the logical_test argument:

    If N7 contains an error value or the #N/A value atthe time the IF function is evaluated, you specify0 as the value_if_true argument so that Excelinputs 0 in cell B9 rather than error value or#N/A.

    For the value_if_false argument, you specifythe original IF function that inputs 0 if the cell N7contains 0; otherwise, it performs the divisionthat computes what percentage the January pro-duction figure is of the total production.

    This amended formula with the ISERROR as thevalue_if_true argument and with the original IFfunction nested inside it as the value_if_false argu-ment in cell B9 looks like this:


    As soon as you copy this modified version of theoriginal formula into the cell range C9:M9, all thecells with percent-of-total formulas will be pro-tected against those ugly error values, as shown inFigure 28-4.

    Figure 28-2: Worksheet template after eliminating the#DIV/0 errors with the IF formula.

    Trapping All Types of Error ValuesThe error-trapping formula created with the IF func-tion in cell B9 (see the preceding section) works fineas long as you know that the grand total in cell N7will contain either 0 or some other numerical value.It does not, however, trap any of the various errorvalues, such as #REF! or #NAME?, or account for thespecial #NA (Not Available) value. If, for some rea-son, one of the formulas feeding into the SUM for-mula in N7 returns one of these beauties, they willsuddenly cascade throughout all the cells with thepercent-of-total formulas (cell range B9:M9).

    Figure 28-3 illustrates this point. As a result of enter-ing the NA function into cell B3, the #NA value hasspread to grand-total cell N7 and, from there, to allthe cells with the percent-of-total formulas in the cellrange B9:M9. Although the original IF formula stops#DIV/0! error values dead in their tracks, it is power-less against any other error value.

    To trap all other error values in the grand total cellN7 and prevent them from spreading to the percent-of-total formulas, you need to add the ISERROR func-tion to the basic IF formula. The ISERROR functionreturns the logical value TRUE if the cell specified as

    32_574272 ch28.qxd 10/1/04 10:49 PM Page 156

  • Trapping All Types of Error Values 157

    Figure 28-4: Worksheet template after modifying theoriginal IF formula to trap all error values.

    If you want to be alerted when a formula con-tains an error value even as you suppress itsdisplay with an error-trapping formula, applysome type of conditional formatting to its cell.To do this in cell B9 of the example work-sheet template, you would set up a Formula Is ISERROR($N$7) Condition 1 and thenassign some sort of bold font and backgroundcolor formatting to signify when the conditionis TRUE. (See Technique 19.)

    32_574272 ch28.qxd 10/1/04 10:49 PM Page 157

  • 29Save Time By Using the Trace

    Precedents feature tofind all cells feeding intoa formula

    Using the TraceDependents feature tofind all the cells fed by aformula

    Using the Trace Error fea-ture to find and fix theoriginal bad formula


    Eliminating Errorswith Error Tracing

    Despite your best efforts, its almost impossible to prevent all for-mula errors from cropping up. Possibly the worst thing about thisis that the errors often tend to spread far and wide, given the webof formula interdependencies in a spreadsheet. The biggest challenge insuch situations is to track down the root of the problem that is, thecell with the original formula error that causes the error values to sproutup all over the place like dandelions over a field after a spring rain.

    Fortunately, Excel offers some effective tools for tracking down the cellthats causing your error woes by tracing the relationships among theformulas in the cells of your worksheet. By tracing the relationships, youcan test formulas to see which cells, called direct precedents in spread-sheet jargon, directly feed the formulas and which cells, called depend-ents (nondeductible, of course), depend upon the formulas results. Exceleven offers a way to visually backtrack the potential sources of an errorvalue in the formula of a particular cell.

    Formula Auditing 101The easiest method for tracing the relationship among cells is offered bythe tools on the Formula Auditing toolbar, shown in Figure 29-1. To dis-play the Formula Auditing toolbar, choose ToolsFormula AuditingShow Formula Auditing Toolbar or choose Formula Auditing on the shortcut menu of one of the displayed toolbars. When you first displaythe Formula Auditing toolbar, Excel automatically makes it a floating toolbar, which you can dock as you see fit.

    This versatile toolbar contains the following tools (from left to right) thatyou can put to good use in your never-ending struggle for truth, justice,and perfection in your Excel workbooks:

    Trace Precedents: When you click this button, Excel draws arrows tothe cells (the so-called direct precedents) that are referred to in the for-mula inside the selected cell. When you click this button again, Exceladds tracer arrows that show the cells (the so-called indirect prece-dents) that are referred to in the formulas in the direct precedents.

    33_574272 ch29.qxd 10/1/04 10:49 PM Page 158

  • Formula Auditing 101 159

    Figure 29-1: The Formula Auditing toolbar gives yougreat tools for hunting down and eliminatingerrors.

    Remove Precedent Arrows: Clicking this buttongets rid of the arrows that were drawn when youclicked the Trace Precedents button.

    Trace Dependents: When you click this button,Excel draws arrows from the selected cell to thecells (the so-called direct dependents) that use, or depend on, the results of the formula in theselected cell. When you click this button again,Excel adds tracer arrows identifying the cells(the so-called indirect dependents) that refer toformulas found in the direct dependents.

    Remove Dependent Arrows: Clicking this buttongets rid of the arrows that were drawn when youclicked the Trace Dependents button.

    Remove All Arrows: Click this button to removeall the arrows drawn, no matter what button orpull-down command you used to put them there.

    Trace Error: When you click this button, Excelattempts to locate the cell that contains the orig-inal formula that has an error. If Excel can findthis cell, it selects it and then draws arrows tothe cells feeding it (the direct precedents) andthe cells infected with its error value (the directdependents). Note that you can use this buttononly on a cell that contains an error value.

    Error Checking

    Trace Dependents

    Remove Precedent Arrows

    Remove Dependent Arrows

    Trace Error

    Circle Invalid Data

    Show Watch Window

    Remove All Arrows

    New Comment

    Clear Validation Circles

    Evaluate Formula

    New Comment: Clicking this button opens acomment box attached to the current cell whereyou can add a text note.

    Circle Invalid Data: Clicking this button drawsred circles around all the data entries in theworksheet that dont currently contain valid data(as defined with the data validation feature see Technique 14 for information on using datavalidation to restrict input in a cell).

    Clear Validation Circles: Clicking this buttonremoves all circles drawn by clicking the CircleInvalid Data button. (To remove individual cir-cles, select the cell and then enter the data thatsrequired by the data validation assigned to thecell.)

    Show Watch Window: Clicking this button opensthe Watch Window dialog box, which displaysthe workbook, sheet, cell location, range name,current value, and formula in any cells that youadd to the watch list. To add a cell to the watchlist, click the cell in the worksheet, click the AddWatch button in the Watch Window dialog box,and then click Add in the Add Watch dialog boxthat appears.

    Evaluate Formula: Clicking this button opensthe Evaluate Formula dialog box, where you canhave Excel evaluate each part of the formula inthe current cell. This can be quite useful in for-mulas that nest many functions within them.

    Clicking the Trace Precedents and the TraceDependents buttons on the Formula Auditing toolbar(or choosing both Trace Precedents and TraceDependents on the ToolsFormula Auditing cascad-ing menus) lets you see the relationship between aformula and the cells that directly and indirectlyfeed it, as well as those cells that directly and indi-rectly depend upon its calculation. Excel establishesthis relationship by drawing arrows from the prece-dent cells to the active cell and from the active cellto its dependent cells.

    If these cells are on the same worksheet, Exceldraws solid red or blue arrows (on a color monitor)extending from the precedent cells to the active cell

    33_574272 ch29.qxd 10/1/04 10:49 PM Page 159

  • Technique 29: Eliminating Errors with Error Tracing160

    Figure 29-3 shows you what happens when I clickthis button a second time to display the indirectprecedents of this formula (think of them as being ageneration earlier in the family tree). The new tracerarrows show that cells A2, A3, and A4 are the directprecedents of the formula in cell A5 indicated bya border around the three cells. Remember that cell A5 is the first direct precedent of the formula in cell B9.

    Likewise, cells B2, B3, and C4 are the direct prece-dents of the formula in cell C5. Cell C5 is the seconddirect precedent of the formula in cell B9. Each timeyou click the Trace Precedents button, Excel dis-plays another (earlier) set of precedents (until nomore generations exist).

    Figure 29-3: Clicking the Trace Precedents button asecond time shows the indirect precedentsof the formula.

    To speed up the process and display both thedirect and indirect precedents in one opera-tion, double-click the Trace Precedents button.

    Figure 29-4 shows what happens when I once againclick the Trace Precedents button (after clicking ittwice before, as shown in Figures 29-2 and 29-3).Clicking the button reveals the indirect precedentsfor cell C5. The formulas in cells C2 and C3 are thedirect precedents of the formula in cell C5. Thedirect precedent of the formula in cell C2 (and, con-sequently, the indirect precedent of the one in cellC5) is not located on this worksheet. This fact isindicated by the dotted tracer arrow coming fromthat cute miniature worksheet icon sitting on top ofcell A3.

    and from the active cell to the dependent cells. If thecells are not located locally on the same worksheet(they may be on another sheet in the same work-book or even on a sheet in a different workbook),Excel draws a black dotted arrow. This arrow comesfrom or goes to an icon picturing a miniature work-sheet that sits to one side, with the direction of thearrowheads indicating whether the cells on theother sheet feed the active formula or are fed by it.

    Tracing Formula PrecedentsYou use the Trace Precedents button on the FormulaAuditing toolbar to trace all the generations of cellsthat contribute to the formula in the selected cell(something like tracing all the ancestors in your fam-ily tree). Many times, finding the original source ofthe formula leads you right to the source of all theerror values in your spreadsheet.

    Figures 29-2 and 29-3 illustrate how you can use theTrace Precedents button to quickly locate the cellsthat contribute, directly and indirectly, to the simpleaddition formula in cell B9. Figure 29-2 shows theworksheet after I clicked the Trace Precedents but-ton the first time. As you can see, Excel draws tracearrows from cells A5 and C5 to indicate that they arethe direct precedents of the addition formula in cell B9.

    Figure 29-2: Clicking the Trace Precedents button showsthe direct precedents of the formula in thecurrent cell.

    33_574272 ch29.qxd 10/1/04 10:49 PM Page 160

  • Tracing Formula Dependents 161

    Figure 29-4: Clicking the Trace Precedents button a thirdtime shows a precedent on another sheet.

    To find out exactly which workbook, worksheet, andcell(s) hold the direct precedents of cell C2, youdouble-click somewhere on the dotted arrow.(Clicking the icon with the worksheet miniaturedoesnt do a thing.). Double-clicking the dottedtracer arrow opens the Go To dialog box, whichshows a list of all the precedents (including theworkbook, worksheet, and cell references). To go toa precedent on another worksheet, double-click thereference in the Go To list box, or select it and clickOK. (If the worksheet is in another workbook, thisworkbook file must already be open before you cango to it.)

    Figure 29-5 shows the Go To dialog box that appearswhen I double-click the dotted tracer arrow. To jumpto the location listed in the Go To list box (cell B4 ofSheet2 in this case), click its name and then click OK.

    Figure 29-5: Double-clicking the dotted tracer arrowopens the Go To dialog box.

    To display all the direct or indirect precedentsor the direct or indirect dependents that areon the same sheet as the formula, click theSpecial button in the Go To dialog box. Thenin the Go To Special dialog box that appears,select either the Precedents or Dependentsoption button and click either the Direct Onlyor All Levels option button.

    To clear the tracer arrows a generation at atime, click the Remove Precedent Arrows button on the Formula Auditing toolbar. Toremove all tracer arrows at once, double-clickthis button.

    Tracing Formula DependentsUse the Trace Dependents button on the FormulaAuditing toolbar to trace all the generations of cellsthat either directly or indirectly utilize the formula inthe selected cell (kind of like tracing the genealogyof all your progeny). Tracing dependents with theTrace Dependents button is much like tracing prece-dents with the Trace Precedents button. Each timeyou click this button, Excel draws another set ofarrows that shows a generation of dependents fur-ther removed.

    To display both the direct and indirectdependents on the same sheet as the formula,double-click the Trace Dependents button onthe Formula Auditing toolbar. Likewise, toremove all the tracer arrows, double-click itsRemove Dependent Arrows button.

    Figure 29-6 shows what happened after I selectedcell B9, double-clicked the Trace Dependents buttonto display both the direct and indirect dependents,and then clicked the button a third time to displaythe dependents on another worksheet.

    33_574272 ch29.qxd 10/1/04 10:50 PM Page 161

  • Technique 29: Eliminating Errors with Error Tracing162

    button on the Formula Auditing toolbar to engagethe use of Excels faithful old Trace Error feature.

    Figure 29-7: Finding the source of a #DIV/0! error withthe Trace Error button.

    Figure 29-7 shows the result of clicking the TraceError button (unfortunately without color, so youcant tell which trace arrows were drawn in blue orred). Note that Excel has selected cell C12, althoughcell E13 was the current one when I clicked theTrace Error button. To cell C12, Excel has drawn ablue tracer arrow (youll have to take my word for it)that identify cell B9 as its direct precedent. From cellC12, the program has drawn a single red tracerarrow (again, you have to trust me on this) from cellC12 to cell E12 that identifies its direct dependent.

    After the Error Trace feature has located the prob-lem formula, you can click the Error Checking buttonon the Formula Auditing toolbar to fix it. When youclick this button, an Error Checking dialog box simi-lar to the one shown in Figure 29-8 appears. This dia-log box not only diagnoses the source of the errorvalue but also offers you several choices on how toproceed:

    Help on This Error: Click this button to displaya Microsoft Excel Help window with informationon the error.

    Show Calculation Steps: Click this button toopen an Evaluate Formula dialog box thatenables you to step through the formula to pin-point exactly where the computation goeswrong.

    Figure 29-6: Clicking the Trace Dependents button todisplay all the cells that use the formulasresult.

    As this figure shows, Excel first draws tracer arrowsfrom cell B9 to cells C12 and C13, indicating that C12and C13 are the direct dependents of cell B9. Then itdraws tracer arrows from cells C12 and C13 to E12and E13, respectively, the direct dependents of C12and C13 and the indirect dependents of B9. Finally, itdraws a tracer arrow from cell E12 to another sheetin the workbook (indicated by the dotted tracerarrow pointing to the worksheet icon).

    Finding the Original Error and Fixing Its FormulaYou use the Trace Error button on the AuditingToolbar when you need to track the source of a for-mula error so that you can correct it. When you clickthis button when the cell pointer is in a cell that con-tains an error value, Excel attempts to track downthe source by selecting the cell with the originaloffending formula and then drawing blue tracerarrows to its direct precedents and red tracerarrows to all its direct dependents.

    Figure 29-7 shows the sample worksheet after I madea damaging modification that left three cells C12,E12, and E13 with #DIV/0! errors. To find the origin of these error values and identify its cause, I selected cell E13 and then clicked the Trace Error

    33_574272 ch29.qxd 10/1/04 10:50 PM Page 162

  • Finding the Original Error and Fixing Its Formula 163

    Ignore Error: Click this button to have the pro-gram disregard the error value and pass on tothe next error value in the worksheet.

    Edit in Formula Bar: Click this button to activatethe Formula bar so that you can edit the formulaand fix the problem.

    Figure 29-8: Correcting the formula error in the ErrorChecking dialog box.

    If you decide to use the Edit in Formula Bar button,make your changes to the formula on the Formulabar and then click the Enter box on the Formula barto enter your fix into the cell. You can tell if you cor-rected the problem because the calculated resultwill replace the error value in the cell and Excel willremove all the error values in the other dependentcells. Also, the program converts all the red tracerarrows (showing the proliferation trail of the originalerror) to regular blue tracer arrows, indicatingmerely that these restored cells are dependents ofthe formula that once contained the original error.

    You can then click the Resume button (which auto-matically replaces the Help on this Error button) in

    the Error Checking dialog box. If the program thenfinds no other error values in the worksheet, an alertdialog box appears, indicating that the error checkof the worksheet is complete. Click OK to close boththis alert dialog box and the Error Checking dialogbox simultaneously. Finally, you can remove all thetracer arrows from the sheet by clicking the RemoveAll Arrows button on the Formula Auditing toolbarand close the toolbar by clicking its Close button.

    Unfortunately, the Error Trace feature is not infalli-ble. Sometimes this feature cant find the source of aformula error the first time you use it. Trace Errorwill fail to locate the source of the error if the pro-gram encounters one of the following conditions inits search for the current cells precedents anddependents:

    A branch point with more than one errorsource: In this case, Excel doesnt make a deter-mination on its own as to which path to pursue;you have to inspect each path manually.

    Preexisting tracer arrows: Always click theRemove All Arrows button to remove all preexist-ing trace arrows before you click the Trace Errorbutton.

    A formula containing a circular reference: Youneed to try to resolve the circular reference byrecalculating the worksheet by selecting theIteration check box on the Calculation tab of theOptions dialog box and then increasing the num-ber of iterations in the Maximum Iterations textbox and perhaps decreasing the amount ofchange in the Maximum Change text box.

    33_574272 ch29.qxd 10/1/04 10:50 PM Page 163

  • 30Save Time By Checking the computers

    date and time

    Creating effective dateformulas

    Creating formulas thatcompute elapsed times


    Creating EfficientDate and TimeFormulas

    Formulas that calculate elapsed times and dates are right up thereafter financial formulas in terms of spreadsheet popularity.However, unlike financial formulas, which rely on tried-and-truemonetary calculations whose functioning is pretty clear to most businessfolks, the way electronic spreadsheet programs deal with dates andtimes, especially when used in arithmetic computations, is an almostcomplete mystery, right up there with where that matching sock disap-pears to in the wash.

    This technique attempts to make clear how Excel sees dates and times sothat you can efficiently create formulas that calculate elapsed dates andtimes. (Where the sock goes is anybodys guess?) Judging from thereader mail I get on dates and times in Excel from my other Excel books,most of you will be happy to just have this one mystery solved!

    The Deal with Dates and TimesI must admit that dates and times in an Excel spreadsheet are particu-larly deceptive. This is because the program is so adept at interpretingalmost any entry that even remotely resembles a date or time as a bonafide date and time value. As a result, you dont think twice about dates ortimes until you try to use them in simple subtraction formulas that com-pute how much time has elapsed between them. Then, all of a sudden, itseems as though Excel doesnt know jack about dates and times, when, infact, it is you who lack the necessary understanding.

    Figure 30-1 shows a list of date and time entries in column B and C of asample worksheet. Column B shows you how Excel automatically formatsand displays the dates and times that I entered in cells B2:B7. (The dateand time in cell B2 is entered via the NOW function, and the rest weretyped in more or less as they appear.) Column C shows you the actualvalues that Excel squirrels away when you make these kinds of date andtime entries. ( I revealed their true, arithmetical nature by applying the

    34_574272 ch30.qxd 10/1/04 10:50 PM Page 164

  • You Do the Date Math! 165

    General number format to exact duplicates copied tothe cell range C2:C7.)

    Figure 30-1: What you see is not always what you get interms of date and time entries.

    As column C of the sample worksheet shown inFigure 30-1 reveals, Excel doesnt treat the dates andtimes that you enter as simple text entries. Anyentry with a format that resembles one of the dateand time number formats utilized by Excel is auto-matically displayed in that date and time format. Atthe same time, the entry is converted, quietlybehind the scenes, into a serial number.

    In the case of dates, this serial number representsthe number of days that have elapsed since thebeginning of the 20th century so that January 1, 1900,is serial number 1; January 2, 1900, is serial number2; and so forth. In the case of times, this serial num-ber is a fraction that represents the number of hours,minutes, and seconds that have elapsed since mid-night, which is serial number 0.00000000. For exam-ple, 12:00:00 p.m. (noon) is serial number 0.50000000;11:00:00 p.m. is 0.95833333; and so forth.

    As long as you make a date or time entry that con-forms to a recognized date or time format, Excelenters it as one of these date or time serial numbers.The only time the program doesnt make this adjust-ment is when you enter a date or time in an unrecog-nized format or specifically enter or import the dateor time as a text entry.

    Keep in mind that Excel can still computeelapsed time between date and times enteredas text. The program can even do calculationsbetween one date or time entered as text andthe other entered as an appropriate date ortime value.

    You Do the Date Math!Most of the date formulas that you build aredesigned to calculate the number of days or yearsthat have elapsed between two dates. To do this,you build a simple formula that subtracts the laterdate from the earlier date. The only problem is thatthe result you get from such date arithmetic usuallydoesnt look like the answer you want. This isbecause Excel gets on the old automatic-formattingbandwagon and assigns an inappropriate date for-mat to the result that really is the number of elapseddays.

    Figure 30-2 illustrates the typical situation. Here, youwant to calculate the years of service for a group ofemployees by subtracting the date of their retire-ments from their start dates. On the surface, thisseems simple enough: All you have to do is subtractthe date value in column E from the date value incolumn F so that the first formula in cell G2 is


    Figure 30-2: Calculating the difference between a stopand start date.

    34_574272 ch30.qxd 10/1/04 10:50 PM Page 165

  • Technique 30: Creating Efficient Date and Time Formulas166

    Figure 30-4: Years of service column after converting thedays to years.

    When Your Time Is UpTimecard-type spreadsheets routinely require formu-las that calculate the amount of elapsed timebetween a starting and ending time. You might have,for example, a worksheet that records the startingand stopping times for your hourly employees andthat also needs to calculate the number of hours andminutes that elapses between these two times to fig-ure their daily and monthly wages.

    To build a formula that calculates how much time haselapsed between two different times of the day, yousimply subtract the ending time of day from the starting time of day. However, you run into the sameproblem with time arithmetic as you do with datearithmetic. Although the computation is quite straight-forward, you still need to deal with unwanted Timenumber formatting and with an additional calculationthat converts the decimal number result into a com-prehensible hour, minute, and second format.

    Figure 30-5 illustrates this situation. Here, Ive set up a simple formula in cell F2 that calculates theelapsed time between a stop time in cell E2 and astart time in cell D2. I then copied the formula downthe column to the cell range F3:F13. As you can see,Excel automatically applies a Time number format tothe differences in column F, making them appear astimes as well.

    The only problem, as you can see in Figure 30-2, isthat the program applies the most common Datenumber format to the calculated results so that thedifference in cell G2 appears as the date


    To display the results in column G as whole num-bers, as youd expect, you have to then format thecalculated differences with another number format.Figure 30-3 shows the Years of Service column afterformatting the range G2:G13 by applying the Generalnumber format to these differences. (You can do thisquickly by pressing Ctrl+Shift+~.) As you can see, thecalculated results in this cell range now appear asthe much more sensible number of days.

    Figure 30-3: The differences between two dates afterapplying the General number format tothem.

    However, because you want the results expressed as the number of years of service rather than days,you still have to convert the days to years. To dothis, I edited the master formula in G2 so that the dif-ference between the retirement date and hire date isdivided by 365.25 and that result is then rounded upto a fraction using a single decimal place:


    Figure 30-4 shows you the result after copying thisedited form of the elapsed date formula down thecolumn to the cell range G3:G13.

    34_574272 ch30.qxd 10/1/04 10:50 PM Page 166

  • When Your Time Is Up 167

    Figure 30-5: Calculating the difference between a stoptime and a start time.

    The way to deal with this is simply to apply another,more appropriate number format to the results.However, if you apply the General format to theresult of such time arithmetic, you find that Excelthen displays the differences as decimal values rep-resenting what fraction of a day (that is, a 24-hourperiod) that difference represents. If, for example,you apply the General format to cell F2 containing9:00 AM as the difference between the stop time of4:30 PM in cell E2 and the start time of 7:30 AM incell D2, you end up with this decimal number:


    To convert decimal numbers like this that representthe fraction of an entire day into the number ofhours that have elapsed, you simply multiply theseresults by 24. Figure 30-6 shows you the worksheetafter editing the original formula in F2 to do just this:


    Figure 30-6 shows the worksheet after copying thisedited formula to the rest of the column in rangeF3:F13 and formatting all the results in the HoursWorked column with the Accounting number formatwith two decimal places.

    Figure 30-6: Hours Worked column after converting thecalculated elapsed times to hours.

    34_574272 ch30.qxd 10/1/04 10:50 PM Page 167

  • 34_574272 ch30.qxd 10/1/04 10:50 PM Page 168

  • Part V

    Worksheet EditingTimesavers

    35_574272 pp05.qxd 10/1/04 10:51 PM Page 169

  • 35_574272 pp05.qxd 10/1/04 10:51 PM Page 170

  • 31 Quickly Finding theWorkbook YouWant to EditNothing is quite as vexing as not being able to find the workbook filethat you need to print or edit. Wasting time opening spreadsheetafter spreadsheet in search of the file you need to work with is notonly frustrating but also time-consuming.

    This technique covers ways to quickly and easily find the workbook fileyou want. Heeding this advice is not only a great way to increase yourspreadsheet efficiency but a good way to keep that blood pressure incheck as well.

    Opening Recently Used FilesThe first place to look for the workbook you want to open is on theRecently Used file list. This is the list of the last four workbook files thatyou had open and edited. This list appears at the bottom of the GettingStarted task pane (in the Open section), the task pane that opens auto-matically when you first launch Excel. (See Figure 31-1.) You also haveaccess to this file list on the File menu at anytime when using the program.

    If you see the name of the workbook you want to open on this list, justclick its filename link to open the workbook in Excel (and automaticallyclose the Getting Started task pane).

    If you routinely edit lots of workbooks in a day, you may want toincrease the number of files that appear on the Recently Used list.Open the General tab of the Options dialog box (ToolsOptions) and then increase the value in the Entries text box the box to theimmediate right of the Recently Used File List check box.


    Save Time By Selecting a workbook

    from the Recently Usedlist

    Searching for a workbookfrom the File Search taskpane

    Searching for a workbookfrom the Open dialog box

    36_574272 ch31.qxd 10/1/04 10:52 PM Page 171

  • Technique 31: Quickly Finding the Workbook You Want to Edit172

    Figure 31-2: Searching for a workbook file from the BasicFile Search task pane.

    Search Text is the text box where you enter oneor more words contained in the file that youwant to find. If youre unsure of how certainwords are spelled, you can use the wildcardcharacters ? and * when entering the searchtext:

    The ? wildcard stands for a single characterso that entering t?m finds files that containTim and Tom but not team and trim.

    The * wildcard character stands for any num-ber of characters so that entering t*m findsfiles that contain all four words in the preced-ing example.

    Figure 31-1: Check the Recently Used file list on theGetting Started task pane for the workbookyou want to open.

    Making the Most of the File Search Task PaneIf the workbook file you want to work with is notamong the four files listed in the Recently Used filelist, your next line of defense is the Search feature inthe Open dialog box. You can access this featureright from the worksheet window. Just use the BasicFile Search task pane (shown in Figure 31-2), whichyou can open by choosing FileFile Search.

    Doing a basic file search

    The Basic File Search task pane contains the follow-ing three boxes that you can use in conducting yourfile search:

    Recently Used File List

    36_574272 ch31.qxd 10/1/04 10:52 PM Page 172

  • Making the Most of the File Search Task Pane 173

    Search In is the combo box where you can spec-ify the place on your computer system to search.By default, Excel searches everywhere on yourcomputer (including the desktop, My Documentsfolder, all local disk drives, and all shared docu-ment folders).

    To restrict the search to just your local harddisk, click the Search In drop-down button, clickthe My Computer expand button (the one withthe +), and then clear the check marks from all the elements except for Local Disk (C:).

    To restrict the search on your hard disk to justcertain folders, click the Local Disk (C:) Expandbutton and then clear the check boxes from allthe folders that you dont want searched.

    If youre part of a network and think that theworkbook may be saved on a networked drive,select the My Network Places check box. (Notethat some networks dont support searching, inwhich case youll receive a message telling youthat it is an unavailable location when you per-form the search.)

    Results Should Be is the drop-down list boxwhere you can specify what types of files to find.To restrict this list to Excel workbook and tem-plate files only, clear the Office Files check boxand then select just the Excel Files check box.

    When you do a basic search, Excel finds workbookfiles that contain any form of the words that youenter as the search text. For example, if you enterinvest in the Search Text field, Excel finds files thatcontain invest, investing, invested, investor, andinvestments. The program also searches for anoccurrence of the words in the cells in all the work-sheets in the workbook and in the Keywords andother fields entered on the Summary tab of the filesProperties dialog box. (See Technique 4.)

    Conducting the file search and using the results

    After you finish specifying the search text, the loca-tion to search, and the results to return, you beginthe search by clicking the Go button in the Basic FileSearch task pane. When you click this button, theBasic File Search task pane becomes a SearchResults task pane, where Excel shows you all thefiles that contain your search text, as shown inFigure 31-3. If the workbook that you want to openappears in the Search Results task pane, you canclick the Stop button to prevent Excel from doingany further searching.

    To open a workbook file displayed in the SearchResults task pane, click its file icon or position themouse pointer on the icon and, when a pop-up but-ton appears, click this button and then click the Editwith Microsoft Excel item on the pop-up menu.

    Figure 31-3: Selecting a workbook file to open in theSearch Results task pane.

    36_574272 ch31.qxd 10/1/04 10:52 PM Page 173

  • Technique 31: Quickly Finding the Workbook You Want to Edit174

    The Advanced File Search task pane (see Figure 31-4)contains a Search For section where you specify theconditions that must be met in order for a file toappear in the Search Results task pane. Heres whatyou find below this section:

    Go button: Begin the search.

    Restore button: Go back to the Basic File Searchtask pane.

    Search In combo box: Specify which drives andfolders to search.

    Results Should Be drop-down list box: Specifywhich types of files to search for.

    The last two boxes Search In and Results ShouldBe function exactly the same as their counter-parts in the Basic File Search task pane.

    Figure 31-4: Setting additional search criteria in theAdvanced File Search task pane.

    If youre not sure from viewing the filenames alonewhich of the files displayed is the one that you wantto open, position the mouse pointer on the file iconfor a few seconds. A ToolTip showing the completepath to the file, along with the date that it was lastmodified, appears below the file icon. If this informa-tion alone isnt enough, click the files pop-up buttonand then click Properties at the bottom of the pop-up menu. This action opens a Properties dialog boxcontaining General, Custom, and Summary tabs thatgive you all sorts of information about the file. (Notethat the Summary tab will be empty except for theAuthor if you didnt fill in this information prior tosaving the workbook file.)

    If your search returned more files than can be dis-played together in the Search Results task pane, aNext x Results link (where x is the actual number ofresults) appears when you scroll down to the end ofthe list. Click this link to display the next group often results. If you find that youre not getting theresults that you expected, click the Stop button atthe bottom of the Search Results task pane and thenclick the Modify button (this button immediatelyreplaces Stop when you click it) to return to theBasic File Search task pane. There, you can tweakyour search criteria or even try narrowing thesearch by using the Advanced File Search feature.

    Doing an advanced file search

    Excel supports an Advanced File Search feature,which enables you to add more specific search crite-ria than just simple words (although it uses exactlythe same Search In and Search Results Should Beoptions). To open the Advanced File Search taskpane from the Basic File Search task pane, click theAdvanced File Search link in the See Also section atthe bottom of the task pane. Note that the AdvancedFile Search link disappears after you do a basicsearch. To bring it back, simply click the Modify but-ton at the bottom of the Search Results task pane.

    36_574272 ch31.qxd 10/1/04 10:52 PM Page 174

  • Searching for Files in the Open Dialog Box 175

    The Search For section contains the following itemsfor specifying the condition or conditions to beapplied in the search:

    Property is the combo box where you specifythe property to search for. The pop-up menuattached to this box displays a complete list ofthings that you can specify including the author,keywords, date last saved or printed, file size,and total editing time, as well as the more mun-dane default of Text or Property.

    Condition is the drop-down list box where youselect the type of limitation set on the propertyduring the search. The conditions available varyaccording to the type of property that you selectin the Property combo box:

    For text properties, you can specify Is(Exactly) for exact matches or Includes forpartial matches.

    For date properties, you can specify On, On orAfter, On or Before, along with a variety oftime-specific conditions.

    For numeric properties, you can specifyEquals, Not Equal To, More Than, Less Than,At Least, and At Most.

    Value is the text box where you enter the text orvalue that is used in judging whether the condi-tion that you set up for the property you speci-fied is TRUE or FALSE. You enter the label ornumber that you want used in the Value text boxjust as you would enter it in your spreadsheet.

    After using these three boxes to specify your searchcriteria, click the Add button to add them to the listbox that appears in the middle of the Advanced FileSearch task pane.

    When specifying search criteria in this task pane,you can apply more than a single set of criteria. Afterspecifying the second set of criteria in the Property,Condition, and Value boxes, choose between the Andand the Or option button before you click the Addbutton:

    When you select And, a file matches only whenall the criteria applied to it are TRUE.

    When you select Or, a file matches when any oneof the criteria applied to it is TRUE.

    After you finish adding criteria in the Search For sec-tion, the place to search in the Search In combo box,and the files to search for in the Results Should Bedrop-down list box, you begin the advanced search-ing by clicking the Go button. As when doing a basicsearch, the Advanced File Search task pane becomesa Search Results task pane where the files that meetyour criteria appear. You can then open the files forediting by clicking their file icons.

    Searching for Files in the Open Dialog BoxThe Basic File Search and Advanced File Search taskpanes arent the only places from which you can dosearches for the workbooks that you need to open.You can also perform a basic or advanced searchfrom within the Open dialog box itself. To access theSearch feature, click the Tools button on the Opendialog boxs toolbar and then select the Search item,as shown in Figure 31-5.

    Figure 31-5: Doing a basic file search from the Open dialog box.

    36_574272 ch31.qxd 10/1/04 10:52 PM Page 175

  • Technique 31: Quickly Finding the Workbook You Want to Edit176

    Search task panes, so searching for files in the FileSearch dialog box is just like doing a search fromthose two task panes. (See Doing a basic filesearch and Doing an advanced file search, earlierin this technique.)

    Like the File Search task pane, the File Search dialogbox enables you to choose between performing abasic or more detailed search with its Basic andAdvanced tabs. Each tab contains the same searchoptions as the Basic File Search and Advanced File

    36_574272 ch31.qxd 10/1/04 10:52 PM Page 176

  • 32 Controlling theWorksheet WindowDisplayThe biggest problem with editing is finding and getting to the placein the worksheet that needs modification and then keeping yourplace in the worksheet as you make the changes. This problem isexacerbated by the fact that you probably often work with really largespreadsheets of which only a small portion can be displayed at any onetime on your screen.

    This technique looks at a number of features that can help you find yourway and keep your place in a spreadsheet. Among these are the Zoom Infeature, the Window feature, and the Freeze Panes feature:

    The Zoom In feature enables you to increase the magnification of theworksheet window, thus making it possible to switch to a really up-close view for editing.

    The Window feature enables you to display different parts of the same or even a different worksheet on-screen.

    The Freeze Panes feature enables you to keep pertinent information,such as column and row headings, on the worksheet window as youscroll other columns and rows of data into view.

    Zooming In for the EditsIn Technique 9, I suggest using the Zoom Out feature to find the placethat you need to edit. In this technique, I recommend that you use theZoom In feature to increase the magnification to a level that makes cellrange editing most comfortable. In case youre not that familiar withExcels Zoom controls, you can access the Zoom feature in one of twoways: the Zoom combo box on the Standard toolbar or the Zoom dialogbox, which you can open by choosing ViewZoom.


    Save Time By Making effective use of

    the Zoom feature

    Freezing rows andcolumns of a worksheeton-screen

    Saving display settings asa view

    37_574272 ch32.qxd 10/1/04 10:52 PM Page 177

  • Technique 32: Controlling the Worksheet Window Display178

    2. Either select Selection on the Zoom comboboxs pop-up menu on the Standard toolbar orclick the Fit Selection option button in theZoom dialog box (ViewZoom).

    Figures 32-1 and 32-2 illustrate this type of situation.In Figure 32-1, I select the cell range J20:L25 therange that needs editing and then click theSelection option from the Zoom combo box on theStandard toolbar.

    Figure 32-1: Selecting the cell range to zoom in on withthe Fit Selection feature.

    Figure 32-2 shows the results of this action. To dis-play only this cell range in the worksheet window,Excel automatically selects a new magnification set-ting of 179%. After editing the cells in this range, I can then return to the normal magnification byselecting 100% from the Zoom combo box.

    Zoom out to locate the cell range to be editedon the worksheet. Then select the range anduse the Fit Selection feature to display it full-screen as you make the necessary editingchanges.

    When setting a new magnification using the Zoomcombo box or the Zoom dialog box, you can selectone of the preset magnification percentages 200%,100%, 75%, 50%, and 25%, with 100% being thedefault setting for all worksheets from its drop-down list. (Of course, the size of the cells at the100% setting can vary, depending on the current resolution and the overall size of your monitorsscreen.)

    You can also enter a custom percentage between a minimum of 10% and a maximum of 400%:

    To do this in the Zoom combo box, click thecombo box, enter the new value, and then pressthe Enter key.

    To set a custom percentage in the Zoom dialogbox, open the Zoom dialog box (ViewZoom),click the Custom text box, type a new percent-age, and click OK.

    If you have a Microsoft IntelliMouse, you canset it up in Excel so that rolling the wheel backand forth zooms out and in on the currentworksheet. On the General tab of the Optionsdialog box (ToolsOptions), select the Zoomon Roll with IntelliMouse check box. After-wards, rolling the wheel backward increasesthe magnification by 15% until you reach themaximum 400%, whereas rolling the wheelforward decreases the magnification by 15%until you reach the minimum 10% value.

    When editing a range of cells, I often find the FitSelection option (abbreviated to Selection on theZoom pop-up menu) to be the most useful becausethis feature automatically selects whatever magnifi-cation is necessary to display all the cells currentlyselected. To use this feature, follow these steps:

    1. Select the range of cells that must be displayedfor the type of editing youre doing.

    37_574272 ch32.qxd 10/1/04 10:52 PM Page 178

  • Frozen Panes in My Windows 179

    Figure 32-2: Cell range after letting the Fit Selectionfeature increase the magnification asneeded.

    Frozen Panes in My WindowsFigure 32-2 could be the poster child for the FreezePanes feature. Although zooming in on the range ofcells that needs editing has made the data entrieseasy to read, without the column and row headingsyou havent a clue as to what kind of data yourelooking at. If I had used the Freeze Panes commandto freeze column A with the row headings and row 2with the column headings, you could tell becausethese headings would still be there on the screeneven after I used the Fit Selection feature to increasethe magnification.

    Columns and rows that you fix with theFrozen Panes feature stay on the screenregardless of the magnification settings youselect or how you scroll through the other cellsof the worksheet.

    To use the Freeze Panes feature to fix columns androws with the spreadsheet headings on-screen, youfirst position the cell pointer in the cell thatslocated to the immediate left of the column or

    columns that you want to freeze and immediatelybeneath the row or rows that you want to freeze.Then choose WindowFreeze Panes.

    Figures 32-3 and 32-4 illustrate how this works.Figure 32-3 shows the Income Analysis spreadsheetafter freezing column A and rows 1 and 2. To do this,I positioned the cell pointer in cell B3 and thenchose WindowFreeze Panes. Notice the thin blackline that runs down column A and across row 2,marking which column and rows of worksheet arefrozen on the display and will now remain in view nomatter how far you scroll to the right to newcolumns or scroll down to new rows.

    Figure 32-3: Freezing the row headings in column A andthe column headings in rows 1 and 2 on theworksheet.

    As Figure 32-4 shows, frozen panes stay on thescreen even when you zoom in and out on the work-sheet. For this figure, I repeated the steps I took inchanging the magnification for Figure 32-2 (only thistime with the frozen panes in place). First, I selectedthe range J20:L25 and then clicked Selection on theZoom combo boxs pop-up menu. Now you can tellat a glance what the values in this range refer to asyou make the necessary edits.

    37_574272 ch32.qxd 10/1/04 10:52 PM Page 179

  • Technique 32: Controlling the Worksheet Window Display180

    instead of taking the time to manually set up theworksheet display that you need, you can have Excelre-create it for you simply by selecting the appropri-ate custom view. When you create a custom view,Excel can save any of the following settings:

    Current cell selection

    Print settings (including different page setups)

    Column widths and row heights (including hid-den columns)

    Display settings on the View tab of the Optionsdialog box (ToolsOptions)

    Current position and size of the spreadsheet window

    Window pane arrangement (including frozenpanes)

    To create a custom view of your worksheet, followthese steps:

    1. Make all the necessary changes to the work-sheet display so that the worksheet windowappears exactly as you want it to appear eachtime you select the view. Also select all theprint settings in the Page Setup dialog box thatyou want used in printing the view. (SeeTechnique 39.)

    2. Choose ViewCustom Views to open theCustom Views dialog box. (See Figure 32-5.)

    Figure 32-5: Saving display and print settings as a custom view.

    3. Click the Add button to open the Add View dialog box.

    Figure 32-4: Spreadsheet after zooming in on a cellselection after freezing panes.

    Although frozen panes keep row and columnheadings on the screen at all times, they haveno effect on the printed worksheet. To printthese headings on each page of a report, youneed to set up their columns and rows as thePrint Titles before sending the report to theprinter. (See Technique 39.)

    A Worksheet with a Custom ViewIn the course of editing a worksheet, you may needto modify the worksheet display many times as youwork with the document. For example, you may findat some point that you need to reduce the magnifica-tion of the worksheet display to 75% magnification.At another point, you may need to return to 100%magnification and hide different columns in theworksheet. At some later point, you may have toredisplay the hidden columns and then freeze panesin the worksheet.

    You can use Excels Custom View feature to savemultiple custom views, each of which contain thedisplay settings you need to use in editing. This way,

    37_574272 ch32.qxd 10/1/04 10:52 PM Page 180

  • A Worksheet with a Custom View 181

    4. Enter a unique descriptive name for your viewin the Name text box, as shown in Figure 32-6.

    Figure 32-6: Naming the new view and selecting itssettings.

    5. To include print settings and hidden columnsand rows in your view, leave both the PrintSettings and Hidden Rows, Columns, and FilterSettings check boxes selected. If you dont want

    to include these settings, clear either or bothcheck boxes. When youre finished, click OK.

    After you define custom views for a spreadsheet,you can invoke their settings by opening the CustomViews dialog box. In the Views list box, either double-click the view to use or select the view and click theShow button.

    Before you define any custom views that hidecolumns, freeze panes, and mess with theworksheets magnification, define a Normal100% custom view that represents the stan-dard view of the worksheet. That way, you canrecover from a special view simply by double-clicking Normal 100% in the Views list box ofthe Custom Views dialog box.

    37_574272 ch32.qxd 10/1/04 10:52 PM Page 181

  • 33Save Time By Splitting the window

    into panes to viewdiverse parts of the same worksheet

    Setting up windows onseparate sheets of thesame workbook

    Setting up windows onseparate sheets in differ-ent workbooks


    ManagingWorksheet Windows

    Keeping tabs on your data in a large spreadsheet is a challenge.Comparing the data entered into widely separate parts of the sameworksheet can require a lot of scrolling back and forth betweenregions. The problem is only compounded when youre dealing with aspreadsheet whose data is distributed over different worksheets. Thereyou have to flip between sheets and scroll the regions youre comparinginto view.

    This technique covers ways you can use worksheet windows to comparedata, copy and move it between different regions of the same (or differ-ent) worksheets, and even move it from one workbook file to another.Two approaches are possible:

    Using a single worksheet: You split the worksheet window into hori-zontal or vertical panes and then scroll different sections of the sheetinto view.

    Using data on different worksheets: You open a second window on asecond worksheet and then arrange the windows to display data fromthe desired regions of both worksheets.

    Opening Panes in the Worksheet WindowExcel makes it easy to split the worksheet window into two or four panes,each equipped with its own scroll bars. After splitting the window intopanes, you can then use each panes scroll bars to bring different parts ofthe same worksheet into view. This is great for comparing the data in dif-ferent sections of a table that wouldnt otherwise be legible if you zoomedout far enough to display both sections in the worksheet window.

    To split the worksheet window into panes, you can use a variety of meth-ods. The most direct way when you need to split the window into onlytwo panes is by dragging the windows split bars to the desired row orcolumn. The most direct way when you need to split the window intofour panes is to strategically position the cell pointer at the appropriaterow and column and then choose WindowSplit.

    38_574272 ch33.qxd 10/1/04 10:53 PM Page 182

  • Opening Panes in the Worksheet Window 183

    To split the window horizontally into two panes(upper and lower), drag the horizontal split bar(the thin bar located above the up scroll arrow onthe vertical scroll bar) down the worksheet until youreach the row border where you want the windowdivided (as shown in Figure 33-1).

    Figure 33-1: Drag the horizontal split bar up to dividethe window into two panes one on top ofthe other.

    To split the window vertically into two panes (leftand right), drag the vertical split bar (the thin barlocated behind the right scroll arrow on the horizon-tal scroll bar) to the left on the worksheet until youreach the column border where you want the win-dow divided (as shown in Figure 33-2).

    To split the window both horizontally and verticallyinto four panes (upper-left, upper-right, lower-left,and lower-right), position the cell pointer in the cellwhose top border marks the place where you wantto divide the worksheet horizontally and makesure the cells left border is where you want the ver-tical division to take place. Then choose WindowSplit. (See Figure 33-3 for an example.) You can get thesame result by dragging first one split bar and thenthe other: For example, drag the horizontal split bardown to the desired row and then drag the verticalsplit bar left until you get to the desired column.

    Horizontal Split Bar

    Figure 33-2: Drag the vertical split bar to the left to dividethe window into two side-by-side panes.

    Figure 33-3: Dividing the window into four panes at row 10 and column D.

    When you split a window into panes, Excel automati-cally synchronizes the scrolling, depending on howyou split the worksheet. When you split a windowinto two horizontal panes (as shown in Figure 33-1),the worksheet window contains a single horizontalscroll bar and two separate vertical scroll bars: Allhorizontal scrolling of the two panes is synchronized;

    Vertical Split Bar

    38_574272 ch33.qxd 10/1/04 10:53 PM Page 183

  • Technique 33: Managing Worksheet Windows184

    compare data from separate sheets or from differentworkbook files. The easiest way to do this is to useExcels Compare Side by Side feature to split theworksheet into two horizontal windows (one on topof the other) in which you can display differentsheets from the same workbook.

    The following steps show how to use this feature tocompare data entered in the same regions on sepa-rate sheets of a spreadsheet. The example comparesrevenue figures from two different years, entered onseparate sheets of the same workbook:

    1. Open the workbook containing the sheets youwant to compare and then activate the work-sheet that you want to appear in the topmostwindow (as shown in Figure 33-4).

    Figure 33-4: Spreadsheet with annual revenues onseparate worksheets.

    2. Choose WindowCompare Side by Side With.Excel creates two horizontal windows numbered1 and 2, with window 2 on the top and window 1on the bottom (as shown in Figure 33-5).

    3. Press Ctrl+F6 to activate window 1 (the lower),and then select the sheet tab of the worksheetwhose data youre comparing with the data inwindow 2 (as shown in Figure 33-6).

    vertical scrolling of each pane remains independent.When you split a window into two vertical panes (as shown in Figure 33-2), the worksheet windowcontains a single vertical scroll bar and two separatehorizontal scroll bars: All vertical scrolling of thetwo panes is synchronized; horizontal scrolling ofeach pane remains independent.

    When you split a window into two horizontal andtwo vertical panes (as shown in Figure 33-3), theworksheet window contains two horizontal scrollbars and two separate vertical scroll bars: Verticalscrolling is synchronized in the top two windowpanes when you use the top vertical scroll bar and synchronized for the bottom two window panes when you use the bottom vertical scroll bar.Likewise, horizontal scrolling is synchronized for theleft two panes when you use the horizontal scroll baron the left and synchronized for the right two paneswhen you use the horizontal scroll bar on the right.

    To move the cell pointer from pane to panewith the keyboard when the window is splitinto four panes, press F6 (the cell pointermoves to the first cell in each pane, goingclockwise) or press Shift+F6 (the cell pointermoves to the first cell in each pane, goingcounterclockwise).

    To remove all panes from a window when you nolonger need them, choose WindowRemove Split.You can also remove individual panes by draggingthe gray dividing bar for the horizontal or verticalpane until you reach one of the edges of the work-sheet window or you can simply double-click thebar that divides that pane.

    Comparing Sheets in the Same WorkbookPanes are fine for comparing different sections of thesame worksheet, but you need to divide the Excelworksheet into separate windows if you want to

    38_574272 ch33.qxd 10/1/04 10:53 PM Page 184

  • Comparing Sheets in Separate Workbooks 185

    Figure 33-5: Spreadsheet after creating horizontalwindows.

    Figure 33-6: Spreadsheet after activating a differentworksheet in window 1.

    When you choose the Compare Side by Side Withcommand on the Window menu, Excel automaticallydisplays the Compare Side by Side toolbar (shown inthe lower part of Figure 33-6) with its three buttons:

    Reset Window Position

    Synchronous Scrolling

    Close Side by Side

    Synchronous Scrolling: When this button isclicked, any scrolling you do in the worksheet inthe active window is mirrored and synchronizedin the worksheet in the inactive window beneathit. If you want to scroll the worksheet in theactive window independently of the one in theinactive window, deactivate the SynchronousScrolling button by clicking it.

    Reset Window Position: Click this button if you manually resize the active window (by drag-ging its size box) and then want to restore thetwo windows to their previous side-by-sidearrangement.

    Close Side by Side: When you click this button,Excel returns the windows to the displayarrangement as it was before you used theWindowCompare Side by Side With command.(If you didnt select a display option in theArrange Windows dialog box, Excel displays the active window at full size.)

    Comparing Sheets in Separate WorkbooksSometimes you need to compare, move, or copydata between the sheets of two different workbooks.Before you can do so, you have to open windows oneach of the separate workbooks. Follow these steps:

    1. Open the two workbooks that contain the datayou want to compare and/or move or copy.

    2. Choose WindowCompare Side by Side With.(See Figure 33-7.)

    3. Press Ctrl+F6 to move the cell pointer betweenthe workbook windows and then select the tabof the sheets that you want to compare.

    When you finish comparing the data on the sheets ofthe two workbooks, close their windows by clickingthe Close Side by Side button in the Compare Side bySide toolbar (or by choosing WindowClose Side bySide if the Compare Side by Side toolbar is hidden).

    38_574272 ch33.qxd 10/1/04 10:53 PM Page 185

  • Technique 33: Managing Worksheet Windows186

    To move a cell range from one workbook toanother, drag the selection from one windowto the other. (Hold down the Ctrl key as youdrag to copy the selection.) To move or copyan entire worksheet, drag its sheet tab fromone workbook window to the other.

    Figure 33-7: Using Compare Side by Side With to createwindows on two different workbooks.

    38_574272 ch33.qxd 10/1/04 10:53 PM Page 186

  • 34 Quick and EasyInsertion andDeletionThis technique looks at insertion-and-deletion editing that goesbeyond the mere cell level where youre limited to just replacingor deleting a cells particular contents. Here you get a look at largerinsertions and deletions that involve structural changes to the worksheetor workbook.

    These larger edits include inserting new cells into or deleting themfrom existing ranges. It also shows how to insert new rows andcolumns into a worksheet and how to (safely) delete existing ones.Finally, it looks at inserting new sheets into a workbook and deleting the ones you no longer need.

    Inserting and Deleting Cells in an Existing RangeSometimes, after building your spreadsheet, you have to modify its struc-ture slightly by inserting new cells for additional entries in an existingrange. To insert new cells without replacing the cells that already haveexisting entries, just use the InsertCells command and then indicatewhether Excel is to shift the cells down or to the right to make room forthe new blank ones.

    Figures 34-1 and 34-2 illustrate this situation. Figure 34-1 shows a work-sheet that tracks home sales for a parcel known as Paradise Estates. Inthis case, I need to insert three additional house sales into Column B, inbetween the $175,000 figure in Row 4 and the $125,000 figure in Row 5. To do this, I select the cell range B5:B7 (which is where I want the newentries to appear), open the Insert dialog box (InsertCells), select theShift Cells Down option button (Shift Cells Right is selected by default),and then click OK.


    Save Time By Safely inserting cells into

    (and removing them from)existing ranges

    Inserting and deletingentire rows and columnsfrom the worksheet

    Inserting and deletingentire worksheets formthe workbook

    39_574272 ch34.qxd 10/1/04 10:53 PM Page 187

  • Technique 34: Quick and Easy Insertion and Deletion188

    so as to leave no gaps in the column. So I select cellB7 before selecting the Shift Cells Up option in theDelete dialog box (EditDelete).

    Figure 34-3: Worksheet after making entries in the threeblank cells in column B.

    Figure 34-4 shows you the result. Here you see theworksheet after removing the mistaken duplicate incell B7 and shifting the entries in the cells below upone row (from the range B8:B11 up to B7:B10).

    Figure 34-4: Worksheet after making entries in the threeblank cells in column B.

    Inserting and Deleting Rows and ColumnsInserting and deleting entire rows and columns in aworksheet is very similar to inserting new cells intoa range or deleting cells from the same range. In

    Figure 34-1: Inserting three blank cells in a column ofexisting entries.

    Figure 34-2 shows you the same worksheet aftershifting the existing entries down and entering thenew home sales figures in cells B5, B6, and B7. HereExcel has automatically updated the SUM function(now in cell B11 but originally entered in cell B8) toinclude the new cells I squeezed in; now theyre partof its range argument.

    Figure 34-2: Worksheet after making entries in the threeinserted cells in column B.

    Deleting cells from existing ranges when you dontwant to leave empty cells is a similar process: Youuse the EditDelete command, as Figures 34-3 and34-4 demonstrate. In Figure 34-3, I discover that thesecond $365,000 figure I entered into cell B7 is aduplicate that shouldnt be there and I dont haveto replace it with some other value. I want to deletethe duplicate in this cell and pull up the existingentries in the rows below (that is, cell range B8:B11)

    39_574272 ch34.qxd 10/1/04 10:53 PM Page 188

  • Inserting and Deleting Rows and Columns 189

    fact, you can actually insert or delete rows fromwithin the Insert and Delete dialog boxes by select-ing their Entire Row or Entire Column option button.There is, however, a big difference in the result:

    Inserting or deleting a new row affects all thecolumns in the worksheet, from column A overto column IV.

    Inserting or deleting a new column affects all therows in the worksheet, from row 1 down to row65536.

    Because these insertions and deletions affect morethan the cells in their immediate vicinity, you haveto be sure that youre not about to adversely affectdata in unseen rows and columns of the sheet beforeyou undertake these operations. Note that, in thisregard, inserting columns or rows can be almost asdetrimental as deleting them if, by inserting them,you split apart existing data tables or lists whosedata should always remain together.

    One way to guard against inadvertently deletingexisting data or splitting a single range is to use theZoom feature: You can zoom out and check visuallyfor intersecting groups of data in the hinterlands ofthe worksheet. The quick way to do this is to enter10 into the Zoom box (on the Standard toolbar) andthen press Enter. Of course, at a zoom setting of 10%,you cant read any of the data entered into the work-sheet, but you can tell whether the column or rowyou intend to fiddle with intersects those data ranges(which you can identify as tiny specks of black).

    Another way to check is to use the Ctrl key with the or key to move the cell pointer from data rangeto data range across the column or row affected bythe deletion of a column or row. Remember thatpressing Ctrl at the same time as an arrow key whenthe cell pointer is in a blank cell jumps the cellpointer to the next occupied cell in the current rowor column. That means if you press Ctrl+ when thecell pointer is in row 79 and the pointer jumps to cellIV79 (the end of the worksheet in that row), you

    know that you wont mess up any data in that row bydeleting the row (which would eliminate the data) orinserting a new row (which would shift the data upor down). So, too, if you press Ctrl+ when the cellpointer is in column C and the cell pointer jumpsdown to cell C65536, youre assured that no data isabout to be purged or shifted left or right if youget rid of that column or insert a new column in itsplace.

    After using one of these methods to ascertain thatyou wont harm existing data in the hinterland of thesheet, youre ready to insert or delete the row or col-umn. Here are some points to remember:

    To insert or delete rows, you first select the rownumber(s) in the row header where the newrows are to be inserted or existing rowsremoved.

    When you insert rows, the existing data in therows below shifts downward.

    When you delete rows, the existing data in therows below shifts upward.

    To insert blank rows, choose InsertRows.

    To delete the selected rows, choose EditDeleteinstead.

    The steps for inserting and deleting worksheetcolumns is almost identical for either procedure:

    1. Select the column letters in the column header. 2. Choose InsertColumns (to insert a column) or

    EditDelete (to delete a column).

    Excel automatically moves any data thats cur-rently in the columns to the right of those youselected:

    When you insert new columns, the existingdata moves to the right.

    When you delete existing columns, the exist-ing data moves to the left.

    39_574272 ch34.qxd 10/1/04 10:53 PM Page 189

  • Technique 34: Quick and Easy Insertion and Deletion190

    Inserting and DeletingWorksheets The most global type of insertion or deletion youmake in a spreadsheet is to insert new worksheetsor delete existing ones from the workbook file itself.The steps for this type of structural edit look likethis:

    1. Select the affected sheet tabs.2. Choose either InsertWorksheet or Edit

    Delete Sheet.

    If youre inserting worksheets, Excel inserts anumber equal to the number of tabs youveselected and places the blank worksheetsahead of them.

    If youre deleting worksheets that containdata, Excel displays an alert dialog box towarn you of possible data loss. To completethe deletion, click the Delete button in thisdialog box.

    39_574272 ch34.qxd 10/1/04 10:53 PM Page 190

  • 35 Outline andSubtotal MagicExcels Outline feature enables you to control the level of detail dis-played in a table of data or a data list in a worksheet. After outlininga table or list, you can quickly condense or expand the display ofthe table or list to show specified levels of detail. You can control whichoutline level is displayed in the worksheet, so its easy to print summaryreports with various levels of data (see Technique 39) or chart just thesummary data (see Technique 22).

    Excels Subtotal feature is a quick way to summarize data in a list withouthaving to create and copy the formulas that perform the desired calcula-tions. Using this feature, you determine which groups of records (rows)are summed as well as which fields (columns) are actually computed.When you need to produce an online or printed report from a data listthat includes various levels of totals, the Subtotal feature is the way to go.

    Adding Outline Levels to a Table or ListWhen you outline a table of data in an Excel worksheet, the programapplies a hierarchy of levels to the rows and columns of data whichyou can then manipulate to display different degrees of detail in the data. The best way to understand how this works is to see the feature inaction.

    Figure 35-1 shows the CG Media 2004 sales table after outlining it. To cre-ate this outline, all I had to do was to select the cell range A2:R14 therange containing the data to be outlined and then choose DataGroupand OutlineAuto Outline; Excel did the rest. As you can see, when theprogram outlined this table, it automatically assigned three differentsummary levels for its rows and columns. (An Excel outline can have upto eight row and column levels, if the table requires it.)


    Save Time By Outlining a table of data

    to control the level ofdetail shown in a table or list

    Having Excel compute thesubtotals and grand totalsin a data list

    40_574272 ch35.qxd 10/1/04 10:54 PM Page 191

  • Technique 35: Outline and Subtotal Magic192

    Figure 35-2: Collapsed sales table with the number-2Column Level button selected.

    Figure 35-3 shows the sales table after further col-lapsing the outline. This time I clicked the number-2Row Level button, which collapsed the outline downto the secondary row level as well as the secondarycolumn level. Excel now hides all columns contain-ing the categories of CD and cassette sales, while atthe same time displaying Show Detail buttons to theimmediate left of rows 7 and 13 (which contain thetotal CD and cassette sales, respectively). To displaycategory sales, either for CDs or cassettes, you haveonly to click the appropriate Show Detail button.

    Figure 35-3: Collapsed sales table with the number-2Column Level and Row Level buttonsselected.

    Show Detail Button

    Figure 35-1: Sales table after applying outline levels withAuto Outline.

    When Excel first outlines the data in your table, theprogram displays the highest outline level (which is3 in this example), showing all the detail. To reducethe amount of detail shown, click a lower-numberedRow Level or Column Level button.

    Figure 35-2 shows the outlined sales table after Iclicked the number-2 Column Level button, whichcollapsed the outline down to the secondary columnlevel: Excel immediately hides all columns with themonthly sales figures, showing only the quarterlyand annual totals. Note that when Excel collapsesthe outline to the secondary column level, it auto-matically adds Show Detail buttons above each col-umn that shows a quarterly total. To display themonthly sales detail for any quarter, just click itsShow Detail button.

    Row Level

    Row Level Bar Hide Detail

    Column Level Column Level Bar

    40_574272 ch35.qxd 10/1/04 10:54 PM Page 192

  • Subtotaling a Table or List 193

    Figure 35-4 shows the sales table after collapsing theoutline one more time. For this figure, I clicked thenumber-1 Row Level button to collapse the outlinedown to the primary row level, while leaving the sec-ondary column level selected. At this point, the tabledisplays only grand totals for each of the four quar-ters, along with the annual details.

    Figure 35-4: Collapsed sales table with the number-2Column Level and number-1 Row Levelbuttons selected.

    To chart just the summary details in an outlinedtable, collapse its row and column levels downuntil only the necessary subtotals or totals aredisplayed. Then select these displayed cells inthe worksheet and press F11 or click the ChartWizard button. (See Technique 22.)

    Press Ctrl+8 to immediately hide (and laterredisplay) all outline symbols in the worksheetwindow.

    To remove an outline from your worksheet, chooseDataGroup and OutlineClear Outline. Note thatremoving the outline does not affect the data in anyway Excel merely removes the outline structure.Also note that it doesnt matter at what level the out-line is displayed at the time you select this com-mand. If the outline is partially or totally collapsed,deleting the outline automatically displays all hiddenrows and columns in the data table or list.

    Create custom views (see Technique 32) thatdisplay your outlined table in various levels ofdetail. Then, instead of having to display the

    outline symbols and manually click the appro-priate Row Level buttons and/or Column Levelbuttons to view a particular level of detail, yousimply select the appropriate custom view.When creating these custom views, be surethat you leave the Hidden Rows, Columns,and Filter Settings check box selected in theAdd View dialog box.

    Subtotaling a Table or ListYou can use Excels Subtotals feature to subtotaldata in a sorted list. (See Technique 44.) To subtotala data list, first you sort the list on the field (column)for which you want the subtotals; then you desig-nate the field (column) that contains the values youwant summed these dont have to be the samefields in the data list.

    When you use the Subtotals feature, you arentrestricted to having the values in the designatedfield added together with the SUM function. You caninstead have Excel return the number of entries with the COUNT function, the average of the entrieswith the AVERAGE function, the highest entry withthe MAXIMUM function, the lowest entry with theMINIMUM function, or even the product of theentries with the PRODUCT function.

    Figures 35-5 and 35-6 illustrate how easy it is to usethe Subtotals feature to obtain totals in a data list. InFigure 35-5, I sorted the sample Employee data list first by the Department field (in ascending order)and then by the Salary field (in descending order).Then I chose DataSubtotals to open the Subtotaldialog box and made the following choices:

    Calculate subtotals for the Department field inthe At Each Change In drop-down list box.

    Use the SUM function in the Use Function drop-down list box.

    Sum the values in the Salary check box in theAdd Subtotal To list box.

    40_574272 ch35.qxd 10/1/04 10:54 PM Page 193

  • Technique 35: Outline and Subtotal Magic194

    As you can see from this figure, when you use theSubtotal feature, Excel outlines the data at the sametime that it adds the rows for the required totals andgrand total. In this example, the program created anoutline with three row levels. When you click thenumber-2 Row Level button, the program hides allrecords (rows) in the data list except for those con-taining the department salary totals and the salarygrand total. When you click the number-1 Row Levelbutton, Excel hides all records (rows) but the onewith the salary grand total.

    In a really large data list, you may want pagebreaks every time there is a change in thesubtotaled field (the one designated in the AtEach Change In drop-down list box). To addthose page breaks, select the Page Breakbetween Groups check box in the Subtotaldialog box.

    Figure 35-5: Subtotaling the salaries for each departmentin the Employee data list.

    Figure 35-6 shows the results I obtained after click-ing the OK button in the Subtotal dialog box. Here,you see the bottom of the data list where it showsthe salary subtotals for the Engineering, HumanResources, and Information Services along withthe grand total of the salaries for all the depart-ments. The grand total is displayed at the bottom ofthe data list because I left the Summary Below Datacheck box selected in the Subtotal dialog box ifyou dont want a grand total, clear this check box.

    Figure 35-6: Bottom of the Employee data list showingsome of the department salary subtotals andthe grand total.

    40_574272 ch35.qxd 10/1/04 10:54 PM Page 194

  • 36 Consolidating Datafrom DifferentWorksheetsExcels Consolidation feature makes short work of combining numeri-cal data in tables stored on several different worksheets or even dif-ferent workbook files. For example, you can use this feature to totalall budget spreadsheets prepared by each department in the company orto create summary totals for income statements for a period of severalyears.

    If you used a template to create each worksheet youre consolidating oran identical layout, Excel can quickly consolidate the values by virtue oftheir common position in the respective worksheets. However, even ifyou laid out the data entries differently in each spreadsheet, Excel canstill consolidate them provided that youve used the same labels todescribe the data entries in their respective worksheets.

    Most of the time, you will want to total the data that youre consolidatingfrom the various worksheets. By default, Excel uses the SUM function tototal all the cells in the worksheets that share the same cell references(when you consolidate by position) or use the same labels (when youconsolidate by category). You can, however, have Excel use any of thefollowing statistical functions when doing a consolidation: COUNT, AVERAGE, MAX, MIN, PRODUCT, COUNTA (referred to as Count Nums),STDEV, STDEVP, VAR, or VARP.

    Consolidating Data by PositionYou consolidate worksheets by position when they use the same layout(such as those created from a template). When you consolidate data byposition, Excel does not copy the labels from the source areas to the des-tination area, only the values.

    To consolidate worksheets by position, follow these steps:

    1. Open all the workbooks with the worksheets you want to consoli-date. If the sheets are all in one workbook, open that file in Excel.

    2. Create a new worksheet to hold the consolidated data.


    Save Time By Combining data by


    Combining data by category

    Linking consolidated data

    41_574272 ch36.qxd 10/1/04 10:54 PM Page 195

  • Technique 36: Consolidating Data from Different Worksheets196

    When you select the cell range by pointing, Excelminimizes the Consolidate dialog box to theReference text box so that you can see whatyoure selecting. If the workbook is not visible ina window, choose it on the Window menu andthen select the cell selection as you normallywould. (Remember that you can move theConsolidate dialog box the one thats beenminimized to the Reference text box by drag-ging its title bar.)

    If the source worksheets are not open, click the Browse button to select the filename in theBrowse dialog box to enter it (plus an exclama-tion point) into the Reference text box. Then youcan type in the range name or cell references you want to use. If you prefer, you can type in the entire cell reference including the filename.Remember that you can use the asterisk (*) andquestion mark (?) wildcard characters when typ-ing in the references for the source area.

    7. Click the Add button to add this reference tothe first source area to the All References list box.

    8. Repeat Steps 6 and 7 until you add all the refer-ences for all the source areas that you want toconsolidate, as shown in Figure 36-2.

    Figure 36-2: The Consolidate dialog box after selecting allthe cell ranges to be totaled.

    If youre consolidating the data in a new work-book, you need to open it (FileNew). If youreconsolidating worksheets generated from a tem-plate, use the template to create the new work-book. (See Technique 1.)

    3. Select the cell at the beginning of the destina-tion area in the new worksheet or select thecell range if you want to limit the destinationarea to a particular region.

    If you want Excel to expand the size of the desti-nation area as needed to accommodate thesource areas, just select the first cell of thisrange.

    4. Choose DataConsolidate to open theConsolidate dialog box, shown in Figure 36-1.

    Figure 36-1: Using the Consolidate dialog box to total2001-2004 sales.

    5. (Optional) Select the function you want to usein the Function drop-down list if you dontwant the values in the source areas summedtogether.

    6. Select the cell range or type the cell referencesfor the first source area in the Reference text box.

    41_574272 ch36.qxd 10/1/04 10:54 PM Page 196

  • Linking Consolidated Data 197

    9. Click the OK button to close the Consolidatedialog box and have Excel consolidate the designated data.

    Figure 36-3 shows you the consolidated worksheetafter closing the Consolidate worksheet and thenincreasing its window to full size. This worksheetnow contains the total sales for the last four years,2001 through 2004.

    Figure 36-3: Full-size worksheet after consolidating thesales data from the last four years.

    Consolidating Data by CategoryYou consolidate data by category when the sourceareas do not share the same cell coordinates in theirrespective worksheets but their data entries do usecommon row and/or column labels. When you con-solidate by category, you include these identifyinglabels as part of the source areas. Unlike consoli-dating by position, Excel copies the row labelsand/or column labels you specify for use in the consolidation.

    When consolidating spreadsheet data by category,you must specify whether to use the top row of col-umn labels and/or the left column of row labels in

    determining which data to consolidate. To use thetop row of column labels, select the Top Row checkbox in the Use Labels In section of the Consolidatedialog box. To use the left column of row labels,select the Left Column check box in this area. Afteryou specify all the source areas (including the cellsthat contain these column and row labels), click theOK button in the Consolidate dialog box to executethe consolidation in the destination area.

    Linking Consolidated DataDuring a consolidation, Excel enables you to link thedata in the source areas specified in the AllReferences list box of the Consolidate dialog box tothe destination area in the new worksheet. That way,any changes that you make to the values in thesource area will be updated automatically in the des-tination area of the consolidation worksheet. To cre-ate links between the source worksheets and thedestination worksheet, you simply select the CreateLinks to Source Data check box in the Consolidatedialog box prior to performing the consolidation.

    When you perform a consolidation with linking, Excelcreates the links between the source areas and thedestination area by outlining the destination area.(See Technique 35.) Each outline level created in thedestination area holds rows or columns that containthe linking formulas to the consolidated data.

    Figure 36-4 shows just such an outline created duringconsolidation. I expanded the level of the outlineshowing the consolidation of the rock music CD sales.

    Here, you can see that during consolidation, Excelcreated four detail rows for each of the four years ofsales (2001, 2002, 2003, and 2004) used in the linkedconsolidation. These rows contain the external refer-ence formulas that link to the source data. For exam-ple, the formula in cell B4 contains the followingformula:

    =[CG Media - 2001 Sales.xls]Sales01!$B$4

    41_574272 ch36.qxd 10/1/04 10:54 PM Page 197

  • Technique 36: Consolidating Data from Different Worksheets198

    This formula links the value in cell B4 in the Sales 01sheet of the CG Media - 2001 Sales.xls workbook.If you change this value in that worksheet, the newvalue is updated automatically in cell B4 in the CGMedia - Consolidated Sales 01-04 workbook,which, in turn, changes the subtotal for the Januaryrock music CD sales in its cell B7.

    Figure 36-4: Consolidated worksheet with links to salesdata from the last four years.

    41_574272 ch36.qxd 10/1/04 10:54 PM Page 198

  • 37 Editing with Search& Replace andSpell CheckNo discussion of spreadsheet editing is complete without includingsomething on the Find and Replace and Spell Check features inExcel. You can use the Find and Replace feature to quickly locateevery occurrence of a specific string (a series of characters) in a work-sheet and then have Excel actually update the cells that it finds with newtext or numbers. This feature is a real timesaver when you need to makea global change that affects cells in diverse parts of the spreadsheet.

    Excels Spell Check feature is a real godsend if youre like me and are notthe best (that is, most accurate) typist in the world. Spell checking aworksheet can go a long way towards eliminating typos that get by theprograms AutoCorrect feature. (See Technique 11.) The only problemwith using Spell Check is that many spreadsheets are crammed full ofacronyms, technical terms, and formal names that Excels spelling dic-tionary has never heard of. To prevent the spell checker from really slow-ing you down by stopping at every other word in the spreadsheet to askif its misspelled, you need to build custom dictionaries that contain mostof these erstwhile unknown terms.

    Using Find and ReplaceExcels Find and Replace feature enables you to easily update the con-tents of a single worksheet or all the worksheets in a workbook on eithera case-by-case basis or globally. To make quick and easy editing changeswith this feature, follow these steps:

    1. To perform a search and replace through the entire worksheet,select a single cell. To restrict the search-and-replace operation to aspecific cell range or nonadjacent selection, select all the cells to beedited.

    2. Choose EditReplace or press Ctrl+H to open the Find and Replacedialog box. (See Figure 37-1.)


    Save Time By Making more global edit-

    ing changes with Findand Replace

    Eliminating typos withSpell Check

    Creating custom diction-aries for Spell Check

    42_574272 ch37.qxd 10/1/04 10:55 PM Page 199

  • Technique 37: Editing with Search & Replace and Spell Check200

    6. Select any additional options you want: Within: Select the Workbook setting to search

    all the worksheets within a workbook.

    Search: Change this setting from By Rows toBy Columns to search down the columns andacross the rows rather that across the rowsand then down the columns.

    Look In: By default, Excel selects Formulas forthis option to look for the search string in thecontents of each cell as its displayed on theFormula bar. To have Excel search for thestring in among the values displayed in thecells themselves, select Values on this drop-down list. To have the program look for thesearch string only in the comments added tothe cells, select Comments on this drop-downlist.

    Match Case: Find occurrences of the searchstring only when it matches the case that youentered.

    Match Entire Cell Contents: Find occurrencesof the search string only when it matches theentire cell entry.

    By default, Excel considers any occurrence ofthe search string to be a match even whenit occurs as part of another part of the cellentry. This means that when you search for25, Excel considers cells containing 25, 15.25,25 Main Street, and 250,000 as matches. Selectthe Match Entire Cell Contents check box tomatch only complete occurrences of yoursearch string.

    7. Click the Find Next button to locate the firstoccurrence of the search string. When Excelfinds an occurrence, click the Replace buttonto replace the first occurrence with the replace-ment string or the Find Next button again toskip this occurrence. (See Figure 37-2.)

    Figure 37-1: Using the Find and Replace feature to makeediting changes.

    3. Click the Options button to expand the Replace tab.

    4. Type the search string that you want to locatein the Find What drop-down list box and spec-ify any formatting to be searched by clickingits Format button.

    When entering the search string, you can use thequestion mark (?) or asterisk (*) wildcards tostand for any characters that youre unsure of.Use the question mark to stand for a single char-acter as in Sm?th, which matches either Smith orSmyth. Use the asterisk to stand for multiplecharacters as in 9*1, which locates 91, 94901, oreven 9553 1st Street. To search for a wildcardcharacter, precede the character with a tilde (~),as in ~*2.5, to locate formulas that are multi-plied by the number 2.5. (The asterisk is the mul-tiplication operator in Excel.)

    If the cell holding the search string that yourelooking for is formatted in a particular way, youcan narrow the search by specifying what for-matting to search for. When you click the Formatbutton, Excel opens a Find Format dialog boxwith the same tabs and options as the standardFormat Cells dialog box. Select the formattingthat you want to search for in this dialog box andthen click OK.

    5. Type the replacement string in the ReplaceWith drop-down list box and specify any for-matting to be added to the replacement stringby clicking its Format button.

    42_574272 ch37.qxd 10/1/04 10:55 PM Page 200

  • Eliminating Typing Errors with Spell Check 201

    Figure 37-2: Finding the first occurrence of the searchstring for possible replacement.

    Using the Find Next and Replace buttons tosearch and replace on a case-by-case basis is byfar the safest way to use the Find and Replacefeature. If youre certain (really certain) that youwont mess anything up by replacing all occur-rences throughout the spreadsheet, click theReplace All button to have Excel make thereplacements globally without stopping to showyou which cells are updated.

    8. When you finish replacing entries on a case-by-case basis, click the Close button to close theFind and Replace dialog box.

    Note that if you globally replace the search string inthe worksheet, Excel automatically closes the Findand Replace dialog box when it finishes replacingthe last match.

    Be clear about the difference between theFormulas and Values Look In options in theexpanded Find and Replace dialog box. When,for example, the default Formulas option isselected and you enter 15 the search string,Excel looks for these two digits only in textentries and within the contents of formulas asthey appear on the Formula bar (as in =15+A4).To have the program find the digits 15 whendirectly entered in a cell or returned as theresult of a formula calculation as actually dis-played in the cells of the worksheet (as whenthe formula =A2-A3 returns 15 to a cell), youmust select Values as the Look In optionbefore you conduct the search.

    Eliminating Typing Errors with Spell CheckExcels Spell Check feature affords you a quick-and-easy way to check for any typos in your spread-sheets before sending them out for any kind ofreview. To spell check a worksheet, click the Spellingbutton on the Standard toolbar, press F7, or chooseToolsSpelling.

    Excel then looks up each word in the Excel diction-ary. If it doesnt find a word (as is often the case withless-common last names, abbreviations, acronyms,and technical terms), Excel selects the cell with the unknown spelling and then displays a Spellingdialog box showing the unknown word in the Not in Dictionary text box, along with suggested correctspellings shown in a Suggestions list box. (See Figure 37-3.)

    Figure 37-3: Flagging a word in the worksheet thats notfound in the dictionary.

    You can then take any of the following actions totake care of the unknown word:

    Select one of the words in the Suggestions listbox and then click the Change button to haveExcel replace the unknown word with theselected suggestion and continue spell checkingthe rest of the worksheet.

    42_574272 ch37.qxd 10/1/04 10:55 PM Page 201

  • Technique 37: Editing with Search & Replace and Spell Check202

    Figure 37-4: Modifying the options for the Spell Checkfeature.

    You can use the controls in the Options dialog boxto change the following settings:

    Dictionary Language: Select a new dictionarylanguage. (This option is especially useful if yourspreadsheet contains British English spellings orFrench or Spanish terms.)

    Add Words To: Select another custom dictionaryto which to add new terms.

    Suggest from Main Dictionary Only: Select thischeck box to have Excel use only the main dic-tionary when doing a spell check (thus, ignoringall words that you add to the custom dictionary).

    Ignore Words in UPPERCASE: Select this checkbox to have Excel ignore acronyms in yourspreadsheet that use all capital letters.

    Ignore Words with Numbers: Clear this checkbox to have Excel flag unknown words that con-tain numbers.

    Ignore Internet and File Addresses: Clear thischeck box to have Excel let unknown words that contain URL and Mailto addresses and filepathnames slide. (You know, stuff such as www.dummies.com and c:\mydocuments\finance.)

    Select one of the words in the Suggestions listbox and then click the Change All button to haveExcel replace all occurrences of the unknownword with the selected suggestion throughoutthe entire worksheet and then continue spellchecking.

    Click the Ignore Once button to let the mis-spelling slide just this once and continue spellchecking the rest of the worksheet.

    Click the Ignore All button to ignore all occur-rences of the unknown word in the worksheetand continue spell checking.

    Click the Add to Dictionary button to add theunknown word to a custom dictionary so thatExcel knows the word the next time you spellcheck that or any other worksheet.

    Click the AutoCorrect button to have Excel add the unknown word to the AutoCorrect listwith the selected suggestion as its automaticreplacement.

    Excel checks the spelling of the cells only inthe current worksheet (not in all the sheets inthe workbook). If you want Excel to spellcheck another worksheet, you need to selectits sheet tab to make it active before you startthe spell check. To spell check just a portion ofthe worksheet, select the range or make anonadjacent cell selection before you start thespell check.

    When Excel finishes checking the current worksheetor cell selection, the program displays an alert dia-log box that indicates that the spell checking is complete.

    Customizing the Spell Check settings

    When you use the Spell Check feature, you canchange certain spelling options to better suit thespreadsheet that youre checking. To change thespelling options, click the Options button at the bot-tom of the Spelling dialog box to open the Optionsdialog box, shown in Figure 37-4.

    42_574272 ch37.qxd 10/1/04 10:55 PM Page 202

  • Eliminating Typing Errors with Spell Check 203

    AutoCorrect Options: Click this button to openthe AutoCorrect dialog box where you changethe settings that determine when certain wordsare automatically corrected as well as add newautomatic replacements.

    Note that Language Specific check boxes and drop-down lists on the right side of the Options dialogbox remain grayed out until you select a dictionaryin the Dictionary Language drop-down list forGerman, Korean, Hebrew, or Arabic. Then you canuse them (depending on the language you select) todetermine how their words are treated during spellchecking.

    Adding words to a custom dictionary

    Click the Add to Dictionary button in the Spellingdialog box to add unknown words to a custom dic-tionary. By default, Excel (as well as your otherMicrosoft applications, such as Word) adds words toa custom dictionary file named CUSTOM.DIC. If youwant, you can create other specialized custom dic-tionaries just to use when spell checking particulartypes of spreadsheets. To create a new custom dic-tionary, follow these steps:

    1. Begin spell checking your worksheet ( press F7or click the Spelling button on the Standardtoolbar).

    You cant start adding words to a new customdictionary until you spell check a worksheet andExcel starts flagging some unknown words.

    2. As soon as Excel locates an unknown word inthe Spelling dialog box that you want to add to a new custom dictionary, click the Optionsbutton.

    3. Click in the Add Word To drop-down list,replace the custom part of the dictionary file-name with a name of your own, and then clickOK or press Enter.

    When editing the custom.dic filename to createa name for your new custom dictionary, be surenot to delete the .dic filename extension. Assoon as you click OK or press Enter, Excel adds the unknown word to your new custom dictionary.

    4. Continue spell checking your worksheet, click-ing the Add to Dictionary button to add allunknown words that you want to be part ofyour new custom dictionary.

    After creating a custom dictionary, Excel auto-matically uses the words in this dictionary as well as in the CUSTOM.DIC when spell checking your worksheets.

    You can directly edit the words that you addto your custom dictionary with the WindowsNotepad text editor. Open the custom diction-ary file (located in the Proof folder on yourhard drive) and then make any changes to theentries in this file by saving your changes withNotepads FileSave command.

    42_574272 ch37.qxd 10/1/04 10:55 PM Page 203

  • 42_574272 ch37.qxd 10/1/04 10:55 PM Page 204

  • Part VI

    Tips for Printing,Sharing, and Reviewing


    43_574272 pp06.qxd 10/1/04 10:55 PM Page 205

  • 43_574272 pp06.qxd 10/1/04 10:55 PM Page 206

  • 38 SpreadsheetSecurityData security is a big issue on everyones mind these days. Excelprovides you with two levels of security: password-protecting theworkbook so that only users who have the password can open thefile and spreadsheet protection that limits what kind of editing, if any,users can do to the existing content and structure of its worksheets.

    In addition to these two levels of security, Excel also makes it possible foryou to hide sensitive data in the worksheet that might not be appropriatefor all users (such as employee salaries or performance review codes)but that nevertheless need to be part of the document.

    This technique looks at all three aspects of spreadsheet security, givingyou pointers on the best ways to preserve the integrity of your spread-sheet as well as guard against its more sensitive information from fallinginto the wrong hands.

    Assigning a Password forOpening a WorkbookWhen assigning a password to a workbook, you can prevent unautho-rized users from opening the workbook and/or editing its file. You seta password for opening the workbook file when youre dealing with aspreadsheet whose data is of a sufficiently sensitive nature that onlya select group of employees should have access to it (such as spread-sheets dealing with personnel information). Of course, after you assigna password to the workbook, you must supply this password to the peo-ple who need access to make it possible for them to open the workbookfile.


    Save Time By Assigning a password for

    opening a workbook

    Protecting worksheetsagainst certain types ofchanges

    Hiding sensitive work-sheet data

    44_574272 ch38.qxd 10/1/04 10:56 PM Page 207

  • Technique 38: Spreadsheet Security208

    2. Select General Options on the Tools pop-upmenu to open the Save Options dialog box,shown in Figure 38-2.

    Figure 38-2: Assigning the passwords to open and modifyin the Save Options dialog box.

    3. To assign a password to open the file, type thepassword in the Password to Open text box.

    When entering the password, it can be up to 255characters long and consist of a combination ofletters and numbers with spaces. Keep in mindwhen using letters, however, that passwords arecase-sensitive, so opensesame and OpenSesameare not the same password because of the differ-ent use of upper- and lowercase letters. As youtype the password, Excel masks the actual char-acters you type by rendering them as asterisks(*) in the text box.

    Note that Excel automatically assigns an Office97/2000 Compatibletype encryption when youassign a password to open the file. You can usethe Advanced button to assign another type ofencryption, but I wouldnt fool with theseoptions unless you really know what youredoing or have been instructed to use anothertype by someone in your IT department.

    When entering passwords, make sure thatyou dont enter something that you canteasily reproduce or something that you cantremember. You must be able to immediatelyreproduce the password in order to assign it,and you must be able to reproduce it later ifyou ever want to be able to open or changethe darned workbook ever again.

    You have a couple options for assigning passwords:

    Assign a password for opening the workbook.Youd assign such a password when youre deal-ing with a spreadsheet whose data needs to beviewed and printed by different users, none ofwhom are authorized to make changes to theentries.

    Assign a password for modifying the workbook.For example, you might assign a password formodifying a workbook before distributing itcompany wide. This password would be inplace while the workbook is being editedand reviewed. (See Technique 42.)

    With a spreadsheet that contains data thats for theeyes of only a select few but that is not to be modi-fied even by those authorized to open it for reviewor printing purposes, you need to assign both apassword for opening the file and a password formodifying its contents or structure.

    To assign a password to open the workbook and/ora password to modify the file, follow these steps:

    1. Save the workbook by choosing FileSave As ifyouve already saved the file at least once or bychoosing FileSave (Ctrl+S) if the files neverbeen saved.

    The Save As dialog box opens. (See Figure 38-1).

    Figure 38-1: Opening the Save Options dialog box fromthe Save As dialog box.

    44_574272 ch38.qxd 10/1/04 10:56 PM Page 208

  • Assigning a Password for Opening a Workbook 209

    4. To assign a password to modify the file, selectthe Password to Modify text box and then typein this password.

    When entering the password for modifying theworkbook, be sure that you assign a differentpassword from the one you just assigned foropening the file (if you did assign a passwordfor opening the file in the previous step).

    5. (Optional) If you want Excel to automaticallycreate a backup of the workbook each timeits saved, select the Always Create Backupcheck box. If you want the password-protectedworkbook to open in read-only mode (so thatchanges can only be saved a in new file), selectthe Read Only Recommended check box.

    6. Click OK to open the Confirm Password dialogbox, shown in Figure 38-3.

    Figure 38-3: Confirming the password to open in theConfirm Password dialog box.

    7. Type the password exactly as you enteredit in the Password to Open text box (or thePassword to Modify text box, if you didntuse the Password to Open text box) and thenclick OK.

    If you just entered a password in the Passwordto Open text box, you need to reenter this pass-word in the Confirm Password dialog box.

    If you just entered a password in the Password toModify text box, you need only to reproduce thispassword in the Confirm Password dialog box.

    However, if you entered a password in both thePassword to Open text box and the Passwordto Modify text box, you must reproduce the

    password entered in the Password to Open textbox in the first Confirm Password dialog boxand then reproduce the password you enteredin the Password to Modify text box in the secondConfirm Password dialog box, which appearsafter you click OK in the first Confirm Passworddialog box.

    8. To save the password-protected version of thefile under a new filename or in a differentfolder, edit the name in the File Name text boxand then select the new folder on the Save Indrop-down list.

    9. Click the Save button to save the workbookwith the password to open and/or passwordto modify.

    Excel then saves the file if this is the first timeyouve saved it. If not, the program displays analert dialog box indicating that the file youresaving already exists and asking you if you wantto replace the existing file.

    10. If the alert dialog box asking you if you wantto replace the existing file appears, click Yes.

    Opening a password-protected workbook

    After saving a workbook file to which youve assigneda password for opening it, you must thereafter beable to faithfully reproduce that password to openthe file (at least until such time as you change ordelete the password). When you next try to openthe workbook, Excel opens a Password dialog boxlike the one shown in Figure 38-4, where you mustenter the password exactly as it was assigned tothe file.

    Figure 38-4: Entering the password to open a file in thePassword dialog box.

    44_574272 ch38.qxd 10/1/04 10:56 PM Page 209

  • Technique 38: Spreadsheet Security210

    Figure 38-6: Opening a workbook file that has beenprotected against modifications.

    If you dont have access to the modification pass-word and choose to open the file in read-only mode(indicated by [Read-Only] appended to the filenameon the title bar), you can review the file and print itsworksheets, but you cant save any editing changesthat you make to it. If you try to save changes withthe FileSave command, Excel displays an alert dia-log box indicating that the file youre working with isread-only (see Figure 38-7).

    Figure 38-7: The alert dialog box that appears when youtry to save a file opened as read-only.

    After you click OK to close this alert dialog box,Excel opens the Save As dialog box where you cansave your changes. Rename the workbook file in theFile Name text box or select a new folder in which tosave the file in the Save In list box; then click Save.

    Changing or deleting passwords

    Sometimes you may find that having to cough up apassword each time that you need to open or modifyan often-used spreadsheet is just not worth all theeffort. You may then decide to remove the passwordsthat youve assigned to a workbook. In some cases,you may just want to change the passwords assignedto open or modify the workbook (either to pass-words that are easier to remember or to ones thatyou want to distribute to a new list of users).

    If you mess up and type the wrong password, Exceldisplays an alert dialog box letting you know thatthe password you entered is incorrect, as shown inFigure 38-5. After you click OK to close the alert dia-log box, you must repeat the entire file-opening pro-cedure (hoping that this time youre able to enterthe correct password).

    Figure 38-5: Oops! Entering anything other thanthe exact password gives you this alertdialog box.

    When you do enter the correct password, Excelimmediately opens the workbook for viewing andprinting (and editing as well, unless youve alsoassigned a password for modifying the file).

    If youre unable to successfully reproduce thepassword, you are unable to open the file andput it to any use! Excel doesnt provide anysort of command for overriding the passwordand opening a protected workbook, nor doesMicrosoft offer any such utility. If theres anydanger of forgetting a workbooks password,be sure to write it down somewhere and keepit in a secure place, preferably under lockand key.

    If your workbook is protected from modificationsand you attempt to open its file, Excel immediatelydisplays a Password dialog box where you have tochoose between opening the file with write privi-leges and opening it in read-only mode. (See Figure38-6.) To be able to make changes to the originalworkbook file with write privileges, you must be ableto accurately enter the password in the Passwordtext box and then click OK. To open the workbookas a read-only file, click the Read Only button in thisdialog box.

    44_574272 ch38.qxd 10/1/04 10:56 PM Page 210

  • Protecting the Worksheet Against Unwanted Changes 211

    To delete or change a password for opening or modi-fying a workbook, open the Save As dialog box (FileSave As) and then open the Save Options dialog box(ToolsGeneral Options on the Save As dialog boxstoolbar).

    To delete the password to open the file, simply pressthe Delete key to remove all the asterisks from thePassword to Open text box (automatically selectedwhen you open the Save Options dialog box). Toreassign the password, replace the current passwordwith the new one you want to assign by typing itover the original one. Then when you click OK, youneed to reenter the new password in the ConfirmPassword dialog box and click OK.

    To delete or change the password for modifying theworkbook, you follow the same procedure, exceptthat you have to be able to successfully reproducethe password for modifying the workbook after open-ing it and then change or delete the password thatsentered into the Password to Modify text box in theSave Options dialog box.

    Finally, after closing the Save Options dialog box,you simply click the Save button in the Save As dia-log box and then click the Yes button in the alertdialog box that asks you if you want to replace theexisting file.

    Protecting the WorksheetAgainst Unwanted ChangesEven spreadsheets that need to be updated on a reg-ular basis (and therefore are not candidates for pass-words to open or modify the workbooks) often needprotection. This is especially true with spreadsheetswhere routine data entry is entrusted to users withlittle or no understanding of Excels workings who, ifthey inadvertently replaced a formula with an entry,would have no idea how to restore it. To keep theformulas and standard text in a spreadsheet safefrom such unwarranted changes, you need to pro-tect its worksheet.

    Before you rush off to take me at my word and turnprotection on in all the worksheets you entrust tothis type of data-entry person, you need to have arudimentary understanding of how worksheet pro-tection operates in Excel.

    First off, be aware that any cell in any Excel work-book can have one of two different protection for-mats assigned to them: either locked or unlocked,and hidden or unhidden. Whenever you begin a newspreadsheet, all the cells in the workbook have thelocked and unhidden protection formats assigned tothem. However, this particular formatting doesntcome into play until you turn on protection in theworksheet by choosing ToolsProtectionProtectSheet. At that time, you are then prevented frommaking any editing changes to all locked cells andfrom viewing the contents of all hidden cells on theFormula bar when they contain the cell pointer.

    Practically speaking, this means that you need to gothrough the sheet removing the Locked protectionformat from all the cell ranges where you or yourusers still need to be able to do data entry and editingeven when protection is turned on in the worksheet.

    When setting up spreadsheet templates,unlock all the cells where users need to inputnew data and keep locked all the cells thatcontain headings and formulas that neverchange. Then turn on worksheet protectionprior to saving the file in the template file for-mat. (See Technique 1.) Formulas and stocktext in all spreadsheets generated from thetemplate will automatically be protected butstill give users access to the areas that requiredata entry.

    Unlocking cells for data entry

    To remove the Locked protection status from a cellrange or nonadjacent selection, follow these steps:

    1. Select the range or ranges to be unlocked.To select multiple ranges to create a nonadjacentcell selection, hold down the Ctrl key as you dragthrough each range.

    44_574272 ch38.qxd 10/1/04 10:56 PM Page 211

  • Technique 38: Spreadsheet Security212

    Figure 38-9: Enabling protection in the Protect Sheetdialog box.

    When you first open this dialog box, the followingcheck boxes are selected:

    The Protect Worksheet and Contents of LockedCells check box at the very top

    The Select Locked Cells and Select UnlockedCells check boxes in the Allow All Users of ThisWorksheet To list box

    All the other check box options (including severalthat are not visible without scrolling up the Allow AllUsers of This Worksheet To list box) are unselected.

    This means that if you click OK at this point, the onlythings that youll be permitted to do in the worksheetare to edit unlocked cells and to select cell ranges ofany type (both locked and unlocked alike).

    If you really want to keep other users out of allthe locked cells in a worksheet, clear the SelectLocked Cells check box in the Allow All Usersof This Worksheet To list box. That way, yourusers are restricted to just those unlockedranges where you permit data input and con-tents editing.

    2. Choose FormatCells or press Ctrl+1 to openthe Format Cells dialog box.

    3. Select the Protection tab and then clear theLocked check box, as shown in Figure 38-8.

    4. Click OK to close the Format Cells dialog box.

    Figure 38-8: Unlocking cells for data entry on theProtection tab of the Format Cells dialogbox.

    Keep in mind that unlocking cells does noth-ing in and of itself. Its not until you turn onthe protection for your worksheet that yourunlocked cells work any differently from thelocked ones. At that time, only unlocked cellsaccept the edits that you specify. (See the nextsection for details.)

    Turning on worksheet protection

    When all cell ranges where you want to allow editingare unlocked, youre ready to turn on protection. Todo this, you choose ToolsProtectionProtect Sheetto open the Protect Sheet dialog box, shown in Fig-ure 38-9.

    44_574272 ch38.qxd 10/1/04 10:56 PM Page 212

  • Protecting the Worksheet Against Unwanted Changes 213

    Dont ever clear the Select Unlocked Cellscheck box and the Select Locked Cells checkbox at the same time. Doing so renders theworksheet completely useless by removing thecell pointer from the worksheet and making itimpossible for the user to edit even theunlocked cells of the spreadsheet.

    In addition to enabling users to select locked andunlocked cells in the worksheet, you can enable thefollowing actions in the protected worksheet byselecting their check boxes in the Allow All Usersof This Worksheet To list box:

    Format Cells: Enables the formatting of cells(with the exception of changing the locked andhidden status on the Protection tab of the FormatCells dialog box).

    Format Columns: Enables formatting so thatusers can modify the column widths and hideand unhide columns.

    Format Rows: Enables formatting so that userscan modify the row heights and hide and unhiderows.

    Insert Columns: Enables the insertion of newcolumns in the worksheet.

    Insert Rows: Enables the insertion of new rowsin the worksheet.

    Insert Hyperlinks: Enables the insertion of newhyperlinks to other documents, both local andon the Web. (See Technique 52.)

    Delete Columns: Enables the deletion of columnsin the worksheet.

    Delete Rows: Enables the deletion of rows in theworksheet.

    Sort: Enables the sorting of data in unlockedcells in the worksheet. (See Technique 44.)

    Use AutoFilter: Enables the filtering of data inthe worksheet. (See Technique 45.)

    Use Pivot Table Reports: Enables the manip-ulation of pivot tables in the worksheet. (SeeTechnique 48.)

    Edit Objects: Enables the editing of graphicobjects, such as text boxes, embedded images,and the like, in the worksheet. (See Technique 56for details.)

    Edit Scenarios: Enables the editing of what-ifscenarios, including modifying and deletingthem. (For details of what-if scenarios, seeTechnique 48.)

    In addition to enabling particular actions in the pro-tected worksheet, you can also assign a passwordthats required in order to remove the protectionsfrom the protected worksheet. When entering a pass-word in the Password to Unprotect Sheet text box ofthe Protect Sheet dialog box, you observe the sameguidelines as when assigning a password to open orto modify the workbook (a maximum of 255 charac-ters that can consist of a combination of letters,numbers, and spaces, with the letters being casesensitive).

    When you enter a password in the Password toUnprotect Sheet text box and then click OK, Exceldisplays the Confirm Password dialog box. Here,you must accurately reproduce the password youjust entered (including upper- and lowercase letters)before Excel turns on the sheet protection andassigns the password to its removal.

    If you dont assign a password to unprotectthe sheet, any user with a modicum of Excelknowledge can turn off the worksheet protec-tion and start making all manner of changesto its contents, including wreaking havoc onits formulas. It makes little sense to turn onthe protection in a worksheet if youre goingto permit anybody to turn it off by simplychoosing the ToolsProtectionUnprotectSheet command.

    Removing protection from a worksheet

    When you turn on protection in a worksheet, yourdata input and editing are restricted solely tounlocked cells in the sheet, and you can performonly those additional actions that you enabled in

    44_574272 ch38.qxd 10/1/04 10:56 PM Page 213

  • Technique 38: Spreadsheet Security214

    To give access to particular ranges in a protectedworksheet, follow these steps:

    1. Choose ToolsProtectionAllow Users to EditRanges to open the All Users to Edit Ranges dia-log box, shown in Figure 38-10.

    Note that if the worksheet is currently protected,the Allow Users to Edit Ranges menu item isgrayed out and unavailable. In that case, you mustremove protection with the ToolsProtectionUnprotect Sheet command before you followStep 1.

    Figure 38-10: Designating the unlocked ranges and theusers who can edit them when the sheet isprotected.

    2. Click the New button to open the New Rangedialog box, shown in Figure 38-11.

    Figure 38-11: Designating the first unlocked range in theNew Range dialog box.

    the Allow Users of this Worksheet To list box. If youtry to replace, delete, or otherwise modify a lockedcell in the protected worksheet (assuming that theSelect Locked Cells check box is selected), Excel dis-plays an alert dialog box with the following message:

    The cell or chart you are trying to changeis protected and therefore read-only

    The message then goes on to tell you that to modifya protected worksheet, you must first remove theprotection by choosing the ToolsProtectionUnprotect Sheet command. If youve assigned apassword to unprotect the sheet, the program dis-plays the Unprotect Sheet dialog box where youmust enter the password exactly as you assigned it.After you enter the correct password and click OK,Excel turns off the protection in the sheet, and youcan once again make any modifications to its struc-ture and contents in both the locked and unlockedcells.

    When you protect a worksheet, only the dataand graphics on that particular sheet are pro-tected. This means that you can mess with thecontents of other sheets of the same work-book without removing protection. To protectthe contents on another sheet, you need toactivate it and then repeat the entire proce-dure for protecting it as well (including unlock-ing cells that need to be edited and selectingwhich other formatting options to enable inthe worksheet and whether or not to assign apassword to unprotect the sheet) before dis-tributing the workbook.

    Enabling cell range editing by certain users

    If youre running Excel 2000 or 2003 on a network ora machine thats being shared with other users, youcan enable the editing of individual ranges in theprotected worksheet for just certain users. Whenyou use this feature, you give particular users per-mission to edit particular cell ranges, provided thatthey can correctly provide the password you assignto that range.

    44_574272 ch38.qxd 10/1/04 10:56 PM Page 214

  • Protecting the Worksheet Against Unwanted Changes 215

    3. Type a descriptive name for the range in theTitle text box (or accept the name Excel assignsto the range such as Range1, Range2, and so on).

    4. Select the Refers to Cells text box and then typein the address of the cell range (without remov-ing the = sign) or select the range or ranges inthe worksheet.

    If you select the range by dragging through itscells, Excel automatically reduces the New Rangedialog box to the Refers to Cells list box.

    5. Type in the password for accessing the range inthe Range Password text box.

    6. Click the Permissions button to open thePermissions for Range1 (or whatever youvenamed the range).

    7. Click the Add button to open the Select Usersor Groups dialog box, shown in Figure 38-12.

    Figure 38-12: Designating the users who can edit therange in the Select Users or Groups dialogbox.

    8. Select the name of the user in the Enter theObject Names to Select list box. To select multi-ple users from this list, hold down the Ctrl keyas you click each user name.

    If this list box is empty, click the Advanced but-ton to expand the dialog box and then click theFind Now button to locate all the users for yourlocation. You can then click the name or Ctrl+click the names you want to add from this list,and then when you click OK, Excel returns youto the original form of the Select Users or Groups

    dialog box and adds these names to its Enter theObject Names to Select list box.

    9. Click OK in the Select Users or Groups dialogbox to close it and return to the originalPermissions dialog box.

    10. Click the name of the first user who must knowthe password and then select the Deny checkbox in the Permissions For list box. (See Fig-ure 38-13.)

    Figure 38-13: Designating which users must have thepassword in order to edit the range.

    11. Repeat Step 10 for each user who must knowthe password and then click OK.

    Excel then displays a warning alert dialog box,letting you know that youre setting a deny per-mission that takes precedence over any allowsentries. That mean that if the person is a mem-ber of two groups, one with an allow entry and

    44_574272 ch38.qxd 10/1/04 10:56 PM Page 215

  • Technique 38: Spreadsheet Security216

    15. Select the Paste Permissions Information Into aNew Workbook check box if you want to createa new workbook that contains all the permis-sions information.

    When you select this check box, Excel createsa new workbook whose first worksheet lists allthe ranges youve assigned, along with the userswho may gain access by providing the rangepassword. You can then save this workbook foryour records. Note that the range password isnot listed on this worksheet; if you want to addit, be sure that you password-protect the work-book so that only you can open it.

    Now, youre ready to protect the worksheet. Ifyou want to do this from within the Allow Usersto Edit Ranges dialog box, click the Protect Sheetbutton to open the Protect Sheet dialog box. Ifyou want to protect the worksheet later on, clickOK to close the Allow Users to Edit Ranges dialogbox and then choose the ToolsProtectionProtect Sheet whenever youre ready to turn onthe worksheet protection.

    16. Click the Protect Sheet button to protect theworksheet; otherwise, click OK to close theAllow Users to Edit Ranges dialog box.

    If you click the Protect Sheet button, Excel opens theProtect Sheet dialog box where you can set a pass-word to unprotect the sheet as well as to select theactions that you permit all users to perform in theprotected worksheet (as outlined earlier in thischapter). After you turn on protection in the work-sheet, only the users youve designated are able toedit the cell range or ranges youve specified. Dontforget to supply the range password to all the userswho are allowed to do editing in the range or rangesat the time you distribute the workbook to them.

    Protecting the structure of the workbook file

    You can apply one last level of protection to yourspreadsheet files: protecting the entire workbook.When you protect the workbook, you ensure thatits users cant modify the files structure by adding,deleting, or even moving and renaming any of its

    the other with a deny entry, the deny entry per-mission rules (meaning that the user must knowthe range password).

    12. Click the Yes button in the Security alert dialogbox to close it and return to the New Range dia-log box.

    13. Click OK in the New Range dialog box to closeit and open the Confirm Password dialog box.

    14. Type the range password in the ReenterPassword to Proceed text box and then clickOK to close it and return to the Allow Usersto Edit Ranges dialog box.

    The Allow Users to Edit Ranges dialog box nowcontains the name and reference of the newrange you just specified as one that can beunlocked when the worksheet is protected,as shown in Figure 38-14.

    Figure 38-14: Allow Users to Edit Ranges dialog box withthe first range unlocked by password.

    If you need to define other ranges available toother users in the worksheet, you can do so byrepeating Steps 2 through 14.

    When you finish adding ranges to the AllowUsers to Edit Ranges dialog box, youre readyto protect the worksheet. If you want to retain arecord of the ranges youve defined, follow Step15. Otherwise, skip to Step 16.

    44_574272 ch38.qxd 10/1/04 10:56 PM Page 216

  • Hiding Sensitive Worksheet Data 217

    worksheets. To protect your workbook, chooseToolsProtectionProtect Workbook to open theProtect Workbook dialog box, shown in Figure 38-15.

    Figure 38-15: Protecting the workbook file fromstructural changes.

    The Protect Workbook dialog box contains twocheck boxes: Structure (which is automaticallychecked) and Windows (which is not selected).This dialog box also contains a Password (Optional)text box where you can enter a password thatmust be supplied before you can unprotect theworkbook. Like every other password in Excel, thepassword to unprotect the workbook can be up to255 characters consisting of a combination of let-ters, numbers, and spaces, with all the letters beingcase sensitive and must be replicated exactlybefore it is put into effect.

    When you protect a workbook with the Structurecheck box selected, Excel prevents you from doingany of the following tasks to the file:

    Inserting new worksheets.

    Deleting existing worksheets.

    Renaming worksheets.

    Hiding or viewing hidden worksheets.

    Moving or copying worksheets to anotherworkbook.

    Displaying the source data for a cell in a pivottable or displaying a tables page fields on sepa-rate worksheets. (See Technique 48.)

    Creating a summary report with the ScenarioManager. (See Technique 49.)

    When you turn on protection for a workbook afterselecting the Windows check box, Excel preventsyou from changing the size or position of the work-books windows (which is not usually somethingyou need to control).

    After you enable protection in a workbook, you canthen turn it off by choosing ToolsProtectionUnprotect Workbook. If you assigned a password tounprotect the workbook, you must accurately repro-duce it in the Password text box in the UnprotectWorkbook dialog box that appears.

    Hiding SensitiveWorksheet DataIn addition to protecting locked cells from editingchanges when the worksheet is protected, you canalso ensure that their contents do not show up onthe Formula bar when their cells contain the cellpointer. You might add this, for example, to cellranges that contain long, complex formulas so thatthey dont clutter the Formula bar by adding to thebusyness of the screen when you move the cellpointer through their cells. (Lets face it. Becausetheyre protected from changes, theres really noreason to look at them anyway.)

    To suppress the display of a cell range from theFormula bar, select the range, open the Protectiontab of the Format Cells dialog box (Ctrl+1), selectthe Hidden check box, and click OK. Then turn onthe worksheet protection (ToolsProtectionProtect Sheet).

    44_574272 ch38.qxd 10/1/04 10:56 PM Page 217

  • Technique 38: Spreadsheet Security218

    protection format to these cell ranges (as describedabove) but also need to apply a custom number for-mat that hides the cells in the worksheet itself. (SeeTechnique 20.)

    Be sure to lock any cell ranges that you rendercompletely invisible in the worksheet by apply-ing the Hidden protection format that hidestheir contents on the Formula bar and a cus-tom number format that hides their display inthe worksheet. This prevents users from mak-ing changes to these cells that now appear forall intents and purposes to be blank.

    Dont ever select the Hidden check box on theProtection tab to hide a range of formulaswhen the Locked check box is not alsoselected. If you do, youre enabling users toreplace or delete a cells contents right at thetime that its contents no longer appear on theFormula bar a recipe for disaster!

    Sometimes your spreadsheet may contain sensitivedata that isnt proper for certain data-entry opera-tors to see, either on the Formula bar when the cellpointer is in their cells or in the worksheet itself. Forthose cases, you not only need to assign the Hidden

    44_574272 ch38.qxd 10/1/04 10:56 PM Page 218

  • 39 Printing Tricks forFlawless ReportsPrinting your spreadsheets is probably the most important task thatyou perform in Excel. This technique looks at all the little things youcan do to ensure that your printed reports not only contain all thenecessary information but also present it in the clearest possible manner.

    Among the tricks of the spreadsheet printing trade of which you shouldbe aware are how to use Excels Page Preview feature to check howthe report will print and to take care of any last-minute problems withthe page elements and how to use the Page Break Preview to take careof any nasty page-break problems. This technique also covers how to usethe Header and Footer feature to create custom running heads for thereport as well as how to use the Print Titles feature to ensure that rowand column headings from the worksheet are printed on each page ofspreadsheet data. Finally, this technique looks at how to obtain a quickprintout of your worksheet data showing the formulas used rather thantheir results so that you can check the integrity of the computations andhave a printed record of them.

    Making Last-Minute Adjustmentswith Print PreviewUsing the Print Preview feature to preview your report and catch anylast-minute problems saves you lots of trips to the printer and tons ofwasted paper as well as affords you a way to make most of the neces-sary last-minute adjustments to the printout. These adjustments caninclude such things as resetting the margins and column widths, modify-ing headers and footers, and changing the page order, size, orientation,and scaling.

    In Print Preview, text and graphics elements assigned to the cells in thePrint Area (that is, the section of the current worksheet included in theprintout) appear more-or-less as they will print. Unlike the standard on-screen view of the worksheet, Print Preview shows you the headers andfooters defined for the report and allows you to page through the reportone page at a time so that you can check the page breaks.


    Save Time By Previewing the report

    before printing it

    Using Page BreakPreview to manage pagebreaks

    Adding headers and foot-ers to your report

    Adding print titles to yourreport

    Printing formulas in yourreport

    Printing charts in yourreport

    45_574272 ch39.qxd 10/1/04 10:57 PM Page 219

  • Technique 39: Printing Tricks for Flawless Reports220

    To position the lower-right corner on the screen,Press Ctrl+End.

    To position the left, right, top, or bottom cornerof the page on the screen from whatever part ofthe page is displayed, press Ctrl+ an arrow key(, , , or ).

    Figure 39-1: First page of a ten-page report in the PrintPreview window.

    Figure 39-2: First page of the report enlarged to 100percent in the Print Preview window.

    Zoom mouse pointer

    If you find any data errors when previewing a report,you can then edit them before you send the job tothe printer by clicking the Close button to exit PrintPreview and return to the normal worksheet view. Ifyou dont find any problems, you can then send thejob to the printer directly from the Print Previewwindow.

    You can open the Print Preview window from thenormal worksheet window, the Page Setup dialogbox, or the Print dialog box:

    From the worksheet: Click the Print Previewbutton on the Standard toolbar or chooseFilePrint Preview.

    From the Page Setup dialog box (FilePageSetup): Click the Print Preview button on theright side of the dialog box beneath the Printbutton.

    From the Print dialog box (FilePrint): Clickthe Preview button located in the lower-left cor-ner of the dialog box.

    When you first open the Print Preview window, thewindow displays a full-page view of the reports firstpage, as shown in Figure 39-1. To increase the pagesize to 100 percent, click the Zoom mouse pointer onthe section of the page that you want to see in detail.

    When the page is enlarged to 100 percent (see Figure39-2), you can use the scroll bars to bring new partsof the page into view in the Print Preview window.Or, if you prefer, you can use the keyboard:

    To scroll up or down, press the and keys orPage Up and Page Down.

    To scroll left to right, press and orCtrl+Page Up and Ctrl+Page Down.

    To position the left edge of the page on thescreen, press the Home key.

    To position the right edge of the page on thescreen, press End.

    To position the upper-left corner of the page onthe screen, press Ctrl+Home.

    45_574272 ch39.qxd 10/1/04 10:57 PM Page 220

  • Making Last-Minute Adjustments with Print Preview 221

    To return to full-page view in the Print Preview win-dow, click the arrowhead pointer somewhere on thepage or click the Zoom button located at the top ofthe Print Preview window. If your report consists ofmore than one page, you can view succeeding pagesby clicking the Next button, located at the top of thewindow, or by pressing the Page Down key. To reviewpages that youve already seen, click the Previousbutton or press Page Up.

    Manipulating the margins and column widths

    If you detect problems with the margins as you pre-view the pages in your report, you can change them.Click the Margins button to display top, bottom, left,and right margin markers along with column indica-tors in the Print Preview window (see Figure 39-3).

    Figure 39-3: Displaying the margins and column-widthmarkers in Print Preview.

    Top margin marker

    Left margin marker

    Header margin marker

    Column markers

    Right margin marker

    Footer margin marker

    Bottom margin marker

    To change the margins and/or adjust the columnwidths, position the mouse pointer on the margin orcolumn marker and then, when the pointer changesto a double-headed arrow, drag the marker in theappropriate direction. When you release the mousebutton, Excel redraws the data on the page thatyoure previewing to suit the new margin settings.Note that changing the margins has no effect on thepositioning of the header or footer text, only thedata in the body of the report.

    To change a column width, you position the mousepointer on the marker of the column border that youwant to increase or decrease and then drag it withthe double-headed mouse pointer in the appropriatedirection. (See Figure 39-4.) After you finish modify-ing the margins or column widths, remove the on-screen markers by clicking the Margins button again.

    Figure 39-4: Decreasing the width of the first column inPrint Preview.

    Manipulating the page settings

    If you identify a problem with the page settings whilepreviewing the pages of a report, you can open thePage Setup dialog box by clicking the Setup button

    45_574272 ch39.qxd 10/1/04 10:57 PM Page 221

  • Technique 39: Printing Tricks for Flawless Reports222

    Figure 39-6: First page of the report in the Print Previewwindow after changing some print settings.

    Controlling Bad Page BreaksPage breaks that split up important information thatshould appear together on the same page are proba-bly the most prevalent type of problem youre likelyto notice in the Print Preview window. Fortunately,Excel offers a variety of methods for taking care ofthe different sorts of paging problems that tend tocrop up.

    If you have page break problems for a printout thatfeatures lots of tables of data that are much widerthan they are tall, often the best way to try to solvethis problem is simply to change the orientationof the printed report from the default Portrait mode(where the printing runs with the short edge of thepaper) to Landscape mode (where the printing runswith the long edge). To try out this solution, openthe Page tab of the Page Setup dialog box (FilePage Setup or the Setup button in Print Preview)and then select the Landscape option button.

    Figure 39-7 shows the effect that changing fromPortrait to Landscape mode has on the sample ten-page report shown in the earlier figures. In this

    on the Print Preview toolbar. You can then use thecontrols on the Page, Margins, Header/Footer, orSheet tab to fix the problem without having toclose the Print Preview window.

    For example, in the first page of my previewed sam-ple report shown in Figure 39-1, I notice that thereport is going to include cell gridlines without theworksheets row and column headings. Luckily, I canremove the cell gridlines and add back the row andcolumn headings while still being able to see howthis all looks in Print Preview. I just need to openthe Sheet tab of the Page Setup dialog box and thenclear the Gridlines check box and select the Rowand Column Headings check box, as shown in Fig-ure 39-5.

    Figure 39-5: Changing Print settings on the Sheet tab ofthe Page Setup dialog box.

    Figure 39-6 shows the first page of the report in PrintPreview after making these changes to the print set-tings on the Sheet tab and then closing the PageSetup dialog box to return to the Print Previewwindow.

    45_574272 ch39.qxd 10/1/04 10:57 PM Page 222

  • Controlling Bad Page Breaks 223

    orientation, you get several more columns of dataprinted on each page with fewer rows.

    Figure 39-7: Switching from Portrait to Landscape modein the Print Preview window.

    Using the Page Break Preview feature

    You can use the Page Break Preview feature to tryand manually adjust the bad page breaks that youidentify in the report. You can access Page BreakPreview from either the normal worksheet windowor the Print Preview window:

    From the normal worksheet: Choose ViewPage Break Preview.

    From the Print Preview window: Click the PageBreak Preview button on the toolbar located atthe top of the window.

    When you choose Page Break Preview, Excel dis-plays the worksheet at a somewhat reduced magnifi-cation with the page breaks clearly identified in theworksheet window. Page borders appear as heavyblue dashed lines, and the page numbers appear inthe middle of the page in light gray. The first timeyou choose Page Break Preview, Excel displays aPage Break Preview Welcome information dialog

    box, shown in Figure 39-8, which informs you thatyou can adjust the page breaks displayed on thescreen by dragging them.

    Figure 39-8: Using Page Break Preview to identify and fixbad page breaks.

    After closing this dialog box, you can examine thepage breaks (indicated by the dotted lines) by scroll-ing through the worksheet. Note that you can usethe Zoom button on the Standard toolbar to reducethe magnification on the worksheet even further sothat you can see all the pages and the order in whichthey will be printed (indicated by the page numbersdisplayed in the center of the page).

    Figure 39-9 shows the Page Break Preview displayshown in Figure 39-8 after reducing the magnificationsetting in the Zoom control from the default 60% ofnormal setting to 35%. At this reduced magnificationsetting, the breaks for all ten pages of the report arenow visible. In the Page Break Preview display at thiszoom setting, you can also see clearly how Excelpages the data in your worksheet proceeding downthe rows of data before going across the columns(so that all the even-numbered pages are belowrather than to the right of odd-numbered pages).

    45_574272 ch39.qxd 10/1/04 10:57 PM Page 223

  • Technique 39: Printing Tricks for Flawless Reports224

    Changing the scale of the printing

    Oftentimes, especially with one- or two-page print-outs, you can solve paging problems by making aslight adjustment to the printing scale. Excel offerstwo controls for scaling the size of the printing inyour report, both of which are located on the Pagetab of the Page Setup dialog box, as shown in Fig-ure 39-10.

    Figure 39-10: Adjusting the scale of the printing on thePage tab of the Page Setup dialog box.

    You can use the Adjust To option button and associ-ated text box to set the printing at a particular mag-nification (between 10% and 400% of normal). Whenmodifying the scale of the printing, you can eitherenter this new percentage into this text box or selectit with its spin buttons.

    Perhaps more practical, at least in the case of print-outs with few pages, is the Fit To control, whichgives Excel the responsibility for selecting the scaleof the printing in order to fit a set number of pages.When you select the Fit To option button, you canthen select the final number of pages in the reportby designating the number of pages in the Page(s)Wide and Tall text boxes.

    Figure 39-9: Page Break Preview display showing all tenpages of the report.

    After examining the page breaks in the Page BreakPreview display, you can then decide which pagebreaks, if any, to adjust. When deciding how toadjust page breaks, keep in mind that Excel wontallow you to drag the page breaks to include morecolumns to the right or more rows lower in the work-sheet because these represent the limit of columnsand rows that fit on the page, given the current pageand printing settings. (To be able to include more ofthese columns or rows on a page, youd have toadjust the margin settings, column widths, or thescaling of the printing.)

    To manually adjust a page break in the Page BreakPreview display, drag its page border to the columnor row where you want the page to break. Note thatExcel distinguishes the page breaks that you adjustin the Page Break Preview display from the ones thatthe program put in by displaying yours as blue solidlines (rather than blue dashed lines).

    After you finish adjusting the bad page breaks in thePage Break Preview display, return to the normalworksheet display by choosing ViewNormal.

    45_574272 ch39.qxd 10/1/04 10:57 PM Page 224

  • Adding Headings to Your Report 225

    When deciding what values to enter or select for theWide and Tall text boxes, refer to the original pagelayout that Excel came up with in the Page BreakPreview display and then adjust its number of pagesacross (wide) and down (tall) accordingly. If, forexample, you find that the original page layout hadfive pages across with two down and that there werejust a couple of columns of data appearing alone onthe last two pages (9 and 10), you could then dis-pense with those last two pages by selecting the FitTo option button and then entering 4 in the Page(s)Wide text box and 2 in the Tall text box. Excel wouldthen reduce the size of the printing as necessary toachieve this new layout, and you could then verifythe page breaks in this new eight-page report layoutbefore sending it to the printer.

    Adding Headings to Your ReportRunning heads headings that appear in the sameposition on each page of the printed report cango a long way towards making the data and chartsin your report more comprehensible to the reader.Excel supports two types of running heads in thereports you print:

    Headers and footers: Headings that appear inthe top and bottom margins respectively oneach page of the report.

    Print titles: Headings that repeat rows andcolumns from the worksheet containing theactual column and row headings that identifythe worksheet data in the table or list thatsbeing printed. Print titles appear at the left andtop of each page in the body of the report.

    Headers and footers made to order

    The Header/Footer tab of the Page Setup dialog box(see Figure 39-11) contains the controls for definingor removing a header and footer from the printedreport. The header contains the information that

    you want printed at the top of every page of thereport, and the footer contains the information thatyou want printed at the bottom of each page. Notethat Excel doesnt automatically assign either aheader or footer when you first print a report froma workbook.

    Figure 39-11: Defining a header and footer on theHeader/Footer tab of the Page Setupdialog box.

    When assigning a header or footer for your report,you can either select one of the stock headings(such as those that print the current page numberor date, or those that print the name of the work-book or worksheet, and so forth) or create a customheading of your own. To select a stock headingon the Header/Footer tab, click the heading in theHeader and/or Footer drop-down list box to replacethe default setting of (none).

    To create a custom heading for the header and/orfooter, click the Custom Header or Custom Footerbutton on this tab to open the respective Headeror Footer dialog box. Figure 39-12 shows the Headerdialog box. (The Footer dialog box is almost a car-bon copy of the Header dialog box.) As you can see,a custom header and footer can consist of up tothree parts:

    45_574272 ch39.qxd 10/1/04 10:57 PM Page 225

  • Technique 39: Printing Tricks for Flawless Reports226

    selected text without inserting any codes into thecurrent section of the custom header or footer.

    TABLE 39-1: HEADER AND FOOTER CODESButton Code What It Does

    Page Number &[Page] Inserts current pagenumber

    Total Pages &[Pages] Inserts the total numberof pages

    Date &[Date] Inserts current date in theform 9/15/04

    Time &[Time] Inserts current time in theform 10:02 AM

    Path &[Path] Inserts the complete path-name for the file in theform C:\mydocuments\finances\budget04

    Filename &[File] Inserts the workbookfilename

    Sheet &[Tab] Inserts the worksheet name

    Picture &[Picture] Inserts the graphic imageyou select

    Also note that when you click the Picture button,Excel opens the Insert Picture dialog box, whereyou choose the graphics file whose image you wantto appear in the header or footer (normally a logoor other mark that fits well within the top or bottommargin). This file is represented in the header orfooter by the &[Picture] code. When you click theFormat Picture button (available only after youveinserted the &[Picture] code in the header orfooter), Excel opens the Format Picture dialogbox, which enables you to modify the imagessize and appearance.

    Print titles on every page

    You can use the text boxes in the Print Titles sectionon the Sheet tab of the Page Setup dialog box to addrow and column headings from tables in a worksheet

    A Left Section in which all the items are left-justified

    A Center Section in which the elements are cen-tered between the left and right margins

    A Right Section in which they are right-justified

    Figure 39-12: Defining a custom header for a report inthe Header dialog box.

    When you create a custom header or footer, youcan mix your text with stock information, such asthe current page number, total number of pages,date, path to the folder containing the file, workbookfilename, and worksheet name. To do this, click theinsertion point in the section where you want to addtext and then type your text interspersed with thestock information whose code you insert. To insertthe code for a piece of stock information, click theappropriate button in the Header or Footer dialogbox. (Refer to Figure 39-12.)

    Table 39-1 shows you the codes that Excel insertsinto the text of your custom header or footer whenyou click the various buttons in the Header or Footerdialog box. Note that when you click the Font but-ton, Excel opens the Font dialog box where you canselect a new font, font size, or font style for the



    Total Pages







    Format Picture

    45_574272 ch39.qxd 10/1/04 10:57 PM Page 226

  • Printing the Formulas in the Report 227

    as headings that appear on each page of the report.Select the Rows to Repeat at Top text box and thenselect the row(s) in the worksheet that contain thecolumn headings you want to appear in the upperportion of each page. Select the Columns to Repeatat Left text and then select the column(s) in theworksheet that contain the row headings you wantto appear on the left side of each page.

    Figures 39-13 and 39-14 illustrate the use of both arow and column print title in a report. In Figure39-13, I designate rows 1 and 2, which contain theworksheet title and the column headings respec-tively as the row print titles. I also designate col-umn A, which contains the row headings for theIncome Analysis table, as the column print titles.

    Figure 39-13: Defining print titles on the Sheet tab of thePage Setup dialog box.

    Figure 39-14 shows the result. Here, you see the thirdpage of the six-page report in the Print Preview win-dow after designating rows 1 and 2 as the row printtitles and column A as the column print titles. As youcan see, column print titles repeated from the firstpage of the report immediately identify the type ofthe income and expenditure just as the row printtitles identify the time frame.

    Figure 39-14: Preview of Page 3 of the report showingthe row and column print titles.

    Printing the Formulasin the ReportNormally, whenever you print a worksheet, Excelprints the entries exactly as they appear in theircells of the worksheet. As a result, when you printa section of worksheet that contains formulas, theprintout shows only the results of the calculationsperformed by the formulas and not the contents ofthe formulas themselves. In addition to a printoutshowing the results, you may also want to print ahard copy of the worksheet showing all the formu-las by which these results were derived. You canthen use this printout of the formulas when double-checking the formulas in the worksheet to make surethat theyre designed correctly.

    To print a copy of the worksheet with the formulasdisplayed in the cells, follow these steps:

    1. Choose ToolsOptions to open the Options dia-log box.

    2. Select the View tab, select the Formulas checkbox, and click OK.

    45_574272 ch39.qxd 10/1/04 10:57 PM Page 227

  • Technique 39: Printing Tricks for Flawless Reports228

    dialog box. Excel returns the worksheet display tonormal so that only the results of formulas are dis-played in the cells and all entries are displayed withtheir formatting.

    You can instantly switch between displayingand hiding formulas in a worksheet by press-ing the Ctrl+` keyboard shortcut Ctrl plusthe accent key with the tilde (~) symbol aboveit. This shortcut acts as a toggle; the first timeyou press it, all formulas are displayed in thecells of your worksheet, and the second timeyou press it, they are once again hidden.

    To help you identify the cell reference of each for-mula in your printout, print the version of the work-sheet that displays the formulas in the cells with thecolumn letters and row numbers on the top row andleftmost column of each page. To do this, you needto open Sheet tab of the Page Setup dialog box(FilePage Setup) and select the Row and ColumnHeadings check box. Then you can print the work-sheet by clicking the Print button in the Page Setupdialog box or, if you need to return to the worksheetto display the formulas in the worksheet beforesending the job to printer, click the dialog boxsClose button instead.

    Printing the Chartsin the ReportTo print an embedded chart as part of the surround-ing data on the same worksheet, you simply printthe worksheet (FilePrint or Ctrl+P). To print anembedded chart by itself without the supportingworksheet data, click the chart to select it and thenchoose FilePrint. Note that you can also print theembedded chart by putting it in its own window(right-click on the embedded chart and then selectChart Window on its shortcut menu) before youselect the Print command. (See Figure 39-16.) Toprint a chart thats on a separate chart sheet, acti-vate its chart sheet tab and then choose FilePrintor press Ctrl+P.

    When the Formulas check box is selected, Exceldisplays the entry in each cell in the worksheetas it appears on the formula (as well as theFormula Auditing toolbar which you can closeby clicking its Close button). In this state, notonly do formulas appear as entered in the work-sheet, but also all values (text and numeric)appear without their formatting, as shown inFigure 39-15.

    3. Click the Print button on the Standard toolbarto send the print job to the printer.

    If you need to print only a particular area ofthe worksheet, select that range and then des-ignate that section as the Print Area (FilePrint AreaPrint Area) before you click thePrint button on the Standard toolbar.

    Figure 39-15 shows the Production Schedule sampleworksheet after displaying its formulas. Note thatExcel automatically adjusts the column widths todisplay the contents of their formulas and displaysthe Formula Auditing toolbar (which I docked abovethe Formula bar). Note too, that the program auto-matically replaces all formatted numbers with theirraw values, including the dates in row 2 that nowdisplay their serial numbers. (Excel restores allnumber formatting as soon as you clear theFormulas check box.)

    Figure 39-15: Worksheet table after displaying theformulas in the worksheet.

    After printing the formulas in the worksheet, youcan return the worksheet to its Normal view withoutthe formulas displayed in the cells by clearing theFormulas check box on the View tab of the Options

    45_574272 ch39.qxd 10/1/04 10:57 PM Page 228

  • Printing the Charts in the Report 229

    Figure 39-16: Getting ready to print an embedded chartin its own chart window.

    When printing a chart alone that is, without itssupporting data or in its own chart sheet or chartwindow the Page Setup dialog box includes aChart tab that contains its own special chart print-ing options:

    Use Full Page: Click this option button to printto scale the chart so that it takes up the entirepage.

    Scale to Fit Page: Click this option button tohave Excel scale the chart so that it prints onthe page size youve selected.

    Custom: Click this option button to print thechart in the size it assumes on the screen.

    Draft Quality: Select this check box to printthe chart by using your printers draft-qualitysetting.

    Print in Black and White: Select this checkbox to have your color printer print the chartin black and white.

    Note that when you place an embedded chartin its own chart window (refer to Figure 39-16),you can open the Page Setup dialog box tochange these print settings on the Chart tabby right-clicking on the title bar and thenclicking Page Setup on the windows shortcutmenu.

    45_574272 ch39.qxd 10/1/04 10:57 PM Page 229

  • Technique40 Sharing Data withOther OfficeProgramsThis technique covers data sharing between Excel and otherWindows programs that you or your coworkers use. In manycases, data sharing involves getting Excel data tables, data lists,and charts into other Office programs that you use, especially MicrosoftWord documents and PowerPoint presentations. In other cases, datasharing involves getting data generated in other programs, such as intables and lists created in Microsoft Word and contacts maintained inMicrosoft Outlook, into an Excel worksheet.

    Sometimes, data sharing involves importing text files into Excel work-sheets. As part of this process, you parse the text entries that is, youtell Excel how to split up the individual pieces of information in each lineof the text file so that these items are entered into separate cells (makingit possible to sort and filter the list by various data items).

    Swapping Data via the ClipboardThe key to swapping blocks of data or discrete objects in or out of Excelis the Windows Clipboard. Excel gives you access to contents of theClipboard in the form of the Clipboard task pane, which you can quicklyopen by pressing Ctrl+CC (that is two Cs in a row all the while holdingdown the Ctrl key).

    With the Clipboard task pane open, you can copy its objects or blocksof text into cells of the open worksheet simply by clicking the item inthis task pane. Figures 40-1 and 40-2 illustrate this situation. Figure 40-1shows the Clipboard task pane open in a new worksheet window. At thistime, the Clipboard contains four items: a URL copied from InternetExplorer, a list of names from a Word document, an endless knot, and aMind Over Media logo graphic copied from a PowerPoint presentation.


    Save Time By Sharing data via the

    Windows Clipboard

    Parsing text files that youimport into Excel

    Embedding Excel data ina Word document

    Linking Excel data in aWord document

    46_574272 ch40.qxd 10/1/04 10:57 PM Page 230

  • Swapping Data via the Clipboard 231

    Figure 40-2: Worksheet after importing various Clipboardobjects into a new worksheet.

    Figure 40-3: Copying Excel data and an embedded chartto the Windows Clipboard.

    Figure 40-4 shows the 2003 Word window after past-ing the worksheet data and accompanying chartfrom Words Clipboard task pane into a new docu-ment. As you can see, Word automatically formatsthe Excel worksheet data as a Word table, while tak-ing the Excel Clustered Column chart in as a sepa-rate graphic object that you can resize and movewithin the document.

    Figure 40-1: Open the Clipboard task pane to see thecontents of the Windows Clipboard.

    Figure 40-2 shows the new worksheet after pastingall four Clipboard objects into the new worksheet.(To do this, you simply click each object in theClipboard task pane.) As you can see, Windowspasted the four names entered on separate lines ofthe Word document into the worksheet as separatecell entries in the range A1:A4 (A1 was the currentcell when I clicked this item in the Clipboard taskpane). The URL is entered in cell A15 as a long textentry when that cell was current, and the twographic files were pasted in as sizable and movablegraphic objects as Excel saw fit.

    In addition to using the Windows Clipboard to pasteinformation into an Excel spreadsheet from otherWindows programs, you can also use the Clipboardto take worksheet data and charts from a spread-sheet for use in another Windows program. Figures40-3 and 40-4 illustrate this situation.

    Figure 40-3 shows the CG Media 2004 Sales work-sheet after copying the table of data in the rangeA1:F11 (with the first quarter sales figures) andthe embedded chart directly beneath it into theWindows Clipboard (shown as the first two itemsin the Clipboard task pane on the right).

    46_574272 ch40.qxd 10/1/04 10:57 PM Page 231

  • Figure 40-4: New Word document after pasting in theExcel worksheet data and chart.

    Importing Text Files into ExcelText files used to be the preferred format for datasharing on personal computers way back in theDark Ages before the universal adoption of MicrosoftWindows on the PC platform and the widespread useof the Internet. Therefore, it should come as no sur-prise to find out that Excel is totally at home withimporting data from almost any text file. To do thisjob, Excel relies on its Text Import Wizard, whichenables you to tell Excel exactly how to split up thedata on each line of the text file into separate cells inthe worksheet (a process technically known as pars-ing the text file).

    Most text files containing lists of related data usesome sort of standard character to separate eachdata item (such as a comma or tab) in every line,just as the file uses the character representing thepressing of the Enter key to mark the separation ofeach line of data within the file. Those text files thatuse the comma to separate data items are known asCSV (comma-separated values) files. Those that use

    tabs to separate the individual data items are knownas tab-delimited files. Note that some programs usethe term delimited files to refer to any text file thatuses a standard character, such as a comma or tab,to separate its individual data items.

    The Text Import Wizard analyzes the structure ofincoming text files to help you determine how to splitup the data in the text file. The Text Import Wizardalways imports the text data into the current work-sheet starting at the active cell and then uses asmany subsequent columns and rows as are neces-sary. For this reason, you should always select anempty cell at the beginning of a blank region in theworksheet (or better yet, in a blank worksheet)before you try to open a text file, a process thatautomatically launches the Text Import Wizard.That way, you never run the risk of the incoming textfile data wiping out existing data in the worksheet.

    To use the Text Import Wizard, follow these steps:

    1. Open the text file in the Open dialog box(FileOpen) as you would any bona fideExcel file.

    Remember that to display the text files in one ofthe folders on your computer, you must selectText Files (*.prn; *.txt; *.csv) in the Files of Typedrop-down menu. (By default, the Excel Opendialog box shows only the Excel files in a folder.)

    Note that Excel displays an alert dialog box indi-cating that the program cannot load the filedirectly and telling you to click OK to open thefile in a different format.

    2. Click OK in the alert dialog box.The Text Import Wizard - Step 1 of 3 dialog boxappears, as shown in Figure 40-5.

    In the Step 1 of 3 dialog box, the Text ImportWizard analyzes the data in the text to try anddetermine whether or not it separates the dataitem with some sort of delimiting character.

    Technique 40: Sharing Data with Other Office Programs232

    46_574272 ch40.qxd 10/1/04 10:57 PM Page 232

  • Importing Text Files into Excel 233

    Figure 40-6: Previewing the way the text information isparsed into columns.

    6. Select the delimiting character in the event thatthe wizard selects the wrong character in theDelimiters section:

    If your text file uses a custom delimiting char-acter, select the Other check box and thenenter that character in its text box.

    If your file uses two consecutive characters(such as a comma and a space), select bothof their check boxes as well as the TreatConsecutive Delimiters as One check box.

    7. The Text Import Wizard treats any charactersenclosed in a pair of double quotes as textentries (as opposed to numbers). If your text fileuses a single quote, click the single quote (')character in the Text Qualifier drop-down listbox. Then click Next.

    The Text Import Wizard - Step 3 of 3 dialog boxappears, as shown in Figure 40-7. In this dialogbox, you can assign a data format to the variouscolumns of text data or indicate that a particularcolumn of data should be skipped and thereforenot imported into your Excel worksheet.

    Figure 40-5: Selecting between a delimited and fixedwidth text file in the Text Import Wizard.

    3. If the wizard decides the file uses some sortof delimiting character, Excel selects theDelimited options button. If, instead, youredealing with a text file in which the data itemsall use the same number of characters (suchas 11 spaces for SSN and 10 spaces for ID num-ber), click the Fixed Width options button.

    4. The Text Import Wizard always assumes thatyou want to start importing the data from thefirst to the very last line in the text file. If youdont need the first line or lines imported, usethe preview list box to determine the numberof the first line to import and then enter thatnumber in the Start Import at Row text box.

    You may not want to import the first line fewlines if they contain stuff like document titlesthat youd only have to eliminate from theworksheet if you did bring them in.

    5. Click Next when youre finished in the Step 1of 3 dialog box.

    The Text Import Wizard - Step 2 of 3 dialog boxappears, as shown in Figure 40-6. This dialog boxcontains a Data Preview section that shows yourtext data aligned (simulating the column arrange-ment in your Excel worksheet).

    46_574272 ch40.qxd 10/1/04 10:57 PM Page 233

  • Figure 40-7: Assigning a data format to the columns ofparsed data.

    8. To assign a data type to a column, click its col-umn in the Data Preview section and then clickthe appropriate option button (General, Text,or Date) in the Column Data Format section inthe upper-right corner.

    You can choose among the following three datatypes:

    General (the default) to convert all numericvalues to numbers, entries recognized as datevalues to dates, and everything else in the col-umn to text

    Text to convert all the entries in the columnto text

    Date to convert all the entries to dates byusing the date format shown in the associateddrop-down list box

    In determining values when using the Generaldata format, Excel uses the period (.) as the deci-mal separator and the comma (,) as the thou-sands separator. If your text data uses these twosymbols in the opposite order (the comma toindicate the decimal point and the period as thethousands separator), as is the case in manyEuropean countries, follow these steps:

    i. Click the Advanced button to open theAdvanced Text Import Settings dialog box.

    ii. Select the comma (,) in the Decimal Separatordrop-down list box and the period (.) in theThousands Separator drop-down list box andthen click OK.

    If your text file uses trailing minus signs (as in100-) to represent negative numbers (insteadof -100), make sure that the Trailing Minus forNegative Numbers check box is selectedbefore you close this dialog box.

    9. If you want to change the date format in a col-umn to which youve assigned the Date dataformat, select its MDY code in the Date drop-down list box (where M stands for the month,D for the day, and Y for the year).

    10. To omit a particular column when importing thetext file, click its column in the Data Previewand then click the Do Not Import Column (Skip)option button at the bottom of the Column DataFormat section.

    11. After youve formatted all the columns as youwant them, click Finish to import and parsethe text file data starting at the current cell.

    Figure 40-8 shows the rows of the imported andparsed text data that appear in the new work-sheet starting at cell A.

    Figure 40-8: New worksheet with parsed data.

    Technique 40: Sharing Data with Other Office Programs234

    46_574272 ch40.qxd 10/1/04 10:57 PM Page 234

  • Embedding Excel Data in Other Office Documents 235

    I recommend the embedding method when the Excelobject (worksheet or chart) is not apt to changevery often, if at all. Reserve the linking method foran Excel object that changes fairly often, when youalways need the latest and greatest version of theobject to appear in the other programs document,or when you dont want to make that document anylarger by actually embedding and saving the Exceldata in it.

    Use the embedding or linking techniques onlywhen youre pretty sure that the Excel data isfar from final and that you need to be able toupdate the data either manually (with embed-ding) or automatically (with linking). If yourExcel data is bound to remain unchanged, justuse the old standby method of copying theExcel data to the Clipboard and then pastingit in place in the other programs document.(See Swapping Data via the Clipboard, ear-lier in this technique.)

    Embedded worksheet data

    The easiest way to embed a table of worksheetdata or a chart in another Office document is to usethe good old drag-and-drop method. Just drag theselected cells or chart from Excel to their place inthe other open Office program window. The onlytrick to dragging and dropping the data is gettingthe windows set up. (You can set up the windowsafter opening the Excel workbook and the otherOffice document by choosing the Tiles WindowsHorizontally or the Tile Windows Vertically itemson the task bars shortcut menu.)

    Figures 40-9 and 40-10 illustrate the procedure forembedding a table of worksheet data (with Januarysales for the Mission Street store) from its worksheet(named Mission Street) in a memo started in a newWord document. After selecting the table in rangeA1:B6 in the Excel window, I dragged this selectionto the beginning of a new paragraph in the Wordmemo. (Hold down the Ctrl key to copy the datarather than move it from Excel to Word.)

    Dont forget to change the type of file fromtext to Microsoft Excel Workbook when youfirst save your imported text file. ChooseFileSave As from the Excel menu bar, selectMicrosoft Excel Workbook (*.xls) in the Saveas Type drop-down list box, and click Save.

    Embedding Excel Data inOther Office DocumentsBecause almost everybody purchases Excel as partof the Microsoft Office suite nowadays, it shouldcome as no surprise to discover that most of the filesharing that takes place between Excel and otherprograms ends up being between Excel and one ofthe other major Microsoft Office applications suchas Word, PowerPoint, and Access.

    When sharing Excel data with another type of Officedocument, Microsoft offers you a choice in the waythat you exchange the application data. You caneither embed the worksheet or chart in the otherprograms document or set up a link between theExcel-generated object in the other program andExcel itself:

    Embedding means that the Excel object (whetherits a worksheet or a chart) actually becomespart of the Word document or PowerPoint pres-entation. Any changes that you then need tomake to the worksheet or chart must be madewithin the Word document or PowerPoint pres-entation. This presupposes that you have Excelon the same computer as Word or PowerPointand that your computer has enough memory torun them both.

    Linking means that the Excel object (worksheetor chart) is only referred to in the Word docu-ment or PowerPoint presentation. Any changesthat you make to the worksheet or chart mustbe made in Excel. They are then automaticallyupdated in the Word document or PowerPointpresentation to which it is linked when youopen the document and/or presentation.

    46_574272 ch40.qxd 10/1/04 10:57 PM Page 235

  • Figure 40-9: Dragging a table of worksheet data toembed it in a new Word memo.

    Figure 40-10 shows the memo after dropping thecopied worksheet table into place at the beginningof a new paragraph in the Word window. Note thatthe table with the worksheet data contains cell grid-lines just like the worksheet from which it wascopied.

    Figure 40-10: Word memo after embedding theworksheet table.

    If you dont want gridlines to appear in theworksheet data that you copy to the Worddocument, you need to remove their displayin the Excel window before you do the drag-and-drop. To remove gridlines from a work-sheet, clear the Gridlines check box on theView tab of the Options dialog box (ToolsOptions).

    The really cool thing about embedding Excel stuff isthat you can edit the data from within Word. Figure40-11 shows the copied table after I indented it withthe Increase Indent button on Words Formattingtoolbar. This figure shows what happens when Idouble-click the embedded table: A frame withcolumns and rows, scroll bars, and sheet tabsappears around the table. Notice, also, that the pull-down menus and toolbars in the Word window havemiraculously changed to Excels menus completewith the Excel Standard and Formatting toolbars.(Its like being at home when youre still on theroad.) At this point, you can edit the tables contentsin Word by using the Excel commands with whichyoure thoroughly familiar.

    Figure 40-11: Editing the embedded worksheet table inWord.

    Technique 40: Sharing Data with Other Office Programs236

    46_574272 ch40.qxd 10/1/04 10:57 PM Page 236

  • Embedding Excel Data in Other Office Documents 237

    Linking worksheet data

    As cool as embedding is, you do find occasionswhen linking the Excel data to the Word documentis the preferred method and is, in fact, even easierto do. Remember that when you link the worksheetdata or charts that you paste into other Office docu-ments, changes made to the data or charts in theoriginal worksheet are automatically updated if thedocument is open at the time you make the modifi-cations in Excel; otherwise, youre prompted toupdate the links when you next open the document.

    Figures 40-12 and 40-13 illustrate how the linkingprocess works. For this example, I want to copythe pie chart showing the January 2005 sales at theMission Street store into the Word memo, while atthe same time create a link between this copy of thechart and the worksheet from which it came. To cre-ate this link, I follow these steps:

    1. Select the pie chart and then copy it to theClipboard (Ctrl+C).

    2. Switch to the Word memo, position theInsertion point cursor at the beginning of anew paragraph, and choose EditPaste Specialon the Word menu bar.

    Doing this opens the Paste Special dialog box,shown in Figure 40-12.

    3. To create the link, select the Paste Link optionbutton and then click OK to paste the copy ofthe pie chart into place in the memo.

    Figure 40-13 shows what happens after I update theembedded chart in the original Chris Cookies work-sheet, changing its chart type from the normal two-dimensional pie chart to a three-dimensional piechart. As you can see, this chart-type change isimmediately reflected in the chart in the Wordmemo when I switch from Excel to Word.

    Suppose that the Office document into which youvelinked the Excel data or graphic object is not openat the time you update the workbook to which it is

    linked. When you next open the document with itsOffice program, an alert dialog box appears, indicat-ing that the document contains links and asking youif you want to update the document with data fromthe linked files. All you have to do is to click the Yesbutton to have the worksheet data or chart in theopen document updated so that it reflects its cur-rent state in the original Excel workbook.

    Figure 40-12: Linking a chart being pasted into the Wordmemo with its original worksheet.

    Figure 40-13: Changes made to the original pie chart areautomatically updated in the Word memo.

    46_574272 ch40.qxd 10/1/04 10:57 PM Page 237

  • 41 Sharing Workbookson a NetworkIf you use Excel on a computer connected to a network, you can sharethe spreadsheets that you create with other users who have networkaccess. Workbook sharing is perfect for spreadsheets that require fre-quent or regular data updates, especially those whose data comes fromseveral departments. For example, spreadsheets that track budgets orschedule projects that rely on input from many departments can benefitfrom workbook sharing.

    This technique covers the different ways you can share a workbook sothat different people can edit its contents at the same time. It also covershow to set the sharing options that control how Excel handles conflictingupdates that users make to the same cells of a worksheet.

    Lets All Learn to ShareTo facilitate workbook sharing, start by saving the spreadsheet file ina folder on a network drive to which everyone that needs to edit thespreadsheet has access. After doing that, you can turn on workbooksharing in one of the following ways:

    Set up file sharing for the workbook by choosing ToolsShare Workbook.

    Turn on change tracking for the workbook by choosing theToolsTrack ChangesHighlight Changes.

    Whenever you use one of these methods to share a workbook, Excel indi-cates that the workbook is now shared by appending [Shared] to theworkbooks filename as it appears on the title bar of the Excel programwindow. When a second person on another computer on the networkopens the shared workbook file, Excel opens a copy of the workbookfile, and the [Shared] indicator also appears on the title bar of his orher Excel program window appended to its filename.


    Save Time By Turning on file sharing for

    a workbook

    Setting up the workbookshare options

    Merging changes fromdifferent users

    47_574272 ch41.qxd 10/1/04 10:58 PM Page 238

  • Lets All Learn to Share 239

    This is different from the way Excel treats a regular,unshared workbook on your computer. When youtry to open an unshared file thats already open,Excel displays a File in Use alert dialog box inform-ing you that the workbook you want to open isalready open. You can then choose between justopening the file in read-only mode (in which youcant save your changes under the original filename)and having the program first open the file in read-only mode and then notify you when the other per-son closes the workbook so you can save yourchanges.

    All users dont have to be running the latest orthe same version of Excel on their computersin order to edit a shared workbook. Workbooksharing is supported by Excel versions 97through 2003. (You cant save changes to ashared workbook when using any earlier ver-sion of Excel.) Also, when you make changesto a shared workbook, Excel uses your username to identify the modifications that youmade. To modify your user name, edit thename in the User Name text box on theGeneral tab of the Options dialog box(ToolsOptions).

    Editing changes not available to a shared workbook

    When you share a workbook, Excel disables some ofthe programs editing features so theyre not avail-able when making changes to the shared spread-sheet. The following tasks are disabled in a sharedworkbook:

    Deleting worksheets from the workbook

    Merging cells in the worksheets of a workbook

    Applying conditional formats to the cells of theworksheets (although any conditional formatsassigned before you share the workbook remainin effect)

    Setting up or applying data validation to cells ofthe worksheets (although all data validationsrestrictions and messages assigned before youshare the workbook remain in effect)

    Inserting or deleting blocks of cells in a work-sheet (although you can insert or delete entirecolumns and rows from the sheet)

    Drawing shapes and adding text boxes with thetools on the Drawing toolbar

    Assigning passwords for protecting individualworksheets or the entire workbook (although allprotection and passwords assigned prior to shar-ing the workbook remain in effect)

    Grouping or outlining data in a worksheet

    Inserting automatic subtotals in a worksheet

    Creating data tables or pivot tables in aworksheet

    Creating, revising, or assigning macros (althoughyou can run macros that were created in theworksheet before it was shared, provided thatthese macros dont perform any operations thatarent supported in a shared workbook)

    Sharing a workbook

    The first way to share a workbook is by turning onfile sharing as follows:

    1. Open the workbook you want to share. Remember to save the workbook you want toshare in a folder on your network so its availableto all the potential users.

    2. Choose ToolsShare Workbook to openthe Share Workbook dialog box, shown inFigure 41-1.

    The Share Workbook dialog box contains twotabs:

    The Editing tab, which enables you to turn onfile sharing and shows you all the users whohave the file open

    The Advanced tab, where you control howlong changes are tracked and how updatesare handled

    47_574272 ch41.qxd 10/1/04 10:58 PM Page 239

  • Technique 41: Sharing Workbooks on a Network240

    6. Click OK in the alert dialog box to save theworkbook with the file-sharing settings.

    Upon closing the alert dialog box and saving theworkbook, the [Shared] indicator is appendedto the filename that appears in the title bar of theExcel program window.

    Setting your sharing options

    After you turn on file sharing for a workbook, Excelcreates a Change History log that records all thechanges made by different individuals to the sameworkbook file. You can then use the Change Historylog to review the various changes made to a sharedworkbook and to determine which changes to retainin the event that conflicting changes are made to thesame cells. You can also use this log when mergingchanges from different copies of the same workbookinto a single file.

    By default, Excel maintains the Change History logfor a period of 30 days from the date that you firstshare the workbook. If you wish, you can changethe length of time that Excel maintains the ChangeHistory log or even, in rare circumstances, elect tonot keep the log. To make changes to the length oftime that Excel maintains the Change History logand make other changes to the sharing settings,select the Advanced tab of the Share Workbookdialog box, shown in Figure 41-2.

    The Advanced tab is divided into the following sec-tions, each with its own options for not only chang-ing how long the Change History log is maintainedbut also when and how updates are handled:

    Track Changes: Enables you to modify how longExcel keeps the Change History log. Just enter anew value in the Keep Change History For textbox or select a new value with the spin buttons.Select the Dont Keep Change History option but-ton if you dont need the Change History log.

    Update Changes: Determines when changesmade by different users are saved. By default,Excel saves changes when the file is saved. To

    Figure 41-1: Turning on file sharing by allowing changesby more than one user.

    3. On the Editing tab, select the Allow Changesby More Than One User at the Same Timecheck box.

    4. To change the settings that affect how long achange log is maintained and how editing con-flicts are handled, select the Advanced tab anduse those options.

    By default, Excel maintains a Change History logfor 30 days. If you wish, you can modify whetheror not Excel maintains this Change History log atall (necessary if you want to reconcile and mergechanges), or you can just change how long theprogram saves this log.

    You can also change when changes are updated,how conflicts are handled, and whether or notyour print settings and data-filtering settings areshared. See the following section, Setting yoursharing options, for more on modifying theseoptions.

    5. Click OK to close the Share Workbookdialog box.

    An alert dialog box appears, indicating that Excelis about to save the workbook and asking you ifyou want to continue.

    47_574272 ch41.qxd 10/1/04 10:58 PM Page 240

  • Lets All Learn to Share 241

    have the program save changes at a set interval,select the Automatically Every option button andthen enter the number of minutes for the saveinterval in the Minutes text box or select it withthe spin buttons.

    When automatically saving changes at a set timeinterval, by default Excel saves only your changeswhile showing you changes made to the work-book by others. To have the program display thechanges made to the file by others when the saveinterval is reached and not save your changes,select the Just See Other Users Changes optionbutton.

    Figure 41-2: Modifying the file-sharing settings onthe Advanced tab of Share Workbookdialog box.

    Conflicting Changes between Users: Determineshow changes made to the same cells of a sharedworkbook by different users are treated. Bydefault, Excel asks you which users changesto accept and which to deny. If you want Excelto accept the changes made by any user at thetime she or he saves the workbook, select TheChanges Being Saved Win option button.

    Include in Personal View: Determines which ofyour personal settings are saved when you savethe workbook. By default, Excel saves both your

    personal print settings (including such thingsas page breaks, changes to the print area, andchanges to the printing settings in the PageSetup dialog box) and the filtering settings youselect with the DataFilter command. Clear thePrint Settings and/or Filter Settings check boxesif you dont want these settings saved as part ofthe shared workbook.

    Turning on change tracking

    The other way to share a workbook on your networkis simply by turning on change tracking. When youdo this, Excel tracks all the changes you make to theshared workbooks cells by highlighting the cells andadding comments that summarize the type of changeyou make. Whenever you enable change tracking,Excel automatically turns on file sharing and createsa Change History log for the workbook in which thechanges are recorded.

    To share a workbook by turning on change tracking,follow these steps:

    1. Open the workbook for which you want totrack changes.

    This assumes that youve already saved theworkbook in a folder on your network thatsavailable to all the potential users.

    2. Choose ToolsTrack ChangesHighlightChanges to open the Highlight Changesdialog box, shown in Figure 41-3.

    Figure 41-3: Sharing a workbook by turning on changetracking.

    47_574272 ch41.qxd 10/1/04 10:58 PM Page 241

  • Technique 41: Sharing Workbooks on a Network242

    7. If you dont want changes displayed in thecells on-screen, clear the Highlight Changeson Screen check box.

    Note that after you finish saving the workbookas a shared file, you can return to the HighlightChanges dialog box and then select its ListChanges on a New Sheet check box to have allyour changes listed on a new worksheet addedto the workbook.

    Note too, that if you select this check box whenthe Highlight Changes on Screen check box isselected, Excel marks the changes in their cellsand lists them on a new sheet. If you clear theHighlight Changes on Screen check box whilethe List Changes on a New Sheet check box isselected, Excel just lists the changes on a newworksheet without marking them in the cells ofthe worksheet.

    8. Click OK to close the Highlight Changesdialog box.

    After Excel closes the dialog box, an alert dialogbox appears, telling you that Excel will now savethe workbook and asking you if you want tocontinue.

    9. Click OK in the alert dialog box to save theworkbook with the change tracking and file-sharing settings.

    After you turn on change tracking in a shared work-book (indicated by [Shared] appended to the file-name on the Excel program title bar), the programhighlights all the following changes in the workbook:

    Changes made to the cell contents, includingmoving and copying the contents to new cellsin the worksheet

    The deletion of the cell contents

    The insertion of new rows, columns, or cells ina worksheet

    When change tracking is turned on in a workbook,the program does not highlight any of the followingchanges:

    3. Select the Track Changes While Editingcheck box.

    By default, Excel selects the When combo boxand chooses the All option from its pop-upmenu to have all changes made to the workbooktracked. Excel also selects the Who combo boxand chooses Everyone from the pop-up menu,meaning it automatically tracks the changesmade by anybody who opens and edits theworkbook (including you).

    4. If you dont want to track all the changes in theworkbook, select one of the following optionsfrom the When pop-up menu:

    Since I Last Saved: Select this option to trackthe changes only from the time you last savedthe workbook.

    Not Yet Reviewed: Select this option to trackall the changes that youve not yet reviewed(and decided whether or not to accept).

    Most often, you want to select this option sothat you can use the ToolsTrack ChangesAccept or Reject Changes command to revieweach users changes and decide whether ornot to keep them.

    Since Date: Select this option to track changesfrom a particular date. Excel then inserts thecurrent date into the When combo box, whichyou can then edit as necessary.

    5. If you want to exempt yourself from changetracking, select Everyone but Me from the Whopop-up menu. Or, if you want to restrict changetracking to a particular user, select the usersname on the Who pop-up menu.

    Change tracking automatically traces changesmade to any cells in any sheet in the workbook.

    6. If you want to restrict change tracking to a par-ticular cell range or cell selection in the work-book, select the Where check box and thenselect the cell range or nonadjacent cell selec-tion in the workbook.

    47_574272 ch41.qxd 10/1/04 10:58 PM Page 242

  • Merging Changes from Different Users 243

    Formatting changes made to the cells

    Hidden or unhidden rows and columns in theworksheet

    Renamed sheet tabs in the workbook

    The insertion or deletion of worksheets in theworkbook

    Comments added to the cells

    Changes to cell values resulting from recalculat-ing their formulas or in cells whose values dependdirectly or indirectly upon the results of theseformulas

    To highlight changes you make to the shared work-book, Excel draws a thin line (in another color usually blue) around the borders of the cell, places atriangle of the same color in the cells upper-left cor-ner, and changes the color of the cells column letterand row number to red. When you position the thickwhite cross pointer on a highlighted cell, Excel dis-plays a comment indicating the change made to thecell, along with the date and time it was made andwho it was made by, as shown in Figure 41-4.

    Figure 41-4: Displaying the comment describing thechange made to a cell highlighted bychange tracking.

    When you turn on change tracking, you turnon file sharing, and while file sharing is ineffect, you cant make certain kinds of editingchanges. For a complete list of these unavail-able changes, see the section Editing changesnot available to a shared workbook, earlier inthis technique.

    Merging Changes fromDifferent UsersAt some point in the sharing of a workbook, youllwant to update the workbook to incorporate thechanges made by different users. When mergingchanges, you may also have to deal with conflict-ing changes made to the same cells and decidewhich changes to accept and which to reject. Afteryouve merged all the input and decided how to dealwith all the conflicting changes, you may want toturn off file sharing to prevent users from doing anyfurther editing.

    Conflict resolution worksheet style

    While file sharing is turned on in a workbook, Excelautomatically updates the changes made to theshared workbook whenever anybody whos editingthe same file saves his or her changes. If the pro-gram identifies cells in the workbook that containconflicting changes (that is, different values placedin the same cell by different users) when you go tosave a copy of the shared workbook, Excel flags thecell in the workbook with a marquee and then dis-plays the conflict in the Resolve Conflicts dialog box,as shown in Figure 41-5. To accept your change tothe cell in question, click the Accept Mine button.To accept the change made by another user, click theAccept Other button instead.

    After you accept your change or the other userschange in the case of the first conflict, Excel moveson to flag the next case and displays a descriptionof the conflicting values in the Resolve Conflicts dia-log box. When you finish accepting or rejecting yourchange or the one made by another user for the

    47_574272 ch41.qxd 10/1/04 10:58 PM Page 243

  • Technique 41: Sharing Workbooks on a Network244

    workbook that you havent yet reviewed for every-one who has modified the shared file. Here are thesettings that you can change:

    To review only those changes you made on thecurrent date, select Since Date on the Whendrop-down list.

    To review changes made since a particular date,edit the current date in the Since Date drop-down list.

    To review changes that everyone has madeexcept you, only those changes youve made,or only those changes a particular coworkerhas made, click the appropriate item (EveryoneBut Me, your name, or another users name) onthe Who drop-down list.

    If you want to restrict the review to a particularrange or region of a worksheet, select the Wherecheck box and then select the range or nonadja-cent cell ranges with the cells to review.

    Figure 41-6: Deciding which changes to review in theshared workbook.

    After you select which changes to review, click OK.Excel then closes this dialog box, highlights the cellin the worksheet that contains the first change toreview, and opens the Accept or Reject Changes dia-log box (shown in Figure 41-7), where you indicatewhether or not to accept or reject the change.

    Heres how to accept or reject changes in thisdialog box:

    To accept a change when there are multiplemodifications, select the one you want to useand then click the Accept button.

    last conflicting value, Excel automatically closesthe Resolve Conflicts dialog box and saves yourchanges to the workbook.

    Figure 41-5: Deciding which change to accept in theResolve Conflicts dialog box.

    If you want Excel to accept only your changesin all cases of conflicting values, click theAccept All Mine button. To have Excel rejectall your changes and accept all those madeby others, click the Accept All Others buttoninstead.

    Accepting or rejecting highlighted changes

    When you share a workbook file by turning onchange tracking for a workbook, you can decidewhich changes to accept or reject by choosingToolsTrack ChangesAccept or Reject Changes.When you first choose this command, Excel displaysan alert dialog box informing you that the programwill save the workbook. When you click OK to closethis alert dialog box, the program looks for conflictsand, if it finds any, opens the Resolve Conflicts dia-log box (refer to Figure 41-5) where you decidewhose changes to use.

    After resolving all the conflicts in the workbook, Excelthen opens the Select Changes to Accept or Rejectdialog box, shown in Figure 41-6. This dialog boxcontains the same three check boxes and associateddrop-down items (When, Who, and Where) as theHighlight Changes dialog box (refer to Figure 41-3).

    By default, the When check box is selected alongwith the Not Yet Reviewed setting. When this settingis selected, Excel displays all the changes in the

    47_574272 ch41.qxd 10/1/04 10:58 PM Page 244

  • Heading 1 245Merging Different Copies of a Shared Workbook

    To reject all the changes and keep the originalvalue, select the original value and then clickthe Accept button.

    If only one change has been made to a cell, youcan keep its original value by clicking the Rejectbutton.

    Figure 41-7: Deciding which changes to accept in theshared workbook.

    After you accept or reject the modification made tothe first highlighted cell, Excel flags the next cell inworksheet that needs reviewing and, at the sametime, displays a description of the change in theAccept or Reject Changes dialog box.

    If you know ahead of time that you want toaccept or reject all the changes that have beenmade since you last reviewed the workbook,click the Accept All button or the Reject Allbutton, respectively.

    After you accept or reject the last change that Excelidentifies in the shared workbook, the Accept orReject Changes dialog box automatically closes,and you can then save the workbook (Ctrl+S) withthe editing changes that you made as a result ofthis review.

    Turning off file sharing

    When you no longer need to share a particularworkbook, you can turn off file sharing. To dothis, open the Share Workbook dialog box (ToolsShare Workbook), clear the Allow Changes by MoreThan One User at the Same Time check box on theEditing tab, and click OK.

    After you stop sharing a workbook, all other userswho have it open are automatically prevented fromsaving the workbook in the same folder under thesame name. To save their changes to the erstwhileshared workbook, they must now save the workbookwith a new filename. You can then merge the changesin their new files with the original workbook (see thefollowing section).

    Its a good idea to inform the users of a sharedworkbook of your intention to remove the filefrom shared use. E-mail all the users and letthem know the date and time after which theworkbook will no longer be shared and opento their edits. That way, all the team membersknow the exact time after which their modifi-cations will no longer be accepted (often agood inducement for the procrastinators toget their editing changes done).

    Merging Different Copiesof a Shared WorkbookInstead of sharing a single workbook with otherusers on the network and then doing a review inwhich you accept or reject their changes when yousave the file or at some predefined time interval,you can distribute copies of a shared workbookand then merge the changes made by differentpeople into one version.

    Distributing the copies

    The key elements for successfully merging differentcopies of a shared workbook are that each copymust have the Change History log turned on andeach copy must be saved under a different filename.This means that in order to create the copies of theworkbook you want to distribute, you need to followthese steps:

    1. Turn on the Change History log in the originalby opening the Share Workbook dialog box( ToolsShare Workbook) and then selecting

    47_574272 ch41.qxd 10/1/04 10:58 PM Page 245

  • Technique 41: Sharing Workbooks on a Network246

    Figure 41-8: Selecting the files to merge into theworkbook open in Excel.

    3. Select the folder that contains the workbook(s)to be merged and then select the files.

    Ctrl+click to select more than one file.

    4. Click OK to close the Select Files to Merge intoCurrent Workbook dialog box.

    After you click OK, Excel merges the disk version(s)of the selected workbook(s) into the version youhave open in Excel (without prompting you toreview or accept or reject any of the updates). Allchanges in the disk version(s) are merged to theworkbook open on your screen. You can then savethis single, updated version of the workbook underthe same name (Ctrl+S) or under a new filename(FileSave As).

    Merging changes from copies of the sameshared workbook involves no conflict resolu-tion. If users change the same cell in thecopies, the program simply replaces the valuein the original shared workbook in turn withthe value in each merged copy. Dont use thisfeature if you want to be able to decide whichvalue to accept and which to reject in suchconflicts.

    the Allow Changes by More Than One User atthe Same Time check box.

    2. Create copies of the original shared workbookby saving them under slightly different file-names ( FileSave As).

    You may want to append numbers or the initialsof the people doing the review to the filenames.

    3. Distribute these different copies to theintended users usually by attaching theworkbook files to e-mail messages.

    These users can then make their edits and savetheir changes to the shared copy of the originalworkbook that they receive from you (which theycan then return to you as e-mail attachments).

    All editing in the copies you distribute mustbe made before the time period for keepingthe Change History log expires (30 days bydefault). If you have any doubt that 30 days isenough time, increase the number of days inthe Keep Change History For text box on theAdvanced tab of the Share Workbook dialogbox before you save copies of the originalworkbook and distribute them to your users.

    Merging the changes

    When youve received the edited copies you distrib-uted and are ready to merge the changes they con-tain into one version, follow these steps:

    1. Open the original shared workbook into whichyou want to merge changes from the othercopies.

    Note that the copies of the original workbookwhose changes will be merged into the originalworkbook must not also be open in Excel andthey must have different filenames.

    2. Choose ToolsCompare and Merge Workbooks.Doing this opens the Select Files to Merge IntoCurrent Workbook dialog box, shown in Figure41-8, where you indicate the workbook files tomerge.

    47_574272 ch41.qxd 10/1/04 10:58 PM Page 246

  • 42 Sending WorkbooksOut for ReviewExcel makes it easy to send out spreadsheets for review by clients,coworkers, and managers who need to give you their input orapproval after reviewing their contents. When getting spread-sheets ready to send out for this type of review, you can annotatethem by attaching your comments to key cells that require particularattention.

    When sending out a workbook for review, you can either send the work-book embedded within the body of an e-mail message or send it as anattachment to an e-mail message. If youre part of a Microsoft ExchangeServer system, you can place a copy of the workbook in a public folderso that all users who have permission to access that folder can open theworkbook for review.

    Getting a Workbook Ready for ReviewIn getting a workbook file ready to send out for review, youll want to addyour comments to the workbooks cells. These comments can ask for clar-ification or suggest changes to the cells contents. One of the best waysto add comments to a workbook is with the buttons on the Reviewingtoolbar (ViewToolbarsReviewing). The Reviewing toolbar, shown inFigure 42-1, also contains buttons that make it easy to review thesenotes, e-mail the workbook as an attachment to others who have toreview the comments, and even reply to suggested changes.

    If you have a Tablet PC, you can use the tablet pen to annotateyour spreadsheet with handwritten notes. Click the Hide InkAnnotations button on the Reviewing toolbar to temporarilyremove their display and the Delete All Ink Annotations buttonto get rid of them permanently.


    Save Time By Adding comments to

    get a workbook readyto send out

    Sending out a workbookfor review

    48_574272 ch42.qxd 10/1/04 10:58 PM Page 247

  • Technique 42: Sending Workbooks Out for Review248

    Figure 42-2: Adding comments to a spreadsheet beingreadied for review.

    Comments: Now you see them, now you dont

    Most of the time, you see the text of a commentyouve added to a cell only when you position themouse pointer somewhere in its cell (as soon as youmove the pointer out of the cell, the comment textmagically disappears). If you want to display all thecomments youve added to cells in the worksheet atone time, click the Show All Comments button onthe Reviewing toolbar or choose ViewComments.The comment boxes for all your cell notes appearin the worksheet until you click the Show AllComments button or choose ViewComment again.

    If you want to keep the text of a single com-ment displayed in the sheet, select the cellcontaining the comment and then click theShow Comment button on the Reviewingtoolbar. Excel will continue to display the com-ment even after you vacate the cell. To get ridof the display of the comment box, you mustselect the cell and then click the ShowComment button a second time.

    Editing and formatting comments

    Comments normally appear to the right of the cell towhich theyve been assigned in a box with an arrowpointing to the comment indicator (the red trianglein the cells upper-right corner). If you want, you canreposition a cells comment box and/or resize it so

    Figure 42-1: Use the Reviewing toolbar to create andedit comments you add to cells.

    Getting your two cents in

    Comments are like electronic sticky notes that youcan attach to the cells of your worksheet. You canadd comments to the current cell either by clickingthe New Comment button on the Reviewing toolbaror by choosing InsertComment.

    Excel responds by adding a comment box (seeFigure 42-2) with your name listed at the top (orthe name of the person who shows up in the UserName text box on the General tab of the Optionsdialog box). You can then type the text of your com-ment in this box. When you finish typing, click anycell in the worksheet to close the Comment box.

    Excel indicates the presence of a comment in a cellby displaying a red triangle in its upper-right corner.To display the comment box with the text of its note,position the thick, white cross mouse pointer onthis red triangle, or position the cell pointer in itscell and click the Show Comment button on theReviewing toolbar.

    New Comment

    Previous Comment

    Next Comment

    Show/Hide All Comments

    Hide Ink Annotations

    Create Microsoft Office Outlook Task

    Send to Mail Recipient (as Attachment)

    Show/Hide Comments

    Delete Comment

    Hide All Ink Annotations

    Update File Reply with Changes

    End Review

    48_574272 ch42.qxd 10/1/04 10:58 PM Page 248

  • Getting a Workbook Ready for Review 249

    that it doesnt obscure certain cells in the immediateregion. You can also edit the text in the commentbox and change the formatting of its text.

    To make any of these editing changes, first positionthe cell pointer in the cell and then click the EditComment button on the Reviewing toolbar. (Thisbutton replaces the Add Comment button as thefirst button on the toolbar.) If the Reviewing toolbarisnt currently displayed on-screen, you can also dothis by right-clicking on the cell and selecting EditComment on the shortcut menu.

    Excel then displays the cells comment box and posi-tions the insertion point at the end of the commenttext, as shown in Figure 42-3.

    To reposition the comment box, follow these steps:

    1. Position the mouse pointer on the edge of thecomment box ( indicated with cross-hatchingand open circles around the perimeter).

    2. When the mouse pointer assumes the shapeof white arrowhead pointing to a black doublecross, drag the outline of the comment box toa new position in the worksheet.

    After you release the mouse button, Excel drawsa new line ending in an arrowhead from the repo-sitioned comment box to the red triangle in thecells upper-right corner.

    To resize the comment box, follow these steps:

    1. Position the mouse pointer on one of the opencircles at the corners and in the middle of eachedge on the boxs perimeter.

    2. When the mouse pointer changes into a double-headed arrow, drag the dotted outline of thecomment box until its the size and shape youwant.

    Excel automatically reflows the comment text tosuit the new size and shape of the box.

    To edit the text of the comment while the insertionpoint is positioned somewhere in it, drag the I-beam

    mouse pointer through the text that needs to bereplaced or press the Backspace key (to removecharacters to the left of the insertion point) orDelete key (to remove characters to the right). Youcan insert new characters by simply typing them.

    Figure 42-3: Editing a comment by resizing its box andpulling it away from the existing data.

    To change the formatting of the comment text, selectthe text by dragging through it and then right-clickon the text and select Format Comment. Excel opensthe Format Comment dialog box (containing thesame options as the Font tab of the Format Cellsdialog box). Here, you can change the font, fontstyle, font size, font color, or add special effectsincluding underlining, strikethrough, and super-and subscripting to the text.

    When you finish making your changes to the com-ment box and text, close the comment box by click-ing any cell in the worksheet.

    Deleting comments in a worksheet

    If you no longer need a particular comment, you candelete it by selecting its cell and then doing any ofthe following:

    48_574272 ch42.qxd 10/1/04 10:58 PM Page 249

  • Technique 42: Sending Workbooks Out for Review250

    Figure 42-4: Sending out a shared workbook for review.

    The reviewers can then use the Next Comment andPrevious Comment buttons on this toolbar to jumpfrom comment to comment in the workbook. Theycan then respond to your comments by makingchanges to cells that have been flagged or byadding comments of their own.

    When theyre ready to send their changes andresponses back to you, they click the Reply withChanges button on the Reviewing toolbar. Excelthen opens their e-mail programs with a new mes-sage to which your modified version of the work-book is automatically attached. This new messagealso has the Subject field filled in and sports a shortmessage in the body stating that they have reviewedthe attached workbook. All they have to do is fill inyour e-mail address (as the original sender) in the Tofield and then click the Send button to send the mod-ified workbook back to you.

    Merging changes into the original workbook

    When you open the modified workbook attached tothe response e-mail in Excel, the program immedi-ately displays a Microsoft Excel alert dialog boxinforming you that the workbook was sent for reviewand asking you if you want to merge the changes in

    Choose EditClearComments.

    Click the Delete Comment button on theReviewing toolbar.

    Right-click on the cell and then select DeleteComment on its shortcut menu.

    Sending Out a Workbookfor ReviewExcel makes it a snap to send out the workbooksthat youve annotated for review to all the peoplewho should comment and make changes. Prior tosending out a workbook for review, you need to turnon file sharing. (See Technique 41 for all the details.)Then follow these steps:

    1. Choose FileSend ToMail Recipient(For Review).

    Excel then opens your e-mail program (such asOutlook or Outlook Express), starts a new e-mailmessage, and attaches the current workbook asan e-mail attachment. The program also automat-ically fills in the Subject line of the message, ask-ing the recipient to review the attached file, andinserts the following text into the body of themessage:

    Please review the attached document.

    2. Fill in the recipients e-mail address in the Totext box, along with the addresses of any otherpeople you want to copy in the Cc text box.(See Figure 42-4.)

    3. Click the Send button to send it off to yourrecipient(s).

    Replying with changes

    When your recipients receive the e-mail messageand open the attached workbook file in Excel, theprogram automatically opens the Reviewing toolbar(if its not already displayed in the Excel window) asit opens the file.

    48_574272 ch42.qxd 10/1/04 10:58 PM Page 250

  • Sending Out a Workbook for Review 251

    this workbook back into the original workbook file. Todo this, click the Yes button in the alert dialog box.

    As soon as you do so, Excel merges all the changesmade by the reviewer into the original workbook.Before you save the changes, you can use the NextComment and Previous Comment button on theReviewing toolbar to jump to and review the anno-tated cells (those with comments you originallyattached and any that the reviewer attached inresponse).

    If you and all your recipients use Outlook asyour e-mail program on a network runningthe Microsoft Exchange Server, you can usethe FileSend ToRouting Recipient com-mand in Excel to create a routing slip that indi-cates all the people you want to review theworkbook as well as the order in which theyreto receive it and comment on its contents. Thiscommand enables you to have a group ofpeople give their feedback to a workbook, allof which is automatically merged into the document by the time it returns to you.

    48_574272 ch42.qxd 10/1/04 10:58 PM Page 251

  • 48_574272 ch42.qxd 10/1/04 10:58 PM Page 252

  • Part VII

    Streamlining DataListing and Data


    49_574272 pp07.qxd 10/1/04 10:59 PM Page 253

  • 49_574272 pp07.qxd 10/1/04 10:59 PM Page 254

  • 43 Adding and EditingData Lists with theData FormMaintaining a large quantity of related information in a special for-mat known as a data list (also occasionally referred to somewhaterroneously as a database) is one of the more important thingsyou can do with Excel. This technique covers how to use the data formthat Excel automatically creates for any data list you generate to add, edit,and find the information you need to maintain. (See Technique 44 for infor-mation on sorting the information in your data lists and Technique 45 forinformation on filtering out all but the information youre interested in atthe time).

    Creating a New Data List and Data FormExcel automatically creates a data form for any data list that you createin Excel. All you have to do is enter the headings for the columns in thedata list (known as fields) in the first row and a row of data entries (thatmake up the first record of the data list) in the row immediately below(see Figure 43-1) and then assign to their cells whatever alignment andnumber formatting you want the rest of the entries in that column (field)to have.

    If your data list contains calculated fields, be sure to enter the formu-las necessary for doing these computations in the appropriate cells ofthe first record. (See the Formula bar entry for cell I2 in Figure 43-1.)Also be sure to assign the desired number format to these results inthe calculated fields. Both the formula and the formatting assigned tothe calculated fields are picked up in the data form.

    Figure 43-1: Creating a new data list and data form by entering the fieldsand first record.


    Save Time By Creating a new data list

    from the data form

    Editing a data list with thedata form

    Finding records in a datalist with the data form

    50_574272 ch43.qxd 10/1/04 10:59 PM Page 255

  • Technique 43: Adding and Editing Data Lists with the Data Form256

    When the data form is displayed, you can use thescroll bar to the right of the fields to move throughthe records in the data list, or you can use variousdirection keys. Table 43-1 lists the navigating func-tions of the scroll bar and these keystrokes. Forexample, to move to the next record in the data list,press the or Enter key or click the scroll arrow atthe bottom of the scroll bar. To move to the previousrecord in the data list (assuming that theres morethan one), press the key or Shift+Enter key or clickthe scroll arrow at the top of the scroll bar. To selecta field in the current record for editing, click thatfields text box or press Tab (next field) or Shift+Tab(previous field) until you select the field (and its cur-rent entry).


    Next record, same field Press the or Enter key,in the data list click the downward-pointing

    scroll arrow, or click theFind Next button.

    Previous record, same field Press the key orin the data list Shift+Enter, click the

    upward-pointing scrollarrow, or click the FindPrev button.

    Next field in the data form Press Tab.

    Previous field in the Press Shift+Tab.data form

    Ten records forward Press Page Down.in the data list

    Ten records backward Press Page Up.in the data list

    First record Press Ctrl+ or Ctrl +in the data list Page Up, or drag the

    scroll box to the topof the scroll bar.

    Last record Press Ctrl+ or Ctrl+Pagein the data list Down, or drag the scroll

    box to the bottom of thescroll bar.

    Figure 43-2 shows the data form that Excel createdfor the new Employee data list shown in Figure 43-1,using the field names in the cell range A1:J1 and thefirst data record in the cell range A2:J2. To displaythe data form for any data list, position the cellpointer in any cell of the list (either in the top rowof field names or in any of field entries in recordsbelow) and then choose DataForm.

    Figure 43-2: Data form created for the Employee listusing the field names and showing the firstdata record.

    In the data form, the program automatically assignshot keys to the various field names (indicated by theunderscores) that you can then select by combiningwith the Alt key. (For example, pressing Alt+E selectsthe Sex field in this data form.)

    Also note that all the field names in the Employeelist with the exception of the Years of Service fieldthat appears near the bottom of the data form arefollowed by text boxes in which you can add or edittheir particular entries. Because the Years of Servicefield is computed by a formula, the data form dis-plays the computed result after the field name with-out providing a text box in which you can edit it. (Tomodify this field entry, youd have to edit the origi-nal formula in cell I2 of the worksheet.)

    50_574272 ch43.qxd 10/1/04 10:59 PM Page 256

  • Creating a New Data List and Data Form 257

    To Move Here Do This

    Within a field Press or to move onecharacter at a time, pressHome to move to the firstcharacter, and press End tomove to the last character.

    Adding new records with the data form

    To add a new record to the data list with the dataform, follow these steps:

    1. Either move to the end of the data list (by drag-ging the scroll box to the very bottom of thescroll bar or by pressing Ctrl+ or Ctrl+PageDown) or simply click the New button on thedata form.

    Excel then displays a blank data form (markedNew Record at the right side the dialog box),which you can then fill in.

    2. Fill in the information in the data form (seeFigure 43-3).

    After entering the information for a field, pressthe Tab key to advance to the next field in therecord. (Be careful not to press the Enter keyyet because this inserts the new record intothe data list.)

    Figure 43-3: Adding the second record for the Employeedata list with the data form.

    You can copy the entry from the same field inthe previous record into the current field bypressing Ctrl+ (double quotation mark). Youwould use this keystroke shortcut, for exam-ple, to carry forward entries for the State fieldwhen youre entering a bunch of records thatall have the same state.

    3. After youve entered all the information youhave for the new record, press the or Enterkey or click the New button again.

    Excel then inserts the new record as the lastrecord in the data list and displays a blank dataform where you can enter the next record.

    4. Insert additional records to the data list, asdesired.

    5. When you finish adding records, press the Esckey or click the Close button to close the dataform dialog box.

    Figure 43-4 shows the new Employee data list afterfilling in the information for the second record andthen pressing the Enter key to enter the record intothe third row of the data list. Not only does Excelautomatically add the new record to the last row ofyour data list, but it also presents you with a cleandata form that you can then use to fill in the informa-tion for the next record.

    Figure 43-4: Employee data list with the second recordentered from the data form.

    50_574272 ch43.qxd 10/1/04 10:59 PM Page 257

  • Technique 43: Adding and Editing Data Lists with the Data Form258

    Figure 43-5: Entering the search criteria to find recordswhere the last name starts with C and thelocation is Boston.

    Then click the Find Next button or press the Enterkey, and Excel locates the first record in the data listwhere the last name begins with the letter C and thelocation is Boston. This is William Cobbs record,shown in Figure 43-6.

    To locate the next record that matches your criteria,click the Find Next button or press Enter, whichbrings you to Sherry Caulfields record, shown inFigure 43-7. Having located Sherrys record, you canthen change her profit-sharing status by selectingthe Profit Sharing text box and replacing No withYes. To insert the editing change that you make inthe data form into the data list itself, close the dataforms dialog box by clicking the Close button.

    When using the Criteria button in the data form tofind records, you can use the following logical opera-tors when entering search criteria in fields that usenumbers or dates:

    Equal to (=): Finds records the same as the text,value, or date you enter.

    Greater than (>): Finds records after the textcharacters (in the alphabet) or the date, orlarger than the value you enter.

    Greater than or equal to (>=): Finds records thesame as the text characters, date, or value you

    Some fields require you to enter their num-bers as text rather than as values. For example,if youre entering part numbers or other iden-tification numbers that use leading zeros, youneed to preface the field entries with an apos-trophe () as in 00210. Note that Excel doesnot copy this very important punctuation fromthe previous entry when you press Ctrl+ tocopy into the current field, so you must do itmanually. For zip code fields, assign theSpecial Zip Code number format to retainleading zeros.

    Finding records with the data form

    You can use the Criteria button in the data form tofind the records in your data list that you need toedit or delete (as described in the next sections).When you click the Criteria button, Excel clears allthe field text boxes so that you can enter the criteriato search for. For example, say that you need to editSherry Caulfields profit-sharing status. You donthave her paperwork in front of you, so you cant lookup her employee number. You do know, however, thatshe works in the Boston office, and although youdont remember exactly how she spells her lastname, you do know that it begins with a C insteadof a K.

    To locate her record, you can at least narrow thesearch to all the records where the Location fieldcontains Boston and the employees Last Namebegins with the letter C, as shown in Figure 43-5. Todo this, open the data form for the Employee datalist, click the Criteria button, and then enter the fol-lowing text in the Last Name field:


    Then, in the Location field you enter


    When entering the criteria for locating matchingrecords in the data form, you can use the questionmark (?) and asterisk (*) wildcard characters just asyou do when using the Excel Find feature to locatecells with particular entries.

    50_574272 ch43.qxd 10/1/04 10:59 PM Page 258

  • Creating a New Data List and Data Form 259

    enter or after the characters (in the alphabet),after the date, or larger than the value.

    Less than (

  • Technique 43: Adding and Editing Data Lists with the Data Form260

    data form is about to be permanently deleted. Tocontinue and remove the record, you need to clickOK or press Enter. If you change your mind anddecide to keep the current record, press the Esckey or click the Cancel button instead.

    Although you can use the Criteria data formto locate a group of records that you want todelete, you can remove only one record at atime with the Delete button. To delete a wholeset of records, you might be better off select-ing them in the worksheet and then removingthem with the EditDelete command (usingthe Shift Cells Up option).

    Removing records from the data list with the data form

    In addition to adding and editing records with thedata form, you can also delete them. To remove arecord from the data list, you simply display therecord in the data form and then click the Deletebutton.

    Be careful when deleting records, however, becauseyou cant restore the records you delete with ExcelsUndo feature. For this reason, Excel always displaysan alert dialog box whenever you click the Deletebutton indicating that the record displayed in the

    50_574272 ch43.qxd 10/1/04 10:59 PM Page 260

  • 44 Sorting WorksheetDataBeing able to properly sort your worksheet data, whether in a stan-dard table or data list, is one of the more important operations thatyou can perform on the data. When you sort worksheet data inExcel, you rearrange the rows or columns of the original data table orlist so that they appear in a particular preferred order. To achieve thispreferred order, you designate the column or rows in the table or listwhose entries are to be used in determining the new data arrangement.

    This technique introduces you to the process of sorting worksheet data.It begins by covering the basic sorting of the records in a data list (seeTechnique 43) using one, two, or even three fields in the list. The tech-nique then shows you how to add a number field to the data list so thatyou can use that field to restore the sorted records to the order in whichthey were originally entered. Finally, you get the lowdown on doing morecomplex sorts of data lists that involve more than three fields and how touse the Sort feature to rearrange the columns (fields) in an existing tableof data or data list.

    Dont Be Out of SortsExcels Sort feature makes it easy to rearrange the records or even thefields in your table of data or data list. To sort your data, Excel uses sort-ing keys to determine how the records or fields should be reordered inthe data list:

    When sorting records, you indicate by cell address which field (that is,column) contains the first or primary sorting key.

    When sorting fields, you indicate which record (row) contains the pri-mary sorting key.

    Excel then applies the selected sort (ascending or descending) to thedata in the key field or row to determine how the records or fields willbe reordered during sorting.


    Save Time By Sorting the records of a

    data list

    Sorting on three or morefields

    Sorting the field names ina list

    51_574272 ch44.qxd 10/1/04 11:00 PM Page 261

  • Technique 44: Sorting Worksheet Data262

    Sorting records in a data list

    To sort the records in your data list with the Sortfeature, follow these steps:

    1. Position the cell pointer somewhere in one ofthe cells in the data list.

    As long as the cell pointer is in any cell in thedata list, Excel automatically selects all therecords in the list when you perform the nextstep. Note that you can manually adjust thisrange if you want to sort less than all therecords in the list.

    2. Choose DataSort to open the Sort dialog box,shown in Figure 44-1.

    Figure 44-1: Using the Sort dialog box to sort the recordsof the Employee data list.

    Excel selects all the rows (records) in the list(excluding the row of field names at the top)and opens the Sort dialog box. If the list of datayoure sorting doesnt have a row of headings inthe top row and you want to include the toprows data in the sort, you need to select the NoHeader Row option button near the bottom ofthe Sort dialog box.

    When a key field contains duplicate entries, Excellists these records in the order in which they wereentered in the table or data list. To indicate howExcel should order records with duplicates in theprimary key, you define a secondary key. For exam-ple, if, when organizing the data list in alphabeticalorder by the Last Name field, you have severalrecords where the last name is Smith, you can haveExcel sort the Smiths records in alphabetical orderby first name. To do so, you define the First Namefield as the secondary key. If the secondary key con-tains duplicates (say you have two John Smiths inyour company), you can define a third key field (theMiddle Name field, if your data list has one) thatdetermines how the duplicate John Smith recordsare to be arranged when the data list is sorted.

    When defining the key fields or rows for a sort, youcan specify either an ascending or descending sortorder for its data:

    When you specify ascending order (which is thedefault), Excel arranges text in A-to-Z order andvalues from smallest to largest.

    When you specify descending order, Excelreverses this order and arranges text in Z-to-Aorder and values range from largest to smallest.

    When sorting on a date field, keep in mind thatascending order puts the records in least-recent-to-most-recent date order, whereas descending ordergives you the records in most-recent-to-least-recentdate order.

    When you choose the ascending sort order for afield containing many different kinds of entries,Excel places numbers (from smallest to largest)before text (in alphabetical order) followed by logi-cal values (TRUE and FALSE), error values, and,finally, blank cells. When youre using the descend-ing sort order, the program uses the same generalarrangement for the different types of entries, butnumbers go from largest to smallest, text runs fromZ to A, and the FALSE logical value precedes theTRUE logical value.

    51_574272 ch44.qxd 10/1/04 11:00 PM Page 262

  • Dont Be Out of Sorts 263

    3. In the Sort By drop-down list, select the nameof the field you want used as the primary keyin sorting the records.

    4. If you want to sort the records in descendingorder (rather than the default ascending order)using the primary key, click the Descendingoption button.

    5. If the primary key field contains duplicates andyou want to specify how these records are tobe sorted, select the name of the field to sortby in the first Then By drop-down list.

    6. If you want to sort the records in descendingorder using the secondary key, click theDescending option button to the right of thefirst Then By drop-down list box.

    7. If the secondary key field contains duplicatesand you want to specify how these records areto be sorted, select the name of the field to sortby in the second Then By drop-down list.

    8. If you want to sort the records in descend-ing order using the tertiary key, click theDescending option button to the right of thesecond Then By drop-down list.

    9. When you finish defining all the keys you needto use in sorting the records in your data list,click OK or press Enter to perform the sort.

    If, when Excel finishes rearranging the records,you find that you sorted the data list using thewrong key fields, choose EditUndo or pressCtrl+Z to restore the data list records to theirprevious unsorted order.

    Note that the Sort dialog box contains an Optionsbutton that, when clicked, opens the Sort Optionsdialog box, shown in Figure 44-2. This dialog boxcontains options for doing a case-sensitive sort onfields that contain text and options for changingthe orientation of the sort from the normal top-to-bottom order to left-to-right order when you wantto sort columns in a list.

    Figure 44-3 illustrates sorting the Employee data listfirst in ascending order by location and then indescending order by salary. For this sort, I selectedthe Location field as the primary key and the Salaryfield as the secondary key in the sort. Also, to havethe records within each location sorted from highestto lowest salary, I chose the Descending option but-ton next to the first Then By drop-down list box.Note in Figure 44-3 how the records are now organ-ized first in ascending order by city listed in theLocation field (Atlanta, Boston, Chicago, and so on)and within each city in descending order by Salary(38,900, 32,200, 29,200, and so on).

    Figure 44-2: Using the Sort Options dialog box to refinethe sort order.

    Figure 44-3: Employee data list sorted by location andsalary.

    51_574272 ch44.qxd 10/1/04 11:00 PM Page 263

  • Technique 44: Sorting Worksheet Data264

    When you release the mouse button, Excel fillsthe Record Number field with sequential num-bers starting with 1, as shown in Figure 44-4.

    5. Save the workbook containing the data list(Ctrl+S).

    Figure 44-4: Employee data list after adding and filling inthe new Record No. field.

    After adding the Record No. field with therecord numbers to the data list, you can returnthe list to its original data-entry order (whichyou would do before adding any new records)by positioning the cell pointer in the cell con-taining the Record No. field name and thenclicking the Sort Ascending button on theStandard toolbar.

    Sorting a list on more than three key fields

    On rare occasions, you may need to sort a data liston more than three fields (the maximum you candefine in one sorting operation). For example, sup-pose youre working with a personnel data list likethe one shown in Figure 44-5 and you want to organ-ize the records in alphabetical order, first by depart-ment, then by supervisor, and finally by last name,first name, and middle name. To sort the records inthis data list by these five fields, you have to per-form two sorting operations:

    To quickly sort records in the data list by usingany single field in the list as the sorting key,use the Sort Ascending button (the one withA above Z) or the Sort Descending button (theone with Z above A) on the Standard toolbar.To sort the data list using these buttons, posi-tion the cell pointer somewhere in the fieldon which the records are to be sorted andthen click the Sort Ascending button or SortDescending button (depending upon whichorder you want to use).

    Sorting on a record number field torestore a list to its original order

    In some data lists, you may want to be able to restorethe records to the order in which they were origi-nally entered (which may not necessarily be anorder that you achieve through sorting). To returna list to its original order after doing any amountof sorting, you assign sequential numbers to therecords before you ever sort them. To do so, followthese steps:

    1. Position the cell pointer in the first cell of thelist and then choose InsertColumn.

    Excel inserts a blank column where you canassign the sequential numbers for the records.

    2. Type Record No. as the field name in the blankcell in the new column and then press Enter.

    3. Type 1 in the blank cell beneath the RecordNumber field name and then click the Enterbutton on the Formula bar.

    Clicking the Enter button ensures that the cellpointer stays in the cell that now contains recordnumber 1.

    4. Position the mouse pointer on the Fill handleof the current cell, press and hold down theCtrl key, and then drag the Fill handle downthe column until you reach the row with thelast record of the data list.

    51_574272 ch44.qxd 10/1/04 11:00 PM Page 264

  • Sorting the Field Names in a Data List 265

    In the first sorting operation, define the LastName field as the primary key, the First Namefield as the secondary key, and the Middle Namefield as the tertiary key.

    In the second sort, define the Department fieldas the primary key and the Supervisor field asthe secondary key.

    Figure 44-5: Personnel data list before sorting.

    Figure 44-6 shows you the personnel data list afterperforming the second sorting operation. As youcan see, the records are now arranged in ascendingorder by department, then by supervisor withindepartment, and finally by the last name, first name,and middle name of the individuals under eachsupervisor.

    Figure 44-6: Personnel data list sorted by department;supervisor, last name, first name, andmiddle name.

    When sorting data list records on more than threekey fields, you need to determine the order of thekey fields from most general to most specific. In thepreceding example, this arrangement would be asfollows:

    Department, Supervisor, Last Name, FirstName, Middle Name

    After arranging the fields in this manner, you thenperform your first sort operation with the more spe-cific key fields at the end of the list. In this example,these fields include the following fields as the pri-mary, secondary, and tertiary keys:

    Last Name, First Name, Middle Name

    Next, you perform your second sorting operationwith the more general key fields at the beginning ofthe list. In this example, the primary and secondaryfields are

    Department, Supervisor

    Sorting the Field Namesin a Data ListYou can use Excels column-sorting capability tochange the order of the fields in a data list withouthaving to resort to cutting and pasting variouscolumns of data. To sort the columns (fields) in adata list, you need to add a row at the top of the listthat you then define as the primary sorting key.The cells in this row contain numbers (from 1 tothe number of the last field in the data list) thatindicate the new order of the fields.

    Figures 44-7 and 44-8 illustrate how you can use col-umn sorting to modify the field order of a data listin the sample personnel data list. In Figure 44-7, Iinserted a new row (row 1) above the row with thefield names for this data list. As you can see, thecells in this row contain numbers that indicate thenew field order. After the fields are sorted using the

    51_574272 ch44.qxd 10/1/04 11:00 PM Page 265

  • Technique 44: Sorting Worksheet Data266

    Figure 44-8 shows the personnel data list after click-ing the OK button in the Sort dialog box and sortingits fields according to the values in the first row. Aftersorting the data list, you then delete this row andmodify the column widths to suit the new arrange-ment before saving the data list with its new fieldarrangement.

    Figure 44-8: Personnel data list after sorting its column inascending order of the top row numbers.

    When sorting the columns in a data list, youmust remember to click the Options button inthe Sort dialog box and then select the SortLeft to Right option button in the Sort Optionsdialog box. Otherwise, Excel sorts your recordsinstead of your columns, and in the process,the row of field names becomes sorted in withthe other data records in your list!

    values in this row (see Figure 44-8), the ID No fieldremains first (indicated by 1), the First Departmentfield becomes the second (2), the Supervisor fieldis third (3), followed by the First Name (4), MiddleName (5), Last Name (6), Title (7), and Salary (8)fields.

    Figure 44-7: Personnel data list before sorting thecolumns according to the numbers inthe top row.

    When I opened the Sort dialog box (DataSort),Excel automatically selected Column A as the pri-mary sort key in the Sort By drop-down list box. Ithen selected the No Header Row option button andclicked the Options button to open the Sort Optionsdialog box. Here, I selected the Sort Left to Rightoption button and then clicked OK. Excel changedColumn A to Row 1 in the Sort By drop-down list box.

    51_574272 ch44.qxd 10/1/04 11:00 PM Page 266

  • 45 Quick and EasyBasic Data ListFilteringFiltering refers to the process of sifting through all the records in adata list to display only those records that meet the particular crite-ria that you specify. In database lingo, this process is also knownas querying the database. The records that meet the filtering criteria youset up for the query (and which are subsequently the only ones that aredisplayed in the list in the worksheet) are referred to as a subset of thedatabase.

    Excels AutoFilter feature makes the filtering of most lists you create areal snap, enabling you to quickly alternate between a subset of the datalist containing only the filtered records and the full list with all the records.This technique covers how to use AutoFilter to do basic and custom fil-tering of the data list. It also covers using the Advanced Filter feature toperform more sophisticated queries that use any number of criteria pro-ducing the subset of the data list.

    AutoFilter BasicsExcels AutoFilter feature is so simple to use that you can set up thefiltering criteria and display the subset of the data list that meet thosecriteria in literally a few button clicks after turning the feature on. Toturn AutoFilter on, position the cell pointer somewhere in one of thecells of the list and choose DataFilterAutoFilter. When you selectthis command, Excel indicates that AutoFilter is on by displaying drop-down buttons to the right of each field name (column heading) in thedata list, as shown in Figure 45-1.

    To filter the list, you simply click the drop-down button for each field(column) that you want to use as filtering criteria and then select theentry you want to use on its drop-down list. For example, to filter theEmployee list so that you only see records where the Dept field isAccounting, click the Dept fields drop-down button and then selectAccounting in its drop-down list. Excel then hides the rows for allrecords where the department is not Accounting, leaving only those


    Save Time By Using AutoFilter to dis-

    play just certain recordsin a data list

    Using AutoFilter to findrecords with the top orbottom ten items in a list

    Using custom views to re-create subsets of adata list

    Using the CustomAutoFilter feature tocreate a subset for arange of values in afield

    52_574272 ch45.qxd 10/1/04 11:00 PM Page 267

  • Technique 45: Quick and Easy Basic Data List Filtering268

    When you filter a data list to create a subset in thismanner, Excel only hides the records that dont meetyour filtering criteria no rows are actually deletedfrom the workbook. To redisplay all the hidden rowswith the missing records, choose DataFilterShow All. If youre filtering the list using the criteriafrom only one field (column), you can also do thisby clicking (All) near the top of that fields drop-down list.

    You can also redisplay all the records inthe data list by turning AutoFilter off(DataFilterAutoFilter).

    If you filter your data list with multiple criteria andonly want to redisplay the records hidden by a par-ticular criterion, click the (All) item in that fieldsdrop-down list.

    Excels AutoFilter buttons enable you to sort asubset of the data list on different sorting keys.To sort a subset in ascending order on a partic-ular field, select the Sort Ascending item at thetop of its drop-down list. To sort in descendingorder, select Sort Descending instead. To sortthe subset on more than one key, select eitherthe Sort Ascending or Sort Descending itemon the various fields drop-down lists in theorder appropriate for sorting duplicates. (SeeTechnique 44.)

    Making it into the top-ten list

    You can select the (Top 10 . . .) item at the top of aparticular fields AutoFilter drop-down list to filterout all records except for those whose entries in thatfield are at the top or bottom of the list by a certainnumber (10 by default) or in a certain top or bottompercent (10 by default).

    You can only use the (Top 10 . . .) item onnumerical and date fields. When you selectthis kind of filtering in a text field, Excels onlyresponse is to beep at you as if to say, Dontyou know that top-ten filtering doesnt makeany sense here?

    where the Dept field contains Accounting displayed.(See Figure 45-2). The program also colors the downward-pointing triangle in the Dept fields drop-down button blue to indicate that the field is beingused in filtering the data list.

    Figure 45-1: Turning on AutoFilter in the Employee datalist.

    Figure 45-2: The Employee data list after filtering out allrecords except those where the Dept field isAccounting.

    To further filter the list and display only thoserecords where the Dept is Accounting and the ProfitSharing is No, click the drop-down button on theProfit Sharing field name and then select No in itsdrop-down list. If you then want to filter the listeven further to display only the records where theDept is Accounting, Profit Sharing is No, and theLocation is Detroit, click the Location fields drop-down button and select Detroit in its drop-down list.

    52_574272 ch45.qxd 10/1/04 11:00 PM Page 268

  • AutoFilter Basics 269

    When you select the (Top 10 . . .) item on a numericor date fields drop-down list, Excel opens the Top 10AutoFilter dialog box, shown in Figure 45-3. Here,you can specify your filtering criteria. By default, theTop 10 AutoFilter dialog box is set to filter out allrecords except those whose entries are among thetop ten items in that field. If you want to use thisdefault filtering criteria, simply click OK.

    Figure 45-3: Using the Top 10 AutoFilter settings todisplay the records with the top ten yearsof service.

    You can also change the filtering criteria before youfilter the data. You can choose between Top andBottom in the leftmost drop-down list and betweenItems and Percent in the rightmost one. You can alsochange the number in the middle drop-down list byselecting the box and entering a new value or choos-ing one from its list.

    When assigning a new value in this combo box, youcan enter a value from 1 on up. Of course, you wantto enter a number less than the total number ofrecords in the list when Items is selected in therightmost combo box and less than 100 whenPercent is selected there or else whats the pointof using the Top 10 AutoFilter at all?

    Figure 45-4 shows the Employee data list after usingthe default settings for the Top 10 AutoFilter in theYears of Service field to display the records for theemployees with the top ten years of service and thensorting the ten records in this subset in descendingorder by these years (by clicking Sort Descending inthe Years of Service fields drop-down list).

    Figure 45-4: The Employee data list showing the recordsfor the employees with the top ten years ofservice.

    Saving subsets of a data list as custom views

    In Technique 32, I introduce custom views and howthey enable you to save different worksheet screendisplay settings so that you can instantly put allthose settings into effect just by selecting the nameof its view. Custom views are perfect for saving sub-sets of a data list using different filtering criteria.That way, instead of having to go through all thetedium of turning on AutoFilter and then selectingthe filtering criteria in all the relevant fields, you canre-create and display the subset in a flash simply byselecting the name of its view in the Custom Viewsdialog box (ViewCustom Views).

    To create a custom view that re-creates and displaysa filtered subset of your data list, you need to manu-ally turn on AutoFilter, select the filtering criteria forthe appropriate fields, and then click the Add buttonin the Custom Views dialog box. (See Technique 32for the details.)

    When creating a new custom view that showsa subset of a filtered data list, you must becareful not to clear the Hidden Rows, Columns,and Filter Settings check box in the Add Viewdialog box (refer to Figure 32-6). Otherwise,you are unable to turn on AutoFilter and hidethe rows with records that dont meet your fil-tering criteria for the view you create.

    52_574272 ch45.qxd 10/1/04 11:00 PM Page 269

  • Technique 45: Quick and Easy Basic Data List Filtering270

    When selecting the operator for the first and secondcondition in the leftmost drop-down lists, you havethe following choices:


    Does Not Equal

    Is Greater Than

    Is Greater Than or Equal To

    Is Less Than

    Is Less Than or Equal To

    Begins With

    Does Not Begin With

    Ends With

    Does Not End With


    Does Not Contain

    Note that you can use the Begins With, Ends With,and Contains operators and their negative counter-parts when filtering a text field. You can also use thequestion mark (?) and asterisk (*) wildcard charac-ters when entering the characters for use with theseoperators. (The question mark wildcard stands forindividual characters, and the asterisk stands forone or more characters.) You use the other logicaloperators when dealing with numeric and datefields.

    When specifying the values to evaluate in the associ-ated combo boxes, you can type in the text, number,or date, or you can select an existing field entry byselecting one from the drop-down list.

    Figure 45-6 shows the subset of the Employee datalist after using the Custom AutoFilter (refer to Figure45-5) that sets up the AND condition that filters outall records except those where the salaries arebetween $55,000 and $75,000, inclusive and aftersorting these remaining records on the Salary fieldin descending order.

    Customizing the AutoFilterSettingsThe basic AutoFilter feature doesnt let you selectmore than a single filtering criterion for any one fieldin the list. This means, for example, that you can usethe basic AutoFilter to filter the Employee list for aparticular salary such as $55,000 but you cant filterthe list for salaries in the range between $55,000 and$75,000. To filter a data list for a range of values in aparticular field, you need to use the CustomAutoFilter feature.

    To invoke Custom AutoFilter, you need to select the(Custom) item at the top of the fields drop-downlist. For the salary example, for example, you do thisby clicking (Custom) in the Salary fields drop-downlist. When you select this item, a Custom AutoFilterdialog box similar to the one shown in Figure 45-5appears.

    Figure 45-5: Using Custom AutoFilter to filter out recordsexcept for those within a range of salaries.

    Here, you select the type of operator to use in evalu-ating the first and the second condition in the topand bottom drop-down lists and the values to beevaluated in the first and second condition in thecombo boxes. You also specify the type of relation-ship between the two conditions with the And or Oroptions. (The And option is selected by default.)

    52_574272 ch45.qxd 10/1/04 11:00 PM Page 270

  • Customizing the AutoFilter Settings 271

    Figure 45-6: A subset of data list where salaries arebetween $55,000 and $75,000, inclusive.

    You can also use the Custom AutoFilter feature tocreate an OR condition where records appear if theycontain either a value or entry that you specify inany one of the two conditions. For example, supposethat you want to create a subset with the records inthe data list where the location is Boston or Chicago.To do this, you open the Custom AutoFilter dialogbox from the Location fields drop-down list. Thenselect the Equals operator in both condition top andbottom drop-down lists, select Boston and thenChicago in the respective combo boxes, and thenselect the OR condition, as shown in Figure 45-7.

    Figure 45-8 shows the subset of the Employee datalist after using the Custom AutoFilter (refer to Figure45-7) that sets up the OR condition that filters out allrecords except those where the location is Boston orChicago and after sorting these remaining recordson the Location field in ascending order.

    Figure 45-7: Using Custom AutoFilter to filter out recordsexcept for those where the city is Boston orChicago.

    Figure 45-8: A subset of the data list where the locationis Boston or Chicago.

    52_574272 ch45.qxd 10/1/04 11:00 PM Page 271

  • Technique46 More Data ListFiltering plusStatistical AnalysisTechnique 45 introduces you to basic data list filtering, whichenables you to create a subset of all the records in the list usingfiltering criteria you select with either the AutoFilter drop-downlists for individual fields or the Top 10 or Custom AutoFilters. This tech-nique takes you to the next step: using the Advanced Filter to create asubset using various filtering criteria entered into a separate range inthe worksheet.

    The great thing about using the Advanced Filter feature is that it enablesyou to set up calculated criteria for filtering the data list and creating thesubset. Also, instead of just having Excel hide rows in the original list tocreate the subset, you can have the program actually copy the matchingrecords that make up the filtered subset into a new part of the worksheet.That way, you can sort, print, and perform any other needed manipula-tions on the subset without affecting the records in the original data list.

    In addition to the Advanced Filtering feature, this technique introducesyou to Excels database functions that enable you to compute variousstatistics about its data based on criteria that you set up in a range justas you do with the Advanced Filter feature.

    Putting the Advanced Filter in ServiceIn order to use the Advanced Filter feature to filter the data list, you needto specify two ranges: a List range containing all the records in the datalist including the top row with the field names and a Criteria rangecontaining a copy of the row of field names with the various filtering cri-teria entered into the appropriate cells. Optionally, you can specify athird Copy To range that indicates where Excel begins copying therecords in the subset of the filtered data when you use the Copy toAnother Location option.

    If youre using the Advanced Filter feature to copy records to a new loca-tion, you can locate the Criteria range in the top rows of columns to theright of the actual data list and then specify the Copy To range as the


    Save Time By Using the Advanced Filter

    to create a subset of adata list

    Setting up AND and ORfiltering criteria

    Setting up calculatedfiltering criteria

    Using database functionsto compute statisticsabout a data list

    53_574272 ch46.qxd 10/4/04 8:35 AM Page 272

  • Putting the Advanced Filter in Service 273

    Figure 46-2 shows you the result of this query (thetechnical name for copying a subset of a data listusing filtering criteria) after you click OK in theAdvanced Filter dialog box. Excel copies the recordsthat match the criteria where the location is Bostonand the Date Hired is prior to January 1, 2000, fromthe original data list in the range A1:J33 into theCopy To range starting with cell L6 and extendingto cell U12.

    Figure 46-2: A subset with the records where theLocation is Boston and the Date Hiredis before Jan. 1, 2000.

    If you want, you can then sort the records in thesubset by turning on AutoFilter (DataFilterAutoFilter) and then selecting the Sort Ascendingor Sort Descending item at the top of the Date Hiredfields drop-down list. You can also print this subsetby selecting its range, L6:U12, and then choosing theSelection option in the Print dialog box (FilePrint)before clicking OK.

    If you dont want to copy the records that meet yourfiltering criteria to a new place in the workbook, youcan just filter the original data list. To do this, leavethe Filter the List, In-Place option selected whenyou specify the List range and Criteria range in theAdvanced Filter dialog box. When you filter the list,Excel simply hides the rows of the records that dontmeet the filtering criteria specified in your Criteriarange, leaving just those that do meet the criteria dis-played in the worksheet. To redisplay all the recordsin the data list, choose DataFilterShow All.

    first cell underneath the Criteria range, similar to thearrangement shown in Figure 46-1.

    Figure 46-1: Copying records that arent filtered out bythe criteria entered in the Criteria range.

    For this figure, I copied the field names in the origi-nal data list in the range A1:J1 to the range L1:U1. Ithen entered Boston in the copy of the Location col-umn (cell R2) and

  • To weed out any duplicate records that matchyour filtering criteria from the Copy To range,be sure to select the Unique Records Onlycheck box in the Advanced Filter dialog boxbefore you click OK.

    Specifying filtering criteria

    Entering filtering criteria in the Criteria Range of theworksheet for advanced filtering is very similar toentering criteria in the data form after clicking theCriteria button. (See Technique 43.) However, youneed to be aware of some differences. For example,if you are searching for the last name Paul and enterthe label Paul for the Criteria range in the Last Namecolumn, Excel matches any last name that beginswith P-a-u-l such as Pauley, Paulson, and so on. Toavoid having Excel match any other last name besidePaul, you have to enter a formula in the cell, as in


    When entering filtering criteria for advanced filter-ing, you can also use the question mark (?) or theasterisk (*) wildcard character in your selection cri-teria, just like you do when using the data form tofind records. If, for example, you enter J*n in theFirst Name column, Excel considers any charactersbetween J and n in the First Name field to be a match,including Joan, Jon, or John as well as Jane or Joanna.To restrict the matches to just those names withcharacters between J and n and to prevent matcheswith names that have trailing characters, you needto enter the following formula in the cell:


    When you use a selection formula like this one,Excel matches names like Joan, Jon, and John butnot names such as Jane or Joanna that have a char-acter following the n.

    When setting up your filtering criteria in the Criteriarange, you can also use the other logical operators,including >, >=, m Records wherethe name startswith a letter afterM (that is, Nthrough Z)

    >= Greater than >=11/6/02 Records whereor equal to the date is on or

    after November6, 2002

    < Less than

  • Putting the Advanced Filter in Service 275

    When you enter two or more criteria in differentrows of the Criteria range, Excel treats the criteriaas a logical OR and selects records that meet anyone of the criteria they contain. Figure 46-4 showsyou an example of a query using a logical OR condi-tion. In this example, Excel copies records where thelocation is either San Francisco or Chicago. To makethis happen, I entered San Francisco in the Locationcolumn in the second row (row 2) of the Criteriarange and Chicago in the third row (row 3).

    Figure 46-4: A subset with the records where theLocation is either Chicago or San Francisco.

    To perform this query, I only had to modify theCriteria range in the Advanced Filter dialog box toData List!$R$1:$R$3 to include the field name incell R1 and the two OR criteria in cells R2 and R3,respectively, before clicking OK.

    When setting up your filtering criteria, you can com-bine logical AND and logical OR conditions (again,assuming that you expand the Criteria range suffi-ciently to include all the rows containing criteria).For example, if you edit the Criteria range used inthe previous query by entering >1/1/99 in cell S2(in the Date Hired column) in row 2 and then expandthe Criteria range to Data List!$R$1:$S$3 whenredoing the query, Excel copies the records wherethe location is San Francisco and the date hired isafter January 1, 1999, as well as the records wherethe location is Chicago (regardless of the datehired).

    of service are greater than 4 because both the crite-ria Human Resources and >4 are placed in the samerow (row 2) for their respective field names, Deptand Date Hired.

    Figure 46-3: A subset with the records where theDepartment is Human Resources andDate Hired is before Jan. 1, 2000.

    Note that in order to perform this query right afterperforming the one shown in Figure 46-2, I had tomodify the Criteria range from Data List!$R$1:$S$2to Data List!$P$1:$T$2 (so that the range nowcontains both Human Resources in cell P2 and >4 incell T2) and had to modify the Copy To range fromData List!$L$6 to Data List!$L$6:$U$6 (so thatit includes all the field names).

    If you dont specify all the field names in a rangewhere they already exist, Excel only copies theentries from the matching records in the field orfields specified as part of the Copy To range. In otherwords, if I leave the Copy To range set at the singlecell (Data List!$L$6), Excel copies only the IDnumbers for the five records that match the filteringcriteria where the department is Human Resourcesand the years of service are greater than 4. All therest of the fields in the matching records are leftblank!

    You can reuse a Copy To range for yourqueries without having to first delete thematching records from a previous query.Excel automatically removes all the recordsfrom the previous query before copying inthe records that match the query youre cur-rently conducting.

    53_574272 ch46.qxd 10/4/04 8:35 AM Page 275

  • Setting up calculated filtering criteria

    You can use calculated criteria to filter or queryyour data list. To do this, you need to enter a logicalformula that Excel can evaluate as either TRUE orFALSE in the Criteria range. You must also enter thisformula under a text entry that is not used as a fieldname in the data list. (I repeat, is not a field name inthe data list.)

    Figure 46-5 shows an example of using a calculatedcriterion that compares values in the Salary field toa calculated value that isnt actually entered in thedata list. Here, I performed a query that copies allthe records from the Employee data list where theemployees salary is above the average salary (whichhappens to be $41,098). In this example, cell V2 con-tains the formula that uses the AVERAGE function tocompute the average employee salary and then com-pares the first salary entry in cell F2 of the data listto that average. In the case of the value in cell F2,this particular condition happens to be true. (Thesalary $84,400 is indeed greater than the averagesalary of $41,098.)

    Figure 46-5: A subset with the records where the salaryis greater than the average salary in thedata list.

    Note that this logical formula is placed in cell V2 ofthe Calculated Criteria column a cell added to theend of the row of copied field names. In the logicalformula, cell F2 is referred to because it is the first

    cell in the data list containing a salary entry. Thecell range ($F$2:$F$33) used as the argument of theAVERAGE function is the range in the Salary fieldcontaining all the salary entries.

    To use a calculated criterion like this one, you mustremember to place the logical formula under a labelthat isnt used as a field name in the data list itself(in this example, the label Calculated Criteria doesnot appear anywhere in the row of field names). Youmust include this label and formula in the Criteriarange (for this query example, the Criteria range isdefined as the cell range Data List!$V$1:$V$2).

    When you then perform the query by using theAdvanced Filter feature, Excel applies this calculatedcriterion to every record in the database. Excel doesthis by adjusting the first Salary field cell referenceF2 (entered as a relative reference) as the programexamines the rest of the records. Note, however, thatthe range reference specified as the argument of theAVERAGE function is entered as an absolute reference($F$2:$F$33) in the criterion formula so that Exceldoesnt adjust this reference but rather comparesthe Salary entry for each record to the AVERAGEcomputed salary for this entire range.

    You can also set up calculated criteria that compareentries in one or more fields to other entries in thedata list. For example, to copy the records where theYears of Service entry is at least two years greaterthan the record before it (assuming that you havesorted the data list in ascending order by years ofservice), you enter the following logical formula inthe cell beneath the Calculated Criteria cell:


    Most often, when referencing to cells within the datalist itself, you want to leave the cell references rela-tive so that they can be adjusted. However, you keepreferences to the cells outside the database absoluteso that they arent changed when making the com-parison with the rest of the records.

    Technique 46: More Data List Filtering plus Statistical Analysis276

    53_574272 ch46.qxd 10/4/04 8:35 AM Page 276

  • Getting Data List Statistics 277

    The database functions, regardless of the difference innames (and they all begin with the letter D) and thecomputations that they perform, all take the samethree arguments, as illustrated by the DAVERAGEfunction:


    The arguments for the database functions requirethe following information:

    Database is the argument that specifies therange containing the data list. The range mustinclude the row of field names.

    Field is the argument that specifies the fieldwhose values are calculated by the databasefunction (averaged in the case of the DAVERAGEfunction). You can specify this argument byenclosing the name of the field in double quotes(as in Salary or Date Hired), or you canenter the number of the column in the data list(counting from left to right with the first fieldcounted as 1).

    Criteria is the argument that specifies theaddress of the range containing the criteriayoure using to determine which values are cal-culated. This range must include at least onefield name indicating the field whose values areto be evaluated and one cell with the values orexpression to be used in the evaluation.

    Note that in specifying the field argument, you mustrefer to a column in the data list that containsnumeric or date data for all the database functions.With the one exception of the DGET function, Excelcant perform computations on text fields. If you mis-takenly specify a column with text entries as thefield argument, Excel returns an error value or 0 asthe result. Table 46-2 lists the various database func-tions available in Excel along with an explanation ofwhat each one calculates. (You already know whatarguments each one takes.)

    When you enter the logical formula for a cal-culated criterion, Excel returns the logical valueTRUE or FALSE. This logical value applies onlyto the field entry for the first record in the datalist that you refer to in the logical formula. Byinspecting this field entry in the data list andseeing if it does indeed meet your intendedselection criteria, you can usually tell whetheryour logical formula is correct.

    You can also use Excels AND, OR, and NOT functionswith the logical operators in calculated criteria tofind records that fall within a range. For example, tofind all the records in the Employee data list wherethe salaries range between $55,000 and $75,000, youenter the following logical formula with the AND func-tion in the cell beneath the Calculated Criteria cell:


  • TABLE 46-2: EXCELS DATABASE FUNCTIONSDatabase Function Name What It Calculates

    DAVERAGE Averages all the values in a fieldof the data list that match thecriteria you specify.

    DCOUNT Counts the number of cells withnumeric entries in a field of thedata list that match the criteriayou specify.

    DCOUNTA Counts the number of nonblankcells in a field of the data list thatmatch the criteria you specify.

    DGET Extracts a single value froma record in the data list thatmatches the criteria you specify.If no record matches the criteria,the function returns the #VALUE!error. If multiple records match,the function returns the #NUM!error.

    DMAX Returns the highest value in afield of the data list that matchesthe criteria you specify.

    DMIN Returns the lowest value in afield of the data list that matchesthe criteria you specify.

    DPRODUCT Multiplies all the values in a fieldof the data list that match thecriteria you specify.

    DSTDEV Estimates the standard deviationbased on the sample of values ina field of the data list that matchthe criteria you specify.

    DSTDEVP Calculates the standard devia-tion based on the population ofvalues in a field of the data listthat match the criteria youspecify.

    DSUM Sums all the values in a field ofthe data list that match the crite-ria you specify.

    DVAR Estimates the variance based onthe sample of values in a field ofthe data list that match the crite-ria you specify.

    Database Function Name What It Calculates

    DVARP Calculates the variance basedon the population of values in afield of the data list that matchthe criteria you specify.

    Figure 46-6 illustrates the use of the database func-tion DSUM. Cell B2 contains the following formula:


    This DSUM function computes the total of all thesalaries in the data list that are above $55,000. Thistotal is shown in cell B2 as $468,500.

    Figure 46-6: A subset with the records where the salaryis greater than the average salary in thedata list.

    To perform this calculation, I specified the rangeA3:J35 containing the entire Employee data list including the top row of field names as the data-base argument. I then specified 6 as the field argu-ment of the DSUM function because the sixth field inthe data list (as counted from the left) contains thesalary values that I want totaled. Finally, I specifiedthe range C1:C2 as the criteria argument of the DSUMfunction. These two cells contain the Criteria rangethat designate that only the values in the Salary fieldexceeding 55000 are to be summed.

    Technique 46: More Data List Filtering plus Statistical Analysis278

    53_574272 ch46.qxd 10/4/04 8:35 AM Page 278

  • Getting Data List Statistics 279

    of employees hired since January 1, 2000. To do thiscalculation, I entered the following database func-tion formula into cell H2:


    Again, this DCOUNT database function uses the samedatabase argument, A3:J35, but instead of 6 as thefield argument designating the column whose entriesare to be computed as in the other two examples, Ispecified 8 because the Date Hired field is in theeighth column in the data list as counted from theleft. The criteria argument for this DCOUNT functionis I1:I2, the range that contains the Date Hired fieldname above the logical formula >1/1/00 in I2.

    Figure 46-6 also contains an example of using theDAVERAGE database function in the cell range E1:F2.This DAVERAGE function calculates the averagesalary for the female employees (employees wherethe Sex field contains F). To get Excel to perform thiscalculation, I entered the following database func-tion formula into cell E2:


    This DCOUNT function uses the same database argu-ment A3:J35 and the field argument 6. The criteriaargument for this DAVERAGE function is F1:F2, therange that contains the Sex field name.

    Finally, Figure 46-6 also contains an example ofthe DCOUNT function in the cell range H1:I2.This DCOUNT function calculates the number

    53_574272 ch46.qxd 10/4/04 8:35 AM Page 279

  • 47 Doing What-ifAnalysis in a Snapwith Data TablesWhat-if analysis, a kind of financial fortune-telling that attemptsto project future returns based on various assumptions, hasalways been the strong suit of electronic spreadsheet programssuch as Excel. This technique covers the basic what-if analysis that youcan perform with Excels Data Table feature. (See Technique 48 for infor-mation on doing slightly a more sophisticated what-if analysis using theGoal Seeking and Scenario features.)

    As part of creating a data table, you enter a series of input values in theworksheet, and Excel uses each of them in the formula that you specify.When Excel finishes computing the data table, you see the results pro-duced by each change in the input values in a single range of the work-sheet. You can then save the data table as part of the worksheet if youneed to keep a record of the results.

    When using Excels Data Table feature, you have a choice between creatinga one-variable and a two-variable data table. In a one-variable data table,Excel substitutes a series of different values for a single input value in aformula. In a two-variable data table, Excel substitutes a series of differ-ent values for two input values in a formula.

    Creating a One-Variable Data TableTo create a one-variable data table, you need to set up the master for-mula in your worksheet and then, in a different range of the worksheet,enter the series of different values that you want substituted for a singleinput value in that formula. Figures 47-1 and 47-2 demonstrate how yougo about doing this.

    In Figure 47-1, cell B5 contains a simple formula for computing the pro-jected sales for 2005, assuming an annual growth rate of 1.75% over theannual sales in 2004. The 2005 projected sales in this cell are calculatedwith the following formula:



    Save Time By Doing what-if analysis

    involving a single variable

    Doing what-if analysisinvolving two variables

    54_574272 ch47.qxd 10/1/04 11:01 PM Page 280

  • Creating a One-Variable Data Table 281

    This formula adds the original sales amount enteredin cell B2 (given the range name Sales_04) to theamount of projected growth (calculated by multiply-ing the sales amount in B2 by the growth rate of1.75% entered in cell B3 and given the range nameGrowth_05). Cell B5 shows you that, assuming anannual growth rate of 1.75% in the year 2005, youcan project total sales of $890,312.50.

    Figure 47-1: Setting up a one-variable data table.

    But what if the growth rate in 2005 is not as low as1.75%, or what if the growth rate is even (heaven forbid) lower than anticipated? To create the one-variable table to answer these questions, you firstbring forward the master formula in cell B5 to cell C7with the formula =B5. Then you enter the series ofdifferent growth rates as the input values in columnB, starting in cell B8. (Cell B7, at the intersection ofthe row with the master formula and the columnwith the input values, must be left blank in a one-variable data table.)

    You can create this series of input values for the datatable quickly with the AutoFill feature. (See Tech-nique 13.) For this example, I created a data seriesthat increments each succeeding value by 0.5% in thecell range B8:B17, starting at 1% and ending at 5.5%.

    After generating the growth rate series in the cellrange B8:B17, select the cell range B7:C17 andchoose DataTable. The blank cell range C8:C17 iswhere Excel puts the projected sales figures basedon the growth rate entered into the comparable cellin column B.

    Excel opens the Table dialog box, shown in Figure47-1, where you must specify the row input cell inthe Row Input Cell text box and/or the column inputcell in the Column Input Cell. The cell that you desig-nate must correspond to the cell in the worksheetthat contains the original input value that is fed intothe master formula.

    In the data table in this example, you only need todesignate B3 as the column input cell. (In the caseof Figure 47-1, when you click in this cell or use anarrow key to select this cell, Excel enters the absolutecell reference, as in $B$3.) You choose cell B3 becauseit contains the growth rate value used in the masterformula.

    After indicating the row or column input cells, Excelcomputes the data table when you click OK. In thisexample, the program creates the data table by sub-stituting each input value in the data series (the rangeB8:B17) into the column input (cell B3). The inputvalue is used in the master formula to calculate anew result, which is entered in the correspondingcell (in the cell range C8:C17). After the program fin-ishes calculating the data table, Excel returns theoriginal value to the row or column input cell (inthis case, 1.75% in cell B3).

    Figure 47-2 shows the completed data table. Here,you can see at a glance the effect on the projectedsales for 2005 of changing a half percentage pointfor the growth rate. After creating the data table,you can then format the results and save the tableas part of the worksheet.

    If you want to see the effect on the results in thetable of using a different range of variables, you onlyneed to enter the new input values in the existingrange. By default, Excel automatically recalculatesthe results in the output range of a data table when-ever you change any of its input values. If you wantto control when each data table in the spreadsheetis recalculated, while still allowing the formulas inthe worksheet to be automatically recalculated,select the Automatic Except Tables option on the

    54_574272 ch47.qxd 10/1/04 11:01 PM Page 281

  • Technique 47: Doing What-if Analysis in a Snap with Data Tables282

    Creating a Two-VariableData TableWhen you have a master formula in a spreadsheet inwhich you want to see the effect of changing two ofits input values, you can create a two-variable datatable. When you create a two-variable data table,you enter two ranges of input values to substitutein the master formula: a single-row range in the firstrow of the table and a single-column range in thefirst column of the data table. When you create atwo-variable data table, you place a copy of the mas-ter formula in the cell at the intersection of this rowand column of input values.

    Figure 47-3 shows the typical setup for a two-variabledata table. This figure uses the projected sales work-sheet from the previous section on a one-variabledata table. Here, I added a second variable to projectthe total sales in 2005. This worksheet contains avalue in cell B4 (given the range name Expenses_05)that shows the projected percentage of expenses tosales. This value is used, in turn, in the master for-mula in cell B5 as follows:


    Note that when you factor in the expenses, the pro-jected sales amount at an annual growth rate of1.75% falls in cell B5 from $890,312.50 to $864,062.50.

    Figure 47-3: Setting up a two-variable data table.

    Calculation tab of the Options dialog box (ToolsOptions). You then manually recalculate the valuesin the data table by pressing F9.

    Figure 47-2: A worksheet with a completed one-variabledata table.

    Excel computes the results in a data table by creat-ing an array formula that uses the TABLE function.(See Technique 25 on array formulas.) In this exam-ple, the array formula entered into the cell rangeC8:C17 is as follows:


    The TABLE function can take two arguments,row_ref and/or column_ref, which represent therow input cell and column input cell for the datatable, respectively. In this example, the data tableuses only a column input cell, so B3 is listed as thesecond and only argument of the TABLE function.Because Excel enters the results in a data table byusing an array formula, Excel doesnt allow you toclear individual result cells in its output range. Ifyou try to delete a single result in the data table,Excel displays an alert dialog box, stating that youcant change part of a table.

    To delete just the results in the output rangeof a data table, select all the cells in the outputrange (cell range C8:C17, in the current exam-ple) before pressing the Delete key or choos-ing EditClearAll.

    54_574272 ch47.qxd 10/1/04 11:01 PM Page 282

  • Creating a Two-Variable Data Table 283

    To determine how changing both the growth rate andthe percentage of expenses to sales affect the pro-jected sales for 2005, you create a two-variable datatable. In setting up this table, you still enter the vari-able growth rates down column B in the cell rangeB8:B17. Then you enter the variable expense ratesacross row 7 in the range C7:G7. This time, you bringforward the master formula by entering the formula=B5 in cell B7, the cell at the intersection of the rowand column containing the two input variables.

    After setting up the two series of variables in thismanner, youre ready to create the table by selectingthe cell range B7:G17 and opening the Table dialogbox (DataTable). For a two-variable data table, youmust designate both a row and column input cell inthe worksheet. In this example, the row input cell isB4, which contains the original expense-to-sales per-centage. The column input cell remains B3, whichcontains the original growth rate. After enteringthese two input cells, youre ready to generate thetwo-variable data table by clicking OK.

    Figure 47-4 shows the completed two-variable datatable with the results of changing both the projectedgrowth rate and the projected expenses. As with aone-variable data table, you can format the projectedresults and save this two-variable data table as partof your worksheet. You can also update the table bychanging any of the (two types of) input variables.

    Figure 47-4: The worksheet with completed two-variabledata table.

    The array formula entered in the output range(C8:G17) to create this two-variable data table isvery similar to the one-variable data table array for-mula, only this time the TABLE function uses both arow_ref and column_ref argument as follows:


    Because this data table uses an array formula,you must select all the cells in the outputrange to delete them.

    54_574272 ch47.qxd 10/1/04 11:01 PM Page 283

  • 48 Easy What-ifAnalysis throughScenarios andGoal Seeking

    In Technique 47, I introduce the rudiments of what-if analysis usingExcels Data Table feature, which enables you to project results basedon the substitution of either one or two input variables in a master for-mula. In this technique, I acquaint you with Excels Scenario Manager,a feature that also enables you to generate different projected resultsbased on sets of input variables. The variables used to generate the pro-jected results are saved as part of named scenarios that you can thenreuse in the spreadsheet whenever you need them. After you finish apply-ing the various scenarios to your spreadsheet, the Scenario Managerenables you to generate a summary report that shows both the inputvariables used by your scenarios as well as the projected results theyproduce.

    In addition to the Scenario Manager, this technique covers Excels GoalSeek feature that enables you to find the key input value necessary toachieve a projected goal. If youve created a two-dimensional chart rep-resenting the projected data, I show you how you can even perform thistype of rudimentary goal seeking by directly manipulating particular datamarkers in the chart.

    Exploring Different ScenariosTo create various scenarios for your spreadsheet with Excels ScenarioManager, you build a worksheet that uses certain cells that change ineach scenario (appropriately enough referred to as the changing cells).To make it easier to identify the changing cells in each scenario that youcreate (especially in any scenario summary reports that you generate),assign range names to the variables in the spreadsheet before you createyour scenarios. (See Technique 26.)

    To create your different scenarios with the Scenario Manager, followthese steps:


    Save Time By Using scenarios to

    explore various cases

    Using goal seeking toreach a target

    55_574272 ch48.qxd 10/1/04 11:02 PM Page 284

  • Exploring Different Scenarios 285

    1. Select the changing cells in the spreadsheet that is, the cells whose values vary in each ofyour scenarios.

    Remember that you can select nonadjacent cellsin the worksheet by holding down the Ctrl key asyou click them.

    2. Choose ToolsScenarios to open the ScenarioManager dialog box, shown in Figure 48-1.

    Figure 48-1: Adding a new scenario to a worksheet.

    3. Click the Add button to open the Add Scenariodialog box, shown in Figure 48-2.

    Figure 48-2: Naming a new scenario and designating itschanging cells.

    This dialog box also contains a Changing Cellstext box that contains the addresses of the vari-able cells that you selected in the worksheet anda Comment box that contains a note with yourname and the current date so you always knowwhen you created the particular scenario.

    4. Type a descriptive name for the new scenarioin the Scenario Name text box.

    Verify the cell references in the Changing Cellstext box to make sure that theyre correct youcan modify them if necessary by first clicking inthe text box and then clicking the cells in theworksheet while holding down the Ctrl key. Youcan also edit the note in the Comment box if youwant to add more information about yourassumptions as part of the new scenario.

    5. Choose what kind of scenario protection, ifany, you need with the Prevent Changes andHide check boxes.

    By default, Excel protects a scenario fromchanges when you turn on protection for theworksheet (see Technique 38) so that you cantedit or delete the scenario in any way. If youwant Excel to hide the scenario as well whenworksheet protection is turned on, select theHide check box. If you dont want to protect orhide the scenario when worksheet protection isturned on, clear the Prevent Changes check boxand leave the Hide check box as it is.

    6. Click OK.Excel then opens the Scenario Values dialog box,shown in Figure 48-3.

    Figure 48-3: Entering the values for the changing cellsappropriate to the new scenario.

    55_574272 ch48.qxd 10/1/04 11:02 PM Page 285

  • Technique 48: Easy What-if Analysis through Scenarios and Goal Seeking286

    To show a particular scenario in the worksheet thatuses the values you entered for the changing cells,simply double-click the scenario name in this listbox or select the scenario and then click the Showbutton. Figure 48-5 shows the recalculated forecasttable after applying the input values used in the BestCase scenario.

    Figure 48-5: The Sales Forecast table after applying theBest Case scenario.

    If, after creating the scenarios for your worksheet,you find that you need to use different input valuesor you want to add or remove scenarios, you canedit the scenarios in the Scenario Manager dialogbox (ToolsScenarios). To modify the scenariosname and/or the input values assigned to the chang-ing cells of that scenario, select the scenario name inthe Scenarios list box and then click the Edit buttonso that you can make the appropriate changes in theEdit Scenario dialog box.

    To remove a scenario from a worksheet, select thescenario name in the Scenarios list box and thenclick the Delete button. Note, however, that if youdelete a scenario in error, you cant restore itby choosing EditUndo Clear. Instead, you must re-create the scenario from scratch.

    The Scenario Values dialog box lists the rangenames (assuming that you named each of thecells), followed by the current value for eachof the changing values that you selected in theworksheet before starting to define differentscenarios for your spreadsheet.

    7. Modify the values in each of the changing cellstext boxes as needed.

    You can accept the values shown in the text boxfor each changing cell if it suits the current sce-nario that youre defining, or you can increase ordecrease any or all of them as needed to reflectthe scenarios assumptions.

    8. Click the Add button.Excel again opens the Add Scenario dialog box,which now displays the name of the scenario youjust defined.

    9. Repeat Steps 3 through 7 to add all the otherscenarios that you want to create.

    After you finish defining all the scenarios you wantto apply to the changing values in the spreadsheet,the Scenario Manager dialog box displays the namesof all the scenarios that you added. For example, inFigure 48-4, you see that three scenarios MostLikely, Best Case, and Worst Case are now listedin the Scenarios list box.

    Figure 48-4: Selecting the Best Case scenario to apply tothe Sales Forecast table.

    55_574272 ch48.qxd 10/1/04 11:02 PM Page 286

  • Exploring Different Scenarios 287

    You can also merge scenarios from other Excel work-book files that are open. (Of course, their worksheetsshould share the same spreadsheet layout and chang-ing cells.) To merge a scenario into the current work-sheet from another workbook, click the Merge buttonin the Scenario Manager dialog box. In the MergeScenarios dialog box that appears, select the work-book in the Book drop-down list, the worksheet inthe Sheet list, and then click OK. Excel then copiesall the scenarios defined for that worksheet andmerges them with any scenarios that youve definedfor the current worksheet.

    After creating the different scenarios for your work-sheet, you can use the Summary button in theScenario Manager dialog box to create a summaryreport that shows the changing values used in eachscenario and, if you want, key resulting values thateach produces. When you click the Summary button,Excel opens a Scenario Summary dialog box, asshown in Figure 48-6. Here, you select cells thatcontain the formulas that are recalculated usingthe changing cells when you apply your variousscenarios.

    Figure 48-6: Designating the result cells for the scenariosummary.

    After selecting the result cells for the summaryreport, click OK to have Excel generate the sum-mary report and display it in a new worksheetwindow, as shown in Figure 48-7.

    Figure 48-7: A scenario summary report for the threescenarios defined for the Sales Forecasttable.

    Note in this summary report that, because all thechanging and result cells in this table are named,the summary report uses their range names in placeof their cell references. Also, when the ScenarioManager generates a summary report, it automati-cally outlines the summary data, thus creating twovertical levels: one for the changing cells and anotherfor the result cells. To hide the changing cells in thistable, simply click its Hide Detail button (the one withthe minus sign above the row level bar that encom-passes the rows with the changing cell values).

    The Scenario Summary dialog box contains aScenario Pivot/Table Report option that youcan select to produce the summary report ona new worksheet in the form of a pivot tablethat you can manipulate directly. (SeeTechnique 49.)

    55_574272 ch48.qxd 10/1/04 11:02 PM Page 287

  • Technique 48: Easy What-if Analysis through Scenarios and Goal Seeking288

    worksheet, the cell that contains the first quartersales. (See Figure 48-8.)

    Figure 48-8: Using the Goal Seek feature to find out howmuch sales must increase to reach a targetincome.

    When you click OK in the Goal Seek dialog box tohave Excel go ahead and adjust the sales figure toreach your desired income figure, you see the GoalSeek Status dialog box, shown in Figure 48-9. As thisfigure shows, Excel increases the sales in cell B3from $250,000 to $352,941.18, which, in turn, returns$300,000 as the income in cell B7. The Goal SeekStatus dialog box informs you that goal seeking hasfound a solution and that the current value and tar-get value are now the same. (If this were not thecase, the Step and Pause buttons in the dialog boxwould become active, and you could have Excel per-form further iterations to try to narrow and ulti-mately eliminate the gap between the target andcurrent value.)

    If you want to keep the values entered in the work-sheet as a result of goal seeking, click OK to closethe Goal Seek Status dialog box. If you want to returnto the original values, click the Cancel button instead.

    To flip back and forth between the after andbefore values after you click OK to enter thegoal seeking solution, press Ctrl+Z to redis-play the original values before goal seekingand then Ctrl+Y to display the values enteredby the goal seeking solution.

    Reaching a Target with Goal SeekingIn some what-if scenarios, you know the projectedoutcome that you want to realize in a worksheetand need Excels help in finding the input valuesnecessary to achieve those results. This kind ofdata analysis is known as goal seeking.

    When you simply need to find the value for a singlevariable that will give the desired result in a particu-lar formula, you can perform a simple type of goalseeking by using Excels Goal Seek feature. If youchart the data using some sort of two-dimensionalcolumn, bar, or line chart, you can also perform thiskind of goal seeking by directly manipulating theappropriate marker on the chart.

    Performing goal seeking

    To use the Goal Seek feature, you simply select thecell containing the formula that will return the resultyoure seeking (referred to as the set cell ), designatethe target value you want this formula to return, andthen indicate the changing cell containing an inputvalue that Excel can modify to return the targetedresult.

    Figures 48-8 and 48-9 illustrate how you can usethe Goal Seek feature to find how much sales mustincrease to realize first quarter income of $300,000(given certain growth, cost of goods sold, andexpense assumptions).

    To find out how much sales must increase to returna net income of $300,000 in the first quarter, you firstselect cell B7 which contains the formula that cal-culates the first quarter income and then openthe Goal Seek dialog box (ToolsGoal Seek). Becausecell B7 is the active cell when you open this dialogbox, the Set Cell text box already contains the cellreference B7. You then select the To Value text boxand enter 300000 as the goal. Then select the ByChanging Cell text box and select cell B3 in the

    55_574272 ch48.qxd 10/1/04 11:02 PM Page 288

  • Reaching a Target with Goal Seeking 289

    Figure 48-9: A worksheet with goal seeking solution andGoal Seek Status dialog box.

    Goal seeking graph style

    If you create an embedded two-dimensional line,column, or bar chart for your data, you can performgoal seeking from the chart window by directlymanipulating the line or bar. Figures 48-10 through48-12 illustrate how this process works.

    In Figure 48-10, you see a two-dimensional bar chartembedded below the Sales Forecast table that graphsthe projected sales and income for all four quarters.The top bar in each cluster represents the quarterlyincome, and the lower bar represents the quarterlysales. To find out how much sales must increase torealize an income of $300,000 in the first quarter, fol-low these steps:

    1. Click the border of the bar chart to select itsChart Area and display the Chart toolbar.

    2. Select the Series Income option on the ChartObjects pop-up menu on the Chart toolbar.

    Excel selects all the bars in the chart represent-ing the Income data series. Now, you need toselect just the one for the first quarter.

    3. Hold down the Ctrl key as you click the barrepresenting the first quarter income the topbar in the first cluster near the bottom of thebar chart as shown in Figure 48-10.

    Figure 48-10: Selecting the bar representing the firstquarter income in the Clustered Bar chart.

    When you select this bar while pressing the Ctrlkey, Excel selects only this bar (as opposed to allthe bars representing income in the chart) anddraws handles around the bar.

    4. Release the Ctrl key and then position themouse pointer at the right end of the bar sothat the mouse pointer becomes a double-headed arrow.

    Now youre ready to extend the first quarterIncome bar by dragging the pointer to the right.

    5. Drag the double arrow to the right until theaccompanying ToolTip reads 300000.

    When you release the mouse button, Excel auto-matically opens the Goal Seek dialog box withthe Set Cell and To Value text boxes alreadyfilled in.

    6. Click cell B3 to insert its cell address ($B$3)in the By Changing Cell text box, as shown inFigure 48-11.

    7. Click OK.The dialog box closes.

    55_574272 ch48.qxd 10/1/04 11:02 PM Page 289

  • Technique 48: Easy What-if Analysis through Scenarios and Goal Seeking290

    Figure 48-12: Selecting the bar representing the firstquarter income in the Clustered Bar chart.

    Figure 48-11: Selecting the bar representing the firstquarter income in the Clustered Bar chart.

    As soon as Excel closes this dialog box, the programupdates the embedded chart as well as changesthe value in the Sales Forecast table, as shown inFigure 48-12.

    55_574272 ch48.qxd 10/1/04 11:02 PM Page 290

  • 49 Summarizing Datawith Pivot Tablesand Pivot ChartsThe subject of this technique is pivot tables and pivot charts. A pivottable represents a very special kind of data table that summarizesdifferent types of data (such as the records of an Excel data list) andenables you to dynamically analyze the relationships between them. Pivottables are great because they calculate all their summary data withoutmaking you create the formulas that perform the computations.

    Pivot tables are quite versatile because they enable you to summarizedata using any of the standard summary functions, including COUNT,AVERAGE, MAX, MIN, and the like (although totals created with the SUMfunction will probably remain your old standby). Best of all, you canalso use pivot tables to cross-tabulate one set of data in your data listwith another. For example, you can use this feature to create a pivottable from an employee list that totals the salaries for each job categorycross-tabulated (arranged) by department or job site.

    In addition to generating a pivot table to summarize and analyze yourdata, you can also create a pivot chart that represents the data sum-maries graphically. Like pivot tables, pivot charts are also dynamic,enabling you to explore and display different relationships betweenthe various types of data, all on the fly.

    Creating Pivot TablesTo create a pivot table for a data list, open the worksheet with the list andthen choose DataPivot Table and PivotChart Report. The PivotTableand PivotChart Wizard launches, which contains the following three dia-log boxes:

    Step 1 of 3 (see Figure 49-1) is where you indicate the source of thedata that you want to summarize as well as choose between creatinga simple pivot table or a pivot chart, which represents the summarydata graphically with a supporting pivot table. The data source optionshere are Microsoft Excel List or Database, an External Data Source (seeTechnique 58), Multiple Consolidation Ranges, or Another PivotTableor PivotChart Report.


    Save Time By Summarizing data on the

    fly with a pivot chart

    Modifying the summaryfunction in a pivot table

    Illustrating the data sum-mary with a pivot chart

    56_574272 ch49.qxd 10/1/04 11:02 PM Page 291

  • Technique 49: Summarizing Data with Pivot Tables and Pivot Charts292

    Figure 49-3: Selecting the location of the new pivot table.

    After you finish going through the options offeredin the three dialog boxes of the PivotTable andPivotChart Wizard, you end up with a blank pivottable, as shown in Figure 49-4.

    Figure 49-4: New worksheet with blank pivot tablecomplete with PivotTable Field List taskpane and toolbar.

    Format Report

    Chart Wizard

    Show Detail Include Hidden Items in Totals

    Field Settings

    Hide Detail

    Refresh Data

    Always Display Items

    Show/Hide Field List

    Figure 49-1: Indicating the source of the data and thetype of report to create.

    Step 2 of 3 (see Figure 49-2) is where you indi-cate the data including field names that youwant to use in the Excel worksheet (when speci-fying a Microsoft Excel List or Database, MultipleConsolidation Ranges, or Another PivotTable orPivotChart Report as the data source), or exe-cute an external data query that gets the data(when specifying an External Data Source).

    Figure 49-2: Indicating the range of the data to use forthe new pivot table.

    Step 3 of 3 (see Figure 49-3) is where you indi-cate whether to place the pivot table in a newworksheet or in a cell range somewhere in thecurrent worksheet. When generating a pivotchart, Excel places the chart on its own chartsheet and places the support pivot table on thesheet that you specify.

    56_574272 ch49.qxd 10/1/04 11:02 PM Page 292

  • Creating Pivot Tables 293

    This new pivot table contains a blank frameworkwith the various areas of the pivot table identifiedin light gray type. Excel opens a floating PivotTableField List task pane that contains a complete list ofthe field names in your data source. You use thesefield names to bring the blank pivot table to life. Inaddition to the PivotTable Field List task pane, Excelalso displays a floating PivotTable toolbar in theExcel window.

    The key to completing the new pivot table is toassign the fields in the Field List task pane to thevarious parts of the table. You can do this job oneof two ways: by dragging a field name from the taskpane and then dropping it on a particular part ofthe pivot table; or by selecting the field name in theField List task pane, selecting the part of the table towhich to attach the field from the task panes drop-down list, and then clicking the Add To button.

    Before you begin this procedure, however, you needto understand the use and significance of the vari-ous areas of a pivot table:

    Drop Page Fields Here: This area contains thefields that enable you to page through the datasummaries shown in the actual pivot table byfiltering out sets of data. For example, if youdesignate the Date Hired field from the sampleEmployee data list as a Page Field, you can dis-play data summaries in the pivot table for indi-vidual years entered into this field or for allyears it contains.

    Drop Column Fields Here: This area containsthe fields that determine the arrangement ofdata shown in the columns of the pivot table.

    Drop Row Fields Here: This area contains thefields that determine the arrangement of datashown in the rows of the pivot table.

    Drop Data Items Here: This area contains thefields that determine which data are presentedin the cells of the pivot table and then summa-rized in its last column (totaled by default).

    To better understand how you can use these variousareas in a pivot table, consider the pivot table shownin Figure 49-5. For this pivot table, I assigned theProfit Sharing field from the data list (a logical fieldthat contains Yes or No to indicate whether anemployee is currently enrolled in the companysprofit-sharing plan) as the Page Field, the Dept field(containing the names of the various departmentsin the company) as the Column Field, the Locationfield (containing the names of the various cities withcorporate offices) as the Row Field, and the Salaryfield as the tables sole Data Item. As a result, thepivot table now displays the sum of the salaries forthe employees in each department (across thecolumns) and then presents these sums by theircorporate location (in each row).

    Figure 49-5: A pivot table after selecting its field and dataitems from the PivotTable Field List.

    Figure 49-6 shows you the pivot table after I changethe Page Field from its default setting of All, whichdisplays the sums for all employees regardless of

    Data Item

    Row Field

    Page Field

    Column Field

    56_574272 ch49.qxd 10/1/04 11:02 PM Page 293

  • Technique 49: Summarizing Data with Pivot Tables and Pivot Charts294

    at the very top. Each item in this list is precededby a check box. To remove items that are currentlyshown in the pivot table, you clear check boxes.To clear all the check boxes in one of these drop-down lists, clear the Show All check box. You canthen individually select the check boxes of the itemswhose values you still want displayed in the pivottable before clicking OK.

    Pivoting the fields in the table

    As the name pivot implies, the real fun of pivot tablescomes from changing how and what data appearsin the table at any time. Because the pivot tableremains dynamic, you can quickly and easily changewhat data the table contains as well as how the tablepresents the data by manipulating its fields.

    For example, suppose that, after making theDept field the pivot tables Column Field and theLocation field the Row Field, you decide that younow want the Location field to be the Column Fieldand the Dept field to be the Row Field? No problem:All you do is drag the Dept Field label from the toprow of the table and drop it in the first column andthen drag the Location Field label from the first col-umn and drop it on the first row. Presto! Excelrearranges the totaled salaries so that the rows ofthe pivot table show the departmental grand totalsand the columns now show the location grand totals,as shown in Figure 49-7.

    Figure 49-7: Pivoting the table so that Location is nowthe Column Field and Dept the Row Field.

    whether theyre currently part of profit sharing, toYes, which displays only the totals of the salaries foremployees who are now part of the plan. For this fig-ure, I also closed the Field List task pane (by clickingthe Hide Field List button on the PivotTable toolbar)and narrowed the columns in the table so that theynow all appear in the Excel window.

    Figure 49-6: The pivot table after changing the PageField from All to Yes.

    To change the Profit Sharing Page Field from All toYes, you simply click the drop-down button attachedto the cell, select Yes, and then click the OK buttonat the bottom of the drop-down list. (To display thesalary totals in the pivot table for those that arentyet enrolled in the profit-sharing plan, select No inthis list instead.)

    In addition to changing the way the data in the pivottable is filtered by selecting a new item in the PageFields drop-down list, you can also collapse andexpand the summary data in the body of the pivottable itself by selecting or unselecting particularitems from the Column fields and Row fields drop-down list.

    When you click one of these drop-down buttons,Excel displays a drop-down list box showing eachunique item in that field following a Show All item

    56_574272 ch49.qxd 10/1/04 11:02 PM Page 294

  • Creating Pivot Tables 295

    Pivoting existing fields within a table is not the onlychange you can make: You can also add new dataitems to the body of the pivot table or assign morefields to its Column Field and Row Field areas. Figure49-8 illustrates this situation.

    Figure 49-8: A pivot table after adding Sex as a PageField and adding Location as another RowField.

    This figure shows the same pivot table after makinga couple of key changes to the table structure. First,I added the Sex field from the PivotTable Field Listas a second Page Field by dragging it from thePivotTable Field List task pane (which I redisplayedby clicking the Show Field List button) and droppingthis field on top of the Profit Sharing Page Field.Then I added the Location field as a second RowField by dragging it from the top row of the pivottable (as shown in Figure 49-7) and dropping it ontop of the Dept Row Field. Finally, for this figure, Ichanged the setting in the Sex Page Field from thedefault of All to M and the Profit Sharing Page Fieldfrom Yes to No.

    As a result, the modified pivot table shown in Figure49-8 now shows the salary totals for all the menin the corporation arranged first by their depart-ment and then by location. Because I added Sex

    as a second Page Field, you can now see the totalsfor just the men or just the women who are or arentcurrently enrolled in the profit-sharing plan simplyby selecting the appropriate Page Field settings.

    Formatting the values in the pivot table

    One thing that stands out like a sore thumb in pivottables is the lack of number formatting for the valuesit summarizes. When Excel creates a new pivot table,it doesnt pick any formatting from the original datasource. You have to manually apply whatever num-ber formats and other kinds of table formatting thatyou want. Fortunately, Excel makes it easy to formatboth the individual fields of the pivot table as well asthe overall table itself.

    To format a particular pivot table field, double-clickone of the field labels in the table or select the labeland then click the Field Settings button on thePivotTable toolbar to open the PivotTable Fielddialog box for that field. To format the values sum-marized in the body of the pivot table, double-clickthe label that says Sum of followed by the name ofthe field whose values are being summarized in thebody of the table to open the PivotTable Field dialogbox (see Figure 49-9).

    Figure 49-9: Using the PivotTable Field dialog box toformat the sums in the pivot table.

    56_574272 ch49.qxd 10/1/04 11:02 PM Page 295

  • Technique 49: Summarizing Data with Pivot Tables and Pivot Charts296

    Figure 49-10: The pivot table after formatting the SalaryData Item and assigning an AutoFormat.

    Selecting new summary functions

    By default, Excel uses the SUM function to total thevalues in the numeric field(s) that you assign as theData Items in the pivot table. Some data summariesrequire the use of another summary function, suchas the AVERAGE or COUNT function. To change thesummary function that Excel uses, open the Fielddialog box for one of the Data Items fields (double-click the fields label at the intersection of the firstColumn Field label and the Row Field label).

    After you open the Field dialog box, you can changeits summary function from the default SUM to anyof the following functions by selecting it in theSummarize By list box:

    COUNT: Displays the count of the records fora particular category. (Note that COUNT is thedefault setting for any text fields that you useas Data Items in a pivot table.)

    AVERAGE: Calculates the average (that is, thearithmetic mean) for the values in the field forthe current category and page filter.

    MAX: Displays the largest numeric value in thatfield for the current category and page filter.

    If youre formatting a numeric field whose data ispresented in the body of the table (as a Data Item)and you want to assign a number format to this data,click the Number button. A simplified version of theFormat Cells opens that contains only a Number tabfrom which you can select the type of number for-mat that you want to use.

    If youre formatting a text field used as a Columnor Row Field in the pivot table and want to sortthe field labels in ascending or descending orderacross the top row or down the first column, clickthe Advanced button in its PivotTable Field dialogbox. Click the Ascending or Descending option but-ton in the AutoSort section of the PivotTable FieldAdvanced Options dialog box.

    To select an AutoFormat for the pivot table,position the cell pointer in any of the tablescells and then click the Format Report button.(If the PivotTable toolbar is not displayed, chooseFormatAutoFormat.) The program selects all thecells in the pivot table and opens up an AutoFormatdialog box. This AutoFormat dialog box contains alist with ten different sample Report formats fol-lowed by ten different sample Table formats, alongwith a sample PivotTable Classic format and a Noneformat. (Use the final option to remove any otherReport or Table formatting.)

    To assign a particular Report or Table format toyour pivot table, select its sample and click OK.Excel assigns all the formatting in the selectedReport or Table format to your pivot table. If youfind that youre not happy with the format youselected, press Ctrl+Z to remove all the new format-ting from the table and select another one from theAutoFormat dialog box.

    Figure 49-10 shows the sample pivot table I originallygenerated from the Employee data list after format-ting the Salary field (assigned as the tables DataItem) with the Accounting number format with zerodecimal places and assigning the Table 8 AutoFormatto the entire table.

    56_574272 ch49.qxd 10/1/04 11:02 PM Page 296

  • Creating Pivot Tables 297

    MIN: Displays the smallest numeric value in thatfield for the current category and page filter.

    PRODUCT: Displays the product of the numericvalues in that field for the current category andpage filter. (All non-numeric entries are ignored.)

    COUNT NUMS: Displays the number of numericvalues in that field for the current category andpage filter. (All non-numeric entries are ignored.)

    STDDEV: Displays the standard deviation for thesample in that field for the current category andpage filter.

    STDDEVP: Displays the standard deviation forthe population in that field for the current cate-gory and page filter.

    VAR: Displays the variance for the sample in thatfield for the current category and page filter.

    VARP: Displays the variance for the populationin that field for the current category and pagefilter.

    After you select the new summary function, click OKto have Excel apply the new function to the data pre-sented in the body of the pivot table.

    Creating a calculated field for the pivot table

    In addition to selecting among the various summaryfunctions to use on the data, you can create yourown calculated fields for the pivot table. Calculatedfields are computed by a formula that you create byusing existing numeric fields in the data source. Tocreate a calculated field for your pivot table, followthese steps:

    1. Select any of the cells in the pivot table.2. Click the PivotTable button on the PivotTable

    toolbar, and then from the pop-up menu,choose FormulasCalculated Field to open theInsert Calculated Field dialog box, shown inFigure 49-11.

    Figure 49-11: Creating a calculated field for the pivottable.

    3. Enter the name for the new field in the Nametext box.

    4. Select the Formula text box and then delete thezero (0) after the equal sign (=) and position the insertion point immediately following theequal sign.

    Now youre ready to type in the formula that per-forms the calculation.

    5. Enter the formula to perform the new fieldscalculation in the Formula text box, insertingwhatever fields you need by selecting the namein the Fields list box and then clicking the InsertField button and indicating the operation to beperformed on the fields with the appropriatearithmetic operators (+, -, *, or / ).

    For example, in Figure 49-11, I created a formulafor the new calculated field called Bonuses thatmultiplies the values in the Salary field by 2.5percent (0.025) to compute the total amount ofannual bonuses to be paid. To do create this for-mula, I selected the Salary field in the Fields listbox to show =Salary. Then I typed *0.025 tocomplete the formula (=Salary*0.025).

    56_574272 ch49.qxd 10/1/04 11:02 PM Page 297

  • Technique 49: Summarizing Data with Pivot Tables and Pivot Charts298

    List task pane and then select Data Area in the drop-down list at the bottom of the task pane before youclick the Add To button.

    Creating a Pivot ChartData tables arent the only things that Excel knowshow to pivot. In addition to creating a pivot tablethat summarizes information in a data list, you canalso have the program create a pivot chart as well.When you elect to create a pivot chart along witha pivot table by selecting the PivotChart Report(with PivotTable Report) option button in the Step 1of 3 PivotTable and PivotChart Wizard dialog box(refer to Figure 49-1), Excel always places the pivotchart on a new chart sheet. This happens regardlessof whether you choose to place the associated pivottable on a new worksheet or somewhere on theworksheet thats current when you open thePivotTable and PivotChart Wizard.

    Figure 49-13 shows how a typical pivot chart appearsin its own chart sheet right after you click the Finishbutton in the PivotTable and PivotChart Wizard.

    Figure 49-13: Generating a new pivot chart.

    6. When you finish entering the formula for yourcalculated field, click the Add button to add thecalculated field to the Pivot Table Field List.

    After you click the Add button, it changes to agrayed-out Modify button. If you start editing theformula in the Formula text box, the Modify but-ton becomes active so that you can click it toupdate the definition.

    7. Click OK to close the dialog box.

    As soon as you close the Insert Calculated Field dia-log box, Excel automatically adds its name to thePivotTable Field List task pane and assigns it as aData Item in the data area. The program also adds anew Data Field and makes it the first Column Field inthe pivot table, as shown in Figure 49-12.

    Figure 49-12: A sample pivot table after adding theBonuses calculated field as a Data Item.

    If you want to hide a calculated field from the bodyof the pivot table, click the Data Fields drop-downbutton to open the drop-down list showing all theData Fields (both calculated and not) and then clearthe calculated fields check box before you click OK.To then add the calculated field back into the pivottable, select its field name in the PivotTable Field

    56_574272 ch49.qxd 10/1/04 11:02 PM Page 298

  • Creating a Pivot Chart 299

    Note that when you choose to generate a pivot chartwith a pivot table, you actually generate the pivottable by building the chart on its chart sheet. Buildinga pivot chart is very similar to building a new pivottable: You assign fields from the data source (an Exceldata list in this example) shown in the PivotTableField List task pane (which I docked to the right ofthe chart area for this figure).

    As with the pivot table, you can assign fields to thepivot chart either by dragging them to the desig-nated areas in the chart (Drop Page Fields Here,Drop Data Items Here, Drop Series Fields Here, orDrop Category Fields Here) or by selecting the fieldname in the Task Pane Field List, and then selectingthe name of the chart area to which to assign thefield in the drop-down list and, finally, clicking theAdd To button.

    Figure 49-14 shows the same chart sheet shown inFigure 49-13 after assigning the data fields to the var-ious areas of the chart. In this example, I assignedthe Sex field as the charts Page Field, the Salaryfield as the Data Item, the Profit Sharing field as theSeries Field, and the Location field as the CategoryField. As a result, Excel generated a Stacked Columnchart that shows the total salaries for each corpo-rate location, differentiated in each column by thosewho are and those who are not enrolled in the profit-sharing plan. Because I designated the Sex field asthe Page Field, I can restrict the chart to show onlythe sum of the mens or womens salaries at eachlocation (differentiated by profit-sharing status)simply by selecting the M or F option on the pop-upmenu that appears when I click the Sex fields drop-down button.

    Figure 49-14: A completed pivot chart.

    Although Excel always chooses the Stacked Columnchart as the basic chart type for each new pivot chartthat you generate, you can select another chart typefor the pivot chart. To do so, simply click the ChartWizard button on the PivotTable toolbar or on theStandard toolbar to open the Chart Wizard - Step 1of 4 dialog box.

    Here, you can select a new chart type from among thetypes displayed on the Standard Types or the CustomTypes tab. When selecting a new chart type on theStandard Types tab, be sure that you select the Pressand Hold to View Sample button so that you can seeexactly how your pivot chart appears in the selectedtype. (You may be surprised to see how Excel has topivot the charts fields to accommodate the charttype you selected.) You can also use the Chart Wizardand Chart pull-down menu to enhance and furtherformat your pivot chart. (See Technique 23.)

    56_574272 ch49.qxd 10/1/04 11:02 PM Page 299

  • 56_574272 ch49.qxd 10/1/04 11:02 PM Page 300

  • Part VIII


    57_574272 pp08.qxd 10/1/04 11:04 PM Page 301

  • 57_574272 pp08.qxd 10/1/04 11:04 PM Page 302

  • 50 Saving Worksheetsas Web PagesThe subject of this technique is turning your worksheets into Webpages that you can publish to your Web site, either publicly on theWorld Wide Web or on your companys more private intranet.When you convert worksheets into Web pages, you have a choicebetween saving their data in static HTML (Hypertext Markup Language)tables or lists or in interactive ones that users can manipulate online as long as theyre running Microsofts Internet Explorer 4.0 or later(6.0 is the current version as of this writing). Interactive Web pagesuse special programs called Office Web Components that provide theperson browsing the Web pages with a set of limited controls for makingbasic changes to the worksheet data and charts online.

    Saving Worksheets as Web PagesConverting your favorite spreadsheet into a Web page ready for publish-ing on a Web site is no more complicated than opening the worksheet inExcel and then choosing FileSave as Web Page.

    To help you visualize how the spreadsheet-as-Web-page will appear whenviewed in your default Web browser, you can use the Web Page Previewfeature. To do this, choose FileWeb Page Preview. This action launchesyour computers default Web browser (usually this is Internet Explorerunless youve specifically installed and selected a different browser) anddisplays the spreadsheet more or less as it will appear in that browserwhen saved as an HTML file. Figure 50-1 shows a preview of the sampleCG Media 2003 Sales worksheet previewed in Internet Explorer 6.0.

    You cant save your spreadsheet as a Web page if the file is password-protected. If youve assigned a password to open the workbook or tomodify the worksheet, you need to remove the password before youtry saving the worksheet as a Web page. (See Technique 38).


    Save Time By Saving worksheets as

    static Web pages

    Saving worksheets asdynamic Web pages

    58_574272 ch50.qxd 10/1/04 11:10 PM Page 303

  • Technique 50: Saving Worksheets as Web Pages304

    Note that the Selection option button changesname depending upon if anything is selected inthe worksheet and whether or not the sheet haspreviously been saved as a Web page (in whichcase, the button becomes Republish: Sheet).

    By default, Excel selects the Entire Workbookoption button, meaning that all the worksheetsin the workbook that contain data will beincluded in the new HTML file.

    5. If you want to add a page title to your HTMLfile, click the Change button, type the headingin the Page Title text box of the Set Page Titledialog box, and click OK.

    A page title appears centered at the top of thepage right above your worksheet data. Dont con-fuse the page title with the Web page header thatappears on the Web browsers title bar. (The onlyway to set the Web page header is to edit itsHTML tag after the HTML file is created.)

    6. Click the Save button to save the file and closethe Save As dialog box.

    Figure 50-2: Saving a worksheet as a Web page in thisversion of the Save As dialog box.

    Excel saves the file and returns you to the Excel win-dow (which now contains the HTML version of yourworkbook or worksheet in place of the original .xlsfile). You can then open the new HTML file in yourWeb browser by launching the browser, choosingFileOpen on its menu bar, and navigating to thefile you just saved.

    Figure 50-1: Previewing the worksheet to save as aWeb page.

    If you decide that you want to save the spreadsheetas a Web page after previewing it in your Webbrowser, follow these steps to save the currentworksheet or entire workbook as a Web page:

    1. Choose FileSave as Web Page to open a spe-cial version of the Save As dialog box, shownin Figure 50-2.

    2. In the Save In drop-down list box, select thefolder in which you want to save the HTML file.

    3. Enter the filename for the new HTML file in theFile Name text box.

    Note that Excel automatically appends the file-name extension .htm (Hypertext Markup) towhatever filename you enter here if youre savingonly the current worksheet. If youre saving anentire workbook that has data on more than oneworksheet, Excel appends the filename extension.mht (Multiple Hypertext). When selecting a file-name, keep in mind that some file servers (espe-cially those running some flavor of UNIX) aresensitive to upper- and lowercase letters in thename.

    4. If you want to save only the current worksheetin the new HTML file, click the Selection: Sheetoption button.

    58_574272 ch50.qxd 10/1/04 11:10 PM Page 304

  • Saving Worksheets as Web Pages 305

    Opening your new Web page at the time you save it

    If you want, you can open your new Web page inyour computers Web browser immediately after sav-ing it. To do this, click the Publish button in the SaveAs dialog box after specifying what part of the work-book to save. When you click this button, Excelopens the Publish as Web Page dialog box, shownin Figure 50-3.

    Figure 50-3: Saving the entire workbook as a Web pageto be immediately opened in the Webbrowser.

    You then need to follow these steps:

    1. In the Item to Publish drop-down list box,select what part of the workbook you want tosave in the HTML file.

    By default, Excel selects Items on Sheet1 (orwhatever your first worksheet is named). Tosave all the worksheets in the workbook, selectEntire Workbook on this drop-down list. To saveonly the range of cells youve selected, selectRange of Cells.

    2. To make the Web page interactive, select theAdd Interactivity With check box and thenselect the type of interactivity (Spreadsheet,Chart, or PivotTable) in the drop-down list boxto its right.

    See the section Creating Interactive Web Pages,later in this technique, for details on the varioustypes of Web interactivity that Excel supports.

    3. To add a page title or to edit the one you addedin the Save As dialog box, click the Change but-ton, make the changes in the Set Title dialogbox, and then click OK.

    4. To select a new folder and assign a new file-name (other than Page.htm, which Excelassigns by default), edit the pathname in theFile Name text box; or, click the Browse buttonselect the appropriate folder, enter the desiredfilename, and click OK.

    5. Select the AutoRepublish Every Time ThisWorksheet Is Saved check box if you wantExcel to automatically save all changes youmake in the Excel worksheet or workbook inthe HTML file that you create with its data.

    6. Clear the Open Published Web Page in Browsercheck box only if you dont want to open theHTML file that youre creating in your Webbrowser as soon as you click the Publishbutton.

    7. Click the Publish button to close the Publish asWeb Page dialog box.

    If you kept the Open Published Web Page in Browsercheck box selected, Windows then launches yourcomputers Web browser and opens the newly savedHTML version of the worksheet or workbook in thisprogram. When you finish reviewing the Web page,close your browser to return to Excel with your orig-inal worksheet.

    Saving all the worksheets in a workbook

    When you save an entire workbook containing sev-eral sheets of data, Excel saves all the data on each

    58_574272 ch50.qxd 10/1/04 11:10 PM Page 305

  • Technique 50: Saving Worksheets as Web Pages306

    The First Sheet () button displays the next sheet.

    The Previous Sheet (

  • Creating Interactive Web Pages 307

    Just keep in mind that anytime you add a worksheetto an existing Web page, Excel appends the worksheetdata to the very bottom of the existing Web page.

    The steps for saving a worksheet as part of an exist-ing HTML file are virtually the same as for saving aworksheet in a new file. The only difference is thatin the File Name text box in Save As dialog box, youenter or select the name of the existing file to whichthe new HTML version of the worksheet will beappended. Also, when you click the Save button, anAlert dialog box appears in which you click the Addto File button rather than the Replace File or Cancelbutton.

    You cant save an entire workbook as part ofan existing Web page. When you select thename of an existing HTML file when the EntireWorkbook option button is selected, your onlychoices are to replace the file or cancel theaction of saving it. If you click the Replace Filebutton in the Alert dialog box that appears,you end up getting rid of the original filerather than adding new data to it!

    Creating Interactive Web PagesIf you know that the users of your Web pages con-taining Excel data will be using Internet Explorer(Version 4.0 or later) to view them, you can make itpossible for them to manipulate the data and makemodest modifications to the worksheet data whenviewing the pages in their Web browser. All you needto do to make this happen is to select the AddInteractivity check box in the Save As dialog box atthe time you save the worksheet as a Web page.

    The types of manipulations and changes that userscan make to the spreadsheet data of an interactiveWeb page in Internet Explorer depend upon the typeof data that the page contains:

    Worksheet data tables: Users can edit the cellentries and have the tables formulas updatedeither automatically or manually as well as mod-ify the formatting of the cells in the table.

    Data lists: Users can sort and filter the data inthe list as well as modify field entries and makeformatting changes to the list.

    Pivot tables: Users can pivot the fields in a tableas well as add new fields. They can also refreshthe table data from the external data source(assuming that this source is accessible from theWeb page), show details for any of the summa-rized data in the table, add calculated fields tothe table, and page through the summaries byusing different items in the Page Fields. (SeeTechnique 49.)

    Charts: Users can edit supporting data (shownbeneath the chart as an attached data table) andhave the chart automatically updated on the page.

    Figure 50-5 shows you how a typical interactive datatable appears on a new Web page after opening it inInternet Explorer 6. Notice that the interactive tableis self-contained with a toolbar at the top, a facsimileof the worksheet row and column header at the top,and vertical and horizontal scroll bars on the rightand the bottom. Notice also that this table uses grid-lines to demarcate the cells and sports a sheet tabat the bottom, just like a regular Excel workbookwindow.

    The Office Web Components add horizontal and ver-tical scroll bars to the interactive table because youhave no way to resize the table. You must use thescroll buttons to bring new parts of the data tableinto view on the Web page. Likewise, the row andcolumn headers are automatically displayed to giveyou a way to widen or narrow the columns andheighten or shorten the rows by dragging the appro-priate border of a column letter or row number.

    Despite the obvious similarities to the Excel work-sheet window, you can see some noticeable differ-ences as well. The most significant difference is thatthe interactive spreadsheet table has no Formula baror menu bar.

    Without a Formula bar, you cant tell which values inthe table are calculated by formulas and which areinput as constants. Also, the only way to edit a table

    58_574272 ch50.qxd 10/1/04 11:10 PM Page 307

  • Technique 50: Saving Worksheets as Web Pages308

    insert or delete the columns or rows that are cur-rently selected.

    To make up for the lack of a menu bar, the tool-bar above the interactive worksheet contains aCommands and Options button. When you clickthis button, a Commands and Options dialog boxwith four tabs Format, Formula, Sheet, andWorkbook appears, as shown in Figure 50-6.

    Figure 50-6: Use the controls in this dialog box to makechanges to an interactive worksheet table.

    These four tabs enable you to make the followingtypes of changes:

    The Format tab contains buttons and boxes forchanging the font, size, alignment, border, andcell and text color of any cells that youveselected.

    The Formula tab contains boxes that enable youto see the contents (very helpful when dealingwith long formulas) and value of the active cell,along with all the range names defined in thetable. You can even use its Define button todefine a new range name for the current cellselection.

    cell is by double-clicking the cell and then editingthe entry there (at which time, you can immediatelytell whether its a value or a formula that youreediting).

    Figure 50-5: Interactive HTML worksheet opened inInternet Explorer.

    Without a menu bar, you must pretty much relyupon the buttons on the toolbar to make changesthat affect the entire table. The only other way toaccess commands that affect the table is by right-clicking on one of the table cells to display its short-cut menu. The items on this shortcut menu duplicatethe functions of the buttons at the top of the table,with the exception of the Insert and Delete items.These menu items both lead to the Rows andColumns submenu options that enable you to either





    Auto Sum

    Sort Ascending Sort Descending

    Auto Filter

    Refresh All

    Export to Microsoft Excel

    Commands and Options


    58_574272 ch50.qxd 10/1/04 11:10 PM Page 308

  • Creating Interactive Web Pages 309

    The Sheet tab is divided into Find What andShow/Hide sections. To find some text or valuesin the table, enter the search text in the FindWhat text box and then click the Find Nextbutton (using the Match Case and Entire CellOnly check boxes if you need to refine thesearch). Select or deselect the Show/Hide checkbox options (Row Headers, Column Headers,Gridlines, and Display Right to Left) to controlwhich interior table elements to display or hide.

    The Workbook tab is divided into Calculation,Show/Hide, and Worksheets sections. Use theManual and Automatic option buttons to switchfrom automatic recalculation (the default) tomanual recalculation (in which case, you clickthe Calculate button to update table formulas).

    Use the Show/Hide check box options (HorizontalScrollbar, Vertical Scrollbar, Sheet Selector, orToolbar) to control which overall table elementsto display or hide. (Note that you cant removethe scroll bars when the table is too large toshow all the data in the table.)

    Use the Sheet Name text box to rename the tablesheet thats selected in the list box below, theInsert button to insert a new sheet into the table,the Delete button to remove the current sheet,and the Hide button to hide the current sheet inthe table.

    Use the Order buttons to move the currentsheet ahead of (with the button with the upward-pointing arrow) or behind (with the button withthe downward-pointing arrow) the other sheetsin the table.

    Unfortunately, you cant save any of thechanges that you make to an interactive Webpage in Internet Explorer. The only way tosave any formatting or editing changes youmake to an interactive data table, data list, orpivot table is to export the page back to Excelas an XML (Extensible Markup Language)file and then save the changes there. SeeTechnique 51 for more on using XML datain Excel.

    58_574272 ch50.qxd 10/1/04 11:10 PM Page 309

  • 51 Importing WebData into theWorksheetThe subject of this technique is getting Web data from the Internetor some other source into your Excel worksheets. The first tech-nique I cover is called a Web query. Web queries enable you toimport text and tables from a Web page directly into the worksheet. Thegreat thing about Web queries is that once you set them up, you can savethem and then use again and again to import the data (which, like stockquotes used in the example, are subject to rapid change).

    For those of you using Excel 2003 (the latest and greatest version of theprogram), I offer you another way to get Web data into your worksheetby using the program to open an XML (Extensible Markup Language)data file. Excel 2003 supports the use of this relatively new Web file for-mat that is on the way to becoming the new lingua franca (universal lan-guage) for all types of computers (all the way from PCs to mainframesand everywhere in between). In practice, using XML files enables you(with the help of your friendly IT department) to effectively use the Excelworksheet as a front end for your companys database and/or intranet.

    Capturing Information for the Spreadsheetwith Web QueriesYou can use Excels Web Query feature to extract text or tables (or a com-bination of the two) from Web pages on the World Wide Web and bringtheir data into an Excel worksheet. Doing a Web query is a lot like per-forming an external database query (see Technique 59) except thatinstead of extracting data from an external database, youre taking itout of a Web page on the Internet.

    The key to being able to do a Web query is having the URL of the Website whose data you want to query. (You know, the http://-type addressthat appears on the Address bar of your Web browser when you visit asite.) You must have this address handy at the time you start the newWeb query because the New Web Query dialog box doesnt provide a


    Save Time By Importing Web page text

    or tables via a Web query

    Importing XML data intoExcel

    59_574272 ch51.qxd 10/1/04 11:10 PM Page 310

  • Capturing Information for the Spreadsheet with Web Queries 311

    way to search the Internet, nor does it give youaccess to your Web favorites as you have in yourWeb browser.

    To capture a URL for the page that you wantto query, visit the Web site in your Webbrowser by using your Web favorites or itssearch capability. Then highlight the URL thatappears in the Web browsers Address bar andcopy it into the Clipboard before you switchback to Excel. There, select the text currentlydisplayed in the Address bar of the New WebQuery dialog box (refer to the steps that fol-low) and paste the pages URL address intothis text box by pressing Ctrl+V.

    To perform a new Web query in Excel, follow thesesteps:

    1. Open the worksheet where you want the Webdata to reside and position the cell pointer inthe first cell where you want the imported datato appear.

    2. Choose DataImport External DataNew WebQuery to open the New Web Query dialog box,shown in Figure 51-1.

    When the New Web Query dialog box opens,Excel connects you to the Internet and displaysyour Web browsers home page.

    3. Enter the URL address of the Web site whosedata you want to extract.

    4. Click the Go button to visit the page.The first part of the page that you visit appearswithin the body of the New Web Query dialog box.

    5. Click somewhere on the Web page to make itactive.

    After the Web page is active, Excel shows whichelements on the page you can import by display-ing yellow buttons with black arrows pointing tothe right in front of each table or text, and youcan then move new parts of the Web page intoview by pressing the arrow keys (, , , or ).

    Figure 51-1: Starting a new Web query.

    6. Select all the tables and text on the Web pagethat you want to import into your Excel work-sheet, as shown in Figure 51-2.

    To select a table or text on the page for import-ing, click its yellow button, whereupon itchanges to a green button containing a blackcheck mark indicating that its selected.

    Figure 51-2: Selecting the Web data to import into theExcel worksheet.

    59_574272 ch51.qxd 10/1/04 11:10 PM Page 311

  • Technique 51: Importing Web Data into the Worksheet312

    10. Select the appropriate option in the WhereDo You Want to Put the Data section and thenclick OK.

    By default, Excel selects the Existing Worksheetoption and selects the current cell as the place atwhich to starting importing the Web data. If youwant to import the Web data at the beginning ofa new worksheet, select the New Worksheetoption instead. If you want to import the data inthe current worksheet but starting at a differentcell, enter its cell address in the text box or clickit directly in the worksheet.

    As soon as Excel closes the Import Data dialog box,the program begins importing the selected Webdata. Because this procedure can take some time,depending upon how much data youre importingand how fast your Internet connection is, Excelinserts a temporary message Getting data in thecurrent cell. The actual Web data replaces the mes-sage as its imported.

    After the data is imported into the worksheet, Exceldisplays the External Data toolbar in the window, asshown in Figure 51-4. You can then click its EditQuery button to revisit the Web page in the Edit WebQuery dialog box. You can modify which tables andtext to import or click its Refresh button to updatethe data a very important feature when youimport data such as stock quotes that you definitelywant to keep up-to-date.

    If you save the Web query, you can redo thequery at any time simply by choosingDataImportant External DataImport Dataand then selecting its .iqy file. When openinga saved Web query, all you have to do is spec-ify where to place the imported data in theImport Data dialog box to once more get thedata from the Web page.

    After you select all the elements on the Webpage, you can either click the Import button togo ahead and bring in the selected text and dataor first save the Web query in a separate queryfile (with an .iqy filename extension for anInternet query).

    To save your query for reuse, follow Step 7.Otherwise, skip to Step 8.

    7. Click the Save Query button to open the SaveQuery dialog box, enter the name for your Webquery in the File Name text box, and click theSave button.

    When importing data and text from Web pagesinto a worksheet, Excel doesnt bother to retainthe Web page formatting. If you want the data inyour worksheet to look exactly as it does on theWeb page with all its fonts and colors, you needtake Step 8. If youre only concerned with theraw data, skip to Step 9.

    8. Click the Options button, select either the FullHTML Formatting or the Rich Text FormattingOnly option in the Web Query Options dialogbox, and then click OK.

    When choosing between the HTML Formattingand Rich Text Formatting Only options, keep inmind that Excel renders RTF formatting morefaithfully than the HTML formatting.

    9. Click the Import button.The New Web Query dialog box closes, and theImport Data dialog box opens, where you indi-cate where to import the data, as shown inFigure 51-3.

    Figure 51-3: Selecting where in the Excel worksheet toimport the Web data.

    59_574272 ch51.qxd 10/1/04 11:10 PM Page 312

  • Importing XML Data into a Worksheet 313

    Figure 51-4: The worksheet after importing the Web dataselected in a new Web query.

    Importing XML Datainto a WorksheetXML (Extensible MarkUp Language) is a markuplanguage that is used just like its cousin, HTML(HyperText Markup Language) to render Web pageson the Internet. This means that it uses codes calledtags to define a documents structure and appear-ance. Unlike HTML, whose tags are all predefinedand set in stone (at least until a new version comesout), XML is extensible in the sense that you (well,actually not you, but a trained programmer) candefine and create new tags as needed for any partic-ular project.

    Another difference between HTML and XML is thatXML actually describes the structure and meaningof its data whereas HTML defines only how its datalooks (and beauty, as they say, is only skin-deep). It isthis quality that makes XML so valuable in terms ofsharing data among different incompatible systems

    Edit Query

    Data Range Properties Refresh Data

    Refresh All

    because it makes it easy to reuse the data whereverits needed.

    XML has three distinct types of files to accomplishits magic:

    XML Data files (using the .xml filename exten-sion) containing your data plus XML tags thatdescribe its meaning and structure

    XML Schema files (using the .xsd filename exten-sion) defining the rules for what you can andcant put in your XML data files

    XML Transform files (using the .xsl filenameextension) that enable the use of the XML datain a variety of programs or files and can auto-mate data exchange between different applica-tions and control its visual display

    The XML features I describe in this section except for the option of saving files in theXML spreadsheet format are available onlyif youre using Excel 2003 either as part of theMicrosoft Office Professional Edition or pur-chased as a stand-alone unit. If you arentusing this version, you cant import XML datafiles.

    In Excel 2003, you need to create an XML map thatlinks certain cells in your worksheet to the schemaused by your XML file. If an outside source such asyour IT department hasnt provided you with anXML schema file, Excel infers one from the structureof the XML file itself. You can then use the schemathat Excel creates to make your map and into whichyou then load the XML data as an Excel 2003 list.(See Technique 53.)

    You cant save a workbook as an XML fileuntil you create an XML map.

    When you first open an XML data file in Excel, theOpen XML dialog box appears. This dialog box givesyou the following choices to open the file:

    59_574272 ch51.qxd 10/1/04 11:10 PM Page 313

  • Technique 51: Importing Web Data into the Worksheet314

    Figure 51-6: The alert dialog box indicating that Excel willcreate the necessary XML schema file.

    4. Click OK.The XML Source task pane appears on the rightside of the Excel window, as shown in Figure51-7. Note that the XML Source task pane showsthe schema created from the XML data file andthat a floating List toolbar appears in the body ofthe worksheet. You then create the XML mapby dragging the pertinent fields from the XMLSource task pane to the desired cells in theworksheet.

    Figure 51-7: The XML Source task pane shows theschema file.

    As an XML List: Select this option to view the XMLdata as an Excel 2003 list. (See Technique 53.)

    As a Read-Only Workbook: Select this optionto open the XML data file in read-only mode a mode that doesnt enable you to save anychanges you make to the original file.

    Use the XML Source Task Pane: Select thisoption to map the data to a schema into whichyou can then load its data.

    To see how easy you can generate an XML schemaand then use it to create an XML map into which toload its data, follow along with these steps:

    1. Open a new workbook in Excel and thenchoose FileOpen.

    2. Select XML Files (*.xml) in the Files of Typedrop-down list, select the XML file you want toopen in the Look In list box, and then click theOpen button.

    This action opens the Open XML dialog box,where you indicate how to open the XML file.(See Figure 51-5.)

    Figure 51-5: Deciding how to open the XML file.

    3. Select the Use the XML Source Task Paneoption and then click OK.

    An alert dialog box appears if the XML data filedoes not refer to an XML schema file or the filedoes not exist (see Figure 51-6). This dialog boxindicates that Excel will create the necessaryschema from the XML source data.

    59_574272 ch51.qxd 10/1/04 11:10 PM Page 314

  • Importing XML Data into a Worksheet 315

    5. Enter labels in the worksheet to identify thefields in the schema that you want to map.Enter these labels in the cells above or to theleft of those cells where you intend to maptheir fields.

    6. Drag the name of the field from the schema tothe cell in the worksheet (next to its identifyinglabel) where you want the data to appear, asshown in Figure 51-8.

    Figure 51-8: The worksheet after mapping the data fieldsin the schema to the worksheet.

    7. Make sure that one of the mapped cells isselected and then choose DataXMLImportto open the Import XML dialog box.

    8. Select the XML file whose data you want toimport into the worksheet with the XML mapin the Look In drop-down list and then clickthe Import button.

    Excel imports the data from the XML file into theappropriate mapped cells in the worksheet. (SeeFigure 51-9.)

    9. Choose FileSave As to open the Save As dia-log box, select the appropriate folder, edit thefilename, and click the Save button.

    After saving the XML data as an Excel workbook, youcan reopen it and refresh the data from the XMLsource at anytime. Note, however, that by default,

    when updating data from an XML source, the pro-gram overwrites the original data in the worksheet.If you want Excel to add to the existing information,you must change this setting.

    Figure 51-9: The worksheet after populating the map byimporting the XML data.

    To do this, choose DataXMLXML Map Propertiesto open the XML Map Properties dialog box. Selectthe Append New Data to Existing XML Lists option(see Figure 51-10) and click OK.

    Figure 51-10: Changing the refresh data setting forXML lists.

    59_574272 ch51.qxd 10/1/04 11:10 PM Page 315

  • Technique 51: Importing Web Data into the Worksheet316

    To refresh the data from an updated XML sourcefile (assuming that it has the same name as theoriginal file), open the worksheet containing themapped XML data and then choose DataXMLRefresh XML Data.

    59_574272 ch51.qxd 10/1/04 11:10 PM Page 316

  • 52 Using Hyperlinksto Make Jumpsin WorkbooksNowadays, everybody knows that hyperlinks are the underlined textor graphics on Web pages that you click to take you directly tosome other part of the Web site or even, in some cases, to a newWeb site on the Internet. What you may not know is that you can addthese kinds of links in your worksheet that connect to a favorite Webpage on the Internet or just your companys intranet. In addition, youcan create hyperlinks that take you to a different part of the same work-sheet, to another worksheet in the same workbook, or to another work-book or other type of document on your hard disk or on a network driveto which you have access.

    This technique covers the creating and editing of all these types ofhyperlinks. It also shows you how you can assign these links not justto the text entries you make in the worksheet or one of its graphicobjects but also to custom menus and toolbars that you build.

    Adding Hyperlinks to a WorksheetTo add hyperlinks to your Excel worksheet, you must define two things:

    The object to which the link is anchored and which you must click toactivate

    The destination where the link takes you when you activate it

    You can attach hyperlinks to any text entry you make in a worksheet cellor to any graphic object that you draw or import into the worksheet. (SeeTechnique 56.) The destinations that you can specify for your hyperlinkscan be inside the workbook or outside of it (including another Excelworkbook or other type of document, Web page, or even an e-mailaddress).


    Save Time By Adding hyperlinks that

    take you to new locationswithin the workbook

    Adding hyperlinks thattake you outside of theworkbook

    Editing hyperlinks withoutactivating them

    60_574272 ch52.qxd 10/1/04 11:11 PM Page 317

  • Technique 52: Using Hyperlinks to Make Jumps in Workbooks318

    2. Choose InsertHyperlink and click the InsertHyperlink button. Or press Ctrl+K to open theInsert Hyperlink dialog box. (See Figure 52-1.)

    Figure 52-1: Adding a new hyperlink in the InsertHyperlink dialog box.

    If you selected a graphic object or a cell that con-tains some entry besides text before opening thisdialog box, you notice that the Text to Displaytext box contains and that this box is grayed out (because thereisnt any text to edit when anchoring a link to agraphic). If you selected a cell with a text entry,that entry appears in the Text to Display textbox. You can edit the text in this box; however,be aware that any change you make to the texthere is also made to the entry in the currentcell as soon as you close the Insert Hyperlinkdialog box.

    3. Click the ScreenTip button located to the imme-diate right of the Text to Display text box andthen type the text that you want to appear nextto the mouse pointer in the Set HyperlinkScreenTip dialog box (see Figure 52-2). Thenclick its OK button to return to the InsertHyperlink dialog box.

    A ScreenTip is text describing the function ofthe link when you position the mouse pointerover the cell or graphic object to which the linkis attached. Note that if you dont add your ownScreenTip, Excel automatically creates its ownScreenTip that lists the destination of the newlink when you position the mouse pointer on itsanchor.

    The destinations inside the workbook with the linkscan include

    Cell reference of a cell in any of the worksheetsin the workbook.

    Range name of the group of cells that you want toselect when you click the hyperlink. (The rangename must already exist at the time you createthe link see Technique 26.)

    The destinations outside the workbook with thelinks can include

    Filename of an existing file that you want toopen when you click the hyperlink. This filecan be another workbook file or any other typeof document that your computer can open.

    URL of a Web page that you want to visit whenyou click the link. This page can be on your com-panys intranet or on the World Wide Web and isopened in your Web browser.

    New document that you want to create in Excelor some other program on your computer whenyou click the hyperlink. You must specify the file-name and file extension, which indicates whattype of document to create and what program tolaunch.

    E-mail address for a new message that you wantto create in your e-mail program when you clickthe hyperlink. You must specify the recipientse-mail address and the subject of the new mes-sage when creating the link.

    The steps for creating a new hyperlink in the work-sheet are very straightforward. The only thing youneed to do beforehand is either to add the text entryto the cell to which you want to anchor the link or todraw or import the graphic object to attach the linkto. Then to add a hyperlink to the text in this cell orthe graphic, follow these steps:

    1. Position the cell pointer in the cell containingthe text or click the graphic object to which youwant to anchor the hyperlink.

    60_574272 ch52.qxd 10/1/04 11:11 PM Page 318

  • Adding Hyperlinks to a Worksheet 319

    Figure 52-2: Adding a custom ScreenTip for the newhyperlink.

    4. Select the type of destination for the new linkby clicking its button in the Link To panel. Yourchoices are

    Existing File or Web Page: Assign the linkdestination to a file on your hard drive orto a Web page. This option is the default.

    Place in This Document: Link to a cell or cellrange in the current workbook.

    Create New Document: Link to a newdocument.

    E-Mail Address: Link to a new e-mail message.

    5. Specify the destination for the new hyperlinkby using the text boxes and drop-down liststhat appear for the type of link destination thatyou selected.

    How you specify this destination depends uponwhich type of link youre adding; see the follow-ing instructions for details.

    Existing File or Web: To link to an existingfile, open its folder in the Look In drop-downlist and then select its file icon in the list box.If youre linking to a Web page, enter the URL(as in http:// and so on) in the Address textbox. If the file or Web page that you selectcontains bookmarks (or range names in thecase of another Excel workbook) that namespecific locations in the file to which you link,click the Bookmark button, select the name ofthe location (bookmark) in the Select Place inDocument dialog box, and click OK.

    Place in This Document: To link to a celladdress or name range in the current work-book, enter the address of the cell to link toin the Type the Cell Reference text box. Selectthe name of the sheet that contains this cell.The sheet name may be listed under the CellReference range or the Defined Names head-ing that appears in the Or Select a Place inThis Document list box.

    Create New Document: To create a new docu-ment to link to, enter a filename for the newdocument in the Name of New Document textbox. Include the three-letter filename exten-sion if this new document is not an Excelworkbook .doc to create a new Word docu-ment, for example, or .txt to create a newtext file. To specify a different folder in whichto create the new document, click the Changebutton to the right of the current path andthen select the appropriate drive and folderin the Create New Document dialog box.If you want to edit the contents of the newdocument right away, leave the Edit the NewDocument Now option selected. If you preferto edit the new document at a later time,select the Edit the New Document Lateroption instead.

    E-Mail Address: To create a new e-mail mes-sage in your e-mail program when the hyper-link is clicked, enter the e-mail address (as ingharvey@mindovermedia.com) in the E-MailAddress text box and then enter the subjectof the new e-mail message in the Subject textbox.

    6. Click OK.

    Excel closes the Insert Hyperlink dialog box andreturns you to the worksheet with the new link(unless you specified that the new link is to createa new document and you left the Edit New DocumentNow option selected, in which case, youre in a newdocument, possibly in another application programsuch as Microsoft Word). If you anchored your new

    60_574272 ch52.qxd 10/1/04 11:11 PM Page 319

  • Technique 52: Using Hyperlinks to Make Jumps in Workbooks320

    Figure 52-3: A table of contents worksheet withhyperlinks to the other sheets in theworkbook.

    Following Links in a WorksheetAfter you follow a hypertext link to its destination,the color of its text changes from the traditionalblue to a dark shade of purple (without affectingits underlining). This color change indicates thatthe hyperlink has been followed. (Note, however,that graphic hyperlinks dont show any change incolor after you follow them.) Followed hypertextlinks regain their original blue color when youreopen their workbooks in Excel.

    To help navigate the links in your workbook, you candisplay the Web toolbar and use its buttons. To openthe Web toolbar, choose ViewToolbarsWeb.Figure 52-4 shows the Web toolbar and identifieseach of its unnamed buttons.

    The Address combo box on the Web toolbar not onlyshows you the address of the current workbook butalso stores all the addresses of the various docu-ments that youve opened and Web pages thatyouve visited. You can then reopen a document orrevisit a Web page simply by clicking its path or URLon the Address drop-down list.

    hyperlink to a graphic object, that object is stillselected in the worksheet. (To deselect the object,click a cell outside of its boundaries.) If you anchoredyour hyperlink to text in the current cell, the textnow appears in blue and is underlined. (You maynot be able to see the underlining until you move thecell pointer out of the cell.)

    Whenever you position the mouse pointerover the cell or the graphic object with thehyperlink, the mouse pointer changes fromthe thick, white cross pointer to a hand withthe index finger pointing up, and theScreenTip that you assigned appears belowand to the right of the hand.

    If you didnt assign a custom ScreenTip to the hyper-link, Excel displays a text box containing the URL orpathname of the links destination. If the link is ahypertext link (that is, if its anchored to a cell con-taining a text entry), the program appends the fol-lowing message to the end to the URL or pathnamethats listed:

    Click once to follow. Click and hold toselect this cell.

    Figure 52-3 shows a table of contents worksheet thatcontains a bunch of hyperlinks to the various sheetsand charts in the workbook. As you can see, when Iposition the hand mouse pointer on the hypertext ofthe first of the many links, Excel displays the longpathname to the cell A1 on the Total Income work-sheet, followed by the message about clicking onceto follow the link and clicking and holding to selectits cell instead.

    You can also assign a hyperlink to a spread-sheet cell or graphic object (see Technique 56)by right-clicking on it and then selectingHyperlink on the shortcut menu. Excel opensthe Insert Hyperlink dialog box where youdefine the destination and ScreenTip for thenew link as described earlier in this section.

    60_574272 ch52.qxd 10/1/04 11:11 PM Page 320

  • Creating Hyperlinks for Custom Menus and Toolbars 321

    Figure 52-4: You can use the buttons on the Web toolbarto navigate the links in a workbook.

    When you follow a link that opens a Web page oranother Office document, you can use the Back andForward buttons to go back and forth between theExcel workbook with your hyperlinks and the desti-nation document or Web page. For example, sup-pose that you create a hypertext link in a cell of yourspreadsheet that opens your favorite financial pageon the World Wide Web. When you click the hyperlinktext, Excel launches Internet Explorer, connects youto the Internet, and takes you directly to that page.

    After browsing the information on the financial Webpage, you may need to return to your Excel spread-sheet to check some data. Without closing theInternet Explorer window, click the Back buttonon the Internet Explorers toolbar to return to theworksheet. From there, you can go right back toyour financial Web page by clicking the Forwardbutton on the Web toolbar.

    You can continue going back and forthbetween the Web page and the Excel spread-sheet as long as you like just by using theBack and Forward buttons on their respectivetoolbars. This way is perfect to go to and frowhen youre copying and pasting informationfrom the Web page into your worksheet.

    Editing Links in a WorksheetThe only trick to editing a link is that you have to bereally careful not to activate the link during the edit-ing process. You must always remember to Ctrl+click




    Start Page

    Show Only Web Toolbar


    Search the Web Address

    or right-click on the links hypertext or graphic toselect the link that you want to edit because simplyclicking activates the link.

    When you right-click a link, Excel displays its short-cut menu. If you want to modify the links destina-tion or ScreenTip, select the Edit Hyperlink option.The Edit Hyperlink dialog box opens with the sameoptions as the Insert Hyperlink dialog box. (Referto Figure 52-1.) You can then use the Link To buttonson the left side of the dialog box to modify the linksdestination or the ScreenTip button to add or changethe ScreenTip text.

    If you want to remove the hyperlink from a cell entryor graphic object without getting rid of the text entryor the graphic, right-click on the cell or graphic andthen select the Remove Hyperlink item. If you wantto clear the cell of both its link and text entry, selectthe Delete item. To get rid of a graphic object alongwith its hyperlink, Ctrl+click the object and press theDelete key.

    Creating Hyperlinks for CustomMenus and ToolbarsTechnique 2 covers how to customize the Excel pull-down menus and toolbars. As part of this process, Idescribe in general terms how to assign new hyper-links to a custom menu item or toolbar button.

    To give you an idea of how easy it is to create ahyperlink and attach it to a custom menu or toolbar,follow along with the instructions for assigning anew hyperlink (which opens the home page of myWeb site) to a custom button on the toolbar I cre-ated in Technique 2 called Choice Tools:

    1. Display the custom toolbar with the custom but-ton to which you want to assign the hyperlink.

    You can do this by choosing ViewToolbars fol-lowed by the name of the custom toolbar on thecascading menu.

    60_574272 ch52.qxd 10/1/04 11:11 PM Page 321

  • Technique 52: Using Hyperlinks to Make Jumps in Workbooks322

    4. With the Existing File or Web Page buttonselected in the Link To section, enter the URLin the Address text box and then click OK (seeFigure 52-6).

    Figure 52-6: Creating the hyperlink to assign to thecustom button.

    For this example, I enter the URL of my Web site,http://www.mindovermedia.com in the Addresstext box.

    5. Click the Close button in the Customize dialogbox.

    The procedure for assigning a new hyperlink to acustom menu item is almost the same. The onlydifference is that you open the Assign Hyperlink:Open dialog box in this case by right-clicking on theCustom Menu item (when the Customize dialog boxis displayed) and choosing Assign HyperlinkOpenfrom its shortcut menu.

    2. Right-click on the custom toolbar and then selectCustomize to open the Customize dialog box.

    3. Right-click on the custom button (the one withthe Happy Face icon) and then choose AssignHyperlinkOpen on the shortcut menu (seeFigure 52-5).

    Figure 52-5: Assigning an existing hyperlink to a custombutton.

    Excel opens the Assign Hyperlink: Open dialogbox that uses the same general layout and con-tains most of the same options (except for thoseused to add a custom ScreenTip) as the InsertHyperlink dialog box you use to create hyper-links you dont assign to custom menus andtoolbars.

    60_574272 ch52.qxd 10/1/04 11:11 PM Page 322

  • Part IX

    The Scary (Or Fun) Stuff

    61_574272 pp09.qxd 10/1/04 11:11 PM Page 323

  • 61_574272 pp09.qxd 10/1/04 11:11 PM Page 324

  • 53 Instant Lists inExcel 2003The Excel list, a new element in version 2003, is one of the most funfeatures youre likely to encounter in this latest go-round of theprogram. Its sometimes described as a spreadsheet within aspreadsheet. By converting a regular list (such as a data list that keepstrack of your employees or clients, expense accounts, and so forth) intothis new type of list, you not only automate the sorting and filtering of itsdata but also make calculations super easy, such as totals and averageson its numeric columns (fields) and counts on any type of column. Bestyet, if you share the data in conjunction with Microsofts new SharePointServices Web site, Excel lists make publishing to the site and synchronizingthe online data with the spreadsheet a veritable breeze. (See Technique 54.)

    As you find out in this technique, Excel 2003 lists make it easy to manipu-late the data in an existing data list as well as enhance the editing processby always giving you room to add a new row of data and by making theinsertion and deletion of new rows and columns in the list as painless ascan be.

    The other great thing about Excel 2003 lists is that you can keep as manylists as you want on the same worksheet without worrying that editingone will affect any of the others. The only thing you do have to be con-cerned about is the fact that filtering one data list can affect another oneif that list shares the same rows due to the simple fact that filteringthe data in one list necessarily involves hiding entire rows in the work-sheet that dont meet the filtering criteria. (See Technique 45.) And this,of course, can temporarily remove the display of data items from a listyoure not filtering that just happens to share the same rows with a listyou are filtering.

    Creating an Excel 2003 ListWhen creating an Excel list, you can either convert an existing data list orcreate one from scratch. Both processes are really easy. Because you prob-ably already have lots of standard data lists taking up space on spread-sheets that youve created, I start with showing you how to convert a


    Save Time By Turning a regular list into

    an Excel 2003 list

    Toggling totals on and offin the list

    Instantly sorting andfiltering the list

    62_574272 ch53.qxd 10/1/04 11:12 PM Page 325

  • Technique 53: Instant Lists in Excel 2003326

    have a header row, Excel goes ahead and adds onefor you containing generic field names such asColumn1, Column2, and so forth.)

    When you close the Create List dialog box, Excelautomatically adds filter buttons ( just like when youchoose DataFilterAutoFilter) to each of the cellswith the field names in the top row of the list. It alsodisplays the List toolbar whose buttons come invery handy when you need to edit the structure ofthe new list. (See Figure 53-2.)

    Figure 53-2: The Employee data list after converting itinto an Excel 2003 list.

    Youll also notice that all the cells of the new list areselected and that Excel draws a dark blue line aroundits borders. (You may only a see a couple on-screenif your list has more columns and rows than Excelcan display at one time.) If you scroll down to thebottom of the list, youll notice that Excel adds ablank row to the new list marked with a blue asteriskin the first cell. (This asterisk isnt really entered inthis cell; it just acts as a marker indicating that thiscell is where you enter the new list data.)

    You can enter new data for the list directly in this rowwith the blue asterisk, or you can use the data form tohave Excel do it for you. If you choose to enter thedata directly into the blank row, Excel adds a newblank row (with the blue asterisk) as soon as youmake a data entry in the first cell. You can also use

    regular data list into an Excel list. Then, on thechance that you fall in love with this new feature anddecide that all new lists you start should be of thistype, I acquaint you with how to create an Excel listfrom scratch.

    Converting an existing list into an Excel list

    The process for turning a standard data list into adynamic Excel 2003 list couldnt be simpler. Positionthe cell pointer in a cell of the data list and thenchoose DataListCreate List or press Ctrl+L. Excelautomatically selects all the data in the list (assumingthat its bounded all around either by a worksheetborder or a blank column or row) and then displaysthe Create List dialog box, as shown in Figure 53-1.

    Figure 53-1: Converting an existing data list into an Excel2003 list.

    This dialog box displays the range address for theselected data table in the Where Is the Data for YourList text box and automatically selects the My ListHas Headers check box. If Excel somehow selectsthe wrong range for your data list, select the cellrange in the worksheet while the Where Is the Datafor Your List text box is selected. (Excel automati-cally minimizes the Create List dialog box to this textbox as you drag through the cell range in the work-sheet.) If your list doesnt happen to have a row offield names at top, clear the My List Has Headerscheck box before clicking OK. (When a list doesnt

    62_574272 ch53.qxd 10/1/04 11:12 PM Page 326

  • Sorting and Filtering the List 327

    the same keystrokes to enter the data and navigatethe list as you do when entering data into a prese-lected data range. (See Technique 12.)

    If you want to use the data form to make newentries, display the form for your list by clicking theList button on the List toolbar and then select theForm item on the pop-up menu. After the lists DataForm displays, you can use it to add the new row(record) to the end of the list or even use it to findand edit existing data. (See Technique 43.)

    When you select any cell outside of the Excel list,the program not only deselects all the cells in the listbut also removes the blank row at the bottom withthe blue asterisk and hides the List toolbar. Youllalso notice that the heavy blue line around theperimeter of the list turns light blue. As soon as youselect any cell in the list, the blue line turns heavyagain, and the blank row for new data entry and theList toolbar both reappear.

    If, as you add rows to the list, Excel encountersa row that contains existing data that could beoverwritten, the program displays an alert dia-log box indicating that the list is inserting rowsthat could cause data in cells below to shiftdown. You then have to click OK to continuework. To prevent this type of interruption toyour data entry in the future, be sure to selectthe Do Not Display This Dialog Again checkbox.

    Creating an Excel list from scratch

    To make a brand-new list into an Excel 2003 list, allyou have to do is enter the column headings (fieldnames) in the blank row set to become the top rowof the list. (This can be anywhere in the worksheetthat has blank rows beneath it.) Then, with the cellpointer in a field name cell, press Ctrl+L (or chooseDataListCreate List) to open the Create Listdialog box.

    Excel automatically selects the row of column head-ings as the data range for the new list. Be sure toselect the My List Has Headers check box before youclick OK. (Excel usually clears this check box when

    the list consists only of column headings withoutdata entries in rows beneath.) Excel then adds thefiltering buttons to the cells with your column head-ings and assigns the bold attribute to their fieldnames. The program also adds a blank row for thefirst list entries (marked with that distinctive blueasterisk) and encloses the cells in this row plusthe row above with column headings within aheavy blue outline, as shown in Figure 53-3.

    Figure 53-3: Starting a brand-new list from columnheadings alone.

    You can then start adding data to the new list byselecting the cell with the blue asterisk and begin-ning to type entries in the blank row. You can alsodo this by opening the data form for the new list(DataForm).

    Sorting and Filtering the ListYou can use any of the filtering buttons that Excelautomatically adds to column headings (or fieldnames) in the top to sort or filter the data in the listjust as you use them with a regular data list (SeeTechnique 45.)

    If you want to sort the list on the entries in a particu-lar column (field), select either Sort Ascending or SortDescending from its drop-down menu. Select SortAscending to sort text alphabetically from A to Z,numbers from smallest to largest, and dates fromleast recent to most recent. Select Sort Descendingwhen you want to sort text alphabetically from Z toA, numbers from largest to smallest, and dates frommost recent to least recent.

    62_574272 ch53.qxd 10/1/04 11:12 PM Page 327

  • Technique 53: Instant Lists in Excel 2003328

    calculation Average, Count, or any of the otheravailable computations from the Total cells drop-down list.

    Figure 53-4 shows the new Excel 2003 Employee listafter adding the Total row. Cell F35 now contains thetotal for the Salary field. I then manually set up theother two calculations in the Total row: cell I35,which calculates the average years of service for theYears of Service field, and C35, which tallies thenumber of employees in the list by counting theentries in the Last Name field.

    Figure 53-4: The Excel list after adding a Total row withthe Toggle Total Row button on the Listtoolbar.

    To remove the Total row and all its calculationsfrom the Excel list, simply click the ToggleTotal Row button on the List toolbar. Excelthen removes the row with all its calculations.To redisplay the Total row, just click the ToggleTotal Row button again. Note also that as youadd rows to the list, Excel automaticallyupdates the calculations in the Total row toreflect the new entries.

    Easy List EditingExcel lists are not only easy to sort, filter, and total,theyre also easy to edit. You can insert new columns

    To filter the rows of data in the list so that the listcontains records only for a certain entry (such asthe Accounting department or the Boston location),select that entry in the particular fields drop-downlist. If you need to do more sophisticated filtering ofthe list, you can use the columns Top 10 or Customoptions to do so. (Refer to Technique 45 for details.)To remove the filtering and redisplay all the recordsin the list, choose DataFilterShow All.

    If you want to remove the filtering buttonsfrom your Excel 2003 list, you can do so byonce again choosing DataFilterAutoFilter.(This command sequence toggles the filteringbuttons on and off.)

    Toggling the Lists TotalRow On and OffThe coolest feature of an Excel 2003 list just has tobe its ability to instantly add a Total row at the bot-tom of the list (under the blank row with the blueasterisk where you can enter a new row of data). Todo this, click the Toggle Total Row button on the Listtoolbar after you select one of the cells in the Excellist. The moment you click this button, Excel adds aTotal row at the bottom of the list. You can then usethis row to total columns with numeric entries byfollowing these steps:

    1. Click the cell in the Total row of the columnyou want summed.

    A drop-down button appears to the right ofthe cell.

    2. Click Sum on the columns drop-down list, whichyou can open by clicking its drop-down button.

    If you dont want to sum the items in a particularcolumn, you can have the program perform anothertype of computation, such as averaging the numbersin the column or counting the items (something youcan have Excel do even in columns that contain textentries). All you do is select the appropriate type of

    62_574272 ch53.qxd 10/1/04 11:12 PM Page 328

  • Easy List Editing 329

    and rows as quickly as you can delete them. And if,for some reason, the cell range in your list doesntinclude all the data you want, you can resize the list(provided that column headings remain in the samerow as the original list and the new range overlapsthe old one).

    Inserting or deleting rows and columns

    Sometimes you create a new list only to discoverafter the fact that you left out a column of data thatyou need. No problem at all: All you have to do isposition the cell pointer in a cell somewhere in thecolumn in front of where you want the missing col-umn to appear. Click the List button on the List tool-bar and choose InsertColumn from its menu. Excelthen inserts a new column, scooting all the other listcolumns to the right over one to make room for it.The new column is automatically given a generic col-umn heading (such as Column1, Column2, and thelike). All you have to do is replace this generic namewith one of your own. (See Figure 53-5.)

    Figure 53-5: The Excel list after inserting a new column.

    To delete an unneeded column from your list, posi-tion the cell pointer in one of its cells, click the Listbutton on the List toolbar, and then choose DeleteColumn from its menu. Excel immediately deletes thecolumn (and all the data it contains), pulling all theexisting list columns on the right to fill the gap. Notethat when deleting a column from a list, Excel doesnot warn you when youre about to delete data withthe columns removal. If you do this in error, you haveto rely on the EditUndo Delete Column command(Ctrl+Z) to bring the column with the data back.

    You can insert and delete rows in the list the sameway you insert and delete columns. Position the cellpointer in a cell somewhere in the row where youwant to insert a new one, click the List button on theList toolbar, and then choose InsertRow from itsmenu. To remove a row (and all its data), chooseDeleteRow from the menu instead.

    The great thing about inserting and deletingrows and columns within an Excel list is thatyou dont have to worry about adverselyaffecting existing data in the same rowsand columns. Keep in mind that editing thestructure is always limited to the boundariesof that list.

    Converting a list back into a regular cell range

    Excel saves all lists that you define for your spread-sheet. If you decide that you no longer need a partic-ular list, you can convert it to a regular range of cellsby clicking the List button on the List toolbar andthen selecting the Convert to Range item from itsmenu (or choose DataListConvert to Range). Theprogram then displays an alert dialog box asking youto confirm the conversion, whereupon you click theYes button.

    Deleting a list

    Excel lists in many ways act like self-contained units(thus the moniker, spreadsheet within a spreadsheet).This means that if you decide that you want to get ridof a list in its entirety (not just some of its cell entriesor even rows and columns), you first need to selectall the cells in the list, including the blank row at thebottom (in other words, every cell that lies withinthe heavy blue border).

    After you select the cells, press Delete to removethe list, headings, data, blue border, and all. Note,however, that Excel does not actually delete the cellscontaining the list, so existing data in the samecolumns and rows do not shift their position in theworksheet to fill in the gaps.

    62_574272 ch53.qxd 10/1/04 11:12 PM Page 329

  • 54 Sharing ExcelWorkbooks and Listswith a SharePointWeb Site

    Microsofts SharePoint Services represents a new technology forcreating and maintaining collaborative Web sites where teammembers can easily share information. This information can takethe form of shared documents (including Excel spreadsheets, charts, andlists), calendars, to-do lists, event announcements, and other similarnotices. Such a team Web site not only serves as a central repository ofall information pertinent to the team but also enables team members toenter into online discussions, respond to online surveys, and review andapprove documents.

    You can run SharePoint Services on an internal server, on which yourteam site functions as a corporate intranet. If you dont have the man-power, money, or expertise to run SharePoint Services on your own Webserver, you can get SharePoint Services as a subscription service througha Web Presence Provider (WPP) that hosts your team site on the Internet.For example, the Mind Over Media Excel Team Site shown in many of thefigures in this chapter is hosted by Adhost, with which I have a monthlysubscription. (For information on setting up and administering a SharePointServices Team site, see my book Excel 2003 All-In-One Desk ReferenceFor Dummies [Wiley].)

    This technique covers how to add Excel workbooks to a SharePoint Website for review by team members. You also find out how to publish Excel2003 lists (see Technique 53) to a SharePoint site and link the data sothat changes you make to the original list can be quickly and easily syn-chronized with the copy of the list residing on the SharePoint server.

    Adding Excel Spreadsheetsto the SharePoint SiteAfter youve set up your SharePoint Web site, you can easily add to thesite the worksheets you want to make available to other team members.Just log on to the home page of your SharePoint Services team site andthen follow these steps:

    Save Time By Adding workbooks to

    your SharePoint site

    Adding lists to yourSharePoint site

    Linking lists with theSharePoint site


    63_574272 ch54.qxd 10/1/04 11:12 PM Page 330

  • Adding Excel Spreadsheets to the SharePoint Site 331

    1. Click the Documents link on the home page ofyour SharePoint site, as shown in Figure 54-1,to open its Documents and Lists page.

    Figure 54-1: Clicking the Documents link on the homepage of SharePoint site.

    2. If you want to create a new document libraryfor housing the spreadsheets, click the CreateDocument Library link. Then on the CreatePage that appears, click the Document Librarylink. Finally, fill in the information about thenew document library on the New DocumentLibrary page and click the Create button.

    When you create a new document library, yourecreating a new folder on the Web site into whichyou can upload the related documents to whichteam members need access. If you dont havemany documents to share on the site, you canjust put the spreadsheets in the predefinedShared Documents library.

    3. Click the Documents and Lists button on thetoolbar and then, on the Documents and Listspage, click the name of the document libraryinto which you want to upload the spread-sheets, as shown in Figure 54-2.

    To upload Excel spreadsheets into the genericShared Documents library, click its hyperlink.

    Figure 54-2: Selecting the document library you want touse for uploading the Excel spreadsheets.

    4. On the document librarys page, click theUpload Document button on the toolbar, asshown in Figure 54-3, to open the UploadDocument page for the document folder youselected.

    5. Upload a single document or multiple documents:

    Single document: Click the Browse button onthe Upload Document page, select the Excelworkbook file in the Choose File dialog boxthat appears, and then click the Open button.

    Multiple workbooks: Click the Upload MultipleDocuments link on the Upload Document page,and then in the new window that appears,select the drive and folder containing the files.Finally, click the check boxes in front of theirfilenames, as shown in Figure 54-4.

    6. Click the Save and Close button on the UploadDocument page.

    7. Click the Yes button in the Internet Exploreralert dialog box asking you if you want tocontinue.

    63_574272 ch54.qxd 10/1/04 11:12 PM Page 331

  • Technique 54: Sharing Excel Workbooks and Lists with a SharePoint Web Site332

    When Windows finishes uploading the files youspecified, youre automatically returned to theDocument Library page where the workbook filenames appear.

    8. Click the Home button on the SharePoint sitestoolbar to redisplay the home page.

    Figure 54-3: Clicking the Upload Document button tostart the uploading procedure.

    Figure 54-4: Selecting the Excel workbook files to uploadto the SharePoint site.

    Opening the spreadsheets on the SharePoint site

    After uploading spreadsheets to the SharePoint site,other team members who have access to the site canopen and view them. Be sure to e-mail all the teammembers ahead of time and let them know whichdocument library contains what spreadsheets. Teammembers can then follow these steps to access thespreadsheets:

    1. Log on to the home page of the site and clickthe link for the document library that containsthe uploaded workbooks.

    2. After the Document Library page opens, clickthe link attached to the workbook files name.

    3. When Internet Explorer displays an alert dialogbox warning that if you dont trust the source ofthe file you shouldnt open it, click OK.

    Internet Explorer downloads the spreadsheet toyour local computer, opening it as a read-only filein Excel. When the workbook opens in your copyof Excel, the Shared Workspace task pane is alsoautomatically displayed, as shown in Figure 54-5.

    Figure 54-5: Opening a worksheet saved on theSharePoint site in Excel.

    63_574272 ch54.qxd 10/1/04 11:12 PM Page 332

  • Adding Excel Spreadsheets to the SharePoint Site 333

    Figure 54-6: Dragging the Share Documents documentlibrary to the main contents area of thehome page.

    Figure 54-7 shows the home page of the Mind OverMedias Excel Team Site after adding the list of spread-sheets uploaded to its Shared Documents documentlibrary to the bottom of the main contents area. Now,any team member can open one of these spread-sheets simply by logging on to the home page andthen clicking the spreadsheets hyperlink in the list.

    Figure 54-7: Home page after adding the list ofspreadsheets uploaded to the SharedDocuments document library.

    The user can then review and print the worksheetopened in Excel. If the user wants to make changesto the spreadsheet and save them, he or she mustrename the workbook or save it locally in order todo so. (The read-only status prevents changes to theoriginal document saved on the SharePoint site.)

    Adding a list of your spreadsheets tothe SharePoint site home page

    To make it as easy as possible for users to access thespreadsheets, you can customize the home page ofthe SharePoint site by adding the document libraryto the main content area. When you do this, all thespreadsheets saved in a particular document libraryare listed in this area. A team member can open anyof the workbooks listed on the home page simply byclicking the link attached to the workbooks filename.

    To add a document library to the main contents areaof the home page, follow these steps:

    1. Log on to the home page of your SharePointsite.

    2. Click the Site Settings button on the home pagetoolbar.

    3. Click the Customize Home Page link in theCustomization section.

    Internet Explorer returns you to the home page,which now contains an Add Web Parts task paneon the right side. (In the SharePoint world, docu-ment libraries are considered Web parts.)

    4. In the Add Web Parts task pane, find the nameof the document library you want to add andthen drag it to the place in the main contentsarea where you want it to appear, as shown inFigure 54-6.

    5. After placing the document library along withits list of spreadsheet files where you want iton the home page, click the Close button in theAdd Web Parts task pane to get rid of it.

    63_574272 ch54.qxd 10/1/04 11:12 PM Page 333

  • Technique 54: Sharing Excel Workbooks and Lists with a SharePoint Web Site334

    After adding a document library to the homepage, you as the administrator can upload newspreadsheets to it by clicking its Add NewDocument link at the bottom of the list of itsdocuments.

    Publishing Lists to theSharePoint SiteIn Technique 53, I go on and on about the virtuesof Excel 2003s new list feature. In this technique,I show you how slick these lists are when used in aSharePoint Web site. Excel makes it ridiculously easyto publish lists of data to a SharePoint site as well asto make changes in the original worksheet in Exceland then synchronize the data in the lists on theSharePoint site. Excel 2003 can even deal with con-flicts that arise in the rare event that a team membermakes changes to the same entry in the list on theSharePoint site that you modify in the list in the orig-inal Excel worksheet.

    Publishing an Excel list on a SharePoint site

    The steps for publishing an Excel list (see Technique53 for information on how to create such a list) to yourSharePoint site are exceedingly straightforward:

    1. Click any cell in the Excel list to display the Listtoolbar.

    2. Click the List button on the List toolbar andthen select Publish List on its pop-up menu.

    The Publish List to SharePoint Site - Step 1 of 2dialog box opens, as shown in Figure 54-8.

    3. Enter the URL of the SharePoint site in theAddress combobox or, if youve published tothe site previously, select the URL in the drop-down list.

    4. Select the Link to the New SharePoint Listcheck box.

    If you dont select this check box when you pub-lish the list, you wont be able to synchronize thedata in the list on the Web site with the list in yourworksheet.

    5. Enter the name for the list in the Name text box.6. Enter a description of the list in the Description

    text box and then click Next.

    7. In the Connect to Share dialog box, enter youruser name and password in the appropriateboxes.

    You must be able to enter both your user ID andpassword to gain entrance to the SharePoint site.Also, in order to publish to the site, your user IDmust have Administrator, Advanced Author, orAuthor status.

    8. Click OK in the Connect to Share dialog box.The Publish List to SharePoint Site - 2 of 2 dialogbox appears, as shown in Figure 54-9.

    When publishing a list to a SharePoint site, eachcolumn (field) of data must use one of the recog-nized data types: text, number, currency, or date.Prior to uploading the list to the Web site, Excelconverts the data in your list into one of thesetypes.

    Figure 54-8: Getting ready to publish an Excel list to mySharePoint Web site.

    63_574272 ch54.qxd 10/1/04 11:12 PM Page 334

  • Publishing Lists to the SharePoint Site 335

    in Figure 54-11. When you first view the list on theWeb site, it appears in Datasheet view, a view thatmimics the Excel worksheet by showing gridlines forthe columns and rows. The column headings (fieldnames) in this view contain filtering drop-down but-tons, which you can use to sort and filter the pub-lished list just as you would any data list in Excel.(See Technique 45.) If you want to view the pub-lished list as a straight list without gridlines and fil-tering buttons, click the Show in Standard Viewbutton on the toolbar located above the list.

    Figure 54-10: Opening the Excel list on the SharePointsite from the SharePoint Services alertdialog box.

    Figure 54-11: Viewing the Excel list after publishing it tothe SharePoint site.

    To return to the original worksheet in Excel, click theMicrosoft Excel button on the Windows taskbar orpress Alt+Tab. When youre finished comparing thelists, close the Internet Explorer window by clickingits Close button to return to Excel.

    Figure 54-9: Verifying the field types before publishingthe list.

    9. Verify that the fields in your list are being con-verted into the correct types. If the informationis correct, click the Finish button to publish thelist. If not, click Cancel and then make any nec-essary changes to the data entries in the incor-rectly converted fields so that they will becorrectly converted the next time you try topublish the list.

    Excel closes the Publish List to SharePoint Site -2 of 2 dialog box, connects to the SharePoint site,and uploads each row (record) of data in the list.When the program finishes uploading the data, aWindows SharePoint Services alert dialog boxappears, indicating that the list was successfullypublished, as shown in Figure 54-10.

    10. If you want to view the list now, click the handylink to the page in the Windows SharePointServices alert dialog box. If you want to viewthe list at a later time, click OK instead.

    After you enter your ID and password again to gainentrance to the SharePoint site, the page with thepublished list appears in Internet Explorer, as shown

    63_574272 ch54.qxd 10/1/04 11:12 PM Page 335

  • Technique 54: Sharing Excel Workbooks and Lists with a SharePoint Web Site336

    You can view the published list on theSharePoint site at any time after publishing itsimply by selecting a cell in the list, clickingthe List button on the List toolbar, and thenselecting View List on Server on the pop-upmenu.

    Synchronizing list data

    After youve published a list that youve linked toyour SharePoint site, its easy to update the changesthat you make to the list in the original worksheet inExcel to the copy of the list on the Web site. All youhave to do is choose DataListSynchronize List.Excel then connects to the SharePoint site andupdates the list published there with all the changesthat youve made. Thats all there is to it.

    To verify your updates in the list on the SharePointsite, choose DataListView List on Server, or clickthe List button on the List toolbar and then chooseView List on Server on its pop-up menu. If the list isalready open in Internet Explorer at the time youmake the updates to the original list in Excel, switchto the Internet Explorer window and click theRefresh Data button in the lists toolbar on the Webpage in order to see the modifications in the list.

    If, when updating the data to the list on the Web site,Excel encounters a conflict in which one of theentries youve changed in the worksheet in Excel hasalso been changed by a team member on theSharePoint site, a Resolve Conflicts and Errors dialogbox appears when you synchronize the lists, asshown in Figure 54-12.

    This dialog box highlights the conflict between yourchange and another team members change andgives you the opportunity to decide which changesto use:

    To use your change and override the other teammembers change, click the Retry My Changesbutton.

    To go with the other team members changeinstead of yours, click the Discard My Changesbutton.

    If you want to leave the other team memberschange on the list on the Web site and keep yourchanges in the local worksheet, click the Cancelbutton.

    If you need to sever the tie between the local andWeb version of the list, click the Unlink My Listbutton. Just be aware that if you select thisoption (which you can also do by choosingDataListUnlink List), you can no longer haveExcel automatically update your changes to thelist in the local worksheet on the SharePoint site.

    To remove a list that youve unlinked from theSharePoint site, go to its Web page on the site,click the Modify Settings and Columns link inthe task pane on the left, and then click theDelete This List link on the Customize page forthe list.

    Figure 54-12: Deciding which changes to keep and whichto discard in the case of a conflict.

    63_574272 ch54.qxd 10/1/04 11:12 PM Page 336

  • 55 Entering Data andIssuing Commandsby VoiceIdont know about you, but there are days when I dream about not hav-ing to pound the keys to get my work entered. Even though I havethe carpal-tunnel-syndrome worries pretty much under control, at theend of a good day at the old keyboard, I end up with backaches that Iswear not even a pretty Geisha girl walking up and down my spine bare-foot (nice as that would be) could fix.

    Hands-free data entry, the cure to all this tsuris (Yiddish for troubles anddistress) for the body, is here today in the form of Offices SpeechRecognition feature. In this technique, you find out how you can speakyour spreadsheet data entries as well as voice your Excel commands(and believe me, it feels really good to tell a computer where to go!). Theonly problem with this speech technology is that it requires a good head-set microphone, a really quiet office environment, lots of voice training,and loads and loads of patience (because sometimes computers thinkyouve said the darndest things), all of which Im still lacking, so, if youknow any good Geishas, please send them my way.

    Hands-Free Data EntryExcel versions 2002 and 2003 support Speech Recognition, which enablesyou to do hands-free data entry by dictating the text or numbers that youwant entered in the current cell and to issue voice commands that allowyou to choose menu items, dialog box options, or even toolbar buttonsby simply saying their names.

    According to Microsoft, to be able to use Speech Recognition in Excel,your computer must be at least a Pentium II running at a minimum speedof 300 MHz with a minimum of 128MB of RAM. You also need a top-qualitymicrophone, preferably one thats attached to a headset (like the kindused by office receptionists). The giveaway microphones that come withPCs are just not sensitive enough for speech recognition because theytend to pick up stray sounds, which frankly make it impossible to haveyour voice commands correctly processed.


    Save Time By Using the Speech feature

    to make data entries inthe worksheet

    Using the Speech featureto issue Excel commands

    64_574272 ch55.qxd 10/1/04 11:13 PM Page 337

  • Technique 55: Entering Data and Issuing Commands by Voice338


    , Comma

    . Period or dot

    ... Ellipsis

    : Colon

    ; Semicolon

    ? Question mark

    / Slash

    Single quote

    End quote

    Quote or open quote

    Close quote or end quote

    ~ Tilde

    ! Exclamation point

    @ At sign or at

    # Pound sign

    $ Dollar sign

    % Percent sign

    ^ Caret

    & Ampersand

    * Asterisk

    ( Paren

    ) Close paren

    - Hyphen or dash

    _ Underscore

    = Equals

    + Plus sign or plus

    [ Open bracket

    ] Right bracket

    \ Backslash

    When using Speech Recognition to dictate dataentries, you need to keep the microphone close toyour mouth and in the same position as you dictate.Speak normally and in a low but not monotone voice(use the same voice and intonation that you usedwhen training Speech Recognition), pausing onlywhen you come to the end of a thought or the dataentry for that cell. Keep in mind that it takes time foryour computer to process your speech, and there-fore, depending upon the speed of your processor, itmay take some time before your words appear onthe Formula bar and in the current cell.

    Be prepared to turn off your microphone as soon asSpeech Recognition has recognized the cell entry(accurately or not) so that you can complete theentry by pressing the Enter key or an arrow key,clicking the Enter button, or clicking another cell. Ifyour mike doesnt have a physical off/on switch, youcan turn it off by clicking the Microphone button onthe Language bar (see Figure 55-1), shown minimizedon the Windows XP taskbar. Note that you can alsocomplete a data entry by clicking the Voice Commandbutton on the Language bar and then saying some-thing like down arrow or enter.

    Figure 55-1: Putting the Language toolbar in Dictationmode to enter data by voice.

    When dictating cell entries, you can include punctu-ation and special symbols in your entries by callingthe symbol by the word that Speech Recognitionunderstands. Table 55-1 gives you a list of these sym-bols and what you should say when dictating themas part of the cell entry.




    Mode Indicator


    Voice Command

    Speech Tools

    64_574272 ch55.qxd 10/1/04 11:13 PM Page 338

  • Just Tell Me What to Do 339

    To Enter You Dictate

    | Vertical bar

    > Greater than

    < Less than

    Enter New line

    When dictating numeric entries in your cells, keepthe following idiosyncrasies in mind:

    Speech Recognition spells out all numbers below20 so that when you say seven, the programinputs seven and not 7 in the cell.

    Speech Recognition enters all numbers 21 andhigher as digits so that when you say thirty-five, the program inputs 35 in the cell.

    To have Speech Recognition enter the fraction 12in the cell, you say one-half.

    To have Speech Recognition enter other fractions,you say the number of the numerator, slash,followed by the number of the denominator asin one slash four to insert 14 into the cell.

    When you say ordinal numbers (first, second,and so on), Speech Recognition inputs 1st, 2nd,and the like in the cell.

    Just Tell Me What to DoAfter youve completed basic voice training as partof installing Speech Recognition, you can start usingthe feature to issue your menu, toolbar, and dialogbox selections verbally. To issue voice commands,you need to display the Language bar and then putSpeech Recognition into Voice Command mode. Whenyou engage Speech Recognition (ToolsSpeechSpeech Recognition) Excel automatically displaysthe Language bar, which remains a floating toolbaron the Excel window at all times unless you minimizethe bar.

    If you do minimize the Language bar, Excel adds thebuttons on the Language bar to the Windows XPtaskbar (immediately to the left of the Notificationsarea that contains the clock and icons for otheritems that are running). By minimizing the Languagebar on the Windows taskbar, you ensure that its but-tons are out the way of the Excel screen so that youdont ever have to interrupt your speaking to movethe floating Language bar out of the way.

    To open the Language bar, minimize it on theWindows XP taskbar, and then get it into VoiceCommand mode, follow these steps:

    1. Choose ToolsSpeechSpeech Recognition toengage Speech Recognition and display theLanguage bar.

    Excel opens the floating Language bar in the mid-dle of the Excel window.

    2. Click the Minimize button (the one with theminus sign icon) at the right end of the floatingLanguage bar.

    Excel adds all the buttons currently displayed onthe Language toolbar to the right side of theWindows taskbar.

    3. Click the Voice Command button on theLanguage bar that now appears on theWindows XP taskbar. (Refer to Figure 55-1.)

    Note that you can also say voice command toselect this button. You can tell that the Languagebar is in Voice Command mode because thewords Voice Command replace Starting Speechor Listening in the Language bars ModeIndicator (the button with the balloon almostmidway in the bar).

    After Speech Recognition is initiated, youre reallyready to tell Excel what to do.

    64_574272 ch55.qxd 10/1/04 11:13 PM Page 339

  • Technique 55: Entering Data and Issuing Commands by Voice340

    first turn off Voice Command temporarily and thenenter or select the new value with the keyboard ormouse. To turn off Voice Command, simply click theMicrophone button on the Language bar, thus caus-ing the bar to hide the Dictation and VoiceRecognition buttons. To resume giving voice com-mands after you have entered or selected the newvalue, click the Microphone button a second time.

    Dont forget to turn off Voice Command before youstart clicking objects in the Excel window with themouse or typing something from the keyboard. Ifyou dont, you stand a good chance of having VoiceCommand decide that your mouse clicks or typingactually sounds like youre speaking some Excelmenu command or toolbar button. Having Excelchoose a harmless command that youre not expect-ing can be bad enough, but having the programchoose one that alters your worksheet can be devas-tating. (Usually when I forget to first turn VoiceCommand off, it responds by having Excel open up anew, blank worksheet, which totally throws me offbecause the worksheet with all my data is suddenlyno longer on-screen!)

    Note that the effects of many Excel commands thatyou choose (whether you do this by voice, key-board, or mouse) are reversible by immediatelyusing the programs Undo command. (Some com-mands, such as saving changes in a document, arenot reversible, however.) If Speech Recognition evermesses up and chooses the wrong menu command,toolbar button, or dialog box option, immediatelysay the word undo. Because Excel supports multi-ple levels of undo, you may have to repeat the wordseveral times to get your worksheet back to thedesired state.

    Telling the cell pointer where to go

    You can use Speech Recognitions Voice Commandmode to move the cell pointer to new cells in theworksheet. Heres a list of the words you can say tomove the cell pointer in the worksheet:

    Choosing menu items, dialog box options, and toolbar buttons

    To choose pull-down menus or select buttons on anopen toolbar (such as the Standard or Formattingtoolbar), say the menu and item name or the toolbarsbutton name. For example, to choose FileSave onthe pull-down menus to save changes to the currentworkbook, you say file, and then when Excel opensthe File menu, you say save to choose the Savemenu item. Alternately, you can just say the wordsave to have Excel perform the same action thistime by clicking the Save button on the Standardtoolbar.

    If you say a menu command that opens a dialog box,you can select its tabs or options by saying theirnames. For example, if you say format and then saycells, the Format Cells dialog box opens. You canselect the Font tab in this dialog box by saying font,and then you can select the Strikethrough check boxby saying strikethrough. To then close the FormatCells dialog box and apply the strikethrough attrib-ute to the entry in the currently selected cell(s), sayokay. To close a dialog box without putting intoeffect any of the options that you changed, say can-cel instead. (You can also say escape to close adialog box without making changes.)

    Keep in mind that you can use Voice Command toselect the dialog box option that you want tochange. Say the word tab to have Excel advancethrough each option displayed on the current tab ofa dialog box, selecting each option as it goes. Whenthe dialog box option that you want to change isselected (indicated by highlighting in the case of textboxes and combo boxes, and dotted outlining in thecase of option buttons and check boxes), you canthen say the new value or suspend Voice Commandand enter the new value manually.

    If you need to enter a new value in one of the textboxes in a dialog box (or select a value in a drop-downlist when you dont already know its name), you must

    64_574272 ch55.qxd 10/1/04 11:13 PM Page 340

  • Just Tell Me What to Do 341

    Right or right arrow to move the cell pointerone column to the right

    Left or left arrow to move the cell pointer onecolumn to the left

    Up or up arrow to move the cell pointer onerow up

    Down or down arrow to move the cell pointerone row down

    Home to move the cell pointer to the beginningof the line

    End and then pause and say the name of anarrow key (up, down, left, or right) tomove the cell pointer to the edge of the next dataregion or worksheet boundary in that direction

    You have a much better chance of having theSpeech Recognition feature understand yourmeaning if you say a phrase such as leftarrow and up arrow instead of just sayingsolitary words such as left and up.

    64_574272 ch55.qxd 10/1/04 11:13 PM Page 341

  • Save Time By Adding clip art images

    Adding images fromgraphics files

    Drawing your owngraphic objects

    Sprucing Up YourSpreadsheets withGraphics

    Usually when one thinks of spreadsheets, art is the last thing thatcomes to mind. However, Im here to tell you that when used withsome self-restraint graphic images can not only add interest toyour otherwise mundane tables and list of numbers but also make theirdata read better. Here, Im particularly thinking of hand-drawn graphicshapes that you add to the worksheet to call attention to exceptionalaspects of the data (either really good or surprisingly bad).

    Excel supports three types of graphic objects that you can use to spruceup your spreadsheets and charts: clip art images supplied by Microsoft,graphics files that can contain drawn images or digital photographs, andhand-drawn graphics that can include simple shapes and lines, text inboxes, and even predefined WordArt and organization-type charts.

    Jazz It Up with Clip ArtMost users are familiar with the cutesy, comic-strip-like graphic imagescollectively referred to as clip art that the Microsoft folks let Office usersuse for free. (They couldnt get away with charging for that stuff, couldthey?) Along with these cartoon images, clip art collections also includesome really fine stock photo images that I like to use. Although Im defi-nitely not what youd call a really big fan of comic-strip clip art, Officesstock photo images arent bad, and I think that you can even sometimesuse the cartoon-like images (in moderation, please) to advantage to givean otherwise dull-as-dirt table of data some interest.

    Microsoft has provided Excel with its own Clip Art task pane that you canuse to search for just the right clip art image and insert it right into yourworksheet. To open the Clip Art task pane, first display the task pane inthe workbook window (if ones not already open) by pressing Ctrl+F1 andthen click the task panes drop-down button and select Clip Art on thepop-up menu.

    The Clip Art task pane contains three text boxes: Search For, Search In,and Results Should Be, as shown in Figure 56-1:

    56Technique65_574272 ch56.qxd 10/1/04 11:13 PM Page 342

  • Adding Images from Graphics Files 343

    Figure 56-1: Selecting a cell phone image in the Clip Arttask pane to add to a new worksheet.

    Search For: Enter the type of image to use. Ientered cell phones in this text box to findimages of mobile phones.

    Search In: Select what type of Clip Art collec-tions to search. By default, Excel selects the AllCollections option, which includes

    The Office Collections that contain the imagesthat come with Microsoft Office

    The Web Collections containing images thatyou pull down from the Internet using the ClipArt on Office Online link at the bottom of theClip Art task pane

    Any personal collections you may have puttogether

    Results Should Be: Select the types of media filesto include in the search. By default, Excel includesall types of media files (clip art, photographs,movies, and sounds) that are listed in yourMicrosoft Clip Organizer.

    Rotation handle

    Sizing handle

    (To have Excel go through all the media files onyour computer and organize them into collectionswith the Organizer, click the Organize Clips linkin the Clip Art task pane and then click the Nowbutton in the Add Clips to Organizer dialog box.)

    If you want to see only the cartoonish Clip Artimages, clear all check boxes except Clip Artin the Selected Media File Types drop-downlist box. To see only stock photographicimages (my preference), clear all the checkboxes in this list box except for Photographs.

    After you do a search, the Clip Art task pane showsyou thumbnail images of art that meets your specifi-cations. To insert one of these clip art images intoyour spreadsheet, click its thumbnail in the Clip Arttask pane.

    After you insert a clip art image in the worksheet,you can manipulate it in the following ways:

    To resize it, drag its sizing handles (the white cir-cles around the perimeter).

    To move it, position the mouse pointer some-where in the image and then drag it to its newposition.

    To rotate it, position the mouse pointer on therotation handle and then drag the mouse right(to rotate clockwise) or left (to rotate counter-clockwise).

    When youve got the image oriented, sized, and posi-tioned the way you want it, click a cell outside theclip art to deselect it.

    Adding Images fromGraphics FilesIn this day and age of digital photography, its not allthat unusual to have photographic files whose imagesshould be made part of the worksheet. Excel makes

    65_574272 ch56.qxd 10/1/04 11:13 PM Page 343

  • Technique 56: Sprucing Up Your Spreadsheets with Graphics344

    Figure 56-2: Inserting a graphics file into the currentworksheet.

    Drawing Objects forthe SpreadsheetThe Drawing toolbar is jam-packed with great toolsfor creating and adding all types of graphic objects.About the only graphic that you cant bring in from

    Reset Pictures

    Set Transparent Color

    Format Pictures

    Line Styles


    More Brightness

    More Contrast

    Insert Picture from File

    Compress Pictures

    Rotate Left 90

    Less Brightness

    Less Contrast


    it easy to insert photos or other types of picturesstored in graphics files on your computer.

    To insert a picture into the worksheet, follow thesesteps:

    1. Choose InsertPictureFrom File (or click theInsert Picture from File button on the Drawingtoolbar, if its open).

    The Insert Picture dialog box opens. This dialogbox works just like the Open dialog box exceptthat its set to display only the graphics files thatExcel can import and it automatically looks in theMy Pictures folder on your hard disk. (You canchange where Excel looks by selecting anotherfolder in the Look In drop-down list box.)

    2. Locate the graphics file with the image that youwant to add to your worksheet, click its thumb-nail in the Insert Picture dialog box and thenclick the Insert button to import the file intothe current worksheet.

    Excel then displays the image from the file youselected, along with the Picture toolbar (seeFigure 56-2) in the current worksheet.

    As with the other graphic objects that you work with,Excel places sizing handles around the perimeter witha rotation handle connected to the sizing handle inthe middle at the top of the image. You can thenreposition, resize, or rotate the image as needed.

    You can also use the tools on the Picture toolbar toedit the photo. Among other things, these tools makeit possible to heighten or lessen the brightness orcontrast of the image, crop out unwanted areasaround the edges, and compress the image so that itdoesnt bulk up the size of your workbook (as onlyhigh-resolution images can).

    If you have a scanner or digital camera con-nected to your computer, you can use theInsertPictureFrom Scanner or Cameracommand to bring a scanned image or digitalphoto that youve taken directly into yourworksheet.

    65_574272 ch56.qxd 10/1/04 11:13 PM Page 344

  • Drawing Objects for the Spreadsheet 345

    this toolbar is one that you create on a scanner orimport from a digital camera thats attached to yourcomputer. (For that you need to use the InsertPictureFrom Scanner or Camera command.) For allthe rest of your graphic needs, the Drawing toolbaris your ticket.

    Figure 56-3 shows the Drawing toolbar and identifiesthe buttons that use only symbols. When you firstopen the Drawing toolbar (by choosing ViewToolbarDrawing), Excel automatically docks it atthe bottom of the Excel window immediately abovethe status bar. You can then move the Drawing tool-bar to another side of the Excel window or even floatit if you want.

    Figure 56-3: The Drawing toolbar is full of great tools fordrawing almost any graphic object.

    The Draw and AutoShapes buttons are attached topop-up menus that open when you click their buttons.The Fill Color, Line Color, Font Color, Shadow Style,and 3-D Style buttons are all attached to pop-uppalettes that open when you click their buttons andfrom which you can select new fill, line, and font col-ors as well as shading and 3-D effects for selectedgraphic objects.

    Drawing various shapes

    You can use the various drawing tools on the Drawingtoolbar to manually draw straight lines, lines with

    Select Objects




    Insert WordArt

    Insert Clip Art

    Fill Color

    Font Color

    Dash Style

    Shadow Style


    Text Box

    Insert Diagram or Organizational Chart

    Insert Picture from File

    Line Style

    Arrow StyleStroke Color

    3-D Style

    arrowheads (simply referred to as arrows), rectangu-lar and square shapes, and oval and circular shapes.To draw any of these shapes, click the appropriatebutton and then drag the thin, black cross pointer todraw its outline. When drawing a line or arrow, Exceldraws the line from the place where you originallyclick the mouse button to the place where yourelease it.

    When drawing a rectangle or an oval, you can con-strain the tool to draw a square or circle by holdingdown the Shift key as you drag the mouse. Note thatwhen drawing a two-dimensional shape such as arectangle, a square, an oval, or a circle Excel auto-matically draws the shape with a white fill thatobscures any data or graphics objects that arebeneath the shape on layers below.

    After youve drawn the basic shape, you can thenuse the Fill Color, Line Color, Line Style, Dash Style,Shadow Style, and 3-D Style buttons on the Drawingtoolbar to enhance the basic shape.

    In addition to drawing your own shapes, you caninsert any number of ready-made shapes (includinglines, arrows, flow chart symbols, banners, andcallouts) by selecting them from the AutoShapespop-up menu and then sizing them in the worksheet.Figure 56-4 shows this pop-up menu with the cas-cading palette of shapes to choose from when youselect Basic Shapes.

    Figure 56-4: Selecting a basic shape to draw from theAutoShapes pop-up menu.

    65_574272 ch56.qxd 10/1/04 11:13 PM Page 345

  • Technique 56: Sprucing Up Your Spreadsheets with Graphics346

    A single crosshatched pattern is displayed whenyou click inside the text box, thus enabling youto format and edit the text.

    A double crosshatched pattern (that just lookslike a bunch of fuzzy dots on my monitor) is dis-played when you click the border of the text boxor start dragging the box to reposition it, thusindicating that you can format and edit the boxitself.

    Making a statement with WordArt

    The WordArt button on the Drawing toolbar enablesyou to insert super fancy headings for your spread-sheets (often a little too fancy for my tastes). Keepthe following points in mind when using the WordArtfeature:

    The WordArt text is really a graphic object thathappens to have some text associated with it(meaning that you cant edit it directly as youcan edit the text that you enter in a text box).

    The WordArt styles are intended for really largefont sizes (36 points being the default), and manydont work well with regular text font sizes (forexample, those below about 24 points in size).

    To insert a WordArt graphic object in your work-sheet, follow these steps:

    1. Click the WordArt button on the Drawingtoolbar.

    The WordArt Gallery dialog box appears, asshown in Figure 56-5. Here, you select the textstyle that you want to use. As this figure shows,the WordArt Gallery contains a wide variety ofstyles at different angles with some styles thateven run the text down in a vertical line.

    2. Select a WordArt style by clicking its picturein the WordArt Gallery dialog box and thenclick OK.

    Excel opens the Edit WordArt Text dialog box,shown in Figure 56-6.

    Using text boxes as callouts

    Text boxes are graphics that combine text with a rec-tangular graphic object. (The only other object thatdoes this are the callouts that you insert from theAutoShapes Callout pop-up menu.) Theyre great forcalling attention to significant trends or special fea-tures in the charts that you create.

    To create a text box, click the Text Box button on theDrawing toolbar and then drag the mouse pointer todraw the outline of the box. When you release themouse button, Excel places the insertion point in theupper-left corner of the box.

    You can then start typing the text that you want dis-played in the text box. When the text that you typereaches the right edge of the text box, Excel auto-matically starts a new line. If you reach the end ofthe text box and keep typing, Excel scrolls the textup, and you then have to resize the text box to dis-play all the text that youve entered. If you want tobreak a line before it reaches the right edge of thetext box, press the Enter key. When you finish enter-ing the text, click anywhere on the screen outside ofthe text box to deselect it.

    Although text boxes are similar to cell com-ments with text-within-a-box display, they dif-fer from comments in that text boxes are notattached to particular cells and are always dis-played in the worksheet. (Comments showonly when you position the mouse pointerover the cell or select the comment with theReviewing toolbar.)

    Text boxes differ somewhat from other graphicobjects that you add to the worksheet. Unlike theother Excel graphic objects, when you select a textbox, it displays sizing handles but no rotation handle(because Excel cant display text at just any angleyou may select). Also, unlike other graphic objects,text boxes display two different border patternswhen you select them:

    65_574272 ch56.qxd 10/1/04 11:13 PM Page 346

  • Drawing Objects for the Spreadsheet 347

    Figure 56-5: Select a WordArt style in the WordArtGallery dialog box.

    3. Replace the dummy text Your Text Here withthe words or phrase that you want presented inthe WordArt style that you just selected in theGallery dialog box.

    4. If you want to change the font and font size ofthe text that you enter, use the Font and Sizedrop-down list boxes. You can also use the Boldand Italic buttons to enhance the text that youenter by making it bold and/or italic.

    Figure 56-6: Entering the text to be displayed in theselected WordArt style.

    5. After you finish entering and enhancing yourtext in the Edit WordArt Text dialog box,click OK.

    Excel inserts your WordArt graphic object in theworksheet and, at the same time, displays theWordArt toolbar that you can use to further for-mat or make changes to your WordArt master-piece, as shown in Figure 56-7.

    Figure 56-7: Sample WordArt text in a worksheet.

    Drawing diagrams and organization charts

    You can use the Insert Diagram or OrganizationChart button on the Drawing toolbar to quickly addan organization chart or diagram to your worksheet(one place where a graphic object actually conveysthe information instead of just embellishing theworksheet data or embedded chart already there).Heres how:

    1. Click the Insert Diagram or Organization Chartbutton to open the Diagram Gallery dialog box,shown in Figure 56-8.

    2. Select the style of diagram or the organizationchart you want and click OK.

    Insert WordArt

    WordArt Gallery

    Format WordArt WordArt Same Letter Heights

    WordArt Alignment

    WordArt Shape WordArt Vertical Text

    WordArt Character Spacing

    65_574272 ch56.qxd 10/1/04 11:13 PM Page 347

  • Technique 56: Sprucing Up Your Spreadsheets with Graphics348

    Figure 56-9: Worksheet after adding a blank organizationchart to it.

    When you create a new organization chart, Excelopens an Organization Chart toolbar containing but-tons for editing the shape and layout of the chart aswell as for adding new levels and branches. Whenyou create a new diagram (in any of the five avail-able styles), the program opens a Diagram toolbarthat contains its own tools for formatting and editingthe diagram.

    You can use the options on the Insert Shape drop-down list to add new text boxes at the subordinateand assistant levels of the chart. You can use theoptions on the Layout drop-down list to select a newstyle for the different levels in the org chart. Finally,you can use the options on the Select drop-down listbox to select all the text boxes at a particular level inthe org chart.

    Auto FormatThe Diagram Gallery dialog box offers you achoice between an organization chart (the firstpicture) and five different types of diagrams(Cycle, Radial, Pyramid, Venn, and Target).

    After you click OK, Excel inserts a blank chart ordiagram into the worksheet as a new graphicobject, as shown in Figure 56-9.

    Figure 56-8: Selecting an organization chart type in theDiagram Gallery dialog box.

    You can then click the different parts of the chart ordiagram and replace its dummy text with text ofyour own. (Organization charts or diagrams createdwith the Insert Diagram or Organization Chart but-ton act like big text boxes with a bunch of graphicswith little text boxes inside them.)

    65_574272 ch56.qxd 10/1/04 11:13 PM Page 348

  • 57 Doing AutomatedTable LookupsIstill remember the first time my spreadsheet teacher showed me howto automate lookups in a worksheet table. The magic of being able toretrieve values from long boring schedules of numbers for use in otherformulas without having to actually find the cell reference myself was quitethrilling. (It doesnt take much to get geeks like me happy.) The only prob-lem is that that the lookup functions that do this magic are considered tobe advanced functions and therefore a bit scary to new users.

    Nevertheless, I think that after you get the hang of using these beautiesthrough this technique, youll be hooked and as happy as I am aboutthem. (Well, maybe not that happy.) In addition to covering the use ofboth the VLOOKUP (vertical lookup) and HLOOKUP (horizontal lookup)functions each of which can retrieve a single value from a table ofdata I also introduce the Lookup Wizard, one of the add-in programsthat comes with Excel that you can use to look up two values in the table.

    Looking Up a Single Table ValueBefore talking about how the two particular lookup functions that return asingle value from a table work, its important to note that lookup tables arestandard data tables in every way except that the following guidelinesmust be observed:

    The values you want looked up in the table (that is, matched againstvalues entered elsewhere in the worksheet) must be in the first column(in a vertical lookup) or row (in a horizontal lookup) of the data table.

    The values in this first column or row must be sorted in ascendingorder, by rows from top to bottom in a vertical lookup and by columnsfrom left to right in a horizontal lookup.

    The values in the first column or row must be unique (no duplicateentries allowed here).


    Save Time By Looking up a single table

    with VLOOKUP

    Looking up a single tablevalue with HLOOKUP

    Looking up two table values with the LookupWizard

    66_574272 ch57.qxd 10/1/04 11:13 PM Page 349

  • Technique 57: Doing Automated Table Lookups350

    Finding approximate matches pertains only whenyoure looking up numeric entries (rather than text)in the first column or row of the vertical or horizontallookup table. When Excel doesnt find an exact matchin this lookup column or row, it locates the nexthighest value that doesnt exceed the lookup_valueargument and then returns the value in the columnor row designated by the col_index_num or row_index_num arguments.

    To see how you can use this lookup function, con-sider the example shown in Figure 57-1. This work-sheet contains a tip table that calculates the tipamount at 15% and 20% for total pretax checkamounts up to $150.00 in the cell range A1:C152.

    Figure 57-1: Tip table using a VLOOKUP functionto calculate the amount of tip to add tothe bill.

    To use this tip table, you enter the percentageof the tip (either 15% or 20%) in cell F2 (namedTip_Percentage) and the amount of the check beforetax in cell F3 (named Pretax_Total). Excel then looksup the value that you enter in the Pretax_Total cellin the first column of the lookup table (A2:C152),named aptly enough, Tip_Table.

    Excel then moves down the values in the first columnof Tip_Table until it finds a match, whereupon the

    Assuming that you set up your lookup table follow-ing these three guidelines, youll have absolutelyno trouble getting your lookup formulas to take thecorrect information out of the table and return it tothe appropriate place in your spreadsheet each andevery time.

    Performing a vertical table lookup

    Excel supports two types of lookup functions, verti-cal and horizontal. The vertical lookup function iscalled VLOOKUP. The VLOOKUP function searchesvertically (top to bottom) the first (leftmost) columnof a lookup table until the program locates a valuethat matches or exceeds the one youre looking up.

    The VLOOKUP function uses the following syntax:


    Heres a closer look at the arguments that make upthis function:

    lookup_value: The value that you want to lookup and match in the first column of the lookuptable.

    table_array: The cell range or name of thelookup table itself.

    col_index_num: The column containing the val-ues that you want returned to the cell containingthe VLOOKUP formula when a match is madebetween the lookup_value and an entry in thefirst column of the table. When entering thisargument, you must enter a value greater thanzero that doesnt exceed the total number ofcolumns in the lookup table.

    range_lookup: (Optional) The logical TRUE orFALSE value that specifies whether you wantExcel to find an exact or approximate match forthe lookup_value in the table_array. When youspecify TRUE or omit the range_lookup, Excelfinds an approximate match. When you specifyFALSE as the range_lookup argument, Excel findsonly exact matches.

    66_574272 ch57.qxd 10/1/04 11:14 PM Page 350

  • Looking Up a Single Table Value 351

    program uses the col_index_num argument in theVLOOKUP function to determine which tip amountfrom that row of the table to return to cell F4. If Excelfinds that the value entered in the Pretax_Total cell($16.50 in this example) doesnt exactly match one ofthe values in the first column of Tip_Table, the pro-gram continues to search down the comparison rangeuntil it encounters the first value that exceeds thepretax total (17.00 in cell A19 in this example). Excelthen moves back up to the previous row in the tableand returns the value in the column that matches thecol_index_num argument of the VLOOKUP function.(This is because the optional range_lookup argumenthas been omitted from the function.)

    Note that the VLOOKUP function in the tip tableexample in Figure 57-1 uses an IF function to deter-mine the col_index_num argument for the VLOOKUPfunction in cell F4. The IF function determines thenumber of the column to be used in the tip table bymatching the percentage entered in Tip_Percentage(cell F2) with 0.15. If they match, the functionreturns 2 as the col_index_num argument, and theVLOOKUP function returns a value from the secondcolumn (the 15% column B) in the Tip_Table range.Otherwise, the IF function returns 3 as the col_index_num argument, and the VLOOKUP function returns avalue from the third column (the 20% column C) inthe Tip_Table range.

    Performing a horizontal lookup

    The horizontal lookup function is called HLOOKUP.The HLOOKUP function searches horizontally (leftto right) the topmost row of a lookup table until itlocates a value that matches or exceeds the one thatyoure looking up. The HLOOKUP function not onlyworks very much like the VLOOKUP but also followsa nearly identical syntax:


    The row_index_num argument in the HLOOKUP function is the number of the row whose values

    are compared to the lookup_value in a horizontaltable. This argument must also be greater than zeroand not exceed the total number of rows in the table.

    Figure 57-2 shows an example that uses the HLOOKUPfunction to look up the price of each bakery itemstored in a separate price lookup table and thenreturn that price to the Price/Doz column of theDaily Sales list.

    Figure 57-2: Using the HLOOKUP function to return theprice of each bakery item from a lookuptable.

    Cell F7 contains the original formula with theHLOOKUP function that is then copied downcolumn F:


    In this HLOOKUP function, the range name Item, givento the Item column in the range C7:C66, is definedas the lookup_value argument, and the cell rangename Prices, given to the cell range D3:G4, is thetable_array argument. The row_index_num argumentis 2 because you want Excel to return the prices inthe second row of the Prices lookup table, and theoptional range_lookup argument is FALSE becausethe item name in the Daily Sales list must matchexactly the item name in the Prices lookup table.

    66_574272 ch57.qxd 10/1/04 11:14 PM Page 351

  • Technique 57: Doing Automated Table Lookups352

    This is exactly what the Lookup Wizard can do foryou. To see how, follow along with these steps:

    1. Choose ToolsLookup to open the LookupWizard - Step 1 of 4 dialog box, shown inFigure 57-4.

    2. Select the cell range containing the data tablein which the lookup is to be performed.

    For the example shown in Figure 57-3, I select thecell range A2:J6 as this range. (Because thisrange is named table_data, I could have enteredthis name instead of selecting the cell range.)

    3. When youre finished selecting the cell range,click the Next button to open the LookupWizard - Step 2 of 4 dialog box, shown inFigure 57-5.

    Figure 57-4: Designating the cell range of the data tableto be searched.

    Figure 57-5: Designating the column and row in the tablethat contains the value to be looked up.

    By having the HLOOKUP function input theprice per dozen for each bakery item in theDaily Sales list, its easy to update any of thesales in the list. All you do is change its Price/Doz cost in the Prices lookup table, and theHLOOKUP function immediately updates thenew price in the Daily Sales list wherever theitem is sold.

    Doing a Two-Way Lookup in a Data TableYou can use the Lookup Wizard add-in to build thenecessary formulas to do a two-way lookup in a datatable. After you activate the Lookup Wizard add-inby selecting the Lookup Wizard check box in theAdd-Ins dialog box (ToolsAdd-Ins), the programadds a Lookup menu item to the Tools menu on themenu bar.

    To better understand how the Lookup Wizard works,consider the example shown in Figure 57-3. Here,you want to create a formula that will look up andreturn the number produced for a particular part ina particular month. To do this, you must fashion aformula that combines the abilities of both theVLOOKUP function, which can look up the correctrow based on the part number you give, and theHLOOKUP function, which can look up the correctcolumn based on the month you enter.

    Figure 57-3: Production Schedule table that enables youto look up the number produced by themonth and part number.

    66_574272 ch57.qxd 10/1/04 11:14 PM Page 352

  • Doing a Two-Way Lookup in a Data Table 353

    This dialog box is where you select the columnand then the row containing the value you wantlooked up in the data table.

    4. In the Which Column Contains the Value toFind drop-down list, click the name of the col-umn containing the value you want to look up.

    In this particular example, I want to look up thenumber produced in the column with the headingJun-03, so I select this heading in the column label.

    5. In the Which Row Contains the Value to Finddrop-down list, click the name of the row con-taining the value you want to look up.

    In this example, I want to look up the numberproduced in the row with the heading Part 102,so I select this heading in the row label.

    6. When youre finished selecting the row andcolumn, click the Next button to open theLookup Wizard - Step 3 of 4 dialog box, shownin Figure 57-6.

    7. Choose how you want the wizard to display theresult:

    Copy Just the Formula to a Single Cell:Select this option button to have only the for-mula inserted into a cell.

    Copy the Formula and Lookup Parameters:Select this option button to have the columnand row information copied along with theformula.

    Figure 57-6: Selecting the way the Lookup Wizarddisplays the result of the two-way lookup.

    For this example, I selected the Copy theFormula and Lookup Parameters option buttonto have Excel copy both the date and the partnumber into the worksheet above the lookup for-mula that it creates.

    8. Click the Next button to open the LookupWizard - Step 4 of 4 or Step 4 of 6 dialog box(depending upon which option you selected inStep 7).

    If you selected the Copy Just the Formula to aSingle Cell option button in Step 8, Excel displaysthe Lookup Wizard - Step 4 of 4 dialog box whereyou indicate the cell where the formula is to becopied. In this case, skip ahead to Step 11.

    If you selected the Copy the Formula and LookupParameters option button in Step 8, the LookupWizard - Step 4 of 6 dialog box appears. In thiscase, continue to Step 9.

    9. Type the address of the cell where you wantthe column parameter copied or click the celldirectly in the spreadsheet and then click theNext button.

    For this example, I select cell B11 to have Jun-03column label copied there.

    When you click Next, Excel displays the LookupWizard - Step 5 of 6 dialog box.

    10. Type the address of the cell where you wantthe row parameter copied or click the celldirectly in the spreadsheet and then click theNext button.

    For this example, I select cell B10 to have thePart 102 row label copied there.

    When you click Next, Excel displays theLookup Wizard - Step 6 of 6 dialog box, shownin Figure 57-7.

    11. Type the address of the cell where you wantthe lookup formula or click the cell directlyin the spreadsheet and then click the Finishbutton.

    66_574272 ch57.qxd 10/1/04 11:14 PM Page 353

  • Technique 57: Doing Automated Table Lookups354


    The MATCH functions return the number of the rowand the column in the data table based on the valuesentered into the cells B10 (named part_lookup) andB11 (named date_lookup), respectively. The INDEXfunction then uses the row number returned by thefirst MATCH function and the column numberreturned by the second MATCH function as itsrow_num and col_num arguments. The INDEX functionthen returns the value in the cell in the data tablethat is at the intersection of the row number and col-umn number returned by the two MATCH functions.

    To have this INDEX formula look up the number pro-duced for another part number and date, all youhave to do is alter the values in the part_lookup cell(B10) and the date_lookup cell (B11), respectively.Figure 57-9 shows the worksheet after changing thepart number to Part 101 in cell B10 and the date toSep-03 in cell B11. As you can see, the INDEX func-tion correctly returns 189 from the ProductionSchedule to cell B12 as soon as these two param-eters are input into their respective cells.

    Figure 57-9: Worksheet after altering the part numberand date in cells B10 and B11, respectively.

    Figure 57-7: Designating the cell to contain the formulathat performs the two-way lookup.

    Figure 57-8 shows what happened when I clicked theFinish button in the Lookup Wizard - Step 6 of 6 dia-log box. The Lookup Wizard copied Part 102 intocell B10 (which I named part_lookup) and the dateJun-03 into cell B11 (which I named date_lookup).

    Figure 57-8: Worksheet after adding the formula thatlooks up the number produced based on thepart and date given.

    The wizard also created the following formula in cellC12 that actually performs the two-way lookup usingthe INDEX function to look up the column and row inthe Production Schedule returned by the followingtwo MATCH functions:

    66_574272 ch57.qxd 10/1/04 11:14 PM Page 354

  • 58 Using Text Formulasfor Fun and ProfitIdefinitely put this technique in the fun column. Using Excels Text func-tions to convert text entries in your spreadsheet to the proper case isdelightfully easy and, more importantly, a real timesaver, especiallywhen youre importing long lists of names and addresses into worksheetswith all the letters in an improper case (more often than not, all in upper-case letters).

    I also consider knowing how to construct formulas that combine textentries made in separate cells of the worksheet a potentially great time-saver. Ive personally had more than a few situations in which I needed tocombine first and last name information originally entered in separatecolumns of a spreadsheet into a single column, and being able to use atext formula rather than having to manually enter the information hassaved literally hours of what I consider to be completely wasted effort.

    Getting Right on the CaseExcel offers three case-related text functions: UPPER, LOWER, andPROPER. All these functions take a single text argument that indicatesthe source of the text whose case is to be converted. As youd expect,the UPPER function converts all letters in the text argument to upper-case. The LOWER function converts all letters in the text argument tolowercase. The PROPER function capitalizes the first letter of each wordas well as any other letters in the text argument that dont follow anotherletter, and all other letters in the text argument are changed to lowercase.

    Figure 58-1 illustrates a situation in which you would use the PROPERfunction. Here, both last and first name text entries were imported intothe worksheet from a text file where the names were all entered in upper-case letters. You need to use the PROPER function to get these namesinto the proper capitalization, that is, an initial capital letter followedby all lowercase letters.


    Save Time By Converting all text entries

    to the correct case

    Joining text together byformula

    Replacing text formulaswith their results

    67_574272 ch58.qxd 10/1/04 11:14 PM Page 355

  • Technique 58: Using Text Formulas for Fun and Profit356

    For this example, I drag the Fill handle down to cellC17 and then drag it over to D17 to convert all theuppercase entries in both the last and first namecolumns. Figure 58-2 shows the worksheet aftercopying this formula. Everything looks fine incolumns C and D with the exception of the two lastnames, Mcavoy and Mcclinton. I still have to fixthose names by capitalizing the A in McAvoy and thesecond C in McClinton.

    Figure 58-2: Worksheet after using the PROPER functionin columns C and D.

    Joining Separate TextEntries TogetherYou can use the ampersand (&) as an operator in anExcel formula to join separate text entries together ina single cell. This procedure is known technically asconcatenating (joining) text strings. For example, inthe sample Client List spreadsheet shown in Figure58-1, you can use this concatenation operator to jointogether and change the order of the last andfirst names currently entered in all uppercase lettersin the first two columns of the worksheet.

    To join the first name entry in cell B3 with the lastname entry in cell A3, you would enter the followingformula:

    =B3& &A3

    Figure 58-1: Sample worksheet with all first and lastnames entered in all caps.

    Follow along with these steps for using thePROPER function to convert text entries to theproper capitalization:

    1. Position the cell pointer in a blank cell wherethe first formula with the PROPER function isto go and then click the Insert Function buttonon the Formula bar to open the Insert Functiondialog box.

    For this example, I select cell C3 as the cell inwhich to enter the first PROPER function.

    2. Select Text in the Category drop-down list box,and then double-click PROPER in the Select aFunction list box to open the FunctionArguments dialog box.

    3. Click the first cell in the worksheet whose textneeds converting to put its address into theText box and then click OK to insert thePROPER function into the cell.

    For this example, I select cell A3 for the argumentof the first PROPER function. Excel then closes theInsert Function dialog box and inserts the formula=PROPER(A3) in cell C3, which now contains theproper capitalization of the last name Aiken.

    4. Copy the formula with the original PROPERfunction as needed in the worksheet to convertthe rest of the cells whose cases needs fixing.

    67_574272 ch58.qxd 10/1/04 11:14 PM Page 356

  • Replacing Text Formulas with Their Results 357

    Notice the use of the double quotes in this formula.They enclose a blank space that is placed betweenthe first and last name you want to join together with the two concatenation operators. If you dontinclude this space in the formula and just joined thefirst and last name together with this formula like this


    Excel would return a fused entry like ChristopherAiken in the cell where you enter the formula.

    To have Excel convert the name entries in columnsA and B to proper capitalization while at the sametime reordering and concatenating them, you wouldenclose the original concatenation formula in thePROPER function as its argument, as in

    =PROPER(B3& &A3)

    Thats all there is to it. Figure 58-3 illustrates the useof this formula to concatenate, reorder, and convertthe original last and first name entries in column F.

    Figure 58-3: Worksheet after concatenating the first andlast names in column G.

    Replacing Text Formulaswith Their ResultsTheres only one big problem with using Text func-tions like the PROPER function to get the right case

    and the ampersand (&) operator to join text entriestogether: Although they mostly deliver the resultsyou want, they deliver them as formulas in their cellsand not text. And how in the world would you be ableto edit the formula results as needed (as in the case ofthe Mcavoy that should be McAvoy and the Mcclintonthat should be McClinton) or sort them in a differentorder?

    The fact is that you have to take the extra step ofconverting the formulas into their calculated values.Then you can edit and sort the resulting values(actually, text in this case) just as though youdtaken time to type into the spreadsheet yourself.

    You use the Paste Special feature to convert the for-mulas in a selection of cells to their calculated values.In the case of the sample worksheet, which now con-tains text formulas that need converting in two ranges,C3:D17 and F3:F17, you would take these steps:

    1. Select the first cell range.In this case, C3:D17.

    2. Choose EditCopy or press Ctrl+C.3. Choose EditPaste Special to open the Paste

    Special dialog box.

    4. Click the Values option button and thenclick OK.

    In this step, youre actually replacing the textformulas with the text entries they compute bypasting the names on top of the formulas. Thisreplaces the original formulas with the calcu-lated results so that this cell range now containstext that you can directly edit and sort.

    5. Select the second cell range and repeat Steps 2through 4.

    Note that you cant do this formula-to-valueconversion in one operation because the PasteSpecial command works only with single cellranges.

    To convert a single formula to its calculatedvalue, simply select the cell and then press F2(Edit), F9 (Calculate), and Enter.

    67_574272 ch58.qxd 10/1/04 11:14 PM Page 357

  • 59 Creating Queries toImport Data from anExternal DatabaseIts not at all strange that most competent spreadsheet users are at acomplete loss when it comes to using full-blown database programs,even relatively simple ones such as Microsofts own Access. After all,although databases often track the same information as spreadsheets, theydo it in a much more elaborate and often customized fashion. (Access, forexample, is more of a program for creating database applications than anapplication program itself.) The answer is not to waste time on learninghow to use your companys DBMS (Database Management System) pro-gram but to figure out how to use Excel to go in and get the data you needfrom your companys database and bring it into Excel where you knowwhat youre doing.

    Excel makes it easy to query other external databases to which you haveaccess to search for the data that youre interested in and then bring thatdata back into the comfortable Excel worksheet environment for furthermanipulation and analysis. To create a query that acquires data from anexternal database, you must complete two procedures. In the first proce-dure, you define the data source that is, the external database thatcontains the data that you want to query. In the second procedure, youspecify the query itself, including all the columns of data that you wantextracted along with the criteria for selecting them.

    Setting Up the Data Source DefinitionThe first step in doing external database queries is to set up a definitionfor the data source that youll be using. This procedure is really straight-forward:

    1. Choose DataImport External DataNew Database Query to openthe Data Source dialog box, shown in Figure 59-1.

    Save Time By Creating a new data

    source definition

    Creating a databasequery that you can reuse


    68_574272 ch59.qxd 10/1/04 11:15 PM Page 358

  • Setting Up the Data Source Definition 359

    If the External Data Query feature is not alreadyinstalled on your computer, Excel displays analert dialog box stating that the Microsoft Queryfeature is not currently installed and asking ifyou want to install this feature now. Click Yes tohave Excel install this feature. (Remember thatyou must have your Office 11 CD handy or beable to specify the path on your companys net-work where the necessary files are stored inorder to do this.) After Microsoft Query isinstalled on your system, the Choose DataSource dialog box appears with the New DataSource item selected on the Databases tab.

    Figure 59-1: Creating a new data source for an externaldatabase query.

    2. Click OK to accept the default settings and toopen the Create New Source Data dialog box,shown in Figure 59-2.

    3. Enter a descriptive name for the databasequery in the What Name Do You Want to GiveYour Data Source text box.

    By naming the data source definition, you canreuse it without having to go through all thesetedious steps for defining it.

    4. Click the name of the driver to be used foryour data source in the Select a Driver for theType of Database You Want to Access drop-down list box.

    Figure 59-2: Creating a new data source for an externaldatabase query.

    This drop-down list box contains drivers for allthe most popular PC databases, such as Access,dBASE, Paradox, and FoxPro, as well as an SQLdriver for sophisticated Database ManagementSystems, such as dB2, and an OBDC Oracle driverfor querying an Oracle database (to name a few).

    5. Click the Connect button to open a dialog boxfor the driver you select. (See Figure 59-3.)

    This action opens a dialog box for the driveryou selected and in which you can choose thedatabase to be used. For example, if you selectMicrosoft Access Driver (*.mdb) as the driverin the Create New Data Source dialog box,Excel opens an ODBC Microsoft Access Setupdialog box.

    6. Click the Select button, and then in the SelectDatabase dialog box that appears, locate thefolder that contains the database file that youwant to query and click OK.

    Excel returns you to the Create New Data Sourcedialog box, which now displays the name of thedatabase that you selected.

    68_574272 ch59.qxd 10/1/04 11:15 PM Page 359

  • Technique 59: Creating Queries to Import Data from an External Database360

    if any, you want applied to the records before youextract them. To define your query, you take thesesteps:

    1. Choose DataImport External DataNewDatabase Query. Then select the name of thedata source to use and click OK to open theQuery Wizard - Choose Columns dialog boxshowing a list of available tables and fields(see Figure 59-4).

    Figure 59-4: Selecting the fields to include in the newquery.

    If the Query Wizard - Choose Columns dialog boxshowing the tables and fields in the data sourceyou just defined is already open (from the previ-ous procedure), ignore Step 1 and go right on toStep 2.

    2. In the Available Tables and Columns list box onthe left, select the fields that you want to useand then copy them to the Columns in YourQuery list box on the right.

    To select the fields that you want to use, clickthe Expand button (+) in front of the name ofeach table in the external database that containsfields that you want. Then click the name of thefield followed by the > button to copy the fieldname to the Columns in Your Query list box. Topreview the data in that field, click the PreviewNow button when the field name is selected inthe Columns in Your Query list box.

    7. If you want, you can select a default table for usein the database in the Select a Default Table forYour Data Source (Optional) drop-down list box.

    8. Also, if you had to specify a user name andpassword to gain access to the database, youcan have this information saved as part of thedata source definition by selecting the SaveMy User ID and Password in the Data SourceDefinition check box.

    9. Click OK to close the Create a New Data Sourcedialog box.

    Figure 59-3: Selecting the Access database to use in theODBC Microsoft Access Setup dialog box.

    Excel closes the Create a New Data Source dialog boxand immediately opens the Query Wizard - ChooseColumns dialog box. If you dont want to create thequery to your newly defined data source right away,click the Cancel button and then click No in the alertdialog box asking you if you want to continue editingthe query.

    Creating the Database QueryThe next step in the process of querying an externaldatabase is to set up the query that tells Excel whichfields youre interested in and what kind of filtering,

    68_574272 ch59.qxd 10/1/04 11:15 PM Page 360

  • Creating the Database Query 361

    Note that the order in which you add the fieldsdetermines their column order in your Excelworksheet. To change the order after copyingthe fields to the Columns in Your Query list box,click the field and then click the up-arrow buttonto the right to promote the field in the list or clickthe down-arrow button to demote the field inthe list.

    3. Click the Next button to open the QueryWizard - Filter Data dialog box, shown inFigure 59-5.

    Figure 59-5: Filtering the fields included in the newquery.

    4. For each field that should be filtered in theColumn to Filter list box, specify the filteringcriteria, including any AND and OR conditions,in the criteria and evaluation drop-down listboxes.

    To set up the criteria by which records areselected, select the field for which you want toset criteria and then click the criteria to use andthe value to be evaluated in the left and rightdrop-down list boxes, respectively.

    The criteria available in the drop-down list boxeson the left are the same as those used with theCustom AutoFilter (see Technique 45) with theexception of the Like, Not Like, Is Null, and Is NotNull operators, which are not available when set-ting criteria for the Custom AutoFilter. (The Likecriteria refers to entries that sound like one that

    you enter in the associated drop-down list boxon the right, and Null refers to empty entries inthe field.)

    When entering the values to be evaluated in theassociated drop-down list boxes on the right,you can use the question mark (?), asterisk (*),and wildcard characters (question marks for sin-gle characters and the asterisk for multiple char-acters) in the text that you enter in these boxes.You can also select data entries in a field fromwhich to compare to by clicking them in thedrop-down list.

    To set up a logical AND condition, make surethat the AND option button is selected whenyou specify the second and even third set of fil-tering criteria. (Remember in an AND condition,records are selected only when all sets of criteriaare TRUE.) To set up a logical OR condition, clickthe Or option button before you specify the sec-ond or even third set of criteria. (Remember inan OR condition, records are selected when anyone of the sets of criteria are TRUE.)

    Note that if you want to acquire all data in aselected field, dont specify any filtering criteriafor that field in the Filter Data dialog box.

    5. When youre finished entering filteringcriteria, click the Next button to open theQuery Wizard - Sort Order dialog box, shownin Figure 59-6.

    Figure 59-6: Specifying how the fields included in thenew query are to be sorted.

    68_574272 ch59.qxd 10/1/04 11:15 PM Page 361

  • Technique 59: Creating Queries to Import Data from an External Database362

    Figure 59-7: Getting ready to save the query file forfuture use.

    8. If you want to save the query to reuse at a latertime, click the Save Query button and thenenter the filename for the new query file in theSave As dialog box and click Save.

    Excel saves your query as a separate query file(indicated by the .dqy file extension) so that youcan reuse it from any workbook file. Note thatExcel automatically saves the data source defini-tion as a separate file (indicated by the .dsn)when you next save the current workbook butdoes automatically save the query.

    9. To see the data and review your query beforeyou bring it into your Excel worksheet, selectthe View Data or Edit Query in Microsoft Queryoption button and then click OK.

    When you do this, Excel opens a Microsoft Querywindow similar to the one shown in Figure 59-8,where you can preview the way the acquireddata will appear when you bring it into Excel.You can also edit the database query in thiswindow.

    10. After you review the data to be queried, clickthe Close button in the Microsoft Query windowto open the Import Data dialog box, shown inFigure 59-9.

    6. Specify the field or fields on which the externaldata is to be sorted.

    To sort the data that you acquire in the externaldatabase query, select the name of the field inthe Sort By drop-down list box and then selecteither the Ascending (default) or Descendingoption button. To sort any duplicates in the fieldthat you specify as the primary sorting key,select the tie-breaking field for the secondary key in the Then By drop-down list box and thenclick its Ascending (default) or Descendingoption button.

    Repeat this procedure to sort the incoming dataon up to three fields total (just as you can sorta standard Excel data list see Technique 44).If you dont want the data sorted, click the Nextbutton without selecting any fields as sorting keys.

    7. When youre finished specifying the field orfields on which the external data is to be sorted,click the Next button to open the Query Wizard -Finish dialog box, shown in Figure 59-7.

    This dialog box contains several options that youcan choose from in completing the query.

    Return Data to Microsoft Office Excel:Leave this option button selected if you wantto return the data to the current or a newworksheet.

    View Data or Edit Query in Microsoft Query:Click this option button if you want to viewthe data and/or edit the query in the MicrosoftQuery window.

    Create an OLAP Cube from This Query: Clickthis option button if you want to create anOLAP (Online Analytic Processing) cube thatsummarizes the data being acquired. (This isuseful when querying huge databases thatcontain so many records that they need to besummarized before importing them into Excel.)

    68_574272 ch59.qxd 10/1/04 11:15 PM Page 362

  • Creating the Database Query 363

    Figure 59-8: Previewing the data to be extracted whenexecuting the external database query.

    Figure 59-9: Indicating where to put the data extractedfrom the external database by the query.

    11. Either click the Existing Worksheet option but-ton and choose where you want the dataimported on the active sheet in the drop-downlist or select the New Worksheet option button.Then click OK to start importing the data.

    By default, the Existing Worksheet option buttonis selected, and cell A1 is designated as the startof the range. To change the starting cell, click itin the worksheet. To import the data into a newworksheet in the current workbook, click theNew Worksheet option button instead.

    When you click OK, Excel executes the databasequery and acquires the data from the external data-base. After the program finishes importing all therecords that match your filtering criteria, it also dis-plays the External Data toolbar. (See Figure 59-10.)You can use the buttons on this toolbar to updatethe acquired data or edit the query.

    By saving a data query, you can reuse it at any timeto connect to an external database and to acquire itsdata according to the querys parameters. To dothis, follow these steps:

    Figure 59-10: Worksheet after executing the query andextracting the information from theexternal database.

    Refresh All

    Refresh Status

    Cancel Refresh

    Query Parameters

    Edit Query

    Refresh Data

    Data Range Properties

    68_574272 ch59.qxd 10/1/04 11:15 PM Page 363

  • Technique 59: Creating Queries to Import Data from an External Database364

    2. Click the name of the query file (with the .dqyfile extension) to use and then click the Openbutton.

    Excel closes the Select Data Source dialog boxand opens the Import Data dialog box, where youindicate where to put the imported data in theExcel worksheet.

    1. Choose DataImport External DataImportData From to open the Select Data Source dia-log box.

    This dialog box displays the names of all thequery files that you create and save (as outlinedin the preceding steps).

    68_574272 ch59.qxd 10/1/04 11:15 PM Page 364

  • 60 AutomatingRepetitive Taskswith MacrosBy now, even if you havent started putting them to good use in yourExcel spreadsheets, youve undoubtedly heard of macros, thosewonderful containers for recording almost any sequence of Excelcommands and then playing them back in a flash at the touch of a key.By using Excels macro feature to record tasks that you perform routinely,not only can you speed up the procedure considerably (because Excel canplay back your keystrokes and mouse actions a heck of lot faster than youcan perform them manually), but youre also assured that each step in thetask is carried out the same way every time you perform the task.

    Excels macro feature records all the commands and keystrokes that youmake in a language called Visual Basic for Applications (VBA), which is aspecial version of the BASIC programming language developed by the goodfolks at Microsoft for use with all the Office application programs. Afterrecording basic macros, Ill show you how you can even play programmerby using Excels Visual Basic Editor to display and make changes to themacros basic VBA code.

    Recording and Playing Back MacrosThe macro recorder built into Excel enables you to capture commandsequences from the time you turn on the recorder until the moment youturn it off. When you turn on the macro recorder, it records all youractions in the active worksheet or chart sheet as you make them.

    Note that the macro recorder doesnt record the actual keystrokes ormouse actions that you take to accomplish an action, only the VBA coderequired to perform the action itself. This means that, if you make mis-takes while following a command sequence, all the actions you take torectify them wont be recorded as part of the macro. For example, if youmake a typing error and then edit it while the macro recorder is on, onlythe corrected entry is recorded as part of the macros VBA instructions.


    Save Time By Recording your command

    sequences as a macro

    Playing back a commandsequence by running amacro

    Editing your macros tomake them interactive

    69_574272 ch60.qxd 10/1/04 11:15 PM Page 365

  • Technique 60: Automating Repetitive Tasks with Macros366

    in a worksheet in 12-point, bold type and centers thecompany name across rows A through E with theMerge and Center feature:

    1. Open the Excel workbook that contains theworksheet data or chart you want your macroto work with.

    If youre building a macro that adds new data toa worksheet (as in this example), open a work-sheet with plenty of blank cells in which to addthe data. If youre building a macro that needs tobe in a particular cell when its steps are playedback, put the cell pointer in that cell.

    2. Choose ToolsMacroRecord New Macroto open the Record Macro box, shown inFigure 60-1.

    Figure 60-1: Getting ready to record theCompany_Name macro.

    3. Replace the Macro1 temporary macro name byentering your name for the macro in the MacroName text box.

    Remember that when naming a macro, you cantuse spaces in the macro name, and it must beginwith a letter and not a number or punctuationsymbol. For this example macro, replace Macro1in the Macro Name text box with the nameCompany_Name.

    Whenever you record a macro, Excel adds aspecial module sheet to the current Excelworkbook that contains the VBA code forplaying back the sequence. To open the mod-ule sheet in Visual Basic Editor to review oredit the macros VBA commands, chooseToolsMacroVisual Basic Editor or simplypress Alt+F11.

    You can store the macros you record as part of thecurrent workbook, in a new workbook, or in a spe-cial, globally available Personal Macro Workbooknamed personal.xls. When you record a macro inyour Personal Macro Workbook, you can run thatmacro from any workbook that you have open.(Thats because the personal.xls workbook issecretly opened whenever you launch Excel, andalthough its immediately hidden, the macros it con-tains are always available.) When you record macrosas part of the current workbook or a new workbook,you can run those macros only when the workbookin which they were recorded is open in Excel.

    When you create a macro with the macro recorder,you decide not only the workbook in which to storethe macro but also what name and shortcut key-strokes to assign it. When creating a name for yourmacro, use the same guidelines as when you assign a standard range name to a cell range in your work-sheet. (See Technique 26.) When assigning a short-cut keystroke to run the macro, you can assign theCtrl key plus a lowercase letter, as in Ctrl+Q, or the Ctrl key plus an uppercase letter (the equivalentof Ctrl+Shift), as in Ctrl+Shift+Q. You cant, however,assign the Ctrl key plus a punctuation or number key(such as Ctrl+1 or Ctrl+/) to your macro.

    Recording the macro

    To see how easy it is to create a macro by recordingyour actions in Excel, follow along with these stepsfor creating a macro that enters the company name

    69_574272 ch60.qxd 10/1/04 11:15 PM Page 366

  • Recording and Playing Back Macros 367

    4. If you want to be able to play back the macro bypressing a keystroke shortcut, select the ShortcutKey text box and then enter the letter of thealphabet that you want to assign to the macro.

    In the Shortcut Key text box, you can enter a low-ercase or uppercase letter between A and Z thatacts like a shortcut key for running the macrowhen you press Ctrl followed by that letter key.

    Just remember that Excel has already assigned anumber of Ctrl+letter keystroke shortcuts fordoing common tasks, such as Ctrl+C for copyingan item to the Clipboard and Ctrl+V for pastingan item from the Clipboard into the worksheet.(Look up Keyboard Shortcuts in the Assistanttask pane opened by pressing F1 for a completelist.) If you assign the same keystrokes to themacro that youre building, your macros short-cut keys override and, therefore, disable Excelsready-made shortcut keystrokes.

    For this example macro, enter C (uppercase) toassign Ctrl+Shift+C as the shortcut keystroke(so as not to disable the ready-made Ctrl+Cshortcut).

    5. On the Store Macro In drop-down list, selectone of the following options for storing the newmacro:

    Personal Macro Workbook: Select this optionto be able to run the macro anytime you like.

    This Workbook (the default): Select thisoption when you need to run the macro onlywhen the current workbook is open.

    New Workbook: Select this option if you wantto open a new workbook in which to recordand save the new macro.

    For this example macro, select the PersonalMacro Workbook so that you can use it to enterthe company name in any Excel workbook thatyou create or edit.

    6. Select the Description list box and then insert abrief description of the macros purpose infront of the information indicating the date andwho recorded the macro.

    In the Description list box, you should documentthe purpose and functioning of your macro.Although this step is optional, its a good idea toget in the habit of recording this informationevery time you build a new macro so that youand your coworkers can always know what toexpect from the macro when running it.

    7. Click OK to close the Record Macro dialog boxand automatically open the Stop Recordingtoolbar, shown in Figure 60-2.

    Figure 60-2: The floating Stop Recording toolbar appearswhenever you turn on the macro recorder.

    The floating Stop Recording toolbar appears assoon as you turn the macro recorder on (althoughall you can see is St and the first part of the o inthe title bar because this toolbar is so short).Also, the message Recording now appears on thestatus bar to remind you that the results of allthe actions you take (including selecting cells,entering data, and choosing commands) will nowbe recorded as part of your macro.

    The Stop Recording toolbar contains a StopRecording button that you can click to turn off themacro recorder and a Relative Reference buttonthat you click when you want the macro recorderto record the macro relative to the position ofthe current cell.

    Stop Recording

    Relative Recording

    69_574272 ch60.qxd 10/1/04 11:15 PM Page 367

  • Technique 60: Automating Repetitive Tasks with Macros368

    those in your Personal Macro Workbook (providedyouve created one). Click the name of the macrothat you want to play and then click the Run buttonor press Enter.

    If you assigned a shortcut keystroke to the macro,you dont have to bother opening the Macro dialogbox to play the macro: Simply press Ctrl plus the let-ter key or Ctrl+Shift plus the letter key you assigned,and Excel immediately plays back all the commandsthat you recorded.

    Figure 60-3: Selecting the macro to run in the Macrodialog box.

    You can assign the macros that you create tobuttons or menu items on custom toolbars ormenus that you create (see Technique 2) andthen play them back by clicking the custombutton or selecting the custom menu item towhich the macro is assigned.

    Before testing a new macro, you may need to select anew worksheet or, at least, a new cell range within theactive worksheet. When recording cell references ina macro, the macro recorder always inserts absolutereferences in the macro sheet unless you click theRelative Reference button on the Stop Recording

    8. Click the Relative Reference button if you wantto be able to play back the macro anywhere inthe worksheet.

    For the example macro that enters the companyname and formats it in the worksheet, you defi-nitely need to click the Relative Reference buttonbefore you start recording commands. Otherwise,you can use the macro only to enter the companyname starting in cell A1 of a worksheet.

    9. Select the cells, enter the data, and choose theExcel commands required to perform the tasksthat you want recorded just as you normallywould in creating or editing the current work-sheet. You can use the keyboard or the mouseor a combination of the two.

    For the example macro, all you do is type thecompany name and click the Enter button onthe Formula bar to complete the entry in thecurrent cell. Next, click the Bold button and thenselect 12 on the Font Size drop-down list on theFormatting toolbar. Finally, drag through cellsA1:E1 to select this range and then click theMerge and Center button, again on theFormatting toolbar.

    When you finish taking all the actions in Excelthat you want recorded, youre ready to shut offthe macro recorder.

    10. Click the Stop Recording button on the floatingStop Recording toolbar (or you can chooseToolsMacroStop Recording).

    When you shut off the macro recorder, the Recordingmessage on the status bar immediately disappears,letting you know that no further actions will berecorded.

    Playing back the macro

    To play back a macro youve recorded, press Alt+F8or choose ToolsMacroMacros to open the Macrodialog box, shown in Figure 60-3. This dialog box listsall the macros in the current workbook as well as

    69_574272 ch60.qxd 10/1/04 11:15 PM Page 368

  • Editing Macros in the Visual Basic Editor 369

    toolbar before you start choosing the commandsand taking the actions in the spreadsheet that youwant recorded as part of the macro. This means thatyour macro enters its data entries or performs itsformatting in the same area of the active worksheet(unless the code in the macro itself causes the macroto first select a new area or select a new sheet in theworkbook active).

    Excel automatically sets the level of macrosecurity to the highest level a level thatprevents macros that arent digitally signedfrom running. To enable Excel to run macrosthat arent signed but that you know comefrom trustworthy sources (such as Fred inAccounting), reset the macro security levelto Medium on the Security Level tab of theSecurity dialog box (ToolsMacroSecurity).Excel thereafter prompts you to enable suchmacros in the worksheet.

    Editing Macros in theVisual Basic EditorAfter youve created a macro, you dont necessarilyhave to rerecord it to change the way it behaves. Inmany cases, you may find it more efficient to changeits behavior by simply editing its contents in VisualBasic Editor (also known as the VBA as in VisualBasic for Applications Editor for short).

    Before you can use VBA Editor to edit a macrothat you saved in your Personal MacroWorkbook, you must first unhide this work-book by selecting PERSONAL.XLS in theUnhide dialog box (WindowUnhide).

    To open a macro for editing in Visual Basic Editor,follow these general steps:

    1. Press Alt+F8 or choose ToolsMacrosMacroto open the Macro dialog box.

    2. Select the name of the macro that you want toedit in the Macro Name list box and then clickthe Edit button to open the module sheet con-taining the macro in VBA Editor, as shown inFigure 60-4.

    Figure 60-4: VBA Editor after maximizing the Codewindow.

    Excel opens Visual Basic Editor with the code foryour macro displayed in the Code window unless you select the name of a macro saved inthe Personal Macro Workbook and this work-book is still hidden. In that case, Excel displaysan alert dialog box telling you that you cant edita hidden macro and informing you that you needto use the WindowUnhide command. You thenneed to click OK in the alert dialog box, pressEsc to close the Macro dialog box, and thenunhide the Personal Macro Workbook before yourepeat these first two macro editing steps.

    After you have the lines of code for the macrodisplayed in the Code window in Visual BasicEditor, you can edit any of its statements asneeded. If you want to obtain a printout of thelines of code in your macro before you beginmaking changes, choose FilePrint or pressCtrl+P. This action opens a Print dialog box with

    69_574272 ch60.qxd 10/1/04 11:15 PM Page 369

  • Technique 60: Automating Repetitive Tasks with Macros370

    If you modified a macro saved in the PersonalMacro Workbook, you have to exit Excel inorder to save your changes to the macro.When you exit the program (Alt+F4 orFileExit), Excel displays an alert dialog boxasking if you want to save the changes youmade to the personal.xls file. Be sure toclick the Yes button to save the changes toyour global macro before you close Excel.

    Modifying the settings for VBA properties

    Even when you dont know anything about program-ming in VBA (and aim to keep it that way), you canget the gist of the more obvious properties in amacro that change certain settings, such as numberformat or font attribute, by experimenting withassigning them new values.

    For example, in the code of the Company_Namemacro (refer to Figure 60-4), you can probably iden-tify the section of VBA commands that begins withthe line With Selection.Font and ends with the lineEnd With as containing the procedure for assigningvarious font attributes for the current cell selection.

    Going a step further, you probably can figure out thatmost of these attributes are being reset by makingthe attribute equal to a new entry or value, such as

    .Name = Arial

    which sets the text font to Arial, followed by

    .Size = 12

    which sets the text size to 12 point. You can also seein this section that particular attributes are beingturned on by setting them equal to True or False,such as

    Selection.Font.Bold = True

    which makes the text in the current cell selectionbold.

    the Current Module option button selected in theRange section and the Code check box selected inthe Print What section so that you just click OK tohave Excel print all the statements in the macro.

    3. Edit the statements in the Code window ofVisual Basic Editor as needed.

    When editing the macros commands, rememberthat you can use the EditUndo (Ctrl+Z) com-mand to undo any deletion that you make bymistake. You can also find out what a particularstatement or property does in the macro byselecting it with the I-beam mouse pointer andpressing F1 or by clicking the Help button on theStandard toolbar.

    After you finish editing the macro, youre readyto return to your spreadsheet where you can testout the modified macro and make sure that youhavent added some wacky, unwanted commandto the macro or, even worse, crippled it so that itno longer runs at all.

    4. Click the View Microsoft Excel button at thebeginning of the Standard toolbar or click theworkbooks minimized button on the Windowstaskbar to return to the worksheet.

    Select an appropriate or safe place in which totest your modified macro and then run it, eitherby pressing its shortcut keys or by pressingAlt+F8, clicking it in the Macro list box, and thenclicking the Run button.

    If something doesnt work as intended or if themacro doesnt work at all, return to the VisualBasic Editor and find and correct your error(s).Click the minimized Microsoft Visual Basic but-ton on the Windows taskbar to return to theVisual Basic Editor and have a try at editing thecode one more time.

    If everything checks out and runs as planned,save your changes as outlined in Step 5.

    5. Press Ctrl+S or choose FileSave to save thechanges to the modified macro if its stored aspart of the current workbook.

    69_574272 ch60.qxd 10/1/04 11:15 PM Page 370

  • Editing Macros in the Visual Basic Editor 371

    You can make your macro behave differently justby doing some careful editing of these settings. Forexample, if you want the final font size to be 24 pointsinstead of 12, all you have to do is edit the Size prop-erty by changing its value from 12 to 24 as follows:

    .Size = 24

    Likewise, you can have the macro apply singleunderlining to the cell selection by editing thexlUnderlineStyle property from none to single as follows:

    .Underline = xlUnderlineStyleSingle

    When the allowable settings for a particularproperty are not obvious (such as in the caseof the Underline property), select the propertyin the Code window without selecting its cur-rent setting and then Press F1 to open theVBA Help window with information on thatproperty. Usually the Example section at thebottom of this Help window gives you an ideaof the different types of values that the prop-erty can take.

    Getting user input by adding a custom dialog box

    One of the biggest problems with recording macrosis that any text or values that you have the macroenter for you can never vary thereafter. If you createa macro that enters the heading Mind Over Media inthe current cell of your worksheet, this is the onlyheading youll ever get out of that macro. However,you can get around this inflexibility by using theInputBox function. When you run the macro, thisVisual Basic function causes Excel to display aninput dialog box where you can enter whatever titlemakes sense for the new worksheet. The macro thenputs that text into the current cell and formats thistext, if thats what youve trained your macro to donext.

    To see how easy it is to use the InputBox functionto add interactivity to an otherwise staid macro,follow along with the steps for converting theCompany_Name macro that currently inputs the textMind Over Media to one that prompts you for thename that you want entered. The InputBox functionuses the following syntax:


    In this function, only the prompt argument isrequired; the rest of the arguments are optional. Theprompt argument specifies the message that appearsinside the input dialog box, prompting the user toenter a new value (or in this case, a new companyname). The prompt argument can be up to a maxi-mum of 1,024 characters. If you want the promptmessage to appear on different lines inside the dia-log box, enter the functions Chr(13) and Chr(10) inthe text (to insert a carriage return and a linefeed inthe message).

    The optional title argument specifies what text todisplay in the title bar of the input dialog box. If youdont specify a title argument, Excel displays theapplication name on the title bar.

    The optional default argument specifies the defaultresponse that automatically appears in the text boxat the bottom of the input dialog box. If you dontspecify a default argument, the text box is empty inthe input dialog box.

    The xpos and ypos optional arguments specify thehorizontal distance from the left edge of the screento the left edge of the dialog box and the vertical dis-tance from the top edge of the screen to the topedge of the dialog box. If you dont specify thesearguments, Excel centers the input dialog box hori-zontally and positions it approximately one-third ofthe way down the screen vertically.

    69_574272 ch60.qxd 10/1/04 11:15 PM Page 371

  • Technique 60: Automating Repetitive Tasks with Macros372

    3. Type the following code to create the InputMsgvariable on line 8 and then press the Enter keyto start a new line 9:

    InputMsg = Enter the title for thisworksheet in the text box below andthen click OK:

    On this line, you want to create a variable thatsupplies the prompt argument to the InputBoxfunction. To do this, state the name of the vari-able (InputMsg in this case) followed by its cur-rent entry. Be sure to enclose the message texton the right side of the equal sign in a closed pairof double quotation marks.

    4. Type the following code to create the InputTitlevariable on line 9 and then press Enter toinsert a new line 10:

    InputTitle = Company Name

    Create a variable named InputTitle that suppliesthe optional title argument for the InputBoxfunction. This variable makes the text CompanyName appear as the title of the input dialog box.Again, be sure to enclose the name for the dialogbox title bar in quotation marks.

    5. Type the following code to create theDefaultText variable on line 10 and then pressEnter to insert a new line 11:

    DefaultText = Mind Over Media

    Create a variable named DefaultText that sup-plies the optional default argument to theInputBox function. This variable makes the textMind Over Media appear as the default entry onthe text box at the bottom of the customCompany Name input dialog box.

    6. Type the following code to create theCompanyName variable that uses the InputBoxfunction on line 11:

    CompanyName = InputBox(InputMsg,InputTitle, DefaultText)

    The helpfile and context optional arguments spec-ify the name of the custom Help file that you makeavailable to the user to explain the workings of theinput dialog box as well as the type of data that itaccepts. As part of the process of creating a customHelp file for use in the Excel Help system, you assignthe topic a context number appropriate to its con-tent, which is then specified as the context argu-ment for the InputBox function. When you specify aHelp file and context argument for this function,Excel adds a Help button to the custom input dialogbox that users can click to access the custom Helpfile in the Help window.

    Before you can add the line of code to the macrowith the InputBox function, you need to find theplace in the Visual Basic commands where the lineshould go. To enter the Mind Over Media text intothe active cell, the Company_Name macro uses thefollowing Visual Basic command:

    ActiveCell.FormulaR1C1 = Mind Over Media

    To add interactivity to the macro, you need to insertthe InputBox function on a line in the Code windowright above this ActiveCell.FormulaR1C1 statement.To supply the first three arguments of the InputBoxfunction (prompt, title, and default), you createvariables whose declared values are used. Finally, youcreate a variable that contains the entire InputBoxfunction and sets it equal to the ActiveCell statementthat begins the macro instructions.

    To make these editing changes to the basic recordedmacro, follow these steps:

    1. Position the insertion point in the Code windowat the beginning of the ActiveCell.FormulaR1C1statement and press Enter to insert a new line.

    2. Press the key to position the insertion pointat the beginning of the new line.

    69_574272 ch60.qxd 10/1/04 11:15 PM Page 372

  • Editing Macros in the Visual Basic Editor 373

    Create a final variable named CompanyNamethat specifies the InputBox function as its entry(using the InputMsg, InputTitle, and DefaultTextvariables that you just created) and stores theresults of this function.

    7. Select Mind Over Media on line 12 and replaceit with CompanyName (with no quotation marks).

    Replace the value Mind Over Media in theActiveCell.FormulaR1C1 property with theCompanyName variable (whose value is deter-mined by whatever is input into the CompanyName input dialog box), thus effectively replac-ing this constant in the macro with the means formaking this input truly interactive.

    Figure 60-5 shows the Code window with the editedCompany_Name macro after adding the statementsthat make it interactive. All you have to do at thispoint is to test the macro to make sure that the inputdialog box performs the way you want it to and thensave the changes in the VBA Editor.

    Figure 60-6 shows the Company Name input dialogbox in action in the worksheet when you execute theedited Company_Name macro. This Company Namedialog box automatically appears and prompts youfor input whenever you run the edited and now fullyinteractive version of the Company_Name macro.

    To enter the default name of Mind Over Media intothe current cell and then have the macro format thistext by using the rest of the macro commands, justclick the OK button in this custom dialog box. To

    enter and format the name of another company, sim-ply type the name of the company (which automati-cally replaces Mind Over Media in the text box)before you click OK.

    Figure 60-5: VBA Editor after adding the statements toCompany_Name macro to create the inputdialog box.

    Figure 60-6: Executing the edited macro that uses thecustom Company Name dialog box.

    69_574272 ch60.qxd 10/1/04 11:15 PM Page 373

  • Save Time By Defining custom func-

    tions for Excel

    Saving custom functionsin add-in files

    Creating CustomFunctions to Use inYour Worksheets

    Lets face it: Although Excel comes stocked with a wide variety ofbuilt-in functions, some of which are pretty specialized, they dontbegin to cover all the types of specific computations you need toperform. Wouldnt it be great if you could extend the body of built-in Excelfunctions to include ones that your business uses? Well, you can do this,and this technique is dedicated to showing you how. Here, you find outhow to turn your most precise and exacting calculations into functionsavailable to any spreadsheet user through Excels thoroughly familiarInsert Function feature.

    All it takes for you to begin creating your own custom functions (knowntechnically as user-defined functions or UDFs for short) is the briefestfamilarity with Excels VBA (Visual Basic for Applications) language andVisual Basic Editor and the information you find in this technique.

    Creating Custom FunctionsTo create a user-defined function, you must do four things:

    Create a new module sheet where the custom function is to be definedin Visual Basic Editor. To do this, select its project in the ProjectExplorer window and then choose InsertModule on the Visual BasicEditor menu bar.

    On the first line in the Code window, enter the name of the custom func-tion and specify the names of the arguments that this function takes.Note that you cant duplicate any built-in function names, such as SUMor AVERAGE functions, and so on, and you must list argument names inthe order in which they are processed and enclosed in parentheses.

    Enter the formula or set of formulas that tells Excel how to calculatethe custom functions result. You do this by entering the argumentnames listed in the Function command with whatever arithmetic oper-ators or built-in functions are required to get the calculation made onthe line or lines below.

    Indicate that youve finished defining the user-defined function byentering the End Function command on the last line.

    61Technique70_574272 ch61.qxd 10/4/04 8:36 AM Page 374

  • Creating Custom Functions 375

    To see how this procedure works in action, considerthe following scenario. You need a custom functionfor your spreadsheets that calculates the sales com-missions for your salespeople based on the numberof sales they make in a month as well as the totalamount of their monthly sales (they sell big-ticketitems, such as RVs). The custom Commission func-tion you want to create requires two arguments:TotalSales and ItemsSold so that the first line ofcode on the module sheet in the Code window wouldhave to be this:

    Function Commission(TotalSales,ItemsSold)

    In determining how the commissions are actuallycalculated, suppose that you base the commissionpercentage on the number of sales made during themonth. For five sales or fewer in a month, you pay acommission rate of 4.5 percent of the salespersonstotal monthly sales; for sales of six or more, you paya commission rate of 5 percent.

    To define the formula section of the Commission cus-tom function, you need to set up an IF construction.This IF construction is similar to the IF function thatyou enter into a worksheet cell except that you usedifferent lines in the macro code for the constructionin the custom function. An ELSE command separatesthe command that is performed if the expression isTrue from the command that is performed if theexpression is False. The macro code is terminatedby an END IF command.

    To set the custom function so that your salespeopleget 4.5 percent of total sales for five or fewer itemssold and 5 percent of total sales for more than fiveitems sold, you enter the following lines of codeunderneath the line with the Function command:

    If ItemsSold

  • Technique 61: Creating Custom Functions to Use in Your Worksheets376

    Figure 61-3: Sample worksheet after using the customfunction to calculate the sales commissions.

    Saving Custom Functions in an Excel Add-inThe only limitation to user-defined functions is thatwhen you enter them directly into a cell (withoutthe use of the Insert Function dialog box), you mustpreface their function names with their filenames.For example, if you want to type in the customCommission function thats saved in the PersonalMacro Workbook and you enter the following formula:


    (assuming that cell C9 contains the total sales and cellC10 contains the number of items sold), Excel returnsthe #NAME? error value to the cell. If you then edit thefunction to include the Personal Macro Workbooksfilename as follows:


    Excel then calculates the sales commission basedon the TotalSales in C9 and the ItemsSold in C10,returning this calculated value to the cell containingthis user-defined function.

    The really nice thing about custom functions is thatyou can use Excels Insert Function button on theFormula bar to use them in your spreadsheets.Figures 61-2 and 61-3 illustrate how easy it is to enterthe custom Commission function in a worksheetwith the Insert Function feature.

    Figure 61-2 shows a worksheet that contains a tablewith the April 2004 RV sales for three salespeople:Fred, Holly, and Jack. For this sample worksheet, Iused the Automatic Subtotals feature (Technique 35)to compute both the monthly total sales (with theSUM function) and the number of sales (with theCOUNT function) for each of these three salespeople.

    Figure 61-2: Entering the arguments for the customCommission function.

    To use the custom Commission function to computethe sales commissions for all the salespeople, I clickthe Insert Function button on the Formula bar to open the Insert Function dialog box, where I select theUser Defined category and then select PERSONAL.XLS!Commission function from the Select a Functionlist. Excel then opens the Function Arguments dialogbox (shown in Figure 61-2), where I supply the neces-sary arguments for this custom function.

    Figure 61-3 shows the sample RV Sales worksheetafter using the custom Commission function tocalculate the sales commissions for all threesalespeople.

    70_574272 ch61.qxd 10/4/04 8:36 AM Page 376

  • Saving Custom Functions in an Excel Add-in 377

    To be able to omit the filenames from custom func-tions when you enter them directly into a cell, youneed to save the workbook file that contains themas a special add-in file. (See Technique 8.) Then,after saving the workbook with your user-definedfunctions as an add-in file, you can start entering thefunctions into any worksheet sans their filenamequalifiers by activating the new add-in file in theAdd-Ins dialog box (ToolsAdd-Ins).

    To convert a workbook containing the user-definedfunctions that you want to be able to enter into work-sheets without their filenames, follow these steps:

    1. Open the workbook in which youve savedyour user-defined functions in Excel.

    Make sure that each custom function worksproperly.

    2. Press Alt+F11 or choose ToolsMacroVisualBasic Editor to open Visual Basic Editor.

    3. Choose ToolsVBAProject Properties fromVisual Basic Editors menu bar to open theVBAProject - Project Properties dialog box,shown in Figure 61-4.

    Figure 61-4: Password-protecting the custom functionsfrom further changes.

    4. Select the Protection tab and then select theLock Project for Viewing check box.

    Selecting this check box prevents other usersfrom viewing the custom functions so that theycant make any changes to them.

    5. Select the Password text box, enter the pass-word there, and then select the ConfirmPassword text box and re-enter the passwordexactly as you entered it in the text box above.Then click OK.

    This password prevents users from removing theview-protection status.

    6. Click the View Microsoft Excel button at thebeginning of the Standard toolbar in the VisualBasic Editor window to return to the Excelworksheet.

    7. Choose FileProperties to open the Propertiesdialog box, shown in Figure 61-5.

    Figure 61-5: Entering a title for the new add-in file.

    70_574272 ch61.qxd 10/4/04 8:36 AM Page 377

  • Technique 61: Creating Custom Functions to Use in Your Worksheets378

    The Browse dialog box closes, and you return tothe Add-Ins dialog box.

    15. Select the check box in front of the name of thenew add-in and then click OK to close the Add-Ins dialog box.

    This action activates the add-in so that you canenter its user-defined functions in any worksheet.

    After you close the Add-Ins dialog box, you can startentering the custom functions that this add-in filecontains directly into the cells of any spreadsheetwithout having to open the Insert Function dialogbox.

    Figure 61-6: Selecting the add-in file that contains thecustom functions.

    8. Enter a descriptive title for the add-in in theTitle text box, enter a description of its contentsin the Comments text box, and then click OK.

    Before saving the workbook as an add-in, youshould add a title and description of the user-defined functions that it contains. (This informa-tion then appears in the Add-Ins dialog boxwhenever you select the add-in file.)

    After you click OK, youre ready to save theworkbook file as a special add-in file.

    9. Choose FileSave As to open the Save Asdialog box.

    10. From the Save as Type drop-down list, selectMicrosoft Excel Add-In (*.xla).

    This action selects the Add-Ins folder in the SaveIn drop-down list box showing the names of anyadd-in files that youve saved there.

    11. Select the File Name drop-down list box andreplace the current filename with one of yourown (without changing the .xla filenameextension) and then click the Save button.

    After saving your workbook as an add-in file, youneed to follow the remaining steps to activate itso that you can enter its user-defined functionsin any worksheet.

    12. Choose ToolsAdd-Ins to open the Add-Ins dia-log box, shown in Figure 61-6.

    13. Click the Browse button in the Add-Ins dialogbox to open the Browse dialog box.

    14. Select the name of your new add-in file in theBrowse list box and then click OK.

    70_574272 ch61.qxd 10/4/04 8:36 AM Page 378

  • Aabsolute cell references, 131133accept changes, sharing workbooks on network,

    244245Accept Labels in Formulas check box, 152Access, 358, 360add-ins

    about, 40built-in, 41deactivating, 41free, 42installing, 4041online, 4243saving custom functions, 376378

    Add-Ins dialog box, 40, 378Add Words To, Spell Check feature, 202adding

    custom words to dictionary, 203Excel to Quick Launch toolbar, 3738headings to report printing, 225227images, 343344list of spreadsheets, SharePoint, 333334macros and links to toolbars and menus, 1718spreadsheets to SharePoint, 330334vertical separator bar, 15

    Advanced File Search task pane, File Search taskpane, 174175

    Advanced Filter featureabout, 272calculated filtering criteria, 276277AND criteria, 274275filtering criteria, 274OR criteria, 274275

    Advanced Text Import Settings dialog box, 234Alert before Overwriting Cells options, 33alignment

    about, 111centering heading across columns, 116

    indenting data entries, 112113nonstandard vertical, 113Orientation, 112Right-to-Left, 112rotating text entries, 113114shrinking text to fit in cells, 115116styles, 92Text Alignment, 111Text Control, 112text wrap within cells, 114115

    Alignment tab, Format Cells dialog box, 112All Hidden button, 109All Programs menu, 39Allow Cell Drag and Drop option, 33Always Show Full Menus check box, 14ampersand, 18, 356Analysis ToolPak, 41Analysis ToolPak VBA, 41AND criteria, Advanced Filter feature, 274275Apply Names feature, 146applying predefined styles, 93arranged workspace, 19array formulas

    about, 137140editing, 140

    Assign Hyperlink dialog box, 18Assign Macro dialog box, 18assigning

    hot keys, 17passwords for spreadsheets, 207209range names to constants, 144

    auto-hiding Windows taskbar, 9AutoComplete, Edit settings, 32AutoCorrect

    about, 58hyperlinks, 5960settings, 5859Smart Tags, 6061Spell Check feature, 203


    71_574272_bindex.qxd 10/1/04 11:16 PM Page 379

  • Excel Timesaving Techniques For Dummies380

    AutoFillabout, 67copying entries, 6970custom lists, 71data entry, 6771incremental entries, 70numbered series, 69series, 68

    AutoFill Options button, 69AutoFilter

    about, 267268customizing settings, 270271saving subsets, 269top 10 list, 268269

    AutoFormat As You Type, 58AutoFormat range formatting, 8789automated lookups

    about, 349single table value, 349352two-way in data table, 352354

    automatic hyperlinks setting, 5960AutoRecover settings, changing, 2526AutoSelect, 5455AutoShapes button, 345AVERAGE function, 193, 195

    BBasic File Search, File Search task pane, 172173BASIC programming language, 365blank worksheets, 8Boolean logic filtering, 274275Border styles, 92built-in add-in programs, 41buttons

    All Hidden button, 109AutoFill Options button, 69AutoShapes button, 345Column Level button, 192Criteria button, 258Custom Button, 17Decrease Decimal button, 93deleting from toolbar, 15Draw button, 345Import button, 71Insert Diagram button, 347Insert Function button,150152

    Insert Hyperlink button, 318Last Tab button, 50Merge and Center button, 116Next Comment button, 251Next Group button, 50Organization Chart button, 347Previous Comment button, 251Print Preview button, 30repositioning, 16ScreenTip button, 318Speak Cells button, 83Trace Error button, 162Trace Precedents button, 160

    Ccalculated fields

    about, 255pivot tables, 297298

    calculated filtering criteria, Advanced Filter, 276277Calculation tab, 163capturing information, Web Query, 310313case-related text functions, 355356Category fields, summary data, 24cell pointer

    direction, 32Edit settings, 32Speech Recognition feature, 340341

    cell selectionsabout, 5354AutoSelect, 5455big, 5657columns, 56complete columns, 56Go To feature, 5556multiple worksheets, 57rows, 56sequential data, 54worksheets, 56

    Cell Value Is, conditional formatting, 98cells

    copying formatting, 89deleting, 187188existing range, 187188inserting, 187188reference destination, 318

    centering heading across columns, 116

    71_574272_bindex.qxd 10/1/04 11:16 PM Page 380

  • Index 381

    changes from different users, sharing workbooks onnetwork, 243245

    changingAutoRecover settings, worksheets, 2526passwords, 210211scale printing, 224225tracking, sharing workbooks on network, 241243

    Character Map program, 104Chart Options dialog box, 127Chart Wizard, 119122Chart Wizard dialog box, 120121charts

    about, 117Chart Wizard, 119122embedded charts, 121122formatting axes, 125127headings, 119, 123125instant, 117119plotted data, 127128printing in reports, 228229repositioning, 122resizing, 122scaling axes, 125127titles, 119, 123125

    check boxesAccept Labels in Formulas, 152Always Show Full Menus, 14Enable Background Error Checking, 29Merge Cells, 116Move Selection After Enter, 32Prompt for Workbook Properties, 24Show Quick Launch, 37

    Circle Invalid Data, Formula Auditing toolbar, 159circular references, 163Clear Validation Circles, Formula Auditing toolbar,

    159Clip Art task pane, 342343Clipboard, copying to, 34Close Side by Side, Compare Side by Side feature,

    185Clustered Bar charts, 123Clustered Column charts, 125clustered column charts, 118codes

    headers and footers, 226number formats, 103104

    Column Level button, 192

    columnsabout, 8copying widths, 90headings names, 142143Inserting, 49sorting in data list, 266widths, 221

    comma, 234Comma (0) style, 93Comma style, 93Commands tab, 14, 15comments, workbook

    deleting, 249250editing, 248249formatting, 248249showing, 248

    Compare Side by Side featureabout, 184Close Side by Side, 185Reset Window Position, 185Synchronous Scrolling, 185

    comparingsheets in same workbook, 184185sheets in separate workbooks, 185186

    concatenating, 356Condition, Search For, 175conditional formatting

    about, 97Cell Value Is, 98criteria, 98finding cells, 100Formula Is, 98number formats, 105106outstanding errors, 100101two conditions, 99100

    Conditional Formatting dialog box, 98Conditional Formatting features, 2930Conditional Sum Wizard, 41conflict resolution worksheet style, 243244Connect to Share dialog box, 334consolidated data linking, 197198Consolidation feature

    about, 195data by category, 197data by position, 195197linking consolidated data, 197198

    constants, assigning range names, 144

    71_574272_bindex.qxd 10/1/04 11:16 PM Page 381

  • Excel Timesaving Techniques For Dummies382

    converting existing list, 329Copy To range, 275copying

    absolute cell references, 131133cell formatting, 89to Clipboard, 34column widths, 90with Ctrl key, 33data validation settings, 7475dimensions, 133135entries, AutoFill, 6970formulas, 131136range formatting, 9091relative cell references, 131133

    COUNT function, 193, 195COUNTA function, 195crashes, computer, 26Create List dialog box, 326Create Names dialog box, 142criteria

    conditional formatting, 98data validation, 75

    Criteria button, 258Criteria data form, 260Ctrl key

    copying with, 33moving cell pointer with, 4849

    Currency (0) style, 93Currency style, 93Custom AutoFilter, 270271Custom Button, 17custom dialog box macros, 371373custom display settings saving, 1112custom functions

    about, 374creating, 374376saving in add-ins, 376378

    custom lists, AutoFill, 71custom menus

    creating, 1617hyperlinks, 321322

    custom number formats, 102106Custom Settings tab, 73custom toolbars

    creating, 1617hyperlinks, 321322

    Custom View feature, 180181

    CUSTOM.DIC, 203Customize dialog box, 14customizing

    menus, 1318predefined styles, 94settings, AutoFilter, 270271Spell Check feature, 202203toolbars, 1318, 1416worksheet gridlines, 11


    by category, Consolidation feature, 197on different worksheets, 182by position, Consolidation feature, 195197

    data entryabout, 58, 62AutoCorrect, 5861AutoFill, 6771Group mode, 6566hands-free, 337339preselect ranges, 6365same entry in many places, 6263

    data formsadding new records, 257258creating, 255260editing records, 259finding records, 258259navigating, 256257removing records, 260

    data listsabout, 255adding new records, 257258creating, 255260editing records, 259filtering, 267271finding records, 258259removing records, 260statistics, 277279

    data sharingabout, 230embedding Excel data in Office documents,

    235237importing text files, 232235swapping data via Clipboard, 230232

    data source definition, 358360

    71_574272_bindex.qxd 10/1/04 11:16 PM Page 382

  • Index 383

    Data Table featureabout, 280one-variable, 280282two-variable, 282283two-way automated lookup, 352354

    data validationabout, 72copying data validation settings, 7475criteria, 75drop-down list, 7374error alert message, 7677finding cells, 75input message, 7576Settings tab, 7273

    database queries, import data from externaldatabase, 360364

    Date, Settings tab, 73dates

    AutoFill, 68errors, 28formulas, 164166

    DAVERAGE function, 277279days, AutoFill, 68DCOUNT function, 277279deactivating add-ins, 41decimal places, numerical entry, 7980decimal Settings tab, 72Decrease Decimal button, 93Default File Location, 2324deleting

    buttons from toolbar, 15cells in existing range, 187188columns, Excel 2003 lists, 329comments, workbook, 249250lists, 329passwords, 210211rows, Excel 2003 lists, 329rows and columns, 188189vertical separator bar, 15worksheet protection, 213214worksheets, 190

    deletion editingabout, 187deleting cells in existing range, 187188deleting rows and columns, 188189deleting worksheets, 190

    delimited files, 232

    dependents, 158desktop shortcut, program startup, 3637destinations, hyperlinks, 318Diagram Gallery dialog box, 348diagrams, drawing, 347348dialog boxes

    Add-Ins dialog box, 40, 378Advanced Text Import Settings, 234Assign Hyperlink, 18Assign Macro, 18Chart Options, 127Chart Wizard, 120121Conditional Formatting, 98Connect to Share, 334Create List, 326Create Names, 142custom, 371373Customize, 14Diagram Gallery, 348Edit WordArt Text, 347Error Checking, 163File Properties, 24Filter Data, 361Format Cells, 30, 102, 112Go To, 51Go To Special, 100Hyperlink, 38ODBC Microsoft Access Setup, 360Open, 175176Options, 21, 25Paste Special, 91Protect Sheet, 212Protect Workbook, 217Rearrange Commands, 1516Save Workspace, 21Scenario Summary, 287Search Results, 37Sort, 262264Speech Properties, 84Speech Recognition, 340Start Menu Properties, 37Style, 107

    Dictionary Language, Spell Check, 202dimensions, copying formulas, 133135direct cell editing, 3435direct precedents, 158Disable AutoRecover check box, 26

    71_574272_bindex.qxd 10/1/04 11:16 PM Page 383

  • Excel Timesaving Techniques For Dummies384

    distributing copies, sharing workbooks, 245246#DIV/0! error, 154Document Recovery task pane, 26dqy files, 364drag-and-drop

    Edit settings, 3334failure, 3334

    drag-and-drop editing, 3334Draw button, 345drawing

    diagrams, 347348objects, 344348organization charts, 347348shapes, 345

    Drawing toolbar, 345drop-down lists, data validation, 7374DSUM function, 277

    Ee-mail address destination, 318Edit settings

    about, 31AutoComplete, 32cell pointer, 32direct cell editing, 3435drag-and-drop, 3334

    Edit WordArt Text dialog box, 347editing

    array formulas, 140changes, sharing workbooks, 239comments, workbook, 248249drag-and-drop, 3334Excel 2003 lists, 328329hyperlinks in worksheet, 321long formulas, 3435macros, 369373

    embedded charts, 121122embedding data in Office documents

    about, 235embedded worksheet data, 235236linking worksheet data, 237

    Enable AutoComplete for Cell Values option, 32Enable Background Error Checking box, 29enabling cell range editing, 214216Equal to, Criteria button, 258error checking

    about, 2728

    hiding error values on-screen and in print, 2930modifying settings, 2829suppressing all error indicators, 29

    Error Checking dialog box, 163Error Checking tab, Options dialog box, 28, 29Error Indicator Color pop-up palette, 29error messages, data validation, 7677error tracing

    about, 158finding original error and fixing formula, 162163Formula Auditing toolbar, 158160formula precedents, 160161tracing formula dependents, 161162

    error valuesabout, 27hiding on-screen and in print, 2930

    errorsabout, 154Evaluates to Error Value, 28, 29formula, 27logical functions, 154155suppressing indicators, 29trapping all types of error values, 156157trapping division by zero errors, 155156

    Euro conversion ISO codes, 110Euro Currency formats, 109110Euro Currency Tools, 41EUROCONVERT function, 41EuroValue toolbar, 109110Evaluate Formula, Formula Auditing toolbar, 159Evaluates to Error Value error, 28, 29Excel 2003 lists

    about, 325converting existing list, 326327, 329creating, 325327deleting columns, 329deleting lists, 329deleting rows, 329editing, 328329filtering, 327328inserting columns, 329inserting rows, 329new list, 327sorting, 327328total row, 328

    EXCEL.EXE, 36EXT mode, 54

    71_574272_bindex.qxd 10/1/04 11:16 PM Page 384

  • Index 385

    FF2 key, 34F5 key, 51FALSE condition, 98field argument, 277fields, 255File Properties dialog box, 24File Search task pane

    about, 172Advanced File Search task pane, 174175Basic File Search, 172173Search Results task pane, 173174

    filenamesdestination, 318extensions, 19

    filesdefault file location, 2324delimited, 232dqy, 364File Properties dialog box, 24HTML, 303309importing text, 232235modifying default file location, 2324protecting structure of workbook, 216217saving with summary information, 2425tab-delimited, 232turn off file sharing, 245XLA, 40, 41xls, 235xlw, 19XML, 309XML Data, 313XML Schema, 313XML Transform, 313xsd, 313xsl, 313

    Fill handle, 68Fill Series, 69Filter Data dialog box, 361filtering

    advanced, 272277criteria, Advanced Filter, 274data lists, 267271Excel 2003 lists, 327328

    Find and Replace featureabout, 199201Formulas and Values Look In option, 201

    findingcells, conditional formatting, 100cells, data validation, 75original error and fixing formula, 162163

    FIX, 79Fixed Decimal setting, 7980folders, designating alternate startup, 20Font styles, 92footers

    codes, 226printing, 225226

    Format Cells dialog boxabout, 30, 102Alignment tab, 112

    Format Painter, 8990Format tab, 308Formats option, Paste Special dialog box, 91formatting

    axes on charts, 125127comments, workbook, 248249copying, 9091values, pivot tables, 295296

    Formatting toolbar styles, 9394Formula Auditing toolbar

    about, 158, 228Circle Invalid Data, 159Clear Validation Circles, 159Evaluate Formula, 159New Comment, 159Remove All Arrows, 159Remove Dependent Arrows, 159Remove Precedent Arrows, 159Slow Watch Window, 159Trace Dependents, 159Trace Error, 159Trace Precedents, 158

    formula errors, 27Formula Is, conditional formatting, 98Formula Omits Cells in Region error, 28Formula tab, 308Formula toolbar, 8

    71_574272_bindex.qxd 10/1/04 11:16 PM Page 385

  • Excel Timesaving Techniques For Dummies386

    formulasabout, 148copying, 131136dates, 164166editing long, 3435IF, 155156Insert Function button, 150152labels instead of cell references, 152153pointing out cell references, 148150precedents, 160161printing in reports, 227228range names, 144147replacing with results, 357SUM formulas, 132133time, 164, 166167

    Formulas and Values Look In option, Find andReplace feature, 201

    Formulas Referring to Empty Cells error, 28Fraction category, 105free add-ins, 4243Freeze Panes feature, 179180freezing computer, 26Frozen Panes feature, 179180Full Screen view, 8functions

    AVERAGE function, 193, 195COUNT function, 193, 195COUNTA function, 195custom, 374378DAVERAGE function, 277279DCOUNT function, 277279DSUM function, 277EUROCONVERT, 41INDEX functions, 354ISERROR function, 29, 156ISNUMBER function, 8081logical functions errors, 154155LOWER function, 355356MATCH functions, 354MAX function, 195MAXIMUM function, 193MIN function, 195MINIMUM function, 193NOT function, 277PMT function, 136PRODUCT function, 193, 195PROPER function, 355356

    STDEV function, 195STDEVP function, 195SUM function, 193summary, 296297TABLE function, 282UPPER function, 355356VAR function, 195VARP function, 195

    GGeneral tab, Options dialog box, 24Go To dialog box, 51Go To feature

    cell selections, 5556navigating worksheets, 51

    Go To Special dialog box, 100Goal Seek feature

    graph style, 289290what-if analysis, 288290

    graph style, Goal Seek feature, 289290graphics

    about, 342adding images, 343344Clip Art task pane, 342343drawing diagrams, 347348drawing objects, 344348drawing organization charts, 347348drawing shapes, 345text boxes as callouts, 346WordArt, 346347

    Greater than, Criteria button, 258Greater than or equal to, Criteria button, 258259gridlines, 8Gridlines tab, 127Group mode, data entry, 6566

    Hhands-free data entry, 337339headings

    centering across columns, 116charts, 119, 123125codes, 226printing, 225226

    71_574272_bindex.qxd 10/1/04 11:16 PM Page 386

  • Index 387

    hidingerror values on-screen and in print, 2930formulas shortcuts, 228number format entries, 106sensitive data, spreadsheet, 217218

    HLOOKUP ( horizontal table lookup), 349, 351352horizontal I-beam pointer, 33horizontal split bar, 183horizontal table lookup (HLOOKUP), 349, 351352hot keys, assigning, 17HTML files, 303309Hyperlink dialog box, 38hyperlinks

    about, 317adding to worksheets, 317320AutoCorrect, 5960custom menus and toolbars, 321322editing links in worksheet, 321following in worksheets, 320321

    II-beam pointer

    horizontal, 33vertical, 33

    IF construction, 155IF formula, 155156Ignore Internet and File Addresses, Spell Check

    feature, 202Ignore Words in UPPERCASE, Spell Check feature,

    202Ignore Words with Numbers, Spell Check feature, 202Import button, 71importing

    data from external database queries, 358364text files, data sharing, 232235Web data into worksheets, 310316XML data into worksheets, 313316

    Inconsistent Formula in Region error, 28inconsistent formulas, 28incremental entries, AutoFill, 70indenting data entries, 112113INDEX functions, 354information capture, Web Query, 310313input message, data validation, 7576Insert Diagram button, 347

    Insert Function button, 150152Insert Hyperlink button, 318inserting

    cells in existing range, 187188columns, 49columns, Excel 2003 lists, 329rows, 49rows, Excel 2003 lists, 329rows and columns, 188189worksheets, 190

    insertion editingabout, 187inserting cells in existing range, 187188inserting rows and columns, 188189inserting worksheets, 190

    installingadd-in programs, 4041Text to Speech, 82

    instant charts, 117119interactive Web page worksheets, 307309Internet Assistant VBA, 41ISERROR function, 29, 156ISNUMBER function, 8081

    Jjoining separate text entries, 356357

    Kkeystroke macros, recording, 108109keystrokes, moving within cell ranges, 64

    LLabel Data with Smart Tags, 60labels instead of cell references, 152153Language toolbar, 338339last cell, navigating worksheets, 4950Last Tab button, 50launching Excel on Windows startup, 39left cell pointer, 32Less than, Criteria button, 259Less than or equal to, Criteria button, 259Library folder, 40

    71_574272_bindex.qxd 10/1/04 11:16 PM Page 387

  • Excel Timesaving Techniques For Dummies388

    linkingabout, 235consolidated data, 197198to toolbars and menus, 1718worksheet data, 237

    List, Settings tab, 73List Data Validation Error, 28lists

    about, 325converting existing, 326327, 329creating, 325327deleting, 329deleting columns, 329deleting rows, 329editing, 328329filtering, 327328inserting columns, 329inserting rows, 329new list, 327sorting, 327328total row, 328

    logical FALSE, 154logical functions errors, 154155logical TRUE, 154long formulas, editing, 3435Lookup Wizard, 41, 352354LOWER function, 355356

    MMacro Systems, 4243macros

    about, 365adding, 1718custom dialog box, 371373editing, 369373modifying settings, 370371playing back, 368369recording, 365368recording keystrokes, 108109

    magnification, 52margins widths, 221MATCH functions, 354MAX function, 195MAXIMUM function, 193memory, add-ins and, 41

    menusAll Programs menu, 39custom menus, 1617custom menus hyperlinks, 321322Microsoft Office submenu, 39pull-down menus, 13Speech Recognition feature, 340

    Merge and Center button, 116Merge Cells check box, 116merging

    different copies, workbooks on network, 245246styles, 9596

    merging changessharing workbooks on network, 246workbook review, 250251

    Microsoft Access, 358, 360Microsoft Office submenu, 39Microsoft SharePoint Services, 330336MIN function, 195MINIMUM function, 193modifying

    default file location, 2324number of workbook sheets, 1011

    modifying settingserror checking, 2829macros, 370371Text to Speech, 84

    monitor size, 14months, AutoFill, 68Move Selection After Enter check box, 32moving

    cell pointer with Ctrl key, 4850within cell ranges keystrokes, 64

    multiple worksheets, selecting, 57

    N#NA error, 154#NAME, 156names

    column headings, 142143ranges, 141144row headings, 142143

    navigating worksheetsabout, 47blanks, 4849data ranges, 48

    71_574272_bindex.qxd 10/1/04 11:16 PM Page 388

  • Index 389

    Go To feature, 51last cell, 4950saving cell pointers position, 47Zoom feature, 52

    negative numbers, 79network, sharing workbooks on

    about, 238accept or reject changes, 244245change tracking, 241243changes from different users, 243245conflict resolution worksheet style, 243244distributing copies, 245246editing changes, 239merging changes, 246merging different copies, 245246setting sharing options, 240241Share Workbook, 238239turn off file sharing, 245

    New Comment, Formula Auditing toolbar, 159new document destination, 318new files with summary information, 2425New Menu item, 16Next Comment button, 251Next Group button, 50None table format, 88nonstandard vertical alignment, 113Normal style, 93Not equal to, Criteria button, 259NOT function, 277NUM indicator, 79Number of Programs on Start Menu option, 38Number Stored as Text error, 28Number styles, 92Number tab, Format Cells dialog box, 105numbers

    about, 78, 102codes, 103104conditionally format entries, 105106custom, 102106decimal places, 7980Euro Currency formats, 109110hide entries, 106ISNUMBER function, 8081stored as text, 28to styles, 107109to toolbars, 107109

    numeric keypad, 7879

    Oobjects drawing, 344348ODBC Microsoft Access Setup dialog box, 360Office Web Components, 307on-screen error values hiding, 2930one-dimensional array ranges, 138one-variable Data Table, 280282Open dialog box Search, 175176opening

    panes, worksheet windows, 182184password-protected workbook, 209210spreadsheet workspace on launch, 2021spreadsheets, SharePoint Web sites, 332333

    Options dialog box, 21, 25OR criteria, Advanced Filter feature, 274275Organization Chart button, 347organization charts, drawing, 347348Orientation alignment, 112Outline feature

    about, 191adding levels to table or list, 191193

    Subtotal feature, 193194Outlook e-mail, 251outstanding errors, 100101

    PPage Break Preview feature, 223224page breaks, 222224page settings, 221222Page Setup dialog box, 30, 229palettes, Error Indicator Color pop-up, 29parsed data, 234Password text box, 377passwords

    assigning for spreadsheets, 207209changing, 210211deleting, 210211opening password-protected workbook, 209210spreadsheet security, 207211

    Paste Link option, 237Paste Special dialog box, 91pathnames

    about, 23installing add-in programs, 40

    71_574272_bindex.qxd 10/1/04 11:16 PM Page 389

  • Excel Timesaving Techniques For Dummies390

    Patterns styles, 92Percent style, 93period, 234Personal Macro Workbook, 370pinning Excel to Start menu, 3839pivot charts, 298299pivot tables

    about, 291calculated fields, 297298creating, 291298formatting values, 295296pivoting fields, 294295summary functions, 296297

    pivoting fields, 294295Places text box, 79playing back macros, 368369plotted data charts, 127128PMT function, 136pointing out cell references, 148150preselect ranges, 6365Previous Comment button, 251Print Preview, 219222Print Preview button, 30printing

    about, 219adding headings to report, 225227changing scale, 224225charts in reports, 228229error values hiding, 2930formulas in reports, 227228headers and footers, 225226margins and column widths, 221page breaks, 222224page settings, 221222Print Preview, 219222titles on every page, 226227

    PRODUCT function, 193, 195Production styles, 92program startup

    about, 36adding Excel to Quick Launch toolbar, 3738desktop shortcut, 3637launching Excel on Windows startup, 39pinning Excel to Start menu, 3839streamlining, 3639

    Prompt for Workbook Properties check box, 24PROPER function, 355356

    Property Search For, 175Protect Sheet dialog box, 212Protect Workbook dialog box, 217protecting structure of workbook file, 216217Protection tab, 377publishing Excel lists to SharePoint Web sites,

    334336pull-down menus, 13


    creating database query, 360364data source definition, 358360import data from external database, 358364,

    360364Query Wizard, 360364Quick Launch toolbar, adding Excel to, 3738

    Rrange formatting

    about, 87AutoFormat, 8789copying formatting, 9091Format Painter, 8990

    range namesabout, 141assigning to constants, 144destination, 318formulas, 144147spanning sheets, 143144

    rearrange buttons from toolbar, 15Rearrange Commands dialog box, 1516Recently Used file list, 171172recently used workbooks, 171172recognizers, 60recording

    keystroke macros, 108109macros, 365368

    Recovered version of software, 26#REF, 156references

    absolute cell references, 1311333-D references, 143

    71_574272_bindex.qxd 10/1/04 11:16 PM Page 390

  • Index 391

    reject changes, sharing workbooks on network,244245

    relative cell references, 131133Remove All Arrows, Formula Auditing toolbar, 159Remove Dependent Arrows, Formula Auditing tool-

    bar, 159Remove Precedent Arrows, Formula Auditing tool-

    bar, 159Replace Contents alert box, 33replacing formulas with results, 357reply with changes, workbook review, 250repositioning

    buttons, 16charts, 122

    Reset Window Position, Compare Side by Sidefeature, 185

    resizing charts, 122Results Should Be, 173right cell pointer, 32Right-to-Left alignment, 112rotating text entries, 113114rows

    about, 8deleting, 188189inserting, 49, 188189name headings, 142143

    SSave tab, Options dialog box, 25Save Workspace dialog box, 21saving

    about, 22changing AutoRecover settings, 2526custom display settings, 1112custom functions in add-ins, 376378modifying default file location, 2324new files with summary information, 2425saving new files with summary information, 2425spreadsheet workspace, 1920worksheets, 2226

    scaling axes charts, 125127Scenario Name text box, 285Scenario Summary dialog box, 287scenarios, what-if analysis, 284287screen display

    about, 7

    customizing worksheet display, 911saving custom display settings, 1112standard display settings, 8switching to full screen, 89

    ScreenTip button, 318Search, Open dialog box, 175176Search For

    Condition, 175Property, 175Value, 175

    Search In combo box, 173Search Results dialog box, 37Search Results task pane, 173174Search Text box, 172sending out workbook review, 250251sequential data cell selections, 54setting

    sharing options, 240241standard column width, 910standard row height, 9

    settings, AutoCorrect, 5859Settings tab

    Custom, 73Date, 73Decimal, 72List, 73Text Length, 73Time, 73Whole Number, 72

    shapes drawing, 345Share Workbook, 238239SharePoint Services, 330336SharePoint Services Team site, 330SharePoint Services Web sites

    about, 325, 330adding list of spreadsheets, 333334adding spreadsheets to, 330334opening spreadsheets, 332333publishing Excel lists to, 334336publishing lists to, 334336synchronizing list data, 336

    sharing workbooks on networkabout, 238accept or reject changes, 244245change tracking, 241243changes from different users, 243245conflict resolution worksheet style, 243244

    71_574272_bindex.qxd 10/1/04 11:16 PM Page 391

  • Excel Timesaving Techniques For Dummies392

    sharing workbooks on network (continued)distributing copies, 245246editing changes, 239merging changes, 246merging different copies, 245246setting sharing options, 240241Share Workbook, 238239turn off file sharing, 245

    Sheet Name text box, 309Sheet tab, 50, 309shortcut icon, 37shortcuts

    hiding formulas, 228program startup, 3637

    Show Quick Launch check box, 37showing

    comments, workbook, 248toolbars and menus, 1314

    shrinking text to fit in cells, 115116single table value, automated lookups, 349352single worksheets window, 182Slow Watch Window, Formula Auditing toolbar, 159Smart Tab, 27Smart Tags

    about, 58AutoCorrect, 6061

    Solver Add-In, 41Sort Ascending, 268Sort Descending, 268Sort dialog box, 262264Sort feature

    about, 261sorting field names in data list, 265266sorting list with three key fields, 264265sorting on record number, 264sorting records in data list, 262264

    Sort Order dialog box, 361sorting

    columns in data list, 266Excel 2003 lists, 327328field names in data list, 265266list with three key fields, 264265on record number, 264records in data list, 262264worksheet data, 261266

    spanning sheets, range names, 143144Speak Cells button, Text to Speech, 83Speak on Enter mode, Text to Speech, 83

    Speech Properties dialog box, 84Speech Recognition feature

    about, 337339cell pointer, 340341dialog boxes, 340menu items, 340punctuation and special symbols, 338339toolbar buttons, 340Voice Command mode, 339

    Spell Check featureabout, 201202Add Words To, 202adding custom words to dictionary, 203AutoCorrect Options, 203customizing, 202203Dictionary Language, 202Ignore Internet and File Addresses, 202Ignore Words in UPPERCASE, 202Ignore Words with Numbers, 202Suggest from Main Dictionary Only, 202

    spreadsheet securityabout, 207enabling cell range editing, 214216hiding sensitive data, 217218passwords, 207211protecting structure of workbook file, 216217removing worksheet protection, 213214turn on worksheet protection, 212213unlocking cells for data entry, 211212

    spreadsheet workspaceabout, 19opening on Excel launch, 2021saving, 1920

    standard column width, 910standard row height, 9Start menu, pinning Excel to, 3839Start Menu Properties dialog box, 37statistics, data lists, 277279STDEV function, 195STDEVP function, 195Stop Recording toolbar, 367streamlining program startup, 3639strings, 199201Style dialog box, 107styles

    about, 92Alignment, 92

    71_574272_bindex.qxd 10/1/04 11:16 PM Page 392

  • Index 393

    applying predefined styles, 93Border, 92Comma (0) style, 93Comma style, 93creating your own, 9495Currency (0) style, 93Currency style, 93customizing predefined styles, 94Font, 92from Formatting toolbar, 9394merging styles, 9596Normal style, 93number formats, 107109Patterns, 92Percent style, 93Production, 92

    Subject fields, summary data, 24Subtotal feature

    about, 191Outline feature, 193194

    Suggest from Main Dictionary Only, Spell Checkfeature, 202

    SUM formulas, 132133SUM function, 193summary functions, pivot tables, 296297summary information, saving new files with, 2425Summary tab

    File Properties dialog box, 24Options dialog box, 25

    suppressing error indicators, 29swapping data via Clipboard, 230232synchronizing list data, SharePoint, 336Synchronous Scrolling, Compare Side by Side

    feature, 185

    Ttab-delimited files, 232TABLE function, 282Tablet PC, 247task panes

    Advanced File Search task pane, 174175Clip Art task pane, 342343Document Recovery task pane, 26File Search task pane, 172175Search Results task pane, 173174

    templatescreating, 1112using, 12

    Text Alignment, 111text boxes as callouts, 346Text Control alignment, 112Text Date with 2 Digit Years error, 28text entries rotating, 113114text functions

    about, 355case-related, 355356joining separate text entries, 356357replacing formulas with results, 357

    Text Import Wizard, 232233Text Length, Settings tab, 73Text to Speech

    about, 82installing, 82modifying settings, 84Speak Cells button, 83Speak on Enter mode, 83

    text wrap within cells, 1141153-D references, 143tilde, 228time

    AutoFill, 68formulas, 164, 166167

    Time Saving Microsoft Excel Solutions, 42Time Settings tab, 73titles

    charts, 119, 123125on every page, 226227

    toolbarscustom, 1617, 321322customizing, 1416Drawing, 345Formula, 8Formula Auditing, 158160, 228number formats, 107109Quick Launch, 3738showing, 1314Speech Recognition feature, 340Stop Recording, 367

    ToolTipsabout, 2728AutoFill, 68

    top 10 list, AutoFilter, 268269

    71_574272_bindex.qxd 10/1/04 11:16 PM Page 393

  • Excel Timesaving Techniques For Dummies394

    total row, Excel 2003 lists, 328Trace Dependents, Formula Auditing toolbar, 159Trace Error, Formula Auditing toolbar, 159Trace Error button, 162Trace Precedents button, 160tracing formula dependents, 161162trapping

    all types of error values, 156157division by zero errors, 155156

    TRUE condition, 98turn off file sharing, 245two-dimensional array ranges, 138two-variable Data Table, 282283two-way in data table, automated lookups, 352354

    UUngroup Sheets, 66Unlocked Cells Containing Formulas error, 28up cell pointer, 32UPPER function, 355356URL destination, 318

    VValue, Search For, 175values

    Cell Value Is, 98error, 27Evaluates to Error Value, 28, 29formatting, pivot tables, 295296hiding error values on-screen and in print, 2930single table value, 349352trapping, 156157

    VAR function, 195VARP function, 195VBA Editor, 369373vertical I-beam pointer, 33vertical split bar, 183vertical table lookup (VLOOKUP), 349352Visual Basic for Applications (VBA)

    about, 365editing macros in, 369373

    VLOOKUP (vertical table lookup), 349352Voice Command mode, 339Voice Selection drop-down list, 84

    WWeb data into worksheets importing, 310316Web page worksheets

    about, 303adding data to, 306307interactive, 307309opening, 305saving as, 303307saving part of worksheet, 306

    Web Presence Provider (WPP), 330Web Query feature

    about, 310capturing information, 310313importing XML data into worksheets, 313316

    Web sites add-ins, 42what-if analysis

    about, 280Goal Seek feature, 288290one-variable Data Table, 280282scenarios, 284287two-variable Data Table, 282283

    Whole Number, Settings tab, 72wildcards, 172Windows startup, launching Excel on, 39wizards

    Chart Wizard, 119122Conditional Sum Wizard, 41Lookup Wizard, 41, 352354Query Wizard, 360364Text Import Wizard, 232233

    WordArt, 346347workbook review

    about, 247comments, 248250getting workbook ready for, 247250merging changes, 250251reply with changes, 250sending out, 250251

    workbook sheets, modifying number of, 1011Workbook tab, 309workbooks finding

    File Search task pane, 172175recently used, 171172

    worksheet data sorting, 261266worksheet gridlines customizing, 11

    71_574272_bindex.qxd 10/1/04 11:16 PM Page 394

  • Index 395

    worksheet windowsabout, 177, 182comparing sheets in same workbook, 184185comparing sheets in separate workbooks, 185186Custom View feature, 180181data on different worksheets, 182Freeze Panes feature, 179180Frozen Panes feature, 179180opening panes, 182184single worksheets, 182Zoom In feature, 177179Zoom Out feature, 177179

    worksheetsdeleting, 190following hyperlinks, 320321Group mode, 6566importing Web data into, 310316inserting, 190navigating, 4752saving, 2226as Web pages, 303309

    XX axis, 127XLA files, 40, 41xls files, 235XLSTART folder, 20xlw files, 19XML Data files, 313XML data into worksheets importing, 313316XML files, 309XML Lists, 314XML Schema files, 313XML Transform files, 313xsd files, 313xsl files, 313

    YY axis, 125126years, AutoFill, 68

    ZZoom feature, 52Zoom In feature, 177179Zoom Out feature, 177179

    71_574272_bindex.qxd 10/1/04 11:16 PM Page 395


    2005-03-14T17:05:40+0800TeAm YYePGI attest to the accuracy and integrity of this document