Excel® Data Analysis: Your visual blueprint™ for analyzing data, charts, and PivotTables, 4th Edition

Published by John Wiley & Sons, Inc.
10475 Crosspoint Boulevard
Indianapolis, IN 46256

www.wiley.com

Published simultaneously in Canada

Copyright © 2013 by John Wiley & Sons, Inc., Indianapolis, Indiana

No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, 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) 646-8600. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, 201-748-6011, fax 201-748-6008, or online at www.wiley.com/go/permissions.

Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material included with standard print versions of this book may not be included in e-books or in print-on-demand. If this book refers to media such as a CD or DVD that is not included in the version you purchased, you may download this material at http://booksupport.wiley.com. For more information about Wiley products, visit www.wiley.com.

Library of Congress Control Number: 2013938097

ISBN: 978-1-118-51714-7

Manufactured in the United States of America

10 9 8 7 6 5 4 3 2 1

Trademark Acknowledgments

Wiley, the Wiley logo, Visual, the Visual logo, Visual Blueprint, Read Less - Learn More and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates. Excel is a registered trademark of Microsoft Corporation in the United States and/or other countries. All other trademarks are the property of their respective owners. John Wiley & Sons, Inc. is not associated with any product or vendor mentioned in this book.

LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND THE AUTHOR MAKE NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES OR PROMOTIONAL MATERIALS. THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR EVERY SITUATION. THIS WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING LEGAL, ACCOUNTING, OR OTHER PROFESSIONAL SERVICES. IF PROFESSIONAL ASSISTANCE IS REQUIRED, THE SERVICES OF A COMPETENT PROFESSIONAL PERSON SHOULD BE SOUGHT. NEITHER THE PUBLISHER NOR THE AUTHOR SHALL BE LIABLE FOR DAMAGES ARISING HEREFROM. THE FACT THAT AN ORGANIZATION OR WEBSITE IS REFERRED TO IN THIS WORK AS A CITATION AND/OR A POTENTIAL SOURCE OF FURTHER INFORMATION DOES NOT MEAN THAT THE AUTHOR OR THE PUBLISHER ENDORSES THE INFORMATION THE ORGANIZATION OR WEBSITE MAY PROVIDE OR RECOMMENDATIONS IT MAY MAKE. FURTHER, READERS SHOULD BE AWARE THAT INTERNET WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR DISAPPEARED BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ.

FOR PURPOSES OF ILLUSTRATING THE CONCEPTS AND TECHNIQUES DESCRIBED IN THIS BOOK, THE AUTHOR HAS CREATED VARIOUS NAMES, COMPANY NAMES, MAILING, E-MAIL AND INTERNET ADDRESSES, PHONE AND FAX NUMBERS AND SIMILAR INFORMATION, ALL OF WHICH ARE FICTITIOUS. ANY RESEMBLANCE OF THESE FICTITIOUS NAMES, ADDRESSES, PHONE AND FAX NUMBERS AND SIMILAR INFORMATION TO ANY ACTUAL PERSON, COMPANY AND/OR ORGANIZATION IS UNINTENTIONAL AND PURELY COINCIDENTAL.

Contact Us

For general information on our other products and services please contact our Customer Care Department within the U.S. at 877-762-2974, outside the U.S. at 317-572-3993 or fax 317-572-4002.

For technical support please visit www.wiley.com/techsupport.

Credits

Executive Editor

Jody Lefevere

Project Editor

Jade L. Williams

Technical Editor

Namir Shammas

Copy Editor

Marylouise Wiack

Editorial Director

Robyn Siesky

Business Manager

Amy Knies

Senior Marketing Manager

Sandy Smith

Vice President and Executive Group Publisher

Richard Swadley

Vice President and Executive Publisher

Barry Pruett

Project Coordinator

Katherine Crocker

Graphics and Production Specialists

Ronda David-Burroughs, Andrea Hornberger, Jennifer Mayberry

Quality Control Technician

Jessica Kramer

Proofreading

Joni Heredia Language Services

Indexing

Potomac Indexing, LLC

About the Author

Paul McFedries is a full-time technical writer. He has been authoring computer books since 1991 and has more than 80 books to his credit, including Teach Yourself VISUALLY Excel 2013, Teach Yourself VISUALLY Windows 8, Windows 8 Visual Quick Tips, The Facebook Guide for People Over 50, iPhone 5 Portable Genius, and iPad 4th Generation and iPad mini Portable Genius, all available from Wiley. Paul’s books have sold more than 4 million copies worldwide. Paul is also the proprietor of Word Spy (http://www.wordspy.com), a website that tracks new words and phrases as they enter the English language. Paul invites you to drop by his personal website at www.mcfedries.com, or you can follow him on Twitter @paulmcf and @wordspy.

Author’s Acknowledgments

It goes without saying that writers focus on text and I certainly enjoyed focusing on the text that you will read in this book. However, this book is more than just the usual collection of words and phrases designed to educate and stimulate the mind. A quick thumb through the pages will show you that this book is also chock full of treats for the eye, including copious screen shots, meticulous layouts, and sharp fonts. Those sure make for a beautiful book and that beauty comes from a lot of hard work by Wiley’s immensely talented group of designers and layout artists.

They are all listed in the Credits section on the previous page, and I thank them for creating another gem. Of course, what you read in this book must also be accurate, logically presented, and free of errors. Ensuring all this was an excellent group of editors that I got to work with directly, including project editor Jade Williams, copy editor Marylouise Wiack, and technical editor Namir Shammas. Thanks to all of you for your exceptional competence and hard work. Thanks, as well, to Wiley Executive Editor Jody Lefevere for asking me to write this book.

How to Use This Visual Blueprint Book

Who This Book Is For

This book is for advanced computer users who want to take their knowledge of this particular technology or software application to the next level.

The Conventions in This Book

Steps

This book uses a step-by-step format to guide you easily through each task. Numbered steps are actions you must do; bulleted steps clarify a point, step, or optional feature; and indented steps give you the result.

Notes

Notes give additional information — special conditions that may occur during an operation, a situation that you want to avoid, or a cross reference to a related area of the book.

Icons and Buttons

Icons and buttons show you exactly what you need to click to perform a step.

Extra or Apply It

An Extra section provides additional information about the preceding task — insider information and tips for ease and efficiency. An Apply It section takes the code from the preceding task one step further and allows you to take full advantage of it.

Bold

Bold type shows text or numbers you must type.

Italics

Italic type introduces and defines a new term.

Courier Font

Courier font indicates the use of scripting language code such as statements, operators, or functions, and code such as objects, methods, or properties.

Excel Data Analysis

Table of Contents

Chapter 1: Building Formulas for Data Analysis

Introducing Data Analysis

Introducing Formulas

Understanding Formula Types

Build a Formula

Add a Range Name to a Formula

Reference Another Worksheet Range in a Formula

Move or Copy a Formula

Switch to Absolute Cell References

Create an Array Formula

Turn On Iterative Calculations

Chapter 2: Troubleshooting Formulas

Understanding Error Values in Excel

Show Formulas Instead of Results

Use a Watch Window to Monitor a Cell Value

Step Through a Formula

Display Text Instead of Error Values

Check for Formula Errors in a Worksheet

Audit a Formula to Locate Errors

Chapter 3: Enhancing Formulas with Functions

Understanding Excel Functions

Understanding Function Types

Add a Function to a Formula

Add a Row or Column of Numbers

Build an AutoSum Formula

Round a Number

Create a Conditional Formula

Calculate a Conditional Sum

Calculate a Conditional Count

Find the Square Root

Retrieve a Column or Row Number

Look Up a Value

Determine the Location of a Value

Return a Cell Value with INDEX

Perform Date and Time Calculations

Chapter 4: Analyzing Financial Data

Calculate Future Value

Calculate Present Value

Determine the Loan Payments

Calculate the Principal or Interest

Find the Required Interest Rate

Determine the Internal Rate of Return

Calculate Straight-Line Depreciation

Return the Fixed-Declining Balance Depreciation

Determine the Double-Declining Balance Depreciation

Figure the Sum-of-the-Years-Digits Depreciation

Chapter 5: Analyzing Statistical Data

Calculate an Average

Calculate a Conditional Average

Determine the Median or the Mode

Find the Rank

Determine the Nth Largest or Smallest Value

Create a Grouped Frequency Distribution

Calculate the Variance and Standard Deviation

Find the Correlation

Chapter 6: Building Tables for Data Analysis

Understanding Tables

Introducing Table Features

Convert a Range to a Table

Select Table Data

Insert a Table Row

Insert a Table Column

Delete a Table Row

Delete a Table Column

Add a Column Subtotal

Chapter 7: Sorting and Filtering Data

Perform a Simple Sort or Filter

Perform a Multilevel Sort

Create a Custom Sort

Sort by Cell Color, Font Color, or Cell Icon

Using Quick Filters for Complex Sorting

Enter Criteria to Find Records

Create an Advanced Filter

Display Unique Records in the Filter Results

Count Filtered Records

Chapter 8: Learning Data Analysis Techniques

Highlight Cells That Meet Some Criteria

Highlight the Top or Bottom Values in a Range

Show Duplicate Values

Show Cells That Are Above or Below Average

Analyze Cell Values with Data Bars

Analyze Cell Values with Color Scales

Analyze Cell Values with Icon Sets

Create a Custom Conditional Formatting Rule

Highlight Cells Based On a Formula

Modify a Conditional Formatting Rule

Remove Conditional Formatting from a Range

Remove Conditional Formatting from a Worksheet

Set Data Validation Rules

Summarize Data with Subtotals

Group Related Data

Remove Duplicate Values from a Range or Table

Consolidate Data from Multiple Worksheets

Chapter 9: Working with Data Analysis Tools

Create a Data Table

Create a Two-Input Data Table

Skip Data Tables When Calculating Workbooks

Analyze Data with Goal Seek

Analyze Data with Scenarios

Understanding Solver

Load the Solver Add-In

Optimize a Result with Solver

Add Constraints to Solver

Save a Solver Solution as a Scenario

Chapter 10: Tracking Trends and Making Forecasts

Plotting a Best-Fit Trendline

Calculating Best-Fit Values

Plotting Forecasted Values

Extending a Linear Trend

Calculating Forecasted Linear Values

Plotting an Exponential Trendline

Calculating Exponential Trend Values

Plotting a Logarithmic Trendline

Plotting a Power Trendline

Plotting a Polynomial Trendline

Chapter 11: Working with the Analysis ToolPak

Load the Analysis ToolPak

Calculate a Moving Average

Compare Variances

Calculate Correlation

Run a Regression Analysis

Determine Rank and Percentile

Generate Random Numbers

Create a Frequency Distribution

Chapter 12: Analyzing Data with PivotTables

Understanding PivotTables

Explore PivotTable Features

Build a PivotTable from an Excel Range or Table

Create a PivotTable from External Data

Refresh PivotTable Data

Add Multiple Fields to the Row or Column Area

Add Multiple Fields to the Data Area

Move a Field to a Different Area

Group PivotTable Values

Change the PivotTable Summary Calculation

Introducing Custom Calculations

Insert a Custom Calculated Field

Insert a Custom Calculated Item

Chapter 13: Visualizing Data with Charts

Examine Chart Elements

Understanding Chart Types

Create a Chart

Display a Data Table

Change the Chart Layout and Style

Select a Different Chart Type

Add a Sparkline to a Cell

Chapter 14: Importing Data into Excel

Understanding External Data

Import Data from a Data Source

Import Data from an Access Table

Import Data from a Word Table

Import Data from a Text File

Import Data from a Web Page

Import Data from an XML File

Refresh Imported Data

Separate Cell Text into Columns

Chapter 15: Querying Data Sources

Understanding Microsoft Query

Define a Data Source

Start Microsoft Query

Tour the Microsoft Query Window

Add a Table to a Query

Add Fields to a Query

Filter the Records with Query Criteria

Sort Query Records

Return the Query Results

Chapter 16: Learning VBA for Data Analysis

Record a Macro

Open the VBA Editor

Explore the Excel Object Model

Add a Macro to a Module

Run a Macro

Assign a Shortcut Key to a Macro

Assign a Macro to the Quick Access Toolbar

Assign a Macro to the Ribbon

Set the Macro Security Level

Digitally Sign Your Excel Macros

Appendix: Using Excel Keyboard Shortcuts

Chapter 1

Building Formulas for Data Analysis

Introducing Data Analysis

Data analysis is the application of tools and techniques to organize, study, reach conclusions, and sometimes make predictions about a specific collection of information. A sales manager might use data analysis to study the sales history of a product, determine the overall trend, and produce a forecast of future sales. A scientist might use data analysis to study experimental findings and determine the statistical significance of the results. A family might use data analysis to find the maximum mortgage that they can afford, or to determine how much they need to put aside each month to finance their retirement or their children’s education.

Manipulate Raw Data

The point of data analysis is to understand information on some deeper, more meaningful level. By definition, raw data is a mere collection of facts that by themselves tell you little or nothing of any importance. To gain some understanding of the data, you must manipulate it in some meaningful way. This can be something as simple as finding the sum or average of a column of numbers or as complex as employing a full-scale regression analysis to determine the underlying trend of a range of values. Both are examples of data analysis, and Excel offers a number of tools, from the straightforward to the sophisticated, to meet even the most demanding needs.

Data

The “data” part of data analysis is a collection of numbers, dates, and text that represents the raw information you have to work with. In Excel, this data resides inside a worksheet and you get it there in one of two ways: you enter it by hand or you import it from an external source. You can then either leave the data as a regular range, or convert it into a table for easier data manipulation.

Data Entry

In many data analysis situations, you must enter the required data into the worksheet manually. For example, if you want to determine a potential monthly mortgage payment, you must first enter values such as the current interest rate, the principal, and the term. Manual data entry is suitable for small projects only, because entering hundreds or even thousands of values is time- consuming and can lead to errors.

Imported Data

Most data analysis projects involve large amounts of data, and the fastest and most accurate way to get that data onto a worksheet is to import it from a non-Excel data source. In the simplest scenario, you can copy the data from a text file, a Word table, or an Access datasheet and then paste it into a worksheet. However, most business and scientific data is stored in large databases, and Excel offers tools to import the data you need into your worksheet. See for more about these tools.

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!

Lesen Sie weiter in der vollständigen Ausgabe!