Sie sind auf Seite 1von 889

Microsoft Excel 2013:

Data Analysis and


Business Modeling

Wayne L. Winston
Pub shed w th the author zat on of M crosoft Corporat on by
O’Re y Med a, Inc
1005 Gravenste n H ghway North
Sebastopo , Ca forn a 95472

Copyr ght © 2014 by Wayne L W nston


A r ghts reserved No part of the contents of th s book may be reproduced or transm tted n any form or by any
means w thout the wr tten perm ss on of the pub sher

ISBN 978-0-7356-6913-0

2 3 4 5 6 7 8 9 10 LSI 9 8 7 6 5 4

Pr nted and bound n the Un ted States of Amer ca

M crosoft Press books are ava ab e through bookse ers and d str butors wor dw de If you need support re ated
to th s book, ema M crosoft Press Book Support at mspinput@microsoft.com P ease te us what you th nk of
th s book at http://www.microsoft.com/learning/booksurvey

M crosoft and the trademarks sted at http://www.microsoft.com/about/legal/en/us/IntellectualProperty/


Trademarks/EN-US.aspx are trademarks of the M crosoft group of compan es A other marks are property of
the r respect ve owners

The examp e compan es, organ zat ons, products, doma n names, ema addresses, ogos, peop e, p aces, and
events dep cted here n are fict t ous No assoc at on w th any rea company, organ zat on, product, doma n name,
ema address, ogo, person, p ace, or event s ntended or shou d be nferred

Th s book expresses the author’s v ews and op n ons The nformat on conta ned n th s book s prov ded w thout
any express, statutory, or mp ed warrant es Ne ther the author, O’Re y Med a, Inc , M crosoft Corporat on, nor
ts rese ers, or d str butors w be he d ab e for any damages caused or a eged to be caused e ther d rect y or
nd rect y by th s book

Acquisitions and Developmental Editor: Kenyon Brown


Production Editor: Kara Ebrah m
Editorial Production: nS ght, Inc
Technical Reviewer: Peter Myers
Copyeditor: nS ght, Inc
Indexer: nS ght, Inc
Cover Design: Tw st Creat ve • Seatt e
Cover Composition: E e Vo ckhausen
Illustrator: Rebecca Demarest

[2014-01-31]
Contents at a glance

Introduction xxi
Chapter 1 Range names 1
Chapter 2 Lookup functions 15
Chapter 3 INDEX function 23
Chapter 4 MATCH function 27
Chapter 5 Text functions 35
Chapter 6 Dates and date functions 51
Chapter 7 Evaluating investments by using net present value criteria 59
Chapter 8 Internal rate of return 67
Chapter 9 More Excel financial functions 75
Chapter 10 Circular references 87
Chapter 11 IF statements 93
Chapter 12 Time and time functions 111
Chapter 13 The Paste Special command 117
Chapter 14 Three-dimensional formulas 123
Chapter 15 The Auditing tool and Inquire add-in 127
Chapter 16 Sensitivity analysis with data tables 139
Chapter 17 The Goal Seek command 149
Chapter 18 Using the Scenario Manager for sensitivity analysis 155
Chapter 19 The COUNTIF, COUNTIFS, COUNT, COUNTA,
and COUNTBLANK functions 161
The SUMIF, AVERAGEIF, SUMIFS, and AVERAGEIFS
Chapter 20
functions 169
Chapter 21 The OFFSET function 175
Chapter 22 The INDIRECT function 187
Chapter 23 Conditional formatting 195
Chapter 24 Sorting in Excel 223
Chapter 25 Tables 231
Chapter 26 Spinner buttons, scroll bars, option buttons, check
boxes, combo boxes, and group list boxes 245
Chapter 27 The analytics revolution 261
Chapter 28 Introducing optimization with Excel Solver 267
Chapter 29 Using Solver to determine the optimal product mix 273
Chapter 30 Using Solver to schedule your workforce 285
Using Solver to solve transportation or distribution
Chapter 31
problems 291
Chapter 32 Using Solver for capital budgeting 297
Chapter 33 Using Solver for financial planning 305
Chapter 34 Using Solver to rate sports teams 313
Chapter 35 Warehouse location and the GRG Multistart
and Evolutionary Solver engines 319
Chapter 36 Penalties and the Evolutionary Solver 329
Chapter 37 The traveling salesperson problem 335
Chapter 38 Importing data from a text file or document 339
Chapter 39 Importing data from the Internet 345
Chapter 40 Validating data 349
Chapter 41 Summarizing data by using histograms 359
Chapter 42 Summarizing data by using descriptive statistics 369
Chapter 43 Using PivotTables and slicers to describe data 385
Chapter 44 The Data Model 441
Chapter 45 PowerPivot 455
Chapter 46 Power View 469
Chapter 47 Sparklines 485
Chapter 48 Summarizing data with database statistical functions 491
Chapter 49 Filtering data and removing duplicates 501
Chapter 50 Consolidating data 521
Chapter 51 Creating subtotals 527
Chapter 52 Charting tricks 533
Chapter 53 Estimating straight-line relationships 569
Chapter 54 Modeling exponential growth 577
Chapter 55 The power curve 581
Chapter 56 Using correlations to summarize relationships 589
Chapter 57 Introduction to multiple regression 597
Chapter 58 Incorporating qualitative factors into multiple regression 605
Chapter 59 Modeling nonlinearities and interactions 615
Chapter 60 Analysis of variance: one-way ANOVA 623
Chapter 61 Randomized blocks and two-way ANOVA 629
Chapter 62 Using moving averages to understand time series 641
Chapter 63 Winters’s method 645
Chapter 64 Ratio-to-moving-average forecast method 651
Chapter 65 Forecasting in the presence of special events 655
Chapter 66 An introduction to random variables 663

iv Contents at a glance
Chapter 67 The binomial, hypergeometric, and negative binomial
random variables 669
Chapter 68 The Poisson and exponential random variable 679
Chapter 69 The normal random variable 683
Chapter 70 Weibull and beta distributions: modeling machine
life and duration of a project 691
Chapter 71 Making probability statements from forecasts 697
Chapter 72 Using the lognormal random variable to model
stock prices 701
Chapter 73 Introduction to Monte Carlo simulation 705
Chapter 74 Calculating an optimal bid 715
Chapter 75 Simulating stock prices and asset allocation modeling 721
Chapter 76 Fun and games: simulating gambling and sporting
event probabilities 731
Chapter 77 Using resampling to analyze data 739
Chapter 78 Pricing stock options 743
Chapter 79 Determining customer value 757
Chapter 80 The economic order quantity inventory model 763
Chapter 81 Inventory modeling with uncertain demand 769
Chapter 82 Queuing theory: the mathematics of waiting in line 777
Chapter 83 Estimating a demand curve 785
Chapter 84 Pricing products by using tie-ins 791
Pricing products by using subjectively determined
Chapter 85
demand 797
Chapter 86 Nonlinear pricing 803
Chapter 87 Array formulas and functions 813

Index 831

Contents at a glance v
Contents
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi
Errata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxv
We want to hear from you. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxv
Stay n touch. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxv

Chapter 1 Range names 1


How can I create named ranges?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Us ng the Name box to create a range name. . . . . . . . . . . . . . . . . . . . 2
Creat ng named ranges by us ng Create From Se ect on 4
Creat ng range names by us ng Define Name . . . . . . . . . . . . . . . . . . . 5
Name Manager. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

Chapter 2 Lookup functions 15


Syntax of the ookup funct ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
VLOOKUP syntax. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
HLOOKUP syntax. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

Chapter 3 INDEX function 23


Syntax of the INDEX funct on. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

What do you think of this book? We want to hear from you!


M crosoft s nterested n hear ng your feedback so we can cont nua y mprove our
books and earn ng resources for you. To part c pate n a br ef on ne survey, p ease v s t:

microsoft.com/learning/booksurvey

vii

Chapter 4 MATCH function 27
Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

Chapter 5 Text functions 35


Text funct on syntax. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
The LEFT funct on. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
The RIGHT funct on. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
The MID funct on. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
The TRIM funct on. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
The LEN funct on. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
The FIND and SEARCH funct ons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
The REPT funct on. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
The CONCATENATE and & funct ons. . . . . . . . . . . . . . . . . . . . . . . . . . 38
The REPLACE funct on. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
The VALUE funct on . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
The UPPER, LOWER, and PROPER funct ons. . . . . . . . . . . . . . . . . . . . 38
The CHAR funct on . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
The CLEAN Funct on. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
The SUBSTITUTE FUNCTION. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40


Extract ng data by us ng the Convert Text To Co umns W zard . . . 43

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

Chapter 6 Dates and date functions 51


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57

Chapter 7 Evaluating investments by using net present


value criteria 59
Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

viii Contents
Chapter 8 Internal rate of return 67
Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

Chapter 9 More Excel financial functions 75


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

CUMPRINC and CUMIPMT funct ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83

Chapter 10 Circular references 87


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90

Chapter 11 IF statements 93
Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106

Chapter 12 Time and time functions 111


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115

Chapter 13 The Paste Special command 117


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121

Chapter 14 Three-dimensional formulas 123


Answer to th s chapter’s quest on . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123

Prob em . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125

ix
Contents
Chapter 15 The Auditing tool and Inquire add-in 127
Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138

Chapter 16 Sensitivity analysis with data tables 139


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146

Chapter 17 The Goal Seek command 149


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152

Chapter 18 Using the Scenario Manager for sensitivity analysis 155


Answer to th s chapter’s quest on . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155

Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158

Chapter 19 The COUNTIF, COUNTIFS, COUNT, COUNTA, and


COUNTBLANK functions 161
Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163

Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166

Chapter 20 The SUMIF, AVERAGEIF, SUMIFS, and AVERAGEIFS


functions 169
Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172

Chapter 21 The OFFSET function 175


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176

Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185

x Contents
Chapter 22 The INDIRECT function 187
Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193

Chapter 23 Conditional formatting 195


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219

Chapter 24 Sorting in Excel 223


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230

Chapter 25 Tables 231


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244

Chapter 26 Spinner buttons, scroll bars, option buttons, check


boxes, combo boxes, and group list boxes 245
Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258

Chapter 27 The analytics revolution 261


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261

Chapter 28 Introducing optimization with Excel Solver 267


Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270

Chapter 29 Using Solver to determine the optimal product mix 273


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283

xi
Contents
Chapter 30 Using Solver to schedule your workforce 285
Answer to th s chapter’s quest on . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288

Chapter 31 Using Solver to solve transportation or distribution


problems 291
Answer to th s chapter’s quest on . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294

Chapter 32 Using Solver for capital budgeting 297


Answer to th s chapter’s quest on . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
Hand ng other constra nts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
So v ng b nary and nteger programm ng prob ems. . . . . . . . . . . . 301

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303

Chapter 33 Using Solver for financial planning 305


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310

Chapter 34 Using Solver to rate sports teams 313


Answer to th s chapter’s quest on . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318

Chapter 35 Warehouse location and the GRG Multistart


and Evolutionary Solver engines 319
Understand ng the GRG Mu t start and Evo ut onary So ver eng nes. . . 319
How does So ver so ve near So ver prob ems?. . . . . . . . . . . . . . . . 319
How does the GRG Non near eng ne so ve non near
opt m zat on mode s?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320
How does the Evo ut onary So ver eng ne tack e nonsmooth
opt m zat on prob ems? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323

Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328

xii Contents
Chapter 36 Penalties and the Evolutionary Solver 329
Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329

Us ng cond t ona formatt ng to h gh ght each emp oyee’s rat ngs. . . . 332

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333

Chapter 37 The traveling salesperson problem 335


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338

Chapter 38 Importing data from a text file or document 339


Answer to th s chapter’s quest on . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344

Chapter 39 Importing data from the Internet 345


Answer to th s chapter’s quest on . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348

Chapter 40 Validating data 349


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349

Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356

Chapter 41 Summarizing data by using histograms 359


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367

Chapter 42 Summarizing data by using descriptive statistics 369


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370
Us ng cond t ona formatt ng to h gh ght out ers . . . . . . . . . . . . . 375

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382

xiii
Contents
Chapter 43 Using PivotTables and slicers to describe data 385
Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386
Remarks about group ng. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437

Chapter 44 The Data Model 441


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 441

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 453

Chapter 45 PowerPivot 455


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 456

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468

Chapter 46 Power View 469


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 470

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483

Chapter 47 Sparklines 485


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 485

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490

Chapter 48 Summarizing data with database statistical


functions 491
Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498

Chapter 49 Filtering data and removing duplicates 501


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 503

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518

Chapter 50 Consolidating data 521


Answer to th s chapter’s quest on . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525


xiv Contents
Chapter 51 Creating subtotals 527
Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 532

Chapter 52 Charting tricks 533


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 534

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566

Chapter 53 Estimating straight-line relationships 569


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 571

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 575

Chapter 54 Modeling exponential growth 577


Answer to th s chapter’s quest on . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 577

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 580

Chapter 55 The power curve 581


Answer to th s chapter’s quest on . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 586

Chapter 56 Using correlations to summarize relationships 589


Answer to th s chapter’s quest on . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591
F ng n the corre at on matr x. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 593
Us ng the CORREL funct on. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 594
Re at onsh p between corre at on and R2 . . . . . . . . . . . . . . . . . . . . . 594
Corre at on and regress on toward the mean. . . . . . . . . . . . . . . . . . 595

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 595

Chapter 57 Introduction to multiple regression 597


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 597

xv
Contents
Chapter 58 Incorporating qualitative factors into multiple
regression 605
Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 605

Chapter 59 Modeling nonlinearities and interactions 615


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 615

Prob ems for Chapters 57 and 58 619

Chapter 60 Analysis of variance: one-way ANOVA 623


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 624

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 628

Chapter 61 Randomized blocks and two-way ANOVA 629


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 630

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 638

Chapter 62 Using moving averages to understand time series 641


Answer to th s chapter’s quest on . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 641

Prob em . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 643

Chapter 63 Winters’s method 645


T me ser es character st cs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 645

Parameter defin t ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 645

In t a z ng W nters’s method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 646

Est mat ng the smooth ng constants. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 647

Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 649

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 649

Chapter 64 Ratio-to-moving-average forecast method 651


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 651

Prob em . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 654

xvi Contents
Chapter 65 Forecasting in the presence of special events 655
Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 655

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 662

Chapter 66 An introduction to random variables 663


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 663

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 667

Chapter 67 The binomial, hypergeometric, and negative


binomial random variables 669
Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 670

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676

Chapter 68 The Poisson and exponential random variable 679


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 679

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 682

Chapter 69 The normal random variable 683


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 683

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 689

Chapter 70 Weibull and beta distributions: modeling machine


life and duration of a project 691
Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 691

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 696

Chapter 71 Making probability statements from forecasts 697


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 698

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 699

xvii
Contents
Chapter 72 Using the lognormal random variable to model
stock prices 701
Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 701

Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 704

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 704

Chapter 73 Introduction to Monte Carlo simulation 705


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 706
The mpact of r sk on your dec s on. . . . . . . . . . . . . . . . . . . . . . . . . . 712
Confidence nterva for mean profit. . . . . . . . . . . . . . . . . . . . . . . . . . 713

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 713

Chapter 74 Calculating an optimal bid 715


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 715

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 718

Chapter 75 Simulating stock prices and asset allocation


modeling 721
Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 722

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 729

Chapter 76 Fun and games: simulating gambling and


sporting event probabilities 731
Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 731

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 737

Chapter 77 Using resampling to analyze data 739


Answer to th s chapter’s quest on . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 739

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 742

Chapter 78 Pricing stock options 743


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 744

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 754

xviii Contents
Chapter 79 Determining customer value 757
Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 757

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 761

Chapter 80 The economic order quantity inventory model 763


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 763

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 767

Chapter 81 Inventory modeling with uncertain demand 769


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 770

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 775

Chapter 82 Queuing theory: the mathematics of waiting in line 777


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 777

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 782

Chapter 83 Estimating a demand curve 785


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 785

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 789

Chapter 84 Pricing products by using tie-ins 791


Answer to th s chapter’s quest on . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 791

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 794

Chapter 85 Pricing products by using subjectively


determined demand 797
Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 797

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 800

Chapter 86 Nonlinear pricing 803


Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 803

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 810

xix
Contents
Chapter 87 Array formulas and functions 813
Answers to th s chapter’s quest ons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 814

Prob ems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 827

Index 831

What do you think of this book? We want to hear from you!


M crosoft s nterested n hear ng your feedback so we can cont nua y mprove our
books and earn ng resources for you. To part c pate n a br ef on ne survey, p ease v s t:

microsoft.com/learning/booksurvey

xx Contents
Introduction

W hether you work for a Fortune 500 corporat on, a sma company, a government
agency, or a not-for-profit organ zat on, f you’re read ng th s ntroduct on the
chances are you use M crosoft Exce n your da y work Your job probab y nvo ves sum-
mar z ng, report ng, and ana yz ng data It m ght a so nvo ve bu d ng ana yt c mod-
e s to he p your emp oyer ncrease profits, reduce costs, or manage operat ons more
­effic ent y

S nce 1999, I’ve taught thousands of ana ysts at organ zat ons such as 3M, Booz
A en Ham ton consu t ng, Br sto -Myers Squ bb, Broadcom C sco Systems, De o tte
Consu t ng, Drugstore com, eBay, E L y, Ford, Genera E ectr c, Genera Motors, Inte ,
M crosoft, Morgan Stan ey, NCR, Owens Corn ng, Pfizer, Proctor & Gamb e, PWC, Sch-
umberger, Te abs, the U S Army, the U S Department of Defense, and Ver zon how to
use Exce more effic ent y and product ve y n the r jobs Students have often to d me
that the too s and methods I teach n my c asses have saved them hours of t me each
week and prov ded them w th new and mproved approaches for ana yz ng mportant
bus ness prob ems

I’ve used the techn ques descr bed n th s book n my own consu t ng pract ce
to so ve many bus ness prob ems For examp e, I have used Exce to he p the Da as
Maver cks and New York Kn ckers NBA basketba teams eva uate referees, p ayers, and
neups Dur ng the ast 15 years I have a so taught Exce bus ness mode ng and data
ana ys s c asses to MBA students at Ind ana Un vers ty’s Ke ey Schoo of Bus ness (As
proof of my teach ng exce ence, I have won over 45 teach ng awards, and have won the
schoo ’s overa MBA teach ng award s x t mes ) I wou d ke to a so note that 95 percent
of MBA students at Ind ana Un vers ty take my spreadsheet mode ng c ass even though
t s an e ect ve

The book you have n your hands s an attempt to make these successfu c asses
ava ab e to everyone Here s why I th nk the book w he p you earn how to use Exce
more effect ve y

■ The mater a s have been tested wh e teach ng thousands of ana ysts ­work ng
for Fortune 500 corporat ons and government agenc es, nc ud ng the
U S  Army

■ I’ve wr tten the book as though I am ta k ng to the reader I hope th s approach


transfers the sp r t of a successfu c assroom env ronment to the wr tten page

xxi

■ I teach by examp e, wh ch makes concepts eas er to master These examp es are
constructed to have a rea -wor d fee Many of the examp es are based on ques-
t ons sent to me by emp oyees of Fortune 500 corporat ons

■ For the most part, I ead you through the approaches I take n Exce to set up
and answer a w de range of data ana ys s and bus ness quest ons You can fo ow
a ong w th my exp anat ons by referr ng to the samp e worksheets that accom-
pany each examp e However, I have a so nc uded temp ate fi es for the book’s
examp es on the compan on webs te If you want to, you can use these tem-
p ates to work d rect y w th Exce and comp ete each examp e on your own

■ For the most part, the chapters are short and organ zed around a s ng e con-
cept You shou d be ab e to master the content of most chapters w th at most
two hours of study By ook ng at the quest ons that beg n each chapter, you’
ga n an dea about the types of prob ems you’ be ab e to so ve after master ng
a chapter’s top cs

■ In add t on to earn ng about Exce formu as, you w earn some mportant
math n a fa r y pa n ess fash on For examp e, you’ earn about stat st cs,
forecast ng, opt m zat on mode s, Monte Car o s mu at on, nventory mode ng,
and the mathemat cs of wa t ng n ne You w a so earn about some recent
deve opments n bus ness th nk ng, such as rea opt ons, customer va ue, and
mathemat ca pr c ng mode s

■ At the end of each chapter, I’ve prov ded a group of pract ce prob ems (over 600
n tota ) that you can work through on your own These prob ems w he p you
master the nformat on n each chapter Answers to a prob ems are nc uded n
fi es on the book’s compan on webs te Many of these prob ems are based on
actua prob ems faced by bus ness ana ysts at Fortune 500 compan es

■ Most of a , earn ng shou d be fun If you read th s book, you w earn how
to pred ct U S pres dent a e ect ons, how to set footba po nt spreads, how
to determ ne the probab ty of w nn ng at craps, and how to determ ne the
probab ty of a spec fic team w nn ng an NCAA tournament These examp es
are nterest ng and fun, and they a so teach you a ot about so v ng bus ness
prob ems w th Exce

Note  To follow along with this book, you must have Excel 2013. Previous ver-
sions of this book can be used with Excel 2003, Excel 2007, or Excel 2010.

xxii  Introduction
What’s new in this edition
Th s ed t on of the book conta ns the fo ow ng changes

■ An exp anat on of Exce ’s 2013 exc t ng F ash F feature

■ An exp anat on of how to de ete nv s b e characters wh ch often mess up


­ca cu at ons

■ An exp anat on of the fo ow ng new Exce 2013 funct ons SHEET, SHEETS,
­FORMULATEXT, and ISFORMULA

■ A s mp e method for st ng a of a workbook’s worksheet names

■ A chapter descr b ng the exc t ng new fie d of ana yt cs

■ How to create P votTab es from data n d sparate ocat ons or based on another
P votTab e

■ How to use Exce 2013’s new T me ne feature to fi ter P votTab es based on


dates

■ A descr pt on of Exce 2013’s Data Mode

■ A descr pt on of Exce 2013’s PowerP vot add- n.

■ How to use Power V ew to create m nd b ow ng charts and graph cs

■ A new chapter on chart ng tr cks and a genera descr pt on of chart ng n


­Exce   2013

■ Over 30 new prob ems have been added

What you should know before reading this book


To fo ow the examp es n th s book you do not need to be an Exce guru Bas ca y, the
two key act ons you shou d know how to do are the fo ow ng

■ Enter a formula  You shou d know that formu as must beg n w th an equa s
s gn (=) You shou d a so know the bas c mathemat ca operators For examp e,
you shou d know that an aster sk (*) s used for mu t p cat on, a forward s ash (/)
s used for d v s on, and the caret key (^) s used to ra se a quant ty to a power

■ Work with cell references  You shou d know that when you copy a formu a
that conta ns a ce reference such as $A$4 (an abso ute ce reference, wh ch s
created by nc ud ng the do ar s gns), the formu a st refers to ce A4 n the

Introduction  xxiii
ce s you copy t to When you copy a formu a that conta ns a ce reference such
as $A4 (a m xed ce address), the co umn rema ns fixed, but the row changes
F na y, when you copy a formu a that conta ns a ce reference such as A4 (a
re at ve ce reference), both the row and the co umn of the ce s referenced n
the formu a change

How to use this book


As you read a ong w th the examp es n th s book, you can take one of two approaches

■ You can open the temp ate fi e that corresponds to the examp e you are study-
ng and comp ete each step of the examp e as you read the book You w be
surpr sed how easy th s process s and amazed w th how much you earn and
reta n Th s s the approach I use n my corporate c asses

■ Instead of work ng n the temp ate, you can fo ow my exp anat ons as you ook
at the fina vers on of each samp e fi e

Using the companion content


Th s book features a compan on webs te that makes ava ab e to you a the samp e fi es
you use n the book’s examp es (both the fina Exce workbooks and start ng temp ates
you can work w th on your own) The workbooks and temp ates are organ zed n fo ders
named for each chapter The answers to a chapter-end ng prob ems n the book are
a so nc uded w th the samp e fi es Each answer fi e s named so that you can dent fy t
eas y For examp e, the fi e conta n ng the answer to Prob em 2 n Chapter 10 s named
s10 2 x sx

To work through the examp es n th s book, you need to copy the book’s samp e fi es
to your computer These pract ce fi es, and other nformat on, can be down oaded from
the book’s deta page, ocated at

http://aka.ms/Excel2013Data/files

D sp ay the deta page n your Web browser, and fo ow the nstruct ons for down-
oad ng the files.

xxiv  Introduction
Acknowledgments
I am eterna y gratefu to Jenn fer Skoog and Norm Ton na, who had fa th n me and
first h red me to teach Exce c asses for M crosoft finance Jenn fer n part cu ar was
nstrumenta n he p ng des gn the content and sty e of the c asses on wh ch the book s
based Ke th Lange of E L y, Pat Keat ng and Doug Hoppe of C sco Systems, and Den-
n s Fu er of the U S Army a so he ped me refine my thoughts on teach ng data ana ys s
and mode ng w th Exce

Ed tors Kenyon Brown and Rache Roume ot s d d a great job of keep ng me (and
the book) on schedu e Peter Myers d d a great job w th the techn ca ed t ng Thanks
a so to Product on Ed tors Kara Ebrah m and Chr s Norton for manag ng the book’s
product on I am gratefu to my many students at the organ zat ons where I’ve taught
and at the Ind ana Un vers ty Ke ey Schoo of Bus ness Many of them have taught me
th ngs I d d not know about Exce

A ex B anton, former y of M crosoft Press, champ oned th s project at the start


and shared my v s on of deve op ng a user-fr end y text des gned for use by bus ness
­ana ysts

F na y, my ove y and ta ented w fe, V v an, and my wonderfu ch dren, Jenn fer and
Gregory, put up w th my ong weekend hours at the keyboard

Support & feedback


The fo ow ng sect ons prov de nformat on on errata, book support, feedback, and
contact nformat on

Introduction  xxv
Errata
We’ve made every effort to ensure the accuracy of th s book and ts compan on con-
tent If you do find an error, p ease report t on our M crosoft Press s te at ore y com

1. Go to http://microsoftpress.oreilly.com

2. In the Search box, enter the book’s ISBN or t t e

3. Se ect your book from the search resu ts

4. On your book’s cata og page, under the cover mage, you’ see a st of nks

5. C ck View/Submit Errata.

You’ find add t ona nformat on and serv ces for your book on ts cata og page
If you need add t ona support, p ease e-ma M crosoft Press Book Support at
­mspinput@microsoft.com

P ease note that product support for M crosoft software s not offered through the
addresses above

We want to hear from you


At M crosoft Press, your sat sfact on s our top pr or ty, and your feedback our most
va uab e asset P ease te us what you th nk of th s book at

http://www.microsoft.com/learning/booksurvey

The survey s short, and we read every one of your comments and deas Thanks n
advance for your nput!

Stay in touch
Let’s keep the conversat on go ng! We’re on Tw tter http://twitter.com/MicrosoftPress.

xxvi  Introduction
CHAPTER 1

Range names

Questions answered in this chapter:


■ I want the tota sa es n Ar zona, Ca forn a, Montana, New York, and New Jersey Can I
use a formu a to compute the tota sa es n a form such as AZ+CA+MT+NY+NJ nstead of
SUM(A21 A25) and st get the r ght answer?

■ What does a formu a such as Average(A A) do?

■ What s the d fference between a name w th workbook scope and one w th worksheet scope?

■ I rea y am gett ng to ke range names I have started defin ng range names for many of the
workbooks I have deve oped at the office However, the range names do not show up n
my formu as How can I make recent y created range names show up n prev ous y created
formu as?

■ How can I paste a st of a range names (and the ce s they represent) nto my worksheet?

■ I am comput ng projected annua revenues as a mu t p e of ast year’s revenue Is there a way


to have the formu a ook ke (1+growth)* ast year?

■ For each day of the week, we are g ven the hour y wage and hours worked Can we compute
tota sa ary for each day w th the wages*hours formu a?

You have probab y worked w th worksheets that use formu as such as SUM(A5000 A5049) Then you
have to find out what’s conta ned n ce s A5000 A5049 If ce s A5000 A5049 conta n sa es n each US
state, wou dn’t the formu a SUM(USSa es) be eas er to understand? In th s chapter, you earn how to
name nd v dua ce s or ranges of ce s and how to use range names n formu as

How can I create named ranges?


There are three ways to create named ranges

■ By enter ng a range name n the Name box

■ By c ck ng Create From Selection n the Defined Names group on the Formulas tab

■ By c ck ng Name Manager or Define Name n the Defined Names group on the


Formulas tab

1

Using the Name box to create a range name
The Name box (shown n F gure 1-1) s ocated d rect y above the abe for co umn A (To see the
Name box, c ck the Formula bar ) To create a range name n the Name box, s mp y se ect the ce or
range of ce s that you want to name, c ck n the Name box, and then type the range name you want
to use Press Enter, and you’ve created the range name C ck ng the drop-down arrow n the Name
box d sp ays the range names defined n the current workbook You can d sp ay a the range names
n a workbook by press ng the F3 key to open the Paste Name d a og box When you se ect a range
name from the Name box, M crosoft Exce 2013 se ects the ce s correspond ng to that range name
Th s enab es you to ver fy that you’ve chosen the ce or range that you ntended to name Range
names are not case sens t ve

FIGURE 1-1  You can create a range name by se ect ng the ce range you want to name and then typ ng the range
name n the Name box.

For examp e, suppose you want to name ce F3 east and ce F4 west See F gure 1-2 and the
Eastwestempt x sx fi e Se ect ce F3, type east n the Name box, and then press Enter Se ect ce
F4, type west n the Name box, and press Enter If you now reference ce F3 n another ce , you see
=east nstead of =F3 Th s means that whenever you see the reference east n a formu a, Exce w
nsert whatever s n ce F3

FIGURE 1-2  Name ce F3 east and ce F4 west.

Suppose you want to ass gn a rectangu ar range of ce s (such as A1 B4) the name Data
Se ect the ce range A1 B4, type Data n the Name box, and press Enter Now a formu a such as
=AVERAGE(Data) wou d average the contents of ce s A1 B4 See the Data x sx fi e and F gure 1-3

2  Chapter 1  Range names


FIGURE 1-3  Name the A1:B4 range Data.

Somet mes, you want to name a range of ce s made up of severa noncont guous rectangu ar
ranges For examp e, n F gure 1-4 and the Noncont g x sx fi e, you m ght want to ass gn the name
Noncontig to the range cons st ng of ce s B3 C4, E6 G7, and B10 C10 To ass gn th s name, se ect any
one of the three rectang es mak ng up the range (B3 C4 for now) Ho d down the Ctr key and then
se ect the other two ranges (E6 G7 and B10 C10) Now re ease the Ctr key, type the name Noncontig
n the Name box, and press Enter Us ng Noncontig n any formu a w now refer to the contents of
ce s B3 C4, E6 G7, and B10 C10 For examp e, enter ng the formu a =AVERAGE(Noncont g) n ce E11
y e ds 4 75 (because the 12 numbers n your range add up to 57, and 57/12 = 4 75)

FIGURE 1-4  Th s s how to name a noncont guous range of ce s.

Range names  Chapter 1   3


Creating named ranges by using Create From Selection
The Statestemp x sx worksheet conta ns sa es dur ng March for each of the 50 US states F gure 1-5
shows a subset of th s data You wou d ke to name each ce n the B6 B55 range w th the cor-
rect state abbrev at on To do th s, se ect the A6 B55 range and c ck Create From Selection n the
Defined Names group on the Formulas tab (see F gure 1-6) and then se ect the Left Co umn check
box, as nd cated n F gure 1-7

FIGURE 1-5  By nam ng the ce s that conta n state sa es w th state abbrev at ons, you can use the abbrev at on
rather than the ce s co umn etter and row number when you refer to the ce .

FIGURE 1-6  Se ect Create From Se ect on.

4  Chapter 1  Range names


FIGURE 1-7  Se ect the Left Co umn check box.

Exce now knows to assoc ate the names n the first co umn of the se ected range w th the ce s n
the second co umn of the se ected range Thus, B6 s ass gned the range name AL, B7 s named AK,
and so on Creat ng these range names n the Name box wou d have been ncred b y ted ous! C ck
the drop-down arrow n the Name box to ver fy that these range names have been created

Creating range names by using Define Name


If you choose Name Manager on the Formulas tab and se ect Define Name from the menu shown
n F gure 1-6, the New Name d a og box shown n F gure 1-8 opens

FIGURE 1-8  Th s s how the New Name d a og box appears before creat ng any range names.

Range names  Chapter 1   5


Suppose you want to ass gn the name range1 (range names are not case sens t ve) to the ce range
A2 B7 Type range1 n the Name box and then po nt to the range or type =A2:B7 n the Refers To
area The New Name d a og box w now ook ke F gure 1-9 C ck OK, and you’re done

FIGURE 1-9  The New Name d a og box ooks ke th s after creat ng a range name.

If you c ck the Scope arrow, you can se ect Workbook or any worksheet n your workbook Th s
dec s on s d scussed ater n th s chapter, so for now, just choose the defau t scope of Workbook You
can a so add comments for any of your range names

Name Manager
If you now c ck the Name arrow, the name range1 (and any other ranges you have created) appears
n the Name box In Exce 2013, there s an easy way to ed t or de ete your range names Open Name
Manager by se ect ng the Formulas tab and then c ck Name Manager from the menu shown
n F gure 1-6 You now see a st of a range names For examp e, for the States x sx fi e, the Name
Manager d a og box w ook ke F gure 1-10

To ed t any range name, doub e-c ck the range name or se ect the range name and c ck Ed t; you
can then change the name of the range, the ce s the range refers to, or the scope of the range

To de ete any subset of range names, first se ect the range names you want to de ete If the range
names are sted consecut ve y, se ect the first range name n the group you want to de ete, ho d
down the Sh ft key, and se ect the ast range name n the group If the range names are not sted
consecut ve y, you can se ect any range name you want to de ete and then ho d down the Ctr key
wh e you se ect the other range names for de et on Then press the De ete key to de ete the se ected
range names

Now ook at some spec fic examp es of how to use range names

6  Chapter 1  Range names


FIGURE 1-10  Th s s the Name Manager d a og box for States.x sx.

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

I want the total sales in Arizona, California, Montana, New York, and New Jersey. Can I
use a formula to compute the total sales in a form such as AZ+CA+MT+NY+NJ instead of
SUM(A21:A25) and still get the right answer?

Return to the States x sx fi e, n wh ch you ass gned each state’s abbrev at on as the range name for
the state’s sa es If you want to compute tota sa es n A abama, A aska, Ar zona, and Arkansas, c ear y
you cou d use the formu a SUM(B6 B9) You cou d a so po nt to ce s B6, B7, B8, and B9, and the for-
mu a wou d be entered as =AL+AK+AZ+AR The atter formu a s se f-descr b ng

As another ustrat on of how to use range names, ook at the H stor ca nvesttemp x sx fi e, shown
n F gure 1-11, wh ch conta ns annua percentage returns on stocks, T-b s, and bonds (Some rows are
h dden n th s figure; the data ends n row 89 )

Range names  Chapter 1   7


FIGURE 1-11  Th s figure shows h stor ca nvestment data.

Se ect the B8 D89 ce range and then choose Formulas and Create From Selection For th s
examp e, names are created n the top row of the range The B8 B89 range s named Stocks, the
C8 C89 range T B s, and the D8 D89 range T Bonds Now you no onger need to remember where
your data s For examp e, n ce B91, after typ ng =AVERAGE(, you can press F3, and the Paste Name
d a og box opens, as shown n F gure 1-12 You can a so br ng up a st of range names that can be
pasted n formu as f you start typ ng and c ck Use In Formula on the Formulas tab

FIGURE 1-12  You can add a range name to a formu a by us ng the Paste Name d a og box.

8  Chapter 1  Range names


You can se ect Stocks n the Paste Name st and c ck OK After enter ng the c os ng parenthes s,
the formu a, =AVERAGE(Stocks), computes the average return on stocks (11 28 percent) The beauty
of th s approach s that even f you don’t remember where the data s, you can work w th the stock
return data anywhere n the workbook!

Th s chapter wou d be rem ss f t d d not ment on the exc t ng AutoComp ete capab t es of Exce
2013 If you beg n typ ng =Average(T, Exce shows you a st of range names and funct ons that beg n
w th T, and you can just doub e-c ck T.Bills to comp ete the entry of the range name

What does a formula such as Average(A:A) do?

If you use a co umn name ( n the form of A A, C C, and so on) n a formu a, Exce treats an ent re
co umn as a named range For examp e, enter ng the =AVERAGE(A A) formu a averages a numbers n
co umn A Us ng a range name for an ent re co umn s very he pfu f you frequent y enter new data n
a co umn For examp e, f co umn A conta ns month y sa es of a product, as new sa es data are entered
each month, your formu a computes an up-to-date month y sa es average Use caut on, however,
because f you enter the =AVERAGE(A A) formu a n co umn A, you w get a c rcu ar reference mes-
sage because the va ue of the ce conta n ng the average formu a depends on the ce conta n ng the
average You earn how to reso ve c rcu ar references n Chapter 10, “C rcu ar references ” S m ar y,
enter ng the =AVERAGE(1 1) formu a averages a numbers n row 1

What is the difference between a name with workbook scope and one with worksheet scope?

The Sheetnames x sx fi e w he p you understand the d fference between range names that have
workbook scope and range names that have worksheet scope When you create names w th the
Name box, the names defau t to workbook scope For examp e, suppose you use the Name box to
ass gn the name sales to the ce range E4 E6 n Sheet3, and these ce s conta n the numbers 1, 2, and
4, respect ve y If you enter a formu a such as =SUM(sa es) n any worksheet, you obta n an answer
of 7 because the Name box creates names w th workbook scope, so anywhere n the workbook you
refer to the name sales (wh ch has workbook scope), the name refers to ce s E4 E6 of Sheet3 In any
worksheet, f you now enter the =SUM(sa es) formu a, you w obta n 7 because anywhere n the
workbook, Exce nks sales to ce s E4 E6 of Sheet3

Now suppose that you type 4, 5, and 6 n ce s E4 E6 of Sheet1 and 3, 4, and 5 n ce s E4 E6 of


Sheet2, and then you open Name Manager, g ve the name jam to ce s E4 E6 of Sheet1, and define the
scope of th s name as Sheet1 Then you move to Sheet2, open Name Manager, g ve the name jam to
ce s E4 E6, and define the scope of th s name as Sheet2 The Name Manager d a og box now ooks
ke F gure 1-13

Range names  Chapter 1   9


FIGURE 1-13  The Name Manager d a og box d sp ays worksheet and workbook names.

Now, what f you enter the =SUM(jam) formu a n each sheet? In Sheet 1, =SUM(jam) w tota ce s
E4 E6 of Sheet1 Because those ce s conta n 4, 5, and 6, you obta n 15 In Sheet2, =SUM(jam) w tota
ce s E4 E6 of Sheet2, y e d ng 3 + 4 + 5 = 12 In Sheet3, however, the =SUM(jam) formu a w y e d a
#NAME? error because no range s named jam n Sheet3 If you enter the =SUM(Sheet2!jam) formu a
anywhere n Sheet3, Exce w recogn ze the worksheet- eve name that represents ce range E4 E6
of Sheet2 and y e d a resu t of 3 + 4 + 5 = 12 Thus, by prefac ng a worksheet- eve name by ts sheet
name fo owed by an exc amat on po nt (!), you can refer to a worksheet- eve range n a worksheet
other than the sheet n wh ch the range s defined

I really am getting to like range names. I have started defining range names for many of
the workbooks I have developed at the office. However, the range names do not show up in
my formulas. How can I make recently created range names show up in previously created
formulas?

Look at the App ynames x sx fi e and F gure 1-14

10  Chapter 1  Range names


FIGURE 1-14  Th s figure shows how to app y range names to formu as.

The pr ce of a product was entered n ce F3 and product demand of =10000–300*F3 n ce F4


The un t cost and fixed cost are entered n ce s F5 and F6, respect ve y, and profit s computed n ce
F7 w th the =F4*(F3–F5)–F6 formu a In th s examp e, Formulas, Create From Selection, and then
Left Column are used to name ce F3 price, ce F4 demand, ce F5 unit cost, ce F6 fixed cost, and ce
F7 profit You wou d ke these range names to show up n the ce F4 and ce F7 formu as To app y
the range names, first se ect the range where you want the range names app ed ( n th s case, F4 F7)
Now open the Defined Names group on the Formulas tab, c ck the Define Name arrow, and then
choose Apply Names H gh ght the names you want to app y and then c ck OK Note that ce F4
now conta ns the =10000–300*pr ce formu a, and ce F7 conta ns the =demand*(pr ce–un t cost)–
fixed cost formu a, as you wanted

By the way, f you want the range names to app y to the ent re worksheet, se ect the ent re work-
sheet by c ck ng the Select All button at the ntersect on of the co umn and row head ngs

How can I paste a list of all range names (and the cells they represent) into my worksheet?

Press F3 to open the Paste Name box and then c ck the Paste List button (See F gure 1-12 ) A st of
range names and the ce s each corresponds to w be pasted nto your worksheet, beg nn ng at the
current ce ocat on

I am computing projected annual revenues as a multiple of last year’s revenue. Is there a way
to have the formula look like (1+growth)*last year?

The Last year x sx fi e conta ns the so ut on to th s prob em As shown n F gure 1-15, you want to com-
pute revenues for 2012–2018 that grow at 10 percent per year off a base eve of $300 m on n 2011

Range names  Chapter 1   11


FIGURE 1-15  Create a range name for the prev ous year.

To beg n, use the Name box to name ce B3 growth Now comes the good part! Move the cursor
to B7 and open the New Name d a og box by c ck ng Define Name n the Defined Names group
on the Formulas tab F n the New Name d a og box as shown n F gure 1-16

FIGURE 1-16  n any ce , th s name refers to the ce above the act ve ce .

Because you are n ce B7, Exce nterprets th s range name a ways to refer to the ce above the
current ce Th s wou d not work f, n the B6 ce reference, the 6 were do ar s gned because do ar
s gn ng the 6 wou d prevent the row reference from chang ng to p ck up the row d rect y above the
act ve ce If you enter the =prev ous*(1+growth) formu a n ce B7 and copy t down to the B8 B13

12  Chapter 1  Range names


range, each ce w conta n the formu a you want and w mu t p y 1 1 by the contents of the ce
d rect y above the act ve ce

For each day of the week, we are given the hourly wage and hours worked. Can we compute
total salary for each day with the wages*hours formula?

As shown n F gure 1-17 (see the Namedrows x sx fi e), row 12 conta ns da y wage rates, and row 13
conta ns hours worked each day

FIGURE 1-17  n any ce , th s name refers to the ce above the act ve ce .

You can se ect row 12 (by c ck ng the 12) and use the Name box to enter the name wage Se ect
row 13 and type the name hours n the Name box If you now enter the wage*hours formu a n ce
F14 and copy th s formu a to the G14 L14 range, you can see that Exce finds the wage and hour va -
ues and mu t p es them n each co umn

Remarks
■ Exce does not a ow you to use the etters r and c as range names

■ The on y symbo s a owed n range names are per ods ( ) and underscores ( )

■ If you use Create From Se ect on to create a range name, and your name conta ns spaces,
Exce nserts an underscore ( ) to fi n the spaces For examp e, Product 1 s created as
Product 1

■ Range names cannot beg n w th numbers or ook ke a ce reference For examp e, 3Q and A4
are not a owed as range names Because Exce 2013 has more than 16,000 co umns, a range
name such as cat1 s not perm tted because there s a CAT1 ce If you try to name a ce CAT1,
Exce te s you the name s nva d Probab y your best a ternat ve s to name the ce cat1

Problems
1. The Stock x sx fi e conta ns month y stock returns for Genera Motors and M crosoft Name
the ranges conta n ng the month y returns for each stock and compute the average month y
return on each stock

2. Open a new b ank workbook and name the range conta n ng the A1 B3 and A6 B8 ce s as Red

Range names  Chapter 1   13


3. In ce s Q5 and Q6 n the C tyd stances x sx fi e, you can enter the at tude and ong tude of
any c ty and, n Q7 and Q8, the at tude and ong tude of a second c ty Ce Q10 computes the
d stance between the two c t es Define range names for the at tude and ong tude of each
c ty and ensure that these names show up n the formu a for tota d stance

4. The Sharedata x sx fi e conta ns the numbers of shares you own of each stock and the pr ce of
each stock Compute the va ue of the shares of each stock w th the shares*pr ce formu a

5. Create a range name that averages the past five years of sa es data Assume annua sa es are
sted n a s ng e co umn Use data n the Last5 x sx fi e

14  Chapter 1  Range names


CHAPTER 2

Lookup functions

Questions answered in this chapter:


■ How can I wr te a formu a to compute tax rates based on ncome?

■ G ven a product ID, how can I ook up the product’s pr ce?

■ Suppose that a product’s pr ce changes over t me I know the date the product was so d How
can I wr te a formu a to compute the product’s pr ce?

Syntax of the lookup functions


Lookup funct ons enab e you to ook up va ues from worksheet ranges In M crosoft Exce 2013, you
can perform both vert ca ookups (by us ng the VLOOKUP funct on) and hor zonta ookups (by
us ng the HLOOKUP funct on) In a vert ca ookup, the ookup operat on starts n the first co umn of
a worksheet range In a hor zonta ookup, the operat on starts n the first row of a worksheet range
Because the major ty of formu as us ng ookup funct ons nvo ve vert ca ookups, th s chapter con-
centrates on VLOOKUP funct ons

VLOOKUP syntax
The syntax of the VLOOKUP funct on s as fo ows The brackets ([ ]) nd cate opt ona arguments

VLOOKUP(lookup value,table range,column index,[range lookup])

■ Lookup value s the va ue you want to ook up n the first co umn of the tab e range

■ Table range s the range that conta ns the ent re ookup tab e The tab e range nc udes the
first co umn, n wh ch you try to match the ookup va ue, and any other co umns n wh ch you
want to ook up formu a resu ts

■ Column index s the co umn number n the tab e range from wh ch the va ue of the ookup
funct on s obta ned

■ Range lookup s an opt ona argument The po nt of range lookup s to spec fy an exact or
approx mate match If the range lookup argument s True or om tted, the first co umn of the
tab e range must be n ascend ng numer ca order If the range lookup argument s True or
om tted and an exact match to the ookup va ue s found n the first co umn of the tab e

15

range, Exce bases the ookup on the row of the tab e n wh ch the exact match s found If the
range lookup argument s True or om tted and an exact match does not ex st, Exce bases the
ookup on the argest va ue n the first co umn that s ess than the ookup va ue If the range
lookup argument s False and an exact match to the ookup va ue s found n the first co umn
of the tab e range, Exce bases the ookup on the row of the tab e n wh ch the exact match
s found If no exact match s obta ned, Exce returns an #N/A (Not Ava ab e) response Note
that a range lookup argument of 1 s equ va ent to True, whereas a range lookup argument of
0 s equ va ent to False.

HLOOKUP syntax
In an HLOOKUP funct on, Exce tr es to ocate the ookup va ue n the first row (not the first co umn)
of the tab e range For an HLOOKUP funct on, use the VLOOKUP syntax and change column to row

Now, exp ore some nterest ng examp es of ookup funct ons

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

How can I write a formula to compute tax rates based on income?

The fo ow ng examp e shows how a VLOOKUP funct on works when the first co umn of the tab e
range cons sts of numbers n ascend ng order Suppose that the tax rate depends on ncome, as
shown n Tab e 2-1

TABLE 2-1  Tax rate on ncome

Income level Tax rate


$0 $9,999 15%
$10,000 $29,999 30%
$30,000 $99,999 34%
$100,000 and over 40%

To see an examp e of how to wr te a formu a that computes the tax rate for any ncome eve , open
the Lookup x sx fi e, shown n F gure 2-1

16  Chapter 2  Lookup funct ons


FIGURE 2-1  Use a ookup funct on to compute a tax rate. The numbers n the first co umn of the tab e range are
sorted n ascend ng order.

F rst, the re evant nformat on (tax rates and break po nts) was entered n ce range D6 E9 The
tab e range s named D6 E9 lookup It’s recommended a ways to name the ce s you’re us ng as the
tab e range If you do so, you need not remember the exact ocat on of the tab e range, and when
you copy any formu a nvo v ng a ookup funct on, the ookup range w a ways be correct To us-
trate how the ookup funct on works, some ncomes were entered n the D13 D17 range By copy ng
the VLOOKUP(D13,Lookup,2,True) formu a from E13 to E14 E17, the tax rate was computed for the
ncome eve s sted n D13 D17 Exam ne how the ookup funct on worked n ce s E13 E17 Note that
because the co umn ndex n the formu a s 2, the answer a ways comes from the second co umn of
the tab e range

■ In D13, the ncome of –$1,000 y e ds #N/A because –$1,000 s ess than the owest ncome
eve n the first co umn of the tab e range If you want a tax rate of 15 percent assoc ated w th
an ncome of –$1,000, rep ace the 0 n D6 w th a number that s –1,000 or sma er

■ In D14, the ncome of $30,000 exact y matches a va ue n the first co umn of the tab e range,
so the funct on returns a tax rate of 34 percent

■ In D15, the ncome eve of $29,000 does not exact y match a va ue n the first co umn of the
tab e range, wh ch means the ookup funct on stops at the argest number ess than $29,000
n the first co umn of the range—$10,000 n th s case Th s funct on returns the tax rate n
co umn 2 of the tab e range oppos te $10,000, or 30 percent

Lookup funct ons  Chapter 2   17


■ In D16, the ncome eve of $98,000 does not y e d an exact match n the first co umn of the
tab e range The ookup funct on stops at the argest number ess than $98,000 n the first
co umn of the tab e range Th s returns the tax rate n co umn 2 of the tab e range oppos te
$30,000—34 percent

■ In D17, the ncome eve of $104,000 does not y e d an exact match n the first co umn of the
tab e range The ookup funct on stops at the argest number ess than $104,000 n the first
co umn of the tab e range, wh ch returns the tax rate n co umn 2 of the tab e range oppos te
$100,000—40 percent

In F13 F17, the va ue of the range lookup argument was changed from True to False, and the
VLOOKUP(D13,Lookup,2,Fa se) formu a was cop ed from F13 to F14 F17 Ce F14 st y e ds a 34
percent tax rate because the first co umn of the tab e range conta ns an exact match to $30,000 A
the other entr es n F13 F17 d sp ay #N/A because none of the other ncomes n D13 D17 has an exact
match n the first co umn of the tab e range

Given a product ID, how can I look up the product’s price?

Often, the first co umn of a tab e range does not cons st of numbers n ascend ng order For examp e,
the first co umn of the tab e range m ght st product ID codes or emp oyee names In my exper ence
teach ng thousands of financ a ana ysts, I’ve found that many peop e don’t know how to dea w th
ookup funct ons when the first co umn of the tab e range does not cons st of numbers n ascend ng
order In these s tuat ons, remember on y one s mp e ru e Use False as the va ue of the range lookup
argument

Here’s an examp e In the Lookup x sx fi e (see F gure 2-2), you can see the pr ces for five products,
sted by the r product ID code How do you wr te a formu a that takes a product ID code and returns
the product pr ce?

FIGURE 2-2  Look up pr ces from product D codes. When the tab e range sn t sorted n ascend ng order, enter
False as the ast argument n the ookup funct on formu a.

Many peop e wou d enter the formu a as n ce I18 VLOOKUP(H18,Lookup2,2) However, note that
when you om t the fourth argument (the range lookup argument), the va ue s assumed to be True

18  Chapter 2  Lookup funct ons


7/31/05, the ookup stops at 5/1/05 and returns the pr ce n C3; and for any date ater than 8/1/05,
the ookup stops at 8/1/05 and returns the pr ce n D3

Problems
1. The Hr x sx fi e g ves emp oyee ID codes, sa ar es, and years of exper ence Wr te a formu a
that y e ds the emp oyee’s sa ary from a g ven ID code Wr te another formu a that y e ds the
emp oyee’s years of exper ence from a g ven ID code

2. The Ass gn x sx fi e g ves the ass gnment of workers to four groups The su tab ty of each
worker for each group (on a sca e from 0 to 10) s a so g ven Wr te a formu a that g ves the
su tab ty of each worker for the group to wh ch the worker s ass gned

3. You are th nk ng of advert s ng M crosoft products on a sports te ecast As you buy more ads,
the pr ce of each ad decreases as shown n the fo ow ng tab e

Number of ads Price per ad


1 5 $12,000
6 10 $11,000
11 20 $10,000
21 and h gher $9,000

For examp e, f you buy 8 ads, you pay $11,000 per ad, but f you buy 14 ads, you pay $10,000
per ad Wr te a formu a that y e ds the tota cost of purchas ng any number of ads

4. You are th nk ng of advert s ng M crosoft products on a popu ar TV mus c program You pay
one pr ce for the first group of ads, but as you buy more ads, the pr ce per ad decreases as
shown n the fo ow ng tab e

Ad number Price per ad


1 5 $12,000
6 10 $11,000
11 20 $10,000
21 or h gher $9,000

For examp e, f you buy 8 ads, you pay $12,000 per ad for the first 5 ads and $11,000 for each
of the next 3 ads If you buy 14 ads, you pay $12,000 for each of the first 5 ads, $11,000 for
each of the next 5 ads, and $10,000 for each of the ast 4 ads Wr te a formu a that y e ds the
tota cost of purchas ng any number of ads H nt You probab y need at east three co umns n
your tab e range, and your formu a m ght nvo ve two ookup funct ons

20  Chapter 2  Lookup funct ons


CHAPTER 3

INDEX function

Questions answered in this chapter:


■ I have a st of d stances between US c t es How can I wr te a funct on that returns the d stance
between, for examp e, Seatt e and M am ?

■ Can I wr te a formu a that references the ent re co umn conta n ng the d stances between each
c ty and Seatt e?

Syntax of the INDEX function


The INDEX funct on enab es you to return the entry n any row and co umn w th n an array of num-
bers The most common y used syntax for the INDEX funct on s the fo ow ng

INDEX(Array,Row Number,Column Number)

To ustrate, the INDEX(A1 D12,2,3) formu a returns the entry n the second row and th rd co umn
of the A1 D12 array Th s entry s the one n ce C2

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

I have a list of distances between US cities. How can I write a function that returns the dis-
tance between, for example, Seattle and Miami?

The Index x sx fi e (see F gure 3-1) conta ns the d stances between e ght US c t es The C10 J17 range,
wh ch conta ns the d stances, s named Distances

23

FIGURE 3-1  You can use the INDEX funct on to ca cu ate the d stance between c t es.

Suppose that you want to enter the d stance between Boston and Denver n a ce Because d s-
tances from Boston are sted n the first row of the array named Distances, and d stances to Denver
are sted n the fourth co umn of the array, the appropr ate formu a s INDEX(d stances,1,4) The
resu ts show that Boston and Denver are 1,991 m es apart S m ar y, to find the (much onger) d s-
tance between Seatt e and M am , you wou d use the INDEX(d stances,6,8) formu a Seatt e and M am
are 3,389 m es apart

Imag ne that a res dent of Seatt e, Kurt Sova n s embark ng on a road tr p to v s t re at ves n
Phoen x, Los Ange es (USC!), Denver, Da as, and Ch cago At the conc us on of the road tr p, Kurt
returns to Seatt e Can you eas y compute how many m es Kurt trave s on the tr p? As you can see n
F gure 3-2, you s mp y st the c t es Kurt v s ted (8-7-5-4-3-2-8) n the order he v s ted them, start ng
and end ng n Seatt e, and copy the INDEX(d stances,C21,C22) formu a from D21 to D26 The formu a
n D21 computes the d stance between Seatt e and Phoen x (c ty number 7), the formu a n D22 com-
putes the d stance between Phoen x and Los Ange es, and so on Kurt w trave a tota of 7,112 m es
on h s road tr p Just for fun, use the INDEX funct on to show that the M am Heat trave more m es
dur ng the NBA season than any other team

FIGURE 3-2  These are the d stances for Kurt s road tr p.

24  Chapter 3  NDEX funct on


Can I write a formula that references the entire column containing the distances between
each city and Seattle?

The INDEX funct on makes t easy to reference an ent re row or co umn of an array If you set the row
number to 0, the INDEX funct on references the sted co umn If you set the co umn number to 0, the
INDEX funct on references the sted row To ustrate, suppose you want to tota the d stances from
each sted c ty to Seatt e You cou d enter e ther of the fo ow ng formu as

SUM(INDEX(distances,8,0))

SUM(INDEX(distances,0,8))

The first formu a tota s the numbers n the e ghth row (row 17) of the D stances array; the second
formu a tota s the numbers n the e ghth co umn (co umn J) of the D stances array In e ther case, you
find that the tota d stance from Seatt e, to the other c t es, and back to Seatt e s 15,221 m es, as you
can see n F gure 3-1

Problems
1. Use the INDEX funct on to compute the d stance between Los Ange es and Phoen x and the
d stance between Denver and M am

2. Use the INDEX funct on to compute the tota d stance from Da as to the other c t es

3. A res dent of Da as, Texas, s embark ng on a road tr p that takes her to Ch cago, Denver, Los
Ange es, Phoen x, and Seatt e How many m es w she trave on th s tr p?

4. The Product x sx fi e conta ns month y sa es for s x products Use the INDEX funct on to com-
pute the sa es of Product 2 n March Use the INDEX funct on to compute tota sa es dur ng
Apr

5. The Nbad stances x sx fi e shows the d stance between any pa r of NBA arenas Suppose you
beg n n At anta, v s t the arenas n the order sted, and then return to At anta How far wou d
you trave ?

6. Use the INDEX funct on to so ve prob em 10 of Chapter 2, “Lookup funct ons ”

NDEX funct on  Chapter 3   25


CHAPTER 4

MATCH function

Questions answered in this chapter:


■ G ven month y sa es for severa products, how can I wr te a formu a that returns the sa es of a
product dur ng a spec fic month? For examp e, how much of Product 2 d d I se dur ng June?

■ G ven a st of baseba p ayers’ sa ar es, how can I wr te a formu a that y e ds the p ayer w th
the h ghest sa ary? How about the p ayer w th the fifth-h ghest sa ary?

■ G ven the annua cash flows from an nvestment project, how do I wr te a formu a that returns
the number of years requ red to pay back the project’s n t a nvestment cost?

Suppose you have a worksheet w th 5,000 rows conta n ng 5,000 names You need to find the name
John Doe, wh ch you know appears somewhere (and on y once) n the st Wou dn’t you ke to
know of a formu a that wou d return the row number that conta ns that name? The MATCH funct on
enab es you to find the first occurrence of a match to a g ven text str ng or number w th n a g ven
array You shou d use the MATCH funct on nstead of a ookup funct on when you want the pos t on
of a number n a range rather than the va ue n a part cu ar ce The syntax of the match funct on s

Match(lookup value,lookup range,[match type])

In the exp anat on that fo ows, assume that a ce s n the ookup range are n the same co umn In
th s syntax

■ Lookup va ue s the va ue you’re try ng to match n the ookup range

■ Lookup range s the range you’re exam n ng for a match to the ookup va ue The ookup
range must be a row or co umn

■ Match type=1 requ res the ookup range to cons st of numbers sted n ascend ng order The
MATCH funct on then returns the row ocat on n the ookup range (re at ve to the top of the
ookup range) that conta ns the argest va ue n the range that s ess than or equa to the
ookup va ue

■ Match type=–1 requ res the ookup range to cons st of numbers sted n descend ng order
The MATCH funct on returns the row ocat on n the ookup range (re at ve to the top of the
ookup range) that conta ns the ast va ue n the range that s greater than or equa to the
ookup va ue

27

■ Match type=0 returns the row ocat on n the ookup range that conta ns the first exact match
to the ookup va ue (Chapter 19, “COUNTIF, COUNTIFS, COUNT, COUNTA, and COUNTBLANK
funct ons,” d scusses how to find the second or th rd match ) When no exact match ex sts and
match type=0, Exce returns the error message #N/A Most MATCH funct on app cat ons use
match type=0, but f match type s not nc uded, match type=1 s assumed Thus, use match
type=0 when the ce contents of the ookup range are unsorted Th s s the s tuat on you usu-
a y face

The Matchex x sx fi e, shown n F gure 4-1, conta ns three examp es of the MATCH funct on’s
syntax

FIGURE 4-1  Use the MATCH funct on to ocate the pos t on of a va ue n a range.

In ce B13, the MATCH(“Boston”,B4 B11,0) formu a returns 1 because the first row n the B4 B11
range conta ns the va ue Boston Text va ues must be enc osed n quotat on marks (“”) In ce B14, the
MATCH(“Phoen x”,B4 B11,0) formu a returns 7 because ce B10 (the seventh ce n B4 B11) s the first
ce n the range that matches Phoenix. In ce E12, the MATCH(0,E4 E11,1) formu a returns 4 because
the ast number that s ess than or equa to 0 n the E4 E11 range s n ce E7 (the fourth ce n the
ookup range) In ce G12, the MATCH(–4,G4 G11,–1) formu a returns 7 because the ast number that
s greater than or equa to –4 n the G4 G11 range s conta ned n ce G10 (the seventh ce n the
ookup range)

The MATCH funct on can a so work w th an nexact match For examp e, the
MATCH(“Pho*”,B4 B11,0) formu a returns 7 The aster sk s treated as a w dcard, wh ch means that
M crosoft Exce searches for the first text str ng n the B4 B11 range that beg ns w th Pho Inc denta y,
th s same techn que can be used w th a ookup funct on For examp e, n the pr ce ookup exerc se n
Chapter 2, “Lookup funct ons,” the VLOOKUP(“x*”, ookup2,2) formu a wou d return the pr ce of prod-
uct X212 ($4 80)

If the ookup range s conta ned n a s ng e row, Exce returns the re at ve pos t on of the first match
n the ookup range, mov ng from eft to r ght As shown n the fo ow ng examp es, the MATCH func-
t on s often very usefu when t s comb ned w th other Exce funct ons such as VLOOKUP, INDEX,
or MAX

28  Chapter 4  MATCH funct on


Answers to this chapter’s questions
Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

Given monthly sales for several products, how can I write a formula that returns the sales of a
product during a specific month? For example, how much of Product 2 did I sell during June?

The Product ookup x sx fi e (shown n F gure 4-2) sts sa es of four NBA bobb e-head do s from
January through June How can you wr te a formu a that computes the sa es of a g ven product dur-
ng a spec fic month? The tr ck s to use one MATCH funct on to find the row that conta ns the g ven
product and another MATCH funct on to find the co umn that conta ns the g ven month You can
then use the INDEX funct on to return the product sa es for the month

FIGURE 4-2 The MATCH funct on can be used n comb nat on w th funct ons such as INDEX and VLOOKUP. The
range B4:G7 conta ns sa es data for the do s and s named Sales.

Th s figure shows how MATCH and INDEX funct ons can be comb ned to ook up sa es for any
month and p ayer comb nat on The range B4 G7 conta ns sa es data for the do s and s named Sales
The product you want to know about s n ce A10 and the month s n ce B10 In C10, you use the
MATCH(A10,A4 A7,0) formu a to determ ne wh ch row number n the Sales range conta ns sa es fig-
ures for the Kobe do Then, n ce D10, use the MATCH(B10,B3 G3,0) formu a to determ ne wh ch co -
umn number n the Sales range conta ns June sa es Now that you have the row and co umn numbers
that conta n the sa es figures you want, you can use the INDEX(Sa es,C10,D10) formu a n ce E10 to
y e d the p ece of sa es data that’s needed For more nformat on on the INDEX funct on, see Chapter
3, “The INDEX funct on ”

Given a list of baseball players’ salaries, how can I write a formula that yields the player with
the highest salary? How about the player with the fifth-highest salary?

The Baseba x sx fi e (see F gure 4-3) sts the sa ar es pa d to 401 Major League Baseba p ayers dur-
ng the 2001 season The data s not sorted by sa ary, and you want to wr te a formu a that returns
the name of the p ayer w th the argest sa ary as we as the name of the p ayer w th the fifth-h ghest
sa ary

MATCH funct on  Chapter 4   29


To find the name of the p ayer w th the h ghest sa ary, proceed as fo ows

1. Use the MAX funct on to determ ne the va ue of the h ghest sa ary

2. Use the MATCH funct on to determ ne the row that conta ns the p ayer w th the h ghest sa ary

3. Use a VLOOKUP funct on (key ng off the data row conta n ng the p ayer’s sa ary) to ook up
the p ayer’s name

The range C12 C412 nc udes p ayers’ sa ar es and s named Salaries The range used n the
VLOOKUP funct on (range A12 C412) s named Lookup

FIGURE 4-3  Th s examp e uses the MAX, MATCH, and VLOOKUP funct ons to find and d sp ay the h ghest va ue n
a st.

In ce C9, you find the h ghest p ayer sa ary ($22 m on) w th the MAX(Sa ar es) formu a Next,
n ce C8, you use the MATCH(C9,Sa ar es,0) formu a to determ ne the p ayer number of the p ayer
w th the h ghest sa ary Var ab e match type=0 was used because the sa ar es are not sted n e ther
ascend ng or descend ng order P ayer number 345 has the h ghest sa ary F na y, n ce C6, you use
the VLOOKUP(C8,Lookup,2) funct on to find the p ayer’s name n the second co umn of the ookup
range Not surpr s ng y, A ex Rodr guez was the h ghest-pa d p ayer n 2001

30  Chapter 4  MATCH funct on


To find the name of the p ayer w th the fifth-h ghest sa ary, you need a funct on that y e ds the
fifth- argest number n an array The LARGE funct on does that job The syntax of the LARGE func-
t on s LARGE(cell range,k) When t s entered th s way, t returns the kth- argest number n a ce
range Thus, the LARGE(sa ar es,5) formu a n ce D9 y e ds the fifth- argest sa ary ($12 6 m on)
Proceed ng as before, you find that Derek Jeter s the p ayer w th the fifth-h ghest sa ary (The dl
before Jeter’s name nd cates that at the beg nn ng of the season, Jeter was on the d sab ed st ) The
SMALL(salaries,5) funct on wou d return the fifth- owest sa ary

Given the annual cash flows from an investment project, how can I write a formula that
returns the number of years required to pay back the project’s initial investment cost?

The Payback x sx fi e, shown n F gure 4-4, shows the projected cash flows for an nvestment project
over the next 15 years Assume that n Year 1, the project requ red a cash outflow of $100 m on
Dur ng Year 1, the project generated a cash nflow of $14 m on You expect cash flows to grow at 10
percent per year How many years w pass before the project pays back ts nvestment?

The number of years requ red for a project to pay back an nvestment s ca ed the payback period.
In h gh-tech ndustr es, the payback per od s often used to rank nvestments (You earn n Chapter 7,
“Eva uat ng nvestments by us ng net present va ue cr ter a,” that payback s flawed as a measure of
nvestment qua ty because t gnores the va ue of money over t me ) For now, concentrate on how to
determ ne the payback per od for th s s mp e nvestment mode

FIGURE 4-4  Use the MATCH funct on to ca cu ate an nvestment s payback per od.

MATCH funct on  Chapter 4   31


To determ ne the payback per od for the project, proceed as fo ows

1. In co umn B, compute the cash flows for each year

2. In co umn C, compute the cumu at ve cash flows for each year

Now you can use the MATCH funct on (w th match type=1) to determ ne the row number of the
first year n wh ch cumu at ve cash flow s pos t ve Th s ca cu at on g ves you the payback per od

The ce s n B1 B3 have the range names sted n A1 A3 Year 0 cash flow (–In t a nvestment) s
entered n ce B5 Year 1 cash flow (Year 1 cf) s entered n ce B6 Copy ng the B6*(1+Growth) for-
mu a from B7 to B8 B20 computes the cash flow for Year 2 through Year 15

To compute the Year 0 cumu at ve cash flow, use the B5 formu a n ce C5 For ater years, you
can ca cu ate cumu at ve cash flow by us ng a formu a such as Year t cumu at ve cash flow=Year t–1
cumu at ve cash flow+Year t cash flow To mp ement th s re at onsh p, copy the =C5+B6 formu a from
C6 to C7 C20

To compute the payback per od, use the MATCH funct on (w th match type=1) to compute the ast
row of the C5 C20 range conta n ng a va ue ess than 0 Th s ca cu at on a ways g ves you the payback
per od For examp e, f the ast row n C5 C20 that conta ns a va ue ess than 0 s the s xth row n the
range, the seventh va ue marks the cumu at ve cash flow for the first year the project s pa d back
Because your first year s Year 0, the payback occurs dur ng Year 6 Therefore, the formu a n ce E2,
MATCH(0,C5 C20,1), y e ds the payback per od (6 years) If any cash flows after Year 0 are negat ve, th s
method fa s because the range of cumu at ve cash flows wou d not be sted n ascend ng order

Problems
1. Us ng the d stances between US c t es g ven n the Index x sx fi e, wr te a formu a us ng the
MATCH funct on to determ ne (based on the names of the c t es) the d stance between any
two of the c t es

2. The Matchtype1 x sx fi e sts the do ar amounts of 30 transact ons n chrono og ca order


Wr te a formu a that y e ds the first transact on for wh ch tota vo ume to date exceeds
$10,000

3. The Matchthemax x sx fi e g ves the product ID codes and un t sa es for 265 products Use the
MATCH funct on n a formu a that y e ds the product ID code of the product w th the argest
un t sa es

4. The Bus st x sx fi e g ves the amount of t me between bus arr va s ( n m nutes) at 45th Street
and Park Avenue n New York C ty Wr te a formu a that, for any arr va t me after the first bus,
g ves the amount of t me you have to wa t for a bus For examp e, f you arr ve 12 4 m nutes
from now, and buses arr ve 5 m nutes and 21 m nutes from now, you wa t 21 – 12 4 = 8 6
m nutes for a bus

32  Chapter 4  MATCH funct on


5. The Sa esdata x sx fi e conta ns the number of computers each sa esperson so d Create a for-
mu a that returns the un ts a g ven sa esperson so d

6. Suppose the VLOOKUP funct on was removed from Exce Exp a n how you cou d st get
a ong by us ng the MATCH and INDEX funct ons

MATCH funct on  Chapter 4   33


CHAPTER 5

Text functions

Questions answered in this chapter:


■ I have a worksheet n wh ch each ce conta ns a product descr pt on, a product ID, and a
product pr ce How can I put a the product descr pt ons n co umn A, a the product IDs n
co umn B, and a the pr ces n co umn C?

■ Every day, I rece ve data about tota US sa es, wh ch s computed n a ce as the sum of
East, North, and South reg ona sa es How can I extract East, North, and South sa es to
separate ce s?

■ At the end of each schoo semester, my students eva uate my teach ng performance on a sca e
from 1 to 7 I know how many students gave me each poss b e rat ng score How can I eas y
create a bar graph of my teach ng eva uat on scores?

■ I have down oaded numer ca data from the Internet or a database When I try to do ca cu a-
t ons w th the data, I a ways get a #VALUE error How can I so ve th s prob em?

■ I ke text funct ons, but s there an easy way (not nvo v ng text funct ons) to extract first
or ast names from data, create an ema st from a st of names, or perform other rout ne
operat ons on text data?

When someone sends you data or you down oad data from the web, t often sn’t formatted the way
you want For examp e, n sa es data you down oad, dates and sa es amounts m ght be n the same
ce , but you need them to be n separate ce s How can you man pu ate data so that t appears n
the format you need? The answer s to become good at us ng the M crosoft Exce text funct ons In
th s chapter, you earn how to use the fo ow ng Exce text funct ons and the new F ash F feature to
man pu ate your data so that t ooks the way you want

■ LEFT

■ RIGHT

■ MID

■ TRIM

■ LEN

■ FIND

35

■ SEARCH

■ REPT

■ CONCATENATE

■ REPLACE

■ VALUE

■ UPPER

■ LOWER

■ PROPER

■ CHAR

■ CLEAN

■ SUBSTITUTE

Text function syntax


The Textfunct ons x sx fi e, shown n F gure 5-1, nc udes examp es of text funct ons You see how to
app y these funct ons to a spec fic prob em ater n the chapter but beg n by see ng what each of the
text funct ons does Then you can comb ne the funct ons to perform some comp ex man pu at ons
of data

FIGURE 5-1  Th s figure shows examp es of text funct ons.

36  Chapter 5  Text funct ons


The LEFT function
The LEFT(text,k) funct on returns the first k characters n a text str ng For examp e, ce C3 conta ns
the LEFT(A3,4) formu a Exce returns Regg.

The RIGHT function


The RIGHT(text,k) funct on returns the ast k characters n a text str ng For examp e, n ce  C4, the
RIGHT(A3,4) formu a returns ller

The MID function


The MID(text,k,m) funct on beg ns at character k of a text str ng and returns the next m characters
For examp e, the MID(A3,2,5) formu a n ce C8 returns characters 2–6 from ce  A3; the resu t s eggie

The TRIM function


The TRIM(text) funct on removes a spaces from a text str ng except for s ng e spaces between words
For examp e, n ce C5, the TRIM(A3) formu a e m nates two of the three spaces between Regg e and
M er and y e ds Reggie Miller. The TRIM funct on a so removes spaces at the beg nn ng and end of a
ce ’s contents

The LEN function


The LEN(text) funct on returns the number of characters n a text str ng ( nc ud ng spaces) For
examp e, n ce C6, the LEN(A3) formu a returns 15 because ce A3 conta ns 15 characters In ce C7,
the LEN(C5) formu a returns 13 Because two spaces have been removed n the tr mmed resu t n ce
C5, ce C5 conta ns two fewer characters than the or g na text n A3

The FIND and SEARCH functions


The FIND(text to find,actua text,k) funct on returns the ocat on at or after character k of the first
character of text to find n actual text FIND s case sens t ve SEARCH has the same syntax as FIND,
but t s not case sens t ve For examp e, the FIND(“r”,A3,1) formu a n ce C10 returns 15, the ocat on
of the first owercase r n the Regg e M er text str ng (The uppercase R s gnored because FIND s
case sens t ve ) Enter ng SEARCH(“r”,A3,1) n ce C11 returns 1 because SEARCH matches r to e ther a
owercase character or an uppercase character Enter ng FIND(“ “,A3,1) n ce C9 returns 7 because the
first space n the Regg e M er str ng s the seventh character

The REPT function


You can use the REPT funct on to repeat a text str ng a spec fied number of t mes The syntax s
REPT(text,number of t mes) For examp e REPT(“ ”,3) produces output

Text funct ons  Chapter 5   37


The CONCATENATE and & functions
The CONCATENATE(text1,text2, . . .,text30) funct on can be used to jo n up to 30 text str ngs nto
a s ng e str ng The & operator can be used nstead of CONCATENATE For examp e, enter ng the
A1&” “&B1 formu a n ce C12 returns Regg e M er Enter ng the CONCATENATE(A1,” “,B1) formu a n
ce D12 y e ds the same resu t

The REPLACE function


The REPLACE(old text,k,m,new text) funct on beg ns at character k of o d text and rep aces the next m
characters w th new text For examp e, n ce C13, the REPLACE(A3,3,2,”nn”) formu a rep aces the th rd
and fourth characters (gg) n ce A3 w th nn Th s formu a y e ds Rennie Miller.

The VALUE function


The VALUE(text) funct on converts a text str ng that represents a number to a number For examp e,
enter ng the VALUE(A15) formu a n ce B15 converts text str ng 31 n ce A15 to numer ca va ue 31
You can dent fy va ue 31 n ce A15 as Eng sh text because t s eft just fied S m ar y, you can den-
t fy va ue 31 n ce B15 as a number because t s r ght just fied

The UPPER, LOWER, and PROPER functions


The UPPER(text) funct on changes text to a uppercase For examp e, n ce C16, the LOWER(C12)
formu a changes the cap ta etters to sma and y e ds reggie miller. In ce C17, the UPPER(C16) for-
mu a changes a etters to uppercase and y e ds REGGIE MILLER. F na y, n ce C18, the PROPER(C17)
formu a restores the proper case and y e ds Reggie Miller.

The CHAR function


The CHAR(number) funct on y e ds (for a number between 1 and 255) the ASCII character w th
that number For examp e, CHAR(65) y e ds A, CHAR(66) y e ds B, and th s sequence cont nues The
ASCIIcharacters x sx fi e conta ns a st of ASCII characters A part a st ng s shown n F gure 5-2

38  Chapter 5  Text funct ons


FIGURE 5-2 Here s a part a st of ASC characters.

The CLEAN Function


As you can see n F gure 5-2, certa n characters, such as character number 10 (wh ch represents a ne
feed), are nv s b e App y ng the CLEAN funct on to a ce removes some but not a the nv s b e (or
nonpr nt ng) ASCII characters The CLEAN funct on w not remove, for examp e, CHAR(160), wh ch s
a nonbreak ng space Later n th s chapter, you exam ne how to remove troub esome characters such
as CHAR(160) from a ce

The SUBSTITUTE FUNCTION


The SUBSTITUTE funct on rep aces spec fic text n a ce when you do not know the pos t on of the
text The syntax of the SUBSTITUTE funct on s ­SUBSTITUTE(ce ,o d text,new text,[ nstance ­number])
The ast argument s opt ona If om tted, every occurrence of o d text n the ce s rep aced by
new text If the ast argument s nc uded (say w th a va ue of n), on y the nth nstance of o d text s
rep aced by new text To ustrate the use of the SUBSTITUTE funct on, suppose you want to rep ace
the spaces n ce C17 w th aster sks F rst, you enter the SUBSTITUTE(D17,” “,”*”) formu a n ce C19

Text funct ons  Chapter 5   39


Th s rep aces each space w th an * and y e ds I* LOVE* EXCEL* 2013! Enter ng the SUBSTITUTE(D17,
”“,”*”,3) formu a n ce C20 rep aces on y the th rd space w th an * and y e ds I LOVE EXCEL*2013!

Answers to this chapter’s questions


You can see the power of text funct ons by us ng them to so ve some actua prob ems that former
students have exper enced work ng for Fortune 500 corporat ons Often, the key to so v ng prob ems
s to comb ne mu t p e text funct ons nto a s ng e formu a

I have a worksheet in which each cell contains a product description, a product ID, and a
product price. How can I put all the product descriptions in column A, all the product IDs in
column B, and all the prices in column C?

In th s examp e, the product ID s a ways defined by the first 12 characters, and the pr ce s a ways
nd cated n the ast 8 characters (w th two spaces fo ow ng the end of each pr ce) The so ut on, con-
ta ned n the Lenora x sx fi e and shown n F gure 5-3, uses the LEFT, RIGHT, MID, VALUE, TRIM, and
LEN funct ons

It’s a ways a good dea to beg n by tr mm ng excess spaces, wh ch you can do by copy ng the
TRIM(A4) formu a from B4 to B5 B12 The on y excess spaces n co umn A turn out to be the two
spaces nserted after each pr ce To see th s, put the cursor n ce A4 and press F2 to ed t the ce If
you move to the end of the ce , you see two b ank spaces The resu ts of us ng the TRIM funct on are
shown n F gure 5-3 To prove that the TRIM funct on removed the two extra spaces at the end of ce
A4, you can use formu as =LEN(A4) and =LEN(B4) to show that ce A4 conta ns 52 characters, and ce
B4 conta ns 50 characters

FIGURE 5-3  Use the TRIM funct on to tr m away excess spaces.

To capture the product ID, you need to extract the 12 eftmost characters from co umn B To do
th s, copy the LEFT(B4,12) formu a from C4 to C5 C12 Th s formu a extracts the 12 eftmost characters
from the text n ce B4 and the fo ow ng ce s, y e d ng the product ID, as you can see n F gure 5-4

40  Chapter 5  Text funct ons


FIGURE 5-4  Use text funct ons to extract the product D, pr ce, and product descr pt on from a text str ng.

To extract the product pr ce, you know that the pr ce occup es the ast s x d g ts of each ce , so you
need to extract the r ghtmost s x characters from each ce To do so, the VALUE(RIGHT(B4,6) formu a
was cop ed from ce D4 to D5 D12 The VALUE funct on was used to turn the extracted text nto a
numer ca va ue If you don’t convert the text to a numer ca va ue, you can’t perform mathemat ca
operat ons on the pr ces

Extract ng the product descr pt on s much tr ck er By exam n ng the data, you can see that f you
beg n your extract on w th the th rteenth character and cont nue unt you are s x characters from
the end of the ce , you can get the data you want Copy ng the MID(B4,13,LEN(B4)–6–12) formu a
from E4 to E5 E12 does the job LEN(B4) returns the tota number of characters n the tr mmed text
Th s formu a (MID for m dd e) beg ns w th the th rteenth character and then extracts the number of
characters equa to the tota number ess the 12 characters at the beg nn ng (the product ID) and the
6 characters at the end (pr ce) Th s subtract on eaves on y the product descr pt on

Now suppose you are g ven the data w th the product ID n co umn C, the pr ce n co umn D, and
the product descr pt on n co umn E Can you put these va ues together to recover your or g na text?

Text can eas y be comb ned by us ng the CONCATENATE funct on Copy ng the
CONCATENATE(C4,E4,D4) formu a from F4 to F5 F12 recovers your or g na (tr mmed) text, wh ch you
can see n F gure 5-4

The concatenat on formu a starts w th the product ID n ce C4 Next, you add the product
descr pt on from ce E4 F na y, you add the pr ce from ce D4 You have now recovered the ent re
text descr b ng each computer! Concatenat on can a so be performed by us ng the & s gn You cou d
recover the or g na product ID, product descr pt on, and pr ce n a s ng e ce w th the C4&E4&D4 for-
mu a Note that ce E4 conta ns a space before the product descr pt on and a space after the product
descr pt on If ce E4 d d not conta n these spaces, you cou d use the C4&” “&E4&” “&D4 formu a to
nsert the necessary spaces The space between each pa r of quotat on marks resu ts n the nsert on
of a space

If the product IDs d d not a ways conta n 12 characters, th s method of extract ng the nformat on
wou d fa You cou d, however, extract the product IDs by us ng the FIND funct on to d scover the
ocat on of the first space Then you cou d obta n the product ID by us ng the LEFT funct on to extract
a characters to the eft of the first space The examp e n the next sect on shows how th s approach
works

If the pr ce d d not a ways conta n prec se y s x characters, extract ng the pr ce wou d be a tt e


tr cky See Prob em 15 for an examp e of how to extract the ast word n a text str ng

Text funct ons  Chapter 5   41


Every day, I receive data about total US sales, which is computed in a cell as the sum of
East, North, and South regional sales. How can I extract East, North, and South sales to
separate cells?

Th s prob em was expressed by an emp oyee n the M crosoft finance department She rece ved
a worksheet each day conta n ng formu as such as =50+200+400, =5+124+1025, and other such
formu as She needed to extract each number nto a ce n ts own co umn For examp e, she wanted
to extract the first number (East sa es) n each ce to co umn C, the second number (North sa es) to
co umn D, and the th rd number (South sa es) to co umn E What makes th s prob em cha eng ng s
that you don’t know the exact ocat on of the character at wh ch the second and th rd numbers start
n each ce In ce A3, North sa es beg n w th the fourth character In ce A4, North sa es beg n w th
the th rd character

The data for th s examp e s n the Sa esstr pp ng x sx fi e, shown n F gure 5-5 You can dent fy the
ocat ons of the d fferent reg ons’ sa es as fo ows

■ East sa es are represented by every character to the eft of the first p us s gn (+)

■ North sa es are represented by every character between the first and second p us s gns

■ South sa es are represented by every character to the r ght of the second p us s gn

By comb n ng the FIND, LEFT, LEN, and MID funct ons, you can eas y so ve th s prob em as fo ows

■ Use the Edit, Replace command to rep ace each equa s gn (=) w th a space To remove the
equa s gns, se ect the A3 A6 range Then, on the Home tab n the Editing group, choose Find
& Select and then choose Replace In the Find What fie d, enter an equa s gn and nsert a
space n the Replace With fie d Then choose Replace All Th s converts each formu a nto
text by rep ac ng the equa s gn w th a space

■ Use the FIND funct on to ocate the two p us s gns n each ce

FIGURE 5-5  Extract East, North, and South sa es w th a comb nat on of the FIND, LEFT, LEN, and MID funct ons.

Beg n by find ng the ocat on of the first p us s gn for each p ece of data By copy ng the
FIND(“+”,A3,1) formu a from B3 to B4 B6, you can ocate the first p us s gn for each data po nt To
find the second p us s gn, beg n one character after the first p us s gn, copy ng the FIND(“+”,A3,B3+1)
formu a from C3 to C4 C6

To find East sa es, you can use the LEFT funct on to extract a the characters to the eft of the first
p us s gn, copy ng the LEFT(A3,B3-1) formu a from D3 to D4 D6 To extract North sa es, use the MID

42  Chapter 5  Text funct ons


funct on to extract a the characters between the two p us s gns Beg n one character after the first
p us s gn and extract the number of characters equa to (Position of 2nd plus sign) – (Position of 1st
plus sign) – 1 If you eave out the –1, you’ get the second p us s gn (Go ahead and check th s ) So, to
get North sa es, you copy the MID(A3,B3+1,C3–B3–1) formu a from E3 to E4 E6

To extract South sa es, you use the RIGHT funct on to extract a the characters to the r ght of the
second p us s gn South sa es w have the number of characters equa to (Total characters in cell) –
(Position of 2nd plus sign) You compute the tota number of characters n each ce by copy ng the
LEN(A3) formu a from F3 to F4 F6 F na y, you can obta n South sa es by copy ng the RIGHT(A3,F3-C3)
formu a from G3 to G4 G6

Extracting data by using the Convert Text To Columns Wizard


There s an easy way to extract East, North, and South sa es (and data s m ar to th s examp e) w thout
us ng text funct ons Se ect ce s A3 A6 and then, on the Data tab on the r bbon, n the Data Tools
group, c ck Text To Columns Se ect Delimited, c ck Next, and then fi n the d a og box as shown
n F gure 5-6

FIGURE 5-6  Th s figure shows the Convert Text To Co umns W zard.

Enter ng the p us s gn n the Delimiters area d rects Exce to separate each ce nto co umns,
break ng at each occurrence of the p us s gn Note that opt ons are prov ded for break ng data at
tabs, sem co ons, commas, or spaces Now c ck Next, se ect the upper- eft corner of your dest nat on
range ( n the examp e, ce A8 s chosen), and c ck Finish The resu t s shown n F gure 5-7

Text funct ons  Chapter 5   43


FIGURE 5-7  Here are the resu ts of the Convert Text To Co umns W zard.

At the end of each school semester, my students evaluate my teaching performance on a scale
from 1 to 7. I know how many students gave me each possible rating score. How can I easily
create a bar graph of my teaching evaluation scores?

The Repeatedh sto x sx fi e conta ns teach ng eva uat on scores (on a sca e from 1 to 7) Two peop e
gave scores of 1, three peop e gave scores of 2, and so on Us ng the REPT funct on, you can eas-
y create a graph to summar ze th s data Copy the =REPT(“ ”,C4) formu a from D4 to D5 D10 Th s
formu a p aces as many “ ” characters n co umn D as the entry n co umn C F gure 5-8 makes c ear
the preponderance of good scores (6s and 7s) and the re at ve rar ty of poor scores (1s and 2s)
Repeat ng a character such as enab es you to m m c a bar graph or h stogram eas y See Chapter
41, “Summar z ng data by us ng h stograms,” for further d scuss on of how to create h stograms
w th Exce

FIGURE 5-8  Use the REPT funct on to create a frequency graph.

I have downloaded numerical data from the Internet or a database. When I try to do calcula-
tions with the data, I always get a #VALUE error. How can I solve this problem?

In the C eanexamp e x sx fi e (see F gure 5-9), the unpr ntab e CHAR(10) and CHAR(160) have been
concatenated n front of the number 33 n ce s E5 and H6, respect ve y In ce s E8 and H8, you app y
the VALUE funct on n an attempt to transform the contents of E5 and H6 nto numbers, but the resu t
s the #VALUE error, wh ch nd cates that Exce cannot figure out that you want these ce s treated as
numbers In ce E11, the contents of ce E5 were c eaned w th the CLEAN(E5) formu a In ce E12,
you see the numer ca va ue 33, so the VALUE(E11) formu a succeeds after CHAR(10) was c eaned
However, n ce H10, an attempt was made to c ean the contents of ce H6 w th the CLEAN(H6)

44  Chapter 5  Text funct ons


formu a In ce H11, the VALUE(H10) formu a fa s because the CLEAN funct on does not remove
CHAR(160) You can, however, use the SUBSTITUTE funct on to rep ace CHAR(160) w th an empty
space, and a s we In ce H14, use the FIND(CHAR(160),H10) formu a to ver fy that CHAR(160)
s present n ce H10 You find that the first character n ce H10 was CHAR(160); f the FIND func-
t on returned an error, you wou d know that CHAR(160) was not present n ce H10 In ce H15, the
SUBSTITUTE(H6,CHAR(160),””) formu a rep aces a occurrences of CHAR(160) w th an empty space In
ce H16, the VALUE(H15) formu a y e ds the number 33, so we can now perform mathemat ca opera-
t ons on the contents of ce H15!

FIGURE 5-9  Use the CLEAN and SUBSTITUTE funct ons to remove unpr ntab e characters.

I like text functions, but is there an easy way (not involving text functions) to extract first
or last names from data, create an email list from a list of names, or perform other routine
operations on text data?

F ash F uses soph st cated pattern recogn t on techno ogy to m m c many tasks that were prev ous y
performed w th text funct ons The F ashfi x sx fi e conta ns the fo ow ng examp es of F ash F n
act on

■ Extract ng first and ast names

■ Creat ng ema addresses for UXYZ Un vers ty by append ng @UXYZ edu to a person’s ast
name

■ Extract ng the do ar and cents amounts from a st of pr ces

To use the F ash F feature, ook at a co umn near your data and n the row conta n ng the first
row of data type n an examp e of what you want to accomp sh Usua y, f you press Enter and then

Text funct ons  Chapter 5   45


Ctr +E, F ash F correct y ant c pates your w shes and fi s n the rema n ng ce s Somet mes, however,
t takes more than one examp e for F ash F to get th ngs r ght

As shown n F gure 5-10, you want to extract each person’s first and ast name n co umns E and F
Type Tricia n ce E6 of the first and ast worksheet and press Enter Press Ctr +E, and Exce fi s n each
person’s first name n E7 E13 S m ar y, f you type Lopez n F6, press Enter, and then press Ctr +E,
F ash F enters each person’s ast name n F7 F13

FIGURE 5-10  F ash F automat ca y fi s n first and ast names.

As shown n F gure 5-11, you want to create an ema address for each person by append ng
­ ­UXYZ edu to each person’s ast name Beg n by typ ng Lopez@UXYZ.edu n ce E6 of the work-
@
sheet ema After press ng Enter, press Ctr +E, and F ash F mag ca y creates ema addresses n the
E7 E13 range

FIGURE 5-11  Create ema addresses w th F ash F .

As shown n F gure 5-12, you want to extract the do ar and cents amounts of the pr ces shown n
the D6 D11 ce range of the Do ars and Cents worksheet To beg n, type 6 n ce E6 and press Enter
After press ng Ctr +E, the correct do ar amounts are nserted n E7 E11 S m ar y, f you type 56 n F6
and press Enter fo owed by Ctr +E, F ash F fi s n the correct cents amounts n F7 F11

46  Chapter 5  Text funct ons


FIGURE 5-12  Use F ash F to extract do ars and cents.

F ash F can make m stakes, espec a y when the data s not very cons stent A so (un ke formu as
nvo v ng text funct ons), the resu ts from F ash F are not dynam c and w not update f the or g na
data s changed

If you w sh, you may d sab e F ash F by se ect ng Options from FILE on the r bbon Under
Advanced, open the Ed t ng Opt ons sect on of the d a og box and c ear Automatically Flash Fill

Problems
1. Ce s B2 B5 of the Showb z x sx workbook conta n the fict t ous addresses of some of our favor-
te peop e Use text funct ons to extract each person’s name to one co umn and each person’s
street address to another

2. The IDpr ce x sx workbook conta ns the product ID and pr ces for var ous products Use text
funct ons to put the product IDs and pr ces n separate co umns and then use the Text To
Columns command on the Data tab on the r bbon to accomp sh the same goa

3. The Quarter ygnpdata x sx workbook conta ns quarter y GNP data for the Un ted States ( n
b ons of 1996 do ars) Extract th s data to three co umns so that the first co umn conta ns
the year, the second co umn conta ns the quarter number, and the th rd co umn conta ns
the GNP  The Textsty esdata x sx fi e conta ns nformat on about the sty e, co or, and s ze of a
var ety of sh rts For examp e, the first sh rt s sty e 100 ( nd cated by d g ts between the co on
and the hyphen) Its co or s 65, and ts s ze s L Use text funct ons to extract the sty e, co or,
and s ze of each sh rt

4. The fi e Textsty esdata x sx conta ns nformat on about the sty e, co or, and s ze for a var ety of
sh rts For examp e, the first sh rt s sty e 100 ( nd cated by d g ts between the co on and the
hyphen) Its co or s 65, and ts s ze s 1 Use text funct ons to extract the s ze, co or, and sty e
of each sh rt

5. The Ema prob em x sx fi e g ves first and ast names of severa new M crosoft emp oyees To
create an ema address for each emp oyee, fo ow the first etter of the emp oyee’s first name
by the emp oyee’s ast name and add @m crosoft com to the end Use text funct ons to create
the ema addresses effic ent y

Text funct ons  Chapter 5   47


6. The L neupdata x sx fi e g ves the number of m nutes p ayed by five-p ayer comb nat ons
( neups) (L neup 1 p ayed 10 4 m nutes, for nstance ) Use text funct ons to put th s data nto a
form su tab e for numer ca ca cu at ons; for examp e, transform 10 4m nto the number 10 4

7. The Reversenames x sx fi e g ves the first names, m dd e names or n t a s, and ast names
of severa peop e Transform these names so that the ast name appears first, fo owed by a
comma, and then fo owed by the first and m dd e names For examp e, transform Gregory
W am W nston nto W nston, Gregory W am

8. The Incomefrequency x sx fi e conta ns the d str but on of start ng sa ar es for MBA graduates
of Faber Co ege Summar ze th s data by creat ng a frequency graph

9. Reca that CHAR(65) y e ds the etter A, CHAR(66) y e ds the etter B, and so on Use these
facts to popu ate ce s B1 B26 effic ent y w th the sequence of A, B, C, and so on through Z

10. The Cap ta zefirst etter x sx fi e conta ns var ous song t t es or phrases, such as, “The ra n n
Spa n fa s ma n y n the p a n ” Ensure that the first etter of each song t t e s cap ta zed

11. The Ageofmach ne x sx fi e conta ns data n the fo ow ng form

• S/N 160768, v b ro er,84” smooth drum,canopy Auct on 6/2–4/2005 n Montgomery,


A abama

• Each row refers to a mach ne purchase Determ ne the year of each purchase

12. When down oad ng corporate data from the Secur ty and Exchange Comm ss on’s EDGAR s te,
you often obta n data for a company that ooks someth ng ke th s

• Cash and Cash Equ va ents $31,848, $31,881


• How wou d you extract Cash and Cash Equ va ents effic ent y for each company?
13. The Lookuptwoco umns x sx fi e g ves the mode , year, and pr ce for each of a ser es of cars
Set up formu as that enab e you to enter the mode and year of a car and return ts pr ce

14. The Mov edata x sx fi e conta ns the names of severa mov es fo owed by the number of cop-
es of the mov e DVD purchased by a oca v deo store Extract the t t e of each mov e from
th s data

15. The Mov edata x sx fi e conta ns the names of severa mov es fo owed by the number of cop-
es of the mov e DVD purchased by a oca v deo store For each mov e, extract the number
of cop es purchased from th s data H nt You probab y want to use the SUBSTITUTE funct on
The syntax of the SUBSTITUTE funct on s SUBSTITUTE(text,o d text,new text,[ nstance num])
If nstance num s om tted, every occurrence of o d text n text s rep aced by new text If
nstance num s g ven, then on y that occurrence of o d text s rep aced by new text For exam-
p e, SUBSTITUTE(A4,1,2) wou d rep ace each 1 n ce A4 w th a 2, but SUBSTITUTE(A4,1,2,3)
wou d rep ace on y the th rd occurrence of a 1 n ce A4 w th a 2

48  Chapter 5  Text funct ons


16. The Prob em16data x sx fi e conta ns the number of peop e who responded 1–5 on a mar-
ket ng quest onna re (1 = Very un ke y to buy product, , 5 = Very ke y to buy product)
Summar ze th s data graph ca y by us ng the aster sk symbo To make your summary ook
more appea ng, on the Home tab on the r bbon, choose Orientation n the Alignment group
and make the text vert ca R ght-c ck the row number and ncrease the row he ght F na y, n
the Alignment group, choose Wrap Text so that you make the text of your graph vert ca

17. The Prob em17data x sx fi e conta ns peop e’s names (such as Mr John Doe) Use text funct ons
to extract each person’s t t e and first name to separate co umns

18. The We rddata x s fi e conta ns three numbers mported from an Internet s te Add up the
numbers and see that the tota s ncorrect Mod fy the data so that the SUM funct on can
obta n the correct sum of the three numbers H nt Use the FIND funct on to find out wh ch
nv s b e character s present!

19. Use F ash F to change the names n the F ashfi temp ate x s worksheet to owercase

20. Use F ash F to extract the number from each row n the Mov enumbers x sx fi e

21. For the data n Mov enumbers x sx, use F ash F to create a co umn that nserts the number n
the mov e t t e at the end of the phrase, “The number n the t t e of th s mov e s “

Text funct ons  Chapter 5   49


CHAPTER 6

Dates and date functions

Questions answered in this chapter:


■ When I enter dates n Exce , I often see a number such as 37625 rather than a date such as
1/4/2003 What does th s number mean, and how can I change t to a norma date?

■ Can I use a formu a to d sp ay today’s date automat ca y?

■ How can I determ ne a date that s 50 workdays after another date? How can I exc ude ho -
days f I want to?

■ How can I determ ne the number of workdays between two dates?

■ I have 500 dates entered n an Exce worksheet How can I wr te formu as to extract from each
date the month, year, day of the month, and day of the week?

■ I am g ven the year, month, and day of the month for a date Is there an easy way to recover
the actua date?

■ My bus ness has purchased and so d mach nes For some, I have the date the mach ne was
purchased and the date the mach ne was so d Can I eas y determ ne how many months we
kept these mach nes?

To ustrate the most common y used month-day-year formats n M crosoft Exce 2013, suppose
today s January 4, 2004 You can enter th s date as any of the fo ow ng

■ 1/4/2004

■ 4-Jan-2004

■ January 4, 2004

■ 1/4/04

If you enter on y two d g ts to represent a year, and the d g ts are 30 or h gher, Exce assumes the
d g ts represent years n the twent eth century; f the d g ts are ower than 30, Exce assumes they rep-
resent years n the twenty-first century For examp e, 1/1/29 s treated as January 1, 2029, but 1/1/30
s treated as January 1, 1930 Each year, the year treated as dates n the twenty-first century ncreases
by one

51

Answers to this chapter’s questions
Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

When I enter dates in Excel, I often see a number such as 37625 rather than a date such as
1/4/2003. What does this number mean, and how can I change it to a normal date?

The way Exce treats ca endar dates s somet mes confus ng to the nov ce The key s understand ng
that Exce can d sp ay a date n a var ety of month-day-year formats, or t can d sp ay a date n serial
format A date n ser a format, such as 37625, s s mp y a pos t ve nteger that represents the number
of days between the g ven date and January 1, 1900 Both the current date and January 1, 1900 are
nc uded n the count For examp e, Exce d sp ays January 3, 1900, n ser a format as the number
3, wh ch means there are three days between January 1, 1900, and January 3, 1900 ( nc ud ng both
days)

Note  Excel assumes that 1900 was a leap year containing 366 days. In reality, 1900 con-
tained only 365 days. For some fascinating information on the origin of this bug, see www.
joelonsoftware.com/items/2006/06/16.html.

F gure 6-1 shows the worksheet named Ser a Format n the Dates x sx fi e Suppose you are g ven
the dates shown n ce s D5 D14 n ser a format For examp e, va ue 37622 n ce D5 nd cates a date
that s 37,622 days after January 1, 1900 ( nc ud ng both January 1, 1900, and day 37,622) To d sp ay
these ser a dates n month-day-year format, copy them to E5 E14 Se ect the E5 E14 ce range, r ght-
c ck the se ect on, and choose Format Cells At any t me, by the way, you can open the Format Ce s
d a og box by press ng Ctr +1 Now se ect the date format you want from the st shown n F gure 6-2
The dates n E5 E14 are d sp ayed n date format, as you can see n F gure 6-1 If you want to format
dates n the ser a number format, se ect E5 E14, r ght-c ck the se ect on, and choose Format Cells,
General

FIGURE 6-1  Use the Format Ce s command to change dates from ser a number format to month day year
format.

52  Chapter 6  Dates and date funct ons


S mp y chang ng the date format of a ce to Genera w y e d the date n ser a format Another
way to obta n the date n ser a format s to use the DATEVALUE funct on and enc ose the date n
quotat on marks For examp e, n the Date Format worksheet of the Dates x sx fi e, ce I5 conta ns the
DATEVALUE(“1/4/2003”) formu a Exce y e ds 37625, wh ch s the ser a format for January 4, 2003

FIGURE 6-2  Reformat a ser a number to month day year format as th s figure shows.

Can I use a formula to display today’s date automatically?

D sp ay ng today’s date w th a formu a s easy, as you can see by ook ng at ce C13 of the Date
Format worksheet shown n F gure 6-3 Enter ng the TODAY() funct on n a ce d sp ays today’s date
Th s screenshot was created on Ju y 7, 2013

Dates and date funct ons  Chapter 6   53


FIGURE 6-3  Here are examp es of date funct ons.

How can I determine a date that is 50 workdays after another date? How can I exclude holi-
days if I want to?

The WORKDAY(start date,#days,[holidays]) funct on d sp ays the date that s the number of work-
days (a workday s a nonweekend day) nd cated by #days after a g ven start date Ho days s an
opt ona argument for the funct on by wh ch you can exc ude from the ca cu at on any dates that are
sted n a ce range Thus, enter ng the WORKDAY(C14,50) formu a n ce D14 of the Date Format
worksheet te s you that 3/14/2003 s 50 workdays after 1/3/2003 If you be eve that the on y two
ho days that matter are Mart n Luther K ng Day and Independence Day, you can change the formu a
to WORKDAY(C14,50,F17 F18) W th th s add t on, Exce does not count 1/20/2003 n ts ca cu at ons,
mak ng 3/17/2003 the fift eth workday after 1/3/2003 Note that nstead of referr ng to the ho days
n other ce s, you can enter them d rect y n the WORKDAY formu a w th the ser a number of each
ho day enc osed n cur y brackets ({ }) For examp e, WORKDAY(38500,10,{38600,38680,38711}) wou d
find the tenth workday after the date w th ser a number 38500, gnor ng Labor Day, Thanksg v ng,
and Chr stmas 2005

The WORKDAY.INTL funct on was ntroduced n Exce 2010 Use th s funct on to choose your own
defin t on of a workday The syntax s WORKDAY INTL(start date,days,weekend,[ho days]) Use the
th rd argument to spec fy the defin t on of a day off You can use the fo ow ng codes to spec fy the
defin t on of a day off

1 or om tted Saturday, Sunday


2 Sunday, Monday
3 Monday, Tuesday
4 Tuesday, Wednesday
5 Wednesday, Thursday
6 Thursday, Fr day

54  Chapter 6  Dates and date funct ons


7 Fr day, Saturday
11 Sunday on y
12 Monday on y
13 Tuesday on y
14 Wednesday on y
15 Thursday on y
16 Fr day on y
17 Saturday on y

For examp e, n worksheet Date Format of the Dates x sx fi e, the date 100 workdays after
3/14/2011 was computed n ce C27 (see F gure 6-4), w th Sunday and Monday as days off, w th the
WORKDAY INTL(C23,100,2) formu a In ce C28, the date 100 workdays after 3/14/2011 when on y
Sunday s a day off was computed by us ng the WORKDAY INTL(C23,100,11) formu a You can a so
enter the defin t on of days off w th a str ng of seven ones and zeroes; a one nd cates a day off, and
the first entry n the str ng s Monday, the second s Tuesday, and so on Thus, n ce s D26 and D27,
the prev ous resu ts were dup cated w th the WORKDAY INTL(C23,100,”1000001”) and WORKDAY
INTL(C23,100,”0000001”) formu as, respect ve y

How can I determine the number of workdays between two dates?

The key to so v ng th s prob em s to use the NETWORKDAYS funct on The syntax for th s funct on s
NETWORKDAYS(start date,end date,[ho days]), where holidays s an opt ona argument dent fy ng a
ce range that sts the dates you want to count as ho days The NETWORKDAYS funct on returns the
number of work ng days between start date and end date, exc ud ng weekends and any sted ho -
days As an ustrat on of the NETWORKDAYS funct on, ook at ce C18 n the Date Format worksheet,
wh ch conta ns the NETWORKDAYS(C14,C15) formu a Th s formu a y e ds the number of work ng days
between 1/3/2003 and 8/4/2003, wh ch s 152 The NETWORKDAYS(C14,C15,F17 F18) formu a n ce
C17 y e ds the number of workdays between 1/3/2003 and 8/4/2003, exc ud ng Mart n Luther K ng
Day and Independence Day The answer s 152–2=150

The NETWORKDAYS.INTL funct on was ntroduced w th Exce 2010 L ke the WORKDAYS.INTL


funct on, NETWORKDAYS.INTL enab es you to custom ze the defin t on of a weekend For exam-
p e, n ce C31 of the Date Format worksheet n the Dates x sx fi e, the number of workdays (373)
between 3/14/2011 and 8/16/2012 was computed, when Sunday and Monday are days off, w th the
NETWORKDAYS INTL(C23,C24,2) formu a (See F gure 6-4 ) In ce D31, the same resu t was computed
w th the NETWORKDAYS INTL(C23,C24,”1000001”) formu a

Dates and date funct ons  Chapter 6   55


FIGURE 6-4  Th s figure shows examp es of nternat ona date funct ons.

I have 500 dates entered in an Excel worksheet. How can I write formulas that will extract
from each date the month, year, day of the month, and day of the week?

The Date Format worksheet of the Dates x sx fi e (see F gure 6-3) sts severa dates n the B5 B10 ce
range In B5 and B7 B9, four formats were used to d sp ay January 4, 2003 In co umns D G, the year,
month, day of the month, and day of the week for each date were extracted By copy ng the YEAR(B5)
formu a from D5 to D6 D10, the year for each date was extracted By copy ng the MONTH(B5) formu a
from E5 to E6 E10, the month (1=January, 2=February, and so on) port on of each date was extracted
By copy ng the DAY(B5) formu a from F5 to F6 F10, the day of the month for each date was extracted
F na y, by copy ng the WEEKDAY(B5,1) formu a from G5 to G6 G10, the day of the week for each date
was extracted Note that th s process m ght not work for non-US reg ona sett ngs

When the ast argument of the WEEKDAY funct on s 1, 1=Sunday, 2=Monday, and so on When
the ast argument s 2, 1=Monday, 2=Tuesday, and so on When the ast argument s 3, 0=Monday,
1=Tuesday, and so on

I am given the year, month, and day of the month for a date. Is there an easy way to recover
the actual date?

The DATE funct on, whose arguments are DATE(year,month,day), returns the date w th the g ven year,
month, and day of the month In the Date Format worksheet, copy ng the DATE(D5,E5,F5) formu a
from ce H5 to ce s H6 H10 recovers the dates you started w th

My business has purchased and sold machines. For some, I have the date the machine was
purchased and the date the machine was sold. Can I easily determine how many months we
kept these machines?

The DATEDIF funct on can eas y determ ne the number of comp ete years, months, or days between
two dates In fi e Dated f x sx (see F gure 6-5), you can see that a mach ne was bought on 10/15/2006
and was so d on 4/10/2008 How many comp ete years, months, or days was the mach ne kept?
The syntax of the DATEDIF funct on s DATEDIF(startdate,enddate,t me un t) If the un t s wr tten

56  Chapter 6  Dates and date funct ons


as “y,” you get the number of comp ete years between the start and end dates; f the un t s wr tten
as “m,” you get the number of comp ete months between the start and end dates; and f the un t s
wr tten as “d,” you get the number of comp ete days between the start and end dates Thus, enter-
ng DATEDIF(D4,D5,”y”) n ce D6 shows that the mach ne was kept for one fu year Enter ng the
DATEDIF(D4,D5,”m”) formu a n ce D7 shows the mach ne was kept for 17 comp ete months Enter ng
the DATEDIF(D4,D5,”d”) formu a n ce D7 shows the mach ne was kept for 543 comp ete days

FIGURE 6-5  Th s figure shows use of the DATEDIF funct on.

Problems
1. What s the ser a format for January 25, 2006?

2. What s the ser a format for February 14, 1950?

3. To what actua date does a ser a format of 4526 correspond?

4. To what actua date does a ser a format of 45000 correspond?

5. Determ ne the day that occurs 74 workdays after today’s date ( nc ud ng ho days)

6. Determ ne the day that occurs 74 workdays after today’s date ( nc ud ng ho days but exc ud-
ng the current year’s Chr stmas, New Year’s Day, and Independence Day)

7. How many workdays ( nc ud ng ho days) are there between Ju y 10, 2005, and August 15,
2006?

8. How many workdays ( nc ud ng ho days but exc ud ng Chr stmas, New Year’s Day, and
Independence Day) are there between Ju y 10, 2005, and August 15, 2006?

Note  The Datep.xlsx file contains several hundred dates. Use this file for the next set
of problems.

9. Determ ne the month, year, day of the month, and day of the week for each date

10. Express each date n ser a format

Dates and date funct ons  Chapter 6   57


11. A project beg ns on December 4, 2005 The project cons sts of Act v t es 1, 2, and 3 Act v ty 2
can start the day after Act v ty 1 fin shes Act v ty 3 can start the day after Act v ty 2 fin shes
Set up a worksheet that accepts as nputs the durat on ( n days) of the three act v t es and
outputs both the month and year dur ng wh ch each act v ty s comp eted

12. You bought a stock on Ju y 29, 2005, and so d t on December 30, 2005 The stock exchange
s c osed on Labor Day, Chr stmas, and Thanksg v ng Create a st of dates of when the stock
market was open dur ng the t me you owned the stock

13. The Mach nedates x sx fi e conta ns dates on wh ch severa mach nes were bought and so d
Determ ne how many months and years each mach ne was kept

14. G ven any date, find a way to have Exce compute the day of the week of the first day of the
date’s month

15. G ven any date, find a way to have Exce compute the ast day of the date’s month H nt
DATE(2005,13,1), surpr s ng y, returns 1/1/2006

16. G ven any date, how can you compute wh ch day of the year t s? For examp e, what day of
the year w 4/15/2020 be? H nt The DATE(2020,1,0) formu a w return the ser a number for
day 0 of January 2020, and Exce w treat th s as December 31, 2019

17. In the country of Fredon a, emp oyees have Tuesday and Wednesday off What date s 200
workdays after 5/3/2013?

18. In the country of Lower Ampere, emp oyees have Fr day and Saturday off In add -
t on, Va ent ne’s Day s a ho day How many workdays are there between 1/10/2014 and
5/31/2015?

19. Suppose the first quarter of each year s January–March, the second quarter s Apr –June, and
so on Wr te a formu a that returns the first day of the quarter for a g ven date

20. Use the defin t ons of quarters g ven n prob em 19 and wr te a formu a that computes the ast
day of the prev ous quarter for any g ven date

21. Set up a spreadsheet n wh ch a person can enter h s date of b rth, and the spreadsheet
returns the person’s actua age

22. Memor a Day s a ways the ast Monday n May Set up a spreadsheet n wh ch you can enter
the year, and the spreadsheet determ nes the date of Memor a Day

23. Create a spreadsheet that a ways sts the next 50 workdays (assum ng no ho days and that
Monday through Fr day are the workdays )

58  Chapter 6  Dates and date funct ons


CHAPTER 7

Evaluating investments by using


net present value criteria

Questions answered in this chapter:


■ What s net present va ue (NPV)?

■ How can I use the Exce NPV funct on?

■ How can I compute NPV when cash flows are rece ved at the beg nn ng of a year or n the
m dd e of a year?

■ How can I compute NPV when cash flows are rece ved at rregu ar nterva s?

Cons der the fo ow ng two nvestments, whose cash flows are sted n the NPV x sx fi e and shown n
F gure 7-1

■ Investment 1 requ res a cash outflow of $10,000 today and $14,000 two years from now One
year from now, th s nvestment w y e d $24,000

■ Investment 2 requ res a cash outflow of $6,000 today and $1,000 two years from now One
year from now, th s nvestment w y e d $8,000

Wh ch s the better nvestment? Investment 1 y e ds tota cash flow of $0, whereas Investment 2
y e ds a tota cash flow of $1,000 At first g ance, Investment 2 appears to be better, but wa t a m nute
Most of the cash outflow for Investment 1 occurs two years from now, whereas most of the cash out-
flow for Investment 2 occurs today Spend ng $1 two years from now doesn’t seem as cost y as spend-
ng $1 today, so maybe Investment 1 s better than first appears To determ ne wh ch nvestment s
better, you need to compare the va ues of cash flows rece ved at d fferent po nts n t me That’s where
the concept of net present va ue proves usefu

59

FIGURE 7-1  To determ ne wh ch nvestment s better, you need to ca cu ate net present va ue.

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

What is net present value?

The net present va ue (NPV) of a stream of cash flow rece ved at d fferent po nts n t me s s mp y the
va ue measured in today’s dollars Suppose you have $1 today, and you nvest th s do ar at an annua
nterest rate of r percent Th s do ar w grow to 1+r do ars n the first year, (1+r)2 do ars n two years,
and so on You can say, n some sense, that $1 today equa s $(1+r) a year from now and $(1+r)2 two
years from now In genera , you can say that $1 today s equa to $(1+r)n n years from now As an
equat on, th s ca cu at on can be expressed as fo ows

$1 now = $(1+r)n rece ved n years from now

If you d v de both s des of th s equat on by (1 + r)n, you get the fo ow ng mportant resu t

1/(1 + r)n now = $1 rece ved n years from now

Th s resu t te s you how to compute ( n today’s do ars) the NPV of any sequence of cash flows You
can convert any cash flow to today’s do ars by mu t p y ng the cash flow rece ved n years from now (n
can be a fract on) by 1/(1 + r)n

60  Chapter 7  Eva uat ng nvestments by us ng net present va ue cr ter a


You then add up the va ue of the cash flows ( n today’s do ars) to find the nvestment’s NPV
Assume r s equa to 0 2 You cou d ca cu ate the NPV for the two nvestments you’re cons der ng as
fo ows

= Investment1NPV = –10,000 + 24,000 –14,000 = $277.78


+
(1 + 0.20)1 (1 + 0.20)2

= Investment2NPV = –6,000 + 8,000 –1,000 = $–27.78


+
(1 + 0.20)1 (1 + 0.20)2

Based on NPV, Investment 1 s super or to Investment 2 A though tota cash flow for Investment 2
exceeds tota cash flow for Investment 1, Investment 1 has a better NPV because a greater proport on
of Investment 1’s negat ve cash flow comes ater, and the NPV cr ter on g ves ess we ght to cash flows
that come ater If you use a va ue of 02 for r, Investment 2 has a arger NPV because when r s very
sma , ater cash flows are not d scounted as much, and NPV returns resu ts s m ar to those der ved by
rank ng nvestments accord ng to tota cash flow

Note  The interest rate of r 0.2 was randomly chosen, skirting the issue of how to deter-
mine an appropriate value of r. You need to study finance for at least a year to understand
the issues involved in determining an appropriate value for r. The appropriate value of r
used to compute NPV is often called the company’s cost of capital. Suffice it to say that
most US companies use an annual cost of capital between 0.1 (10 percent) and 0.2 (20 per-
cent). If the annual interest rate is chosen according to accepted finance practices, p
­ rojects
with NPV > 0 increase the value of a company, projects with NPV < 0 decrease the value
of a company, and projects with NPV 0 keep the value of a company unchanged. A
­company should (if it had unlimited investment capital) invest in every available investment
having positive NPV.

To determ ne the NPV of Investment 1 n M crosoft Exce , ass gn the range name r to the nter-
est rate ( ocated n ce C3) Copy the T me 0 cash flow from C5 to C7 You can determ ne the NPV
for Investment 1’s Year 1 and Year 2 cash flows by copy ng the D5/(1+r )^D$4 formu a from D7 to E7
The caret symbo (^), ocated over the number 6 on the US keyboard, ra ses a number to a power
In ce A5, compute the NPV of Investment 1 by add ng the NPV of each year’s cash flow w th the
SUM(C7 E7) formu a To determ ne the NPV for Investment 2, copy the formu as from C7 E7 to C8 E8
and from A5 to A6

How can I use the Excel NPV function?

The Exce NPV funct on uses the NPV(rate,range of ce s) syntax Th s funct on determ nes the NPV
for the g ven rate of the cash flows n the range of ce s The funct on’s ca cu at on assumes that the
first cash flow s one per od from now In other words, enter ng the NPV(r ,C5 E5) formu a w not
determ ne the NPV for Investment 1 Instead, th s formu a (entered n ce C14) computes the NPV
of the fo ow ng sequence of cash flows –$10,000 a year from now, $24,000 two years from now,
and –$14,000 three years from now Ca th s Investment 1 (End of Year) The NPV of Investment 1
(End of Year) s $231 48 Assum ng beg nn ng of year cash flows, to compute the actua cash NPV of

Eva uat ng nvestments by us ng net present va ue cr ter a  Chapter 7   61


Investment 1, enter the C7+NPV(r ,D5 E5) formu a n ce C11 Th s formu a does not d scount the T me
0 cash flow at a (wh ch s correct because T me 0 cash flow s a ready n today’s do ars) but first mu -
t p es the cash flow n D5 by 1/1 2 and then mu t p es the cash flow n E5 by 1/1 22

The formu a n ce C11 y e ds the correct NPV of Investment 1, $277 78

How can I compute NPV when cash flows are received at the beginning of a year or in the
middle of a year?

To use the NPV funct on to compute the net present va ue of a project whose cash flows a ways
occur at the beg nn ng of a year, you can use the approach descr bed to determ ne the NPV of
Investment 1 Separate out the Year 1 cash flow and app y the NPV funct on to the rema n ng cash
flows A ternat ve y, observe that for any year n, $1 rece ved at the beg nn ng of year n s equ va ent
to $(1 + r) rece ved at the end of year n Remember that n one year, a do ar w grow by a factor
of (1 + r) Thus, f you mu t p y the resu t obta ned w th the NPV funct on by (1 + r), you can convert
the NPV of a sequence of year-end cash flows to the NPV of a sequence of cash flows rece ved at the
beg nn ng of the year You can a so compute the NPV of Investment 1 n ce D11 w th the (1+r )*C14
formu a Of course, you aga n obta n an NPV of $277 78

Now suppose the cash flows for an nvestment occur n the m dd e of each year For an organ za-
t on that rece ves month y subscr pt on revenues, you can approx mate the 12 month y revenues
rece ved dur ng a g ven year as a ump sum rece ved n the m dd e of the year How can you use the
NPV funct on to determ ne the NPV of a sequence of m d-year cash flows? For any Year n,

$ 1+r

rece ved at the end of Year n s equ va ent to $1 rece ved at the m dd e of Year n because n ha f a
year, $1 w grow by a factor of

1+r

If you assume the cash flows for Investment 1 occur m d-year, you can compute the NPV of the
m d-year vers on of Investment 1 n ce C17 w th the SQRT(1+r )*C14 formu a You obta n a va ue of
$253 58

How can I compute NPV when cash flows are received at irregular intervals?

Cash flows often occur at rregu ar nterva s, wh ch makes comput ng the NPV or nterna rate of
return (IRR) of these cash flows more d fficu t Fortunate y, the Exce XNPV funct on makes comput ng
the NPV of rregu ar y t med cash flows a snap

The XNPV funct on uses the XNPV(rate,va ues,dates) syntax The first date sted must be the ear -
est, but other dates need not be sted n chrono og ca order The XNPV funct on computes the NPV
of the g ven cash flows, assum ng the current date s the first date n the sequence For examp e, f the
first sted date s 4/8/13, the NPV s computed n Apr 8, 2013, do ars

62  Chapter 7  Eva uat ng nvestments by us ng net present va ue cr ter a


To ustrate the use of the XNPV funct on, ook at the examp e on the NPV as of F rst Date work-
sheet n the XNPV x sx fi e, wh ch s shown n F gure 7-2 Suppose that on Apr 8, 2015, you pa d out
$900 Later, you rece ve the fo ow ng amounts

■ $300 on August 15, 2015

■ $400 on January 15, 2016

■ $200 on June 25, 2016

■ $100 on Ju y 3, 2016

If the annua nterest rate s 10 percent, what s the NPV of these cash flows? Enter the dates ( n
Exce date format) n D3 D7 and the cash flows n E3 E7 Enter ng the XNPV(A9,E3 E7,D3 D7) formu a n
ce D11 computes the project’s NPV n Apr 8, 2015, do ars because that s the first date sted Th s
project wou d have an NPV, n Apr 8, 2015, do ars, of $28 64

FIGURE 7-2  Th s figure shows the use of the XNPV funct on.

The computat ons the XNPV funct on performs are as fo ows

1. Compute the number of years after Apr 8, 2015, that each date occurred (Th s was done n
co umn F ) For examp e, August 15 s 0 3534 years after Apr 8

2. D scount cash flows at the rate of 1/(1+rate)years after

For examp e, the August 15, 2015 cash flow s d scounted by


1 = 0.967
(1 + 0.1)3534

3. Sum up overa cash flows n ce E11 (cash flow va ue)*(d scount factor)

Suppose that today’s date s actua y Ju y 8, 2013 How wou d you compute the NPV of an nvest-
ment n today’s do ars? S mp y add a row w th today’s date and 0 cash flow and nc ude th s row n
the range for the XNPV funct on (See F gure 7-3 and the Today worksheet ) The NPV of the project n
today’s do ars s $106 99

Eva uat ng nvestments by us ng net present va ue cr ter a  Chapter 7   63


FIGURE 7-3  NPV s converted to today s do ars.

Note that f a cash flow s eft b ank, the NPV funct on gnores both the cash flow and the per od,
and the XNPV funct on returns a #NUM error

Problems
1. An NBA p ayer s to rece ve a $1,000,000 s gn ng bonus today and $2,000,000 one year, two
years, and three years from now Assum ng r = 0 10 and gnor ng tax cons derat ons, wou d he
be better off rece v ng $6,000,000 today?

2. A project has the fo ow ng cash flows

Now One year from now Two years from now Three years from now
$4 m on $4 m on $4 m on $3 m on

If the company’s cost of cap ta s 15 percent, shou d t proceed w th the project?

3. Beg nn ng one month from now, a customer w pay h s Internet prov der $25 per month for
the next five years Assum ng a revenue for a year s rece ved at the m dd e of a year, est -
mate the NPV of these revenues Use r = 0 15

4. Beg nn ng one month from now, a customer w pay $25 per month to her Internet prov der
for the next five years Assum ng a revenue for a year s rece ved at the m dd e of a year, use
the XNPV funct on to obta n the exact NPV of these revenues Use r = 0 15

64  Chapter 7  Eva uat ng nvestments by us ng net present va ue cr ter a


CHAPTER 8

Internal rate of return

Questions answered in this chapter:


■ How can I find the IRR of cash flows?

■ Does a project a ways have a un que IRR?

■ Are there cond t ons that guarantee a project w have a un que IRR?

■ If each of two projects has a s ng e IRR, how can I use the projects’ IRRs?

■ How can I find the IRR of rregu ar y spaced cash flows?

■ What s the MIRR, and how can I compute t?

The net present va ue (NPV) of a sequence of cash flows depends on the nterest rate (r) used For
examp e, f you cons der cash flows for Projects 1 and 2 (see the IRR worksheet n the IRR x sx fi e,
shown n F gure 8-1), you find that for r = 0 2, Project 2 has a arger NPV, and for r = 0 01, Project 1 has
a arger NPV When you use NPV to rank nvestments, the outcome can depend on the nterest rate It
s the nature of human be ngs to want to bo everyth ng n fe down to a s ng e number The nterna
rate of return (IRR) of a project s s mp y the nterest rate that makes the NPV of the project equa to 0
If a project has a un que IRR, the IRR has a n ce nterpretat on For examp e, f a project has an IRR of 15
percent, you rece ve an annua rate of return of 15 percent on the cash flow you nvested In th s chap-
ter’s examp es, you’ find that Project 1 has an IRR of 47 5 percent, wh ch means that the $400 nvested
at T me 1 s y e d ng an annua rate of return of 47 5 percent Somet mes, however, a project m ght
have more than one IRR or even no IRR In these cases, speak ng about the project’s IRR s use ess

FIGURE 8-1  Th s figure shows an examp e of the RR funct on.

67

Answers to this chapter’s questions
Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

How can I find the IRR of cash flows?

The IRR funct on ca cu ates nterna rate of return The funct on has the IRR(range of cash
flows,[guess]) syntax, n wh ch guess s an opt ona argument If you do not enter a guess for a proj-
ect’s IRR, Exce beg ns ts ca cu at ons w th a guess that the project’s IRR s 10 percent and then var es
the est mate of the IRR unt t finds an nterest rate that makes the project’s NPV equa 0 (the project’s
IRR) If Exce can’t find an nterest rate that makes the project’s NPV equa 0, Exce returns #NUM In
ce B5, enter the IRR(C2:I2) formu a to compute Project 1’s IRR Exce returns 47 5 percent Thus, f you
use an annua nterest rate of 47 5 percent, Project 1 w have an NPV of 0 S m ar y, you can see that
Project 2 has an IRR of 80 1 percent

Even f the IRR funct on finds an IRR, a project m ght have more than one IRR To check whether
a project has more than one IRR, you can vary the n t a guess of the project’s IRR (for exam-
p e, from –90 percent to 90 percent) You can vary the guess for Project 1’s IRR by copy ng the
IRR($C$2 $I$2,A8) formu a from B8 to B9 B17 Because a the guesses for Project 1’s IRR y e d 47 5
percent, you can be fa r y confident that Project 1 has a un que IRR of 47 5 percent S m ar y, you can
be fa r y confident that Project 2 has a un que IRR of 80 1 percent

Does a project always have a unique IRR?

In the Mu t p e IRR worksheet n the IRR x sx fi e (see F gure 8-2), you can see that Project 3 (cash flows
of –20, 82, –60, 2) has two IRRs The guess was var ed about Project 3’s IRR from –90 percent to 90
percent by copy ng the IRR($B$4 $E$4,B8) formu a from C8 to C9 C17

68  Chapter 8  nterna rate of return


FIGURE 8-2  Th s project has more than one RR.

Note that when a guess s 30 percent or ess, the IRR s –9 6 percent For other guesses, the IRR s
216 1 percent For both these nterest rates, Project 3 has an NPV of 0

In the No IRR worksheet n the IRR x sx fi e (shown n F gure 8-3), you can see that no matter what
guess you use for Project 4’s IRR, you rece ve the #NUM message Th s message nd cates that Project
4 has no IRR

When a project has mu t p e IRRs or no IRR, the concept of IRR oses v rtua y a mean ng Desp te
th s prob em, however, many compan es st use IRR as the r major too for rank ng nvestments

nterna rate of return  Chapter 8   69


FIGURE 8-3  Th s s a project w th no RR.

Are there conditions that guarantee a project will have a unique IRR?

If a project’s sequence of cash flows conta ns exact y one change n s gn, the project s guaranteed to
have a un que IRR For examp e, for Project 2 n the IRR worksheet, the s gn of the cash flow sequence
s – + + + + + There s on y one change n s gn (between T me 1 and T me 2), so Project 2 must have
a un que IRR For Project 3 n the Mu t p e IRR worksheet, the s gns of the cash flows are – + – +
Because the s gn of the cash flows changes three t mes, a un que IRR s not guaranteed For Project
4 n the No IRR worksheet, the s gns of the cash flows are + – + Because the s gns of the cash flows
change tw ce, a un que IRR s not guaranteed n th s case e ther Most cap ta nvestment projects
(such as bu d ng a p ant) beg n w th a negat ve cash flow fo owed by a sequence of pos t ve cash
flows Therefore, most cap ta nvestment projects do have a un que IRR

If each of two projects has a single IRR, how can I use the projects’ IRRs?

If a project has a un que IRR, you can state that the project ncreases the va ue of the company if and
only if the project’s IRR exceeds the annua cost of cap ta For examp e, f the cost of cap ta for a
company s 15 percent, both Project 1 and Project 2 wou d ncrease the va ue of the company

70  Chapter 8  nterna rate of return


Suppose two projects are under cons derat on (both hav ng un que IRRs), but you can undertake
at most one project It’s tempt ng to be eve that you shou d choose the project w th the arger IRR
To ustrate that th s be ef can ead to ncorrect dec s ons, ook at F gure 8-4 and the Wh ch Project
worksheet n IRR x sx Project 5 has an IRR of 40 percent, and Project 6 has an IRR of 50 percent If you
rank projects based on IRR and can choose on y one project, you wou d choose Project 6 Remember,
however, that a project’s NPV measures the amount of va ue the project adds to the company C ear y,
Project 5 w (for v rtua y any cost of cap ta ) have a arger NPV than Project 6 Therefore, f on y one
project can be chosen, Project 5 s t IRR s prob emat c because t gnores the sca e of the project
Whereas Project 6 s better than Project 5 on a per-do ar- nvested bas s, the arger sca e of Project 5
makes t more va uab e to the company than Project 6

FIGURE 8-4  RR can ead to an ncorrect cho ce of wh ch project to pursue.

How can I find the IRR of irregularly spaced cash flows?

Cash flows occur on actua dates, not just at the start or end of the year The XIRR funct on has the
XIRR(cash flow,dates,[guess]) syntax The XIRR funct on determ nes the IRR of a sequence of cash
flows that occur on any set of rregu ar y spaced dates As w th the IRR funct on, guess s an opt ona
argument For an examp e of how to use the XIRR funct on, ook at F gure 8-5 and worksheet XIRR of
the IRR x sx fi e

FIGURE 8-5  Th s s an examp e of the XIRR funct on.

The XIRR(F4 F7,E4 E7) formu a n ce D9 shows that the IRR of Project 7 s –48 69 percent

What is the MIRR, and how can I compute it?

In many s tuat ons, the rate at wh ch a company borrows funds s d fferent from the rate at wh ch
the company re nvests funds IRR computat ons mp c t y assume that the rate at wh ch a company

nterna rate of return  Chapter 8   71


borrows and re nvests funds s equa to the IRR If you know the actua rate at wh ch you borrow
money and the rate at wh ch you can re nvest money, the mod fied nterna rate of return (MIRR)
funct on computes a d scount rate that makes the NPV of a your cash flows ( nc ud ng pay ng
back your oan and re nvest ng your proceeds at the g ven rates) equa to 0 The syntax of MIRR s
MIRR(cash flow va ues,borrow ng rate,re nvestment rate) A n ce th ng about MIRR s that t s a ways
un que F gure 8-6 n worksheet MIRR of the IRR x sx fi e conta ns an examp e of MIRR Suppose you
borrow $120,000 today and rece ve the fo ow ng cash flows Year 1 $39,000; Year 2 $30,000; Year 3
$21,000; Year 4 $37,000; Year 5 $46,000 Assume you can borrow at 10 percent per year and re nvest
your profits at 12 percent per year

After enter ng these va ues n ce s E7 E12 of worksheet MIRR, you can find the MIRR n ce D15
w th the MIRR(E7 E12,E3,E4) formu a Thus, th s project has an MIRR of 12 61 percent The actua IRR
of 13 07 percent was computed n ce D16

FIGURE 8-6  Th s s an examp e of the MIRR funct on.

Note that f a cash flow s eft b ank, the IRR funct on gnores both the cash flow and the per od
and returns a #NUM error

72  Chapter 8  nterna rate of return


Problems
1. Compute a IRRs for the fo ow ng sequence of cash flows

Year 1 Year 2 Year 3 Year 4 Year 5 Year 6 Year 7


$10,000 $8,000 $1,500 $1,500 $1,500 $1,500 $1,500

Cons der a project w th the fo ow ng cash flows Determ ne the project’s IRR If the annua
cost of cap ta s 20 percent, wou d you undertake th s project?

Year 1 Year 2 Year 3


$4,000 $2,000 $4,000

F nd a IRRs for the fo ow ng project

Year 1 Year 2 Year 3


$100 $300 $250

F nd a IRRs for a project hav ng the g ven cash flows on the sted dates

1/10/2003 7/10/2003 5/25/2004 7/18/2004 3/20/2005 4/1/2005 1/10/2006


$1,000 $900 $800 $700 $500 $500 $350

Cons der the fo ow ng two projects and assume a company’s cost of cap ta s 15 percent F nd
the IRR and NPV of each project Wh ch projects add va ue to the company? If the company
can choose on y a s ng e project, wh ch project shou d t choose?

Year 1 Year 2 Year 3 Year 4


Project 1 $40 $130 $19 $26
Project 2 $80 $36 $36 $36

Twenty-five-year-o d Meg Pr or ntends to nvest $10,000 n her ret rement fund at the beg n-
n ng of each of the next 40 years Assume that dur ng each of the next 30 years, Meg w earn
15 percent on her nvestments and dur ng the ast 10 years before she ret res, her nvestments
w earn 5 percent Determ ne the IRR assoc ated w th her nvestments and her fina ret re-
ment pos t on How do you know there w be a un que IRR? How wou d you nterpret the
un que IRR?

2. G ve an ntu t ve exp anat on of why Project 6 (on the Wh ch Project worksheet n the IRR x sx
fi e) has an IRR of 50 percent

nterna rate of return  Chapter 8   73


CHAPTER 9

More Excel financial functions

Questions answered in this chapter:


■ You are buy ng a cop er Wou d you rather pay $11,000 today or $3,000 a year for five years?

■ If at the end of each of the next 40 years I nvest $2,000 a year toward my ret rement and earn
8 percent a year on my nvestments, how much w I have when I ret re?

■ I am borrow ng $10,000 for 10 months w th an annua nterest rate of 8 percent What are my
month y payments? How much pr nc pa and nterest am I pay ng each month?

■ I want to borrow $80,000 and make month y payments for 10 years The max mum month y
payment I can afford s $1,000 What s the max mum nterest rate I can afford?

■ If I borrow $100,000 at 8 percent nterest and make payments of $10,000 per year, how many
years w t take me to pay back the oan?

When you borrow money to buy a car or house, you a ways wonder whether you are gett ng a good
dea When you save for ret rement, you are cur ous about how arge a nest egg you’ have when you
ret re In our da y work and persona ves, financ a quest ons s m ar to these often ar se Know edge
of the M crosoft Exce PV, FV, PMT, PPMT, IPMT, CUMPRINC, CUMIPMT, RATE, and NPER funct ons
makes t easy to answer these types of quest ons

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

You are buying a copier. Would you rather pay $11,000 today or $3,000 a year for five years?

The key to answer ng th s quest on s be ng ab e to va ue the annua payments of $3,000 per year
Assume the cost of cap ta s 12 percent per year You cou d use the NPV funct on to answer th s ques-
t on, but the Exce PV funct on prov des a much qu cker way to so ve t A stream of cash flows that
nvo ves the same amount of cash outflow (or nflow) each per od s ca ed an annuity Assum ng that
each per od’s nterest rate s the same, you can eas y va ue an annu ty by us ng the Exce PV funct on
It returns the va ue n today’s do ars of a ser es of future payments, under the assumpt on of per od c,
constant payments and a constant nterest rate The syntax of the PV funct on s PV(rate,#per,[pmt],[fv
],[type]), where pmt, fv, and type are opt ona arguments

75

Note  When working with Excel financial functions, you can use the following conventions
for the signs of pmt (payment) and fv (future value): money received has a positive sign,
and money paid out has a negative sign.

■ Rate s the nterest rate per per od For examp e, f you borrow money at 6 percent per year
and the per od s a year, then rate = 0 06 If the per od s a month, then rate = 0 06/12 =
0 005

■ #per s the number of per ods n the annu ty For th s cop er examp e, #per = 5 If payments on
the cop er are made each month for five years, #per = 60 Your rate must, of course, be con-
s stent w th #per That s, f #per mp es a per od s a month, you must use a month y nterest
rate; f #per mp es a per od s a year, you must use an annua nterest rate

■ Pmt s the payment made each per od For th s cop er examp e, pmt = –$3,000 A payment has
a negat ve s gn, whereas money rece ved has a pos t ve s gn At east one of pmt or fv must be
nc uded

■ Fv s the cash ba ance (or future va ue) you want to have after the ast payment s made For
th s cop er examp e, fv = 0 For examp e, f you want to have a $500 cash ba ance after the ast
payment, fv = $500 If you want to make an add t ona $500 payment at the end of the ast
per od, fv = –$500 If fv s om tted, t s assumed to equa 0

■ Type s e ther 0 or 1 and nd cates when payments are made When type s om tted or equa to
0, payments are made at the end of each per od When type = 1, payments are made at the
beg nn ng of each per od Note that you may a so wr te True nstead of 1 and Fa se nstead of
0 n a funct ons d scussed n th s chapter

F gure 9-1 nd cates how to so ve the cop er prob em (See the PV worksheet of the
Exce finfunct ons x sx fi e )

The present va ue of pay ng $3,000 at the end of each year for five years w th a 12 percent cost
of cap ta was computed n ce B3 by us ng the =PV(0 12,5,–3000,0,0) formu a Exce returns an
NPV of $10,814 33 By om tt ng the ast two arguments, you can obta n the same answer w th the
=PV(0 12,5,–3000) formu a Thus, t s a better dea to make payments at the end of the year than to
pay out $11,000 today

If you make payments on the cop er of $3,000 at the beg nn ng of each year for five years, the NPV
of the payments s computed n ce B4 w th the =PV(0 12,5,–3000,0,1) formu a Note that chang ng
the ast argument from a 0 to a 1 changed the ca cu at ons from end of year to beg nn ng of year You
can see that the present va ue of your payments s $12,112 05 Therefore, t’s better to pay $11,000
today than make payments at the beg nn ng of the year

Suppose you pay $3,000 at the end of each year and must nc ude an extra $500 payment at the
end of Year 5 You can now find the present va ue of a your payments n ce B5 by nc ud ng a future
va ue of $500 w th the =PV(0 12,5,–3000,–500,0) formu a Note that the $3,000 and $500 cash flows

76  Chapter 9  More Exce financ a funct ons


have negat ve s gns because you are pay ng out the money The present va ue of a these payments s
equa to $11,098 04

FIGURE 9-1  Th s s an examp e of the PV funct on.

If at the end of each of the next 40 years I invest $2,000 a year toward my retirement and earn
8 percent a year on my investments, how much will I have when I retire?

In th s s tuat on, you want to know the va ue of an annu ty n terms of future do ars (40 years from
now) and not today’s do ars Th s s a job for the Exce FV (future va ue) funct on The FV funct on
g ves the future va ue of an nvestment assum ng per od c, constant payments w th a constant nter-
est rate The syntax of the FV funct on s FV(rate,#per,[pmt],[pv],[type]), where pmt, pv, and type are
opt ona arguments

■ Rate s the nterest rate per per od In th s case, rate equa s 0 08

■ #Per s the number of per ods n the future at wh ch you want the future va ue computed
#Per s a so the number of per ods dur ng wh ch the annu ty payment s rece ved In th s
case, #per = 40

■ Pmt s the payment made each per od In th s case, pmt equa s –$2,000 The negat ve s gn
nd cates that you are pay ng money nto an account At east one of pmt or pv must be
nc uded

■ Pv s the amount of money ( n today’s do ars) owed r ght now In th s case, pv equa s $0
If today you owe someone $10,000, then pv equa s $10,000 because the ender gave you
$10,000, and you rece ved t If today you had $10,000 n the bank, then pv equa s –$10,000
because you must have pa d $10,000 nto your bank account If pv s om tted, t s assumed to
equa 0

More Exce financ a funct ons  Chapter 9   77


■ Type s a 0 or 1 and nd cates when payments are due or money s depos ted If type equa s 0
or s om tted, money s depos ted at the end of the per od In th s case, type s 0 or om tted If
type equa s 1, payments are made or money s depos ted at the beg nn ng of the per od

In worksheet FV of fi e Exce finfunct ons x sx (see F gure 9-2), you can enter the =FV(0 08,40,–2000)
formu a n ce B3 to find that, n 40 years, your nest egg w be worth $518,113 04 Note that you
shou d enter a negat ve va ue for the annua payment because the $2,000 s pa d nto your account
You cou d obta n the same answer by enter ng the ast two unnecessary arguments w th the
FV(0 08,40,–2000,0,0) formu a

If depos ts were made at the beg nn ng of each year for 40 years, the =FV(0 08,40,–2000,0,1) for-
mu a (entered n ce B4) wou d y e d the va ue n 40 years of your nest egg $559,562 08

FIGURE 9-2  Th s s an examp e of the FV funct on.

F na y, suppose that, n add t on to nvest ng $2,000 at the end of each of the next 40 years, you
n t a y have $30,000 to nvest If you earn 8 percent per year on your nvestments, how much money
w you have when you ret re n 40 years? You can answer th s quest on by sett ng pv equa to
–$30,000 n the FV funct on The negat ve s gn s used because you have depos ted, or pa d, $30,000
nto your account In ce B5, the =FV(0 08,40,–2000,–30000,0) formu a y e ds a future va ue of
$1,169,848 68

78  Chapter 9  More Exce financ a funct ons


I am borrowing $10,000 for 10 months with an annual interest rate of 8 percent. What are my
monthly payments? How much principal and interest am I paying each month?

The Exce PMT funct on computes the per od c payments for a oan, assum ng constant payments and
a constant nterest rate The syntax of the PMT funct on s PMT(rate,#per,pv,[fv],[type]), where fv and
type are opt ona arguments

■ Rate s the per-per od nterest rate of the oan In th s examp e, use one month as a per od;
rate equa s 0 08/12 = 0 006666667

■ #Per s the number of payments made In th s case, #per equa s 10

■ Pv s the present va ue of a the payments That s, pv s the amount of the oan In th s case,
pv equa s $10,000 Pv s pos t ve because you are rece v ng the $10,000

■ Fv nd cates the fina oan ba ance you want to have after mak ng the ast payment In th s
case, fv equa s 0 If fv s om tted, Exce assumes that t equa s 0 Suppose you have taken out
a ba oon oan for wh ch you make payments at the end of each month, but at the conc us on
of the oan, you pay off the fina ba ance by mak ng a $1,000 ba oon payment Then fv equa s
–$1,000 The $1,000 s negat ve because you are pay ng t out

■ Type s a 0 or 1 and nd cates when payments are due If type equa s 0 or s om tted, payments
are made at the end of the per od If you first assumed end-of-month payments, type s 0 or
om tted If type equa s 1, payments are made or money s depos ted at the beg nn ng of the
per od

In ce G1 of the PMT worksheet of the Exce finfunct ons x sx fi e (see F gure 9-3), compute the
month y payment on a 10-month oan for $10,000, assum ng an 8 percent annua nterest rate and
end-of-month payments w th the =–PMT(0 08/12,10,10000,0,0) formu a The month y payment s
$1,037 03 The PMT funct on by tse f returns a negat ve va ue because you are mak ng payments to
the company g v ng you the oan

If you want to, you can use the Exce IPMT and PPMT funct ons to compute the amount of nter-
est pa d each month toward the oan and the amount of the ba ance pa d down each month (Th s s
ca ed payment on the pr nc pa )

To determ ne the nterest pa d each month, use the IPMT funct on The syntax of the IPMT func-
t on s IPMT(rate,per,#per,pv,[fv],[type]), where fv and type are opt ona arguments The per argument
nd cates the per od number for wh ch you compute the nterest The other arguments mean the
same as they do for the PMT funct on S m ar y, to determ ne the amount pa d toward the pr nc pa
each month, you can use the PPMT funct on The syntax of the PPMT funct on s PPMT(rate,per,#per,p
v,[fv],[type]) The mean ng of each argument s the same as t s for the IPMT funct on By copy ng the
=–PPMT(0 08/12,C6,10,10000,0,0) formu a from F6 to F7 F16, you can compute the amount of each
month’s payment that s app ed to the pr nc pa For examp e, dur ng Month 1, you pay on y $970 37
toward the pr nc pa As expected, the amount pa d toward the pr nc pa ncreases each month
The m nus s gn s needed because the pr nc pa s pa d to the company g v ng you the oan, and PPMT
w return a negat ve number By copy ng the =–IPMT(0 08/12,C6,10,10000,0,0) formu a from G6 to

More Exce financ a funct ons  Chapter 9   79


G7 G16, you can compute the amount of nterest pa d each month For examp e, n Month 1, you pay
$66 67 n nterest Of course, the amount of nterest pa d each month decreases

FIGURE 9-3  These are examp es of PMT, PPMT, CUMPRINC, CUMIPMT, and IPMT funct ons.

Note that each month (Interest Pa d) + (Payment Toward Pr nc pa ) = (Tota Payment) Somet mes
the tota s off by a cent due to round ng

You can a so create the end ng ba ances for each month n co umn H by us ng the re at onsh p
(End ng Month t Ba ance) = (Beg nn ng Month t Ba ance) – (Month t Payment toward Pr nc pa ) Note
that n Month 1, Beg nn ng Ba ance equa s $10,000 In co umn D, you can create each month’s beg n-
n ng ba ance by us ng the re at onsh p of (for t = 2, 3, 10)(Beg nn ng Month t Ba ance) = (End ng
Month t – 1 Ba ance) Of course, End ng Month 10 Ba ance equa s $0, as t shou d

Interest each month can be computed as (Month t Interest) = (Interest rate) * (Beg nn ng Month t
Ba ance) For examp e, the Month 3 nterest payment can be computed as = (0 0066667) * ($8,052 80),
wh ch equa s $53 69

Of course, the NPV of a payments s exact y $10,000 You can check th s n ce D17 w th the
NPV(0 08/12,E6 E15) formu a (See F gure 9-3 )

If the payments are made at the beg nn ng of each month, the amount of each payment s com-
puted n ce D19 w th the =–PMT(0 08/12,10,10000,0,1) formu a Chang ng the ast argument to 1
changes each payment to the beg nn ng of the month Because the ender s gett ng her money

80  Chapter 9  More Exce financ a funct ons


ear er, month y payments are ess than the end-of-month case If she pays at the beg nn ng of the
month, the month y payment s $1,030 16

F na y, suppose that you want to make a ba oon payment of $1,000 at the end of 10 months  If
you make your month y payments at the end of each month, the =–PMT(0 08/12,10,10000,–1000,0)
formu a n ce D20 computes your month y payment The month y payment turns out to be $940
Because $1,000 of the oan s not be ng pa d w th month y payments, t makes sense that your new
month y payment s ess than the or g na end-of-month payment of $1,037 03

CUMPRINC and CUMIPMT functions


You’ often want to accumu ate the nterest or pr nc pa pa d dur ng severa per ods The CUMPRINC
and CUMIPMT funct ons make th s easy

The CUMPRINC funct on computes the pr nc pa pa d between two per ods ( nc us ve) The syntax
of the CUMPRINC funct on s CUMPRINC(rate,#per,pv,start per od,end per od,type) Rate, #per, pv,
and type have the same mean ngs as descr bed prev ous y

The CUMIPMT funct on computes the nterest pa d between two per ods ( nc us ve) The syn-
tax of the CUMIPMT funct on s CUMIPMT(rate,#nper,pv,start per od,end per od,type) Rate, #per,
pv, and type have the same mean ngs as descr bed prev ous y For examp e, n ce F19 on the PMT
worksheet, you can compute the nterest pa d dur ng months 2 through 4 ($161 01) by us ng the
=CUMIPMT(0 08/12,10,10000,2,4,0) formu a In ce G19, compute the pr nc pa pa d off n months 2
through 4 ($2,950 08) by us ng the =CUMPRINC(0 08/12,10,10000,2,4,0) formu a

I want to borrow $80,000 and make monthly payments for 10 years. The maximum monthly
payment I can afford is $1,000. What is the maximum interest rate I can afford?

G ven a borrowed amount, the ength of a oan, and the payment each per od, the RATE funct on
te s you the rate of the oan The syntax of the RATE funct on s RATE(#per,pmt,pv,[fv],[type],[guess]),
where fv, type, and guess are opt ona arguments #Per, pmt, pv, fv, and type have the same mean-
ngs as prev ous y descr bed Guess s s mp y a guess at what the oan rate s Usua y, guess can be
om tted Enter ng the =RATE(120,–1000,80000,0,0) formu a n ce D9 of the Rate worksheet ( n the
Exce finfunct ons x sx fi e) y e ds 7241 percent as the month y rate Assume payments are made at the
end of the month (See F gure 9-4 )

You can ver fy the RATE funct on ca cu at on n ce D15 The =PV( 007241,120,–1000,0,0) formu a
y e ds $80,000 08 Th s shows that payments of $1,000 at the end of each month for 120 months have
a present va ue of $80,000 08

If you cou d pay back $10,000 dur ng month 120, the max mum rate you cou d hand e wou d be
g ven by the =RATE(120,–1000,80000,–10000,0,0) formu a In ce D12, th s formu a y e ds a month y
rate of 0 818 percent

More Exce financ a funct ons  Chapter 9   81


FIGURE 9-4  Th s s an examp e of the RATE funct on.

If I borrow $100,000 at 8 percent interest and make payments of $10,000 per year, how many
years will it take me to pay back the loan?

G ven the s ze of a oan, the payments each per od, and the oan rate, the NPER funct on
te s you how many per ods t takes to pay back a oan The syntax of the NPER funct on s
NPER(rate,pmt,pv,[fv],[type]), where fv and type are opt ona arguments

Assum ng end-of-year payments, the =NPER(0 08,–10000,100000,0,0) formu a n ce D7 of work-


sheet Nper ( n the Exce finfunct ons x sx fi e) y e ds 20 91 years (See F gure 9-5 ) Thus, 20 years of
payments w not qu te pay back the oan, but 21 years w overpay the oan To ver fy the ca cu at on,
use the PV funct on n ce s D10 and D11 to show that pay ng $10,000 per year for 20 years pays back
$98,181 47, and pay ng $10,000 for 21 years pays back $100,168 03

Suppose that you are p ann ng to pay back $40,000 n the fina payment per od How many years
w t take to pay back the oan? Enter ng the =NPER(0 08,–10000,100000,–40000,0) formu a n ce
D14 shows that t w take 15 90 years to pay back the oan Thus, 15 years of payments w not qu te
pay off the oan, and 16 years of payments w s ght y overpay the oan

82  Chapter 9  More Exce financ a funct ons


FIGURE 9-5  Th s s an examp e of the NPER funct on.

Problems
Un ess otherw se ment oned, a payments are made at the end of the per od

1. You have just won the ottery At the end of each of the next 20 years, you w rece ve a pay-
ment of $50,000 If the cost of cap ta s 10 percent per year, what s the present va ue of your
ottery w nn ngs?

2. A perpetuity s an annu ty that s rece ved forever If I rent out my house and, at the beg n-
n ng of each year, I rece ve $14,000, what s the va ue of th s perpetu ty? Assume an annua 10
percent cost of cap ta (H nt Use the PV funct on and et the number of per ods be many!)

3. I now have $250,000 n the bank At the end of each of the next 20 years, I w thdraw $15,000
If I earn 8 percent per year on my nvestments, how much money w I have n 20 years?

4. I depos t $2,000 per month (at the end of each month) over the next 10 years My nvestments
earn 0 8 percent per month I wou d ke to have $1 m on n 10 years How much money
shou d I depos t now?

5. A Prem er League soccer p ayer s rece v ng $15 m on at the end of each of the next seven
years He can earn 6 percent per year on h s nvestments What s the present va ue of h s
future revenues?

More Exce financ a funct ons  Chapter 9   83


• Year 4 15 percent

• Year 5 10 percent

The catch s that the ARM conta ns a c ause that ensures that month y payments can ncrease a
max mum of 7 5 percent from one year to the next To compensate the ender for th s prov -
s on, the borrower adjusts the end ng ba ance of the oan at the end of each year based on the
d fference between what the borrower actua y pa d and what he shou d have pa d Determ ne
month y payments dur ng Years 1–5 of the oan

24. You have a cho ce of rece v ng $8,000 each year beg nn ng at age 62, and end ng when you
d e, or rece v ng $10,000 each year beg nn ng at age 65 and end ng when you d e If you
th nk you can earn an 8 percent annua return on your nvestments, wh ch w net the arger
amount?

25. You have just won the ottery and wrece ve $50,000 a year for 20 years What rate of nter-
est wou d make these payments the equ va ent of rece v ng $500,000 today?

26. A bond pays a $50 coupon at the end of each of the next 30 years and pays $1,000 face va ue
n 30 years If you d scount cash flows at an annua rate of 6 percent, what wou d be a fa r
pr ce for the bond?

27. You have borrowed $100,000 on a 40-year mortgage w th month y payments The annua
nterest rate s 16 percent How much w you pay over the course of the oan? W th four years
eft on the oan, how much w you st owe?

28. I need to borrow $12,000 I can afford payments of $500 per month, and the annua rate of
nterest s 4 5 percent How many months w t take to pay off the oan?

29. You are cons der ng borrow ng $50,000 on a 180-month oan The annua nterest rate on the
oan depends on your cred t score n the fo ow ng fash on

Wr te a formu a that g ves your month y payments as a funct on of your cred t score

30. You ntend to borrow $40,000 for a new car You want to determ ne the month y payments
and tota nterest pa d n the fo ow ng s tuat ons

• 48-month oan, 6 85% annua rate

• 60-month oan, 6 59% annua rate

86  Chapter 9  More Exce financ a funct ons


CHAPTER 10

Circular references

Questions answered in this chapter:


■ I often get a c rcu ar reference message from Exce Does th s mean I’ve made an error?

■ How can I reso ve c rcu ar references?

When M crosoft Exce 2013 d sp ays a message stat ng that your workbook conta ns a c rcu ar refer-
ence, t means there s a oop, or dependency, between two or more ce s n a workbook For examp e,
a c rcu ar reference occurs f the va ue n ce A1 nfluences the va ue n D3, the va ue n ce D3 nflu-
ences the va ue n ce E6, and the va ue n ce E6 nfluences the va ue n ce A1 F gure 10-1 ustrates
the pattern of a c rcu ar reference

FIGURE 10-1  Th s s a oop caus ng a c rcu ar reference.

As you’ soon see, you can reso ve c rcu ar references by c ck ng the File tab on the r bbon
and then choos ng Options Choose Formulas and then se ect the Enable Iterative Calculation
check box

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

I often get a circular reference message from Excel. Does this mean I’ve made an error?

A c rcu ar reference usua y ar ses from a og ca y cons stent worksheet n wh ch severa ce s exh b t a
oop ng re at onsh p s m ar to that ustrated n F gure 10-1 Look at a s mp e examp e of a prob em
that cannot eas y be so ved n Exce w thout creat ng a c rcu ar reference

87

A sma company earns $1,500 n revenues and ncurs $1,000 n costs It wants to g ve 10 percent
of ts after-tax profits to char ty Its tax rate s 40 percent How much money shou d t g ve to char ty?
The so ut on to th s prob em s n worksheet Sheet1 n the C rcu ar x sx fi e, shown n F gure 10-2

FIGURE 10-2  A c rcu ar reference can occur when you re ca cu at ng taxes.

Beg n by nam ng the ce s n D3 D8 w th the correspond ng names n ce s C3 C8 Enter the firm’s


revenue, tax rate, and costs n D3 D5 To compute a contr but on to char ty as 10 percent of after-
tax profit, enter the 0 1*after tax profit formu a n ce D6 Determ ne before-tax profit n ce D7 by
subtract ng costs and the char tab e contr but on from revenues The formu a n ce D7 s Revenues–
Costs–Char ty F na y, compute after-tax profit n ce D8 as (1–tax rate)*before tax profit

Exce nd cates a c rcu ar reference n ce D8 (See the bottom- eft corner of the C rcu ar x sx fi e)
What’s go ng on?

1. Char ty (ce D6) nfluences before-tax profit (ce D7)

2. Before-tax profit (ce D7) nfluences after-tax profit (ce D8)

3. After-tax profit (ce D8) nfluences char ty

Thus, you have a oop of form D6-D7-D8-D6 ( nd cated by the b ue arrows n F gure 10-2), wh ch
causes the c rcu ar reference message The worksheet s og ca y correct; you have done noth ng
wrong St , you can see from F gure 10-2 that Exce s ca cu at ng an ncorrect answer for char tab e
contr but ons

How can I resolve circular references?

Reso v ng a c rcu ar reference s easy S mp y c ck the File tab at the eft end of the r bbon and then
choose Options to open the Excel Options d a og box Choose Formulas n the eft pane and then
se ect the Enable Iterative Calculation check box n the Calculation Options sect on, as shown n
F gure 10-3

88  Chapter 10  C rcu ar references


FIGURE 10-3  Use Enab e terat ve Ca cu at on to reso ve a c rcu ar reference.

When you act vate Enab e Iterat ve Ca cu at on, Exce recogn zes that your c rcu ar reference has
generated the fo ow ng system of three equat ons w th three unknowns

Charity=0.1*(AfterTax Profit)
BeforeTax Profit=Revenue–Charity–Costs
AfterTax Profit=(1–Tax rate)*(BeforeTax Profit)

The three unknowns are Char ty, BeforeTax Profit, and AfterTax Profit When you act vate Enab e
Iterat ve Ca cu at on, Exce terates (based on my exper ence w th c rcu ar references, 100 terat ons
shou d be used) to seek a so ut on to a equat ons generated by the c rcu ar reference From one
terat on to the next, the va ues of the unknowns are changed by a comp ex mathemat ca procedure
(Gauss-Se de Iterat on) Exce stops f the max mum change n any worksheet ce from one tera-
t on to the next s sma er than the Max mum Change va ue (0 001 by defau t) You can reduce the
Max mum Change sett ng to a sma er number, such as 0 000001 If you do not reduce the Max mum
Change sett ng to a sma er number, you m ght find Exce ass gn ng a va ue of, for examp e, 5 001 to
a ce that shou d equa 5, and th s s annoy ng In add t on, some comp ex worksheets m ght requ re
more than 100 terat ons before converg ng to a reso ut on of the c rcu ar ty For th s examp e, how-
ever, the c rcu ar ty s a most nstant y reso ved, and you can see the so ut on g ven n F gure 10-4

Note  The charitable contribution of $28.30 is now exactly 10 percent of the after-tax profit
of $283.01. All other cells in the worksheet are now correctly computed.

Note that the Exce terat on procedure s on y guaranteed to work when so v ng systems of linear
equat ons In other s tuat ons, convergence to a so ut on s not a ways guaranteed In the tax examp e,
reso v ng the c rcu ar references requ res so v ng a system of near equat ons, so you know Exce w
find the correct answer

C rcu ar references  Chapter 10   89


FIGURE 10-4  Exce runs the ca cu at ons to reso ve the c rcu ar reference.

Here’s one more examp e of a c rcu ar reference In any Exce formu a, you can refer to an ent re
co umn or row by name For examp e, the AVERAGE(B B) formu a averages a ce s n co umn B The
=AVERAGE(1 1) formu a averages a ce s n row 1 Th s shortcut s usefu f you’re cont nua y dump ng
new data (such as month y sa es) nto a co umn or row The formu a a ways computes average sa es,
and you do not ever need to change t The prob em s that f you enter th s formu a n the co umn or
row that t refers to, you create a c rcu ar reference By act vat ng Enab e Iterat ve Ca cu at on, c rcu ar
references such as these are reso ved qu ck y

Problems
1. Before pay ng emp oyee bonuses and state and federa taxes, a company earns profits of
$60,000 The company pays emp oyees a bonus equa to 5 percent of after-tax profits State
tax s 5 percent of profits (after bonuses are pa d) Federa tax s 40 percent of profits (after
bonuses and state tax are pa d) Determ ne the amount pa d n bonuses, state tax, and
federa  tax

2. On January 1, 2002, I have $500 At the end of each month, I earn 2 percent nterest Each
month’s nterest s based on the average of the month’s beg nn ng and end ng ba ances How
much money w I have after 12 months?

3. My a rp ane s fly ng the fo ow ng route Houston–Los Ange es–Seatt e–M nneapo s–


Houston On each eg of the journey, the p ane’s fue usage (expressed as m es per ga on)
s 40– 02*(average fue en route) Here, average fue en route s equa to 5*( n t a fue en
route+fina fue en route) My p ane beg ns n Houston w th 1,000 ga ons of fue The d stance
flown on each eg of the journey s as fo ows

90  Chapter 10  C rcu ar references


CHAPTER 11

IF statements

Questions answered in this chapter:


■ If I order up to 500 un ts of a product, I pay $3 00 per un t If I order from 501 through 1,200
un ts, I pay $2 70 per un t If I order from 1,201 through 2,000 un ts, I pay $2 30 per un t If I
order more than 2,000 un ts, I pay $2 00 per un t How can I wr te a formu a that expresses the
purchase cost as a funct on of the number of un ts purchased?

■ I just purchased 100 shares of stock at a cost of $55 per share To hedge the r sk that the stock
m ght dec ne n va ue, I purchased 60 s x-month European put opt ons Each opt on has an
exerc se pr ce of $45 and costs $5 How can I deve op a worksheet that nd cates the s x-month
percentage return on my portfo o for a var ety of poss b e future pr ces?

■ Many stock market ana ysts be eve that mov ng-average trad ng ru es can outperform the
market A common y suggested mov ng-average trad ng ru e s to buy a stock when the
stock’s pr ce moves above the average of the past 15 months and to se a stock when the
stock’s pr ce moves be ow the average of the past 15 months How wou d th s trad ng ru e
have performed aga nst the Standard & Poor’s 500 Stock Index (S&P)?

■ In the game of craps, two d ce are tossed If the tota of the d ce on the first ro s 2, 3, or 12,
you ose If the tota of the d ce on the first ro s 7 or 11, you w n Otherw se, the game keeps
go ng How can I wr te a formu a to determ ne the status of the game after the first ro ?

■ In most pro forma financ a statements, cash s used as the p ug to make assets and ab t es
ba ance I know that us ng debt as the p ug wou d be more rea st c How can I set up a pro
forma statement hav ng debt as the p ug?

■ When I copy a VLOOKUP formu a to determ ne sa ar es of nd v dua emp oyees, I get a ot


of #NA errors Then when I average the emp oyee sa ar es, I cannot get a numer ca answer
because of the #NA errors Can I eas y rep ace the #NA errors w th a b ank space so I can
compute average sa ary?

■ My worksheet conta ns quarter y revenues for Wa -Mart Can I eas y compute the revenue for
each year and p ace t n the row conta n ng the first quarter’s sa es for that year?

■ IF statements can get rather arge How many IF statements can I nest n a ce ? What s the
max mum number of characters a owed n an Exce formu a?

93

The s tuat ons sted here seem to have tt e, f anyth ng, n common However, sett ng up M crosoft
Exce 2013 mode s for each of these s tuat ons requ res the use of an IF statement The IF formu a s
probab y the s ng e most usefu formu a n Exce W th IF formu as, you can conduct cond t ona tests
on va ues and formu as, m m ck ng (to a m ted degree) the cond t ona og c prov ded by comput ng
anguages such as C, C++, and Java

An IF formu a beg ns w th a cond t on such as A1>10 If the cond t on s true, the formu a returns
the first va ue sted n the formu a; otherw se, you move on w th n the formu a and repeat the pro-
cess The eas est way to show you the power and ut ty of IF formu as s to use them to he p answer
each of th s chapter’s quest ons

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

If I order up to 500 units of a product, I pay $3.00 per unit. If I order from 501 through 1,200
units, I pay $2.70 per unit. If I order from 1,201 through 2,000 units, I pay $2.30 per unit. If I
order more than 2,000 units, I pay $2.00 per unit. How can I write a formula that expresses
the purchase cost as a function of the number of units purchased?

You can find the so ut on to th s quest on on the Quant ty D scount worksheet n the Ifstatement x sx
fi e The worksheet s shown n F gure 11-1

FIGURE 11-1  You can use an F formu a to mode quant ty d scounts.

Suppose ce A9 conta ns your order quant ty You can compute an order’s cost as a funct on of the
order quant ty by mp ement ng the fo ow ng og c

■ If A9 s ess than or equa to 500, the cost s 3*A9

■ If A9 s from 501 through 1,200, the cost s 2 70*A9

94  Chapter 11  F statements


■ If A9 s from 1,201 through 2,000, the cost s 2 30*A9

■ If A9 s more than 2,000, the cost s 2*A9

Beg n by nk ng the range names n A2 A4 to ce s B2 B4 and nk ng the range names n ce s


D2 D5 to ce s C2 C5 Then you can mp ement th s og c n ce B9 w th the fo ow ng formu a

IF(A9<=_cut1,price1*A9,IF(A9<=_cut2,price2*A9,IF(A9<=_cut3,price3*A9,price4*A9)))

To understand how Exce computes a va ue from th s formu a, reca that IF statements are eva u-
ated from eft to r ght If the order quant ty s ess than or equa to 500 (cut1), the cost s g ven by
pr ce 1*A9 If the order quant ty s not ess than or equa to 500, the formu a checks to see whether
the order quant ty s ess than or equa to 1,200 If th s s the case, the order quant ty s from 501
through 1,200, and the formu a computes a cost of pr ce 2*A9 Next, the formu a checks whether the
order quant ty s ess than or equa to 2,000 If th s s true, the order quant ty s from 1,201 through
2,000, and the formu a computes a cost of pr ce 3*A9 F na y, f the order cost has not yet been com-
puted, the formu a defau ts to the va ue pr ce 4*A9 In each case, the IF formu a returns the correct
order cost Note that three other order quant t es are entered n ce s A10 A12, and the cost formu a s
cop ed to B10 B12 For each order quant ty, the formu a returns the correct tota cost

An IF formu a conta n ng more than one IF statement s ca ed a nested IF formula

I just purchased 100 shares of stock at a cost of $55 per share. To hedge the risk that the stock
might decline in value, I purchased 60 six-month European put options. Each option has an
exercise price of $45 and costs $5. How can I develop a worksheet that indicates the six-
month percentage return on my portfolio for a variety of possible future prices?

Before tack ng th s prob em, I want to rev ew some bas c concepts from the wor d of finance A
European put opt on a ows you to se a share of a stock at a g ven t me n the future ( n th s case, s x
months) for the exerc se pr ce ( n th s case, $45) If the stock’s pr ce n s x months s $45 or h gher, the
opt on has no va ue Suppose, however, that the pr ce of the stock n 6 months s be ow $45 Then you
can make money by buy ng a share and mmed ate y rese ng the stock for $45 For examp e, f n 6
months the stock s se ng for $37, you can make a profit of $45 – $37, or $8 per share, by buy ng a
share for $37 and then us ng the put to rese the share for $45 You can see that put opt ons protect
you aga nst downward moves n a stock pr ce In th s case, whenever the stock’s pr ce n s x months s
be ow $45, the puts start accru ng some va ue Th s cush ons a portfo o aga nst a decrease n va ue of
the shares t owns Note a so that the percentage return on a portfo o (assume that the stocks n the
portfo o do not pay d v dends) s computed by d v d ng the number of the change n the portfo o’s
va ue (fina portfo o va ue– n t a portfo o va ue) by the portfo o’s n t a va ue

W th th s background, ook at how the s x-month percentage return on th s portfo o, cons st ng


of 60 puts and 100 shares of stock, var es as the share pr ce var es between $20 and $65 You can
find th s so ut on on the Hedg ng worksheet n the Ifstatement x sx fi e The worksheet s shown n
F gure 11-2

The abe s n A2 A7 are nked to ce s B2 B7 The n t a portfo o va ue s equa to


100($55)+60($5)=$5,800, shown n ce B7 By copy ng the IF(A9<expr ce,expr ce–A9,0)*Nputs formu a
from B9 to B10 B18, you can compute the fina va ue of the puts If the s x-month pr ce s ess than

F statements  Chapter 11   95


the exerc se pr ce, you can va ue each put as exercise price–six-month price Otherw se, each put w
have a va ue of $0 n s x months Copy the Nshares*A9 formu a from C9 to C10 C18 and compute the
fina va ue of the shares Copy ng the ((C9+B9)–startva ue)/startva ue) formu a from D9 to D10 D18
computes the percentage return on the hedged portfo o Copy ng the (C9–Nshares*pr cenow)/
(Nshares*pr cenow) formu a from E9 to E10 E18 computes the percentage return on the portfo o f
you are unhedged (that s, you have no puts)

FIGURE 11-2  Th s s a hedg ng examp e that uses F statements.

In F gure 11-2, you can see that f the stock pr ce drops be ow $45, the hedged portfo o has
a arger expected return than the unhedged portfo o Note a so that f the stock pr ce does not
decrease, the unhedged portfo o has a arger expected return Th s s why the purchase of puts s
often referred to as portfolio insurance

Many stock market analysts believe that moving-average trading rules can outperform the
market. A commonly suggested moving-average trading rule is to buy a stock when the
stock’s price moves above the average of the previous 15 months and to sell a stock when the
stock’s price moves below the average of the previous 15 months’ price. How would this trad-
ing rule have performed against the Standard & Poor’s 500 Stock Index (S&P)?

96  Chapter 11  F statements


In th s examp e, compare the performance of the mov ng-average trad ng ru e ( n the absence of
transact on costs for buy ng and se ng stock) to a buy-and-ho d strategy The strength of a mov ng-
average trad ng ru e s that t he ps you fo ow market trends A mov ng-average trad ng ru e ets you
r de up w th a bu market and se before a bear market destroys you

The data set conta ns the month y va ue of the S&P 500 Index for the per od of January, 1871,
through October, 2002 To track the performance of the mov ng-average trad ng strategy, you need
to track the fo ow ng nformat on each month

■ What s the average of the S&P 500 Index over the past 15 months?

■ Do I own stock at the beg nn ng of each month?

■ Do I buy stock dur ng the month?

■ Do I se stock dur ng the month?

■ What s the cash flow for the month (pos t ve f I se stock, negat ve f I buy stock, and
0 otherw se)?

The worksheet for th s s tuat on requ res you to scro down many rows It he ps to keep co umns
A and B, as we as the head ngs n row 8, v s b e as you scro down To do th s, n the Matrad ngru e
x sx fi e, move the cursor to ce C9, choose View on the r bbon, and then se ect Freeze Panes n the
Windows group Th s presents the cho ces shown n F gure 11-3

FIGURE 11-3  Choose from the Freeze Panes opt ons.

Here you choose Freeze Panes, wh ch keeps co umns A and B and rows 6–8 v s b e as you scro
through the worksheet Freeze Top Row keeps just the top row v s b e wh e scro ng through the
rest of the worksheet For examp e, f the v s b e top row s row 6, you see row 6 no matter how far
down you scro If you choose Freeze First Column, you a ways see the eftmost co umn as you
scro through the worksheet Se ect ng Unfreeze Panes from the menu returns you to norma
worksheet v ew

The Matrad ngru e x sx fi e, shown n F gure 11-4, nc udes the formu as needed to track the effec-
t veness of a mov ng-average strategy Tack ng th s prob em requ res severa IF formu as, and some
of the IF formu as requ re an AND operator For examp e, you buy the stock dur ng a month f and
on y f you don’t own the stock at the beg nn ng of the month, and the current month’s pr ce s h gher
than the 15-month mov ng average for the stock’s pr ce The first month for wh ch you can compute a
15-month mov ng average s Apr 1872, so beg n your ca cu at ons n row 24

F statements  Chapter 11   97


FIGURE 11-4  The mov ng average trad ng ru e beats buy and ho d.

Assume that you first owned the stock n Apr 1872, so enter Yes n ce C24

■ By copy ng the AVERAGE(B9 B23) formu a from D24 to D25 D1590, you compute the 15-month
mov ng average for each month

Note  An easy way to copy the formula from D24 to D25:D1590 is to point at the
lower-right corner of cell D24 (the pointer appears as a crosshair) and then double-
click the left mouse button. Double-clicking copies the formula to all the cells in the
column with a value in the column to the left. You can use this trick to copy formulas
in multiple columns also.

■ By copy ng the IF(AND(C24=”No”,B24>D24),”yes”,”no”) formu a from E24 to E25 E1590, you


determ ne for each month whether the S&P share s purchased dur ng the month Remember
that you purchase the share on y f you d d not own the stock at the beg nn ng of the month,
and the current va ue of the S&P exceeds ts 15-month mov ng average Not ce the AND por-
t on of the formu a It conta ns two cond t ons (more than two are a owed) separated by a
comma If both cond t ons are sat sfied, the formu a returns Yes; otherw se, t returns No For
an IF formu a to recogn ze text, p ace quotat on marks (“ “) around the text

■ By copy ng the IF(AND(C24=”Yes”,B24<D24),”yes”,”no”) formu a from F24 to F25 F1590, you


determ ne for each month whether the S&P share s so d The stock s so d f and on y f you
owned the S&P share at the beg nn ng of the month and the current va ue of the S&P share
s be ow the 15-month mov ng average Apr 1873 s the first month n wh ch you se your
S&P stock

■ Dur ng any month before October 2002, f you buy a share of the S&P dur ng the month, the
cash flow s negat ve the va ue of the S&P share you bought If you se a share of the S&P dur-
ng the month, the cash flow equa s the va ue of the S&P Otherw se, the cash flow s 0 Dur ng
October 2002, you se any S&P share you own to get cred t for ts va ue Therefore, by copy-
ng the IF(E24=”yes”,–B24,IF(F24=”yes”,B24,0)) formu a from G24 to G25 G1589, you record the

98  Chapter 11  F statements


cash flow for a months before October 2002 Enter ng the IF(C1590=”yes”,B1590,0) formu a n
ce G1590 g ves you cred t for se ng any stock you own at the beg nn ng of the past month

• In ce G6, compute tota profit from the mov ng-average trad ng strategy w th the
SUM(G24 G1590) formu a You can see that the 15-month mov ng-average strategy earns a
profit of $1,319 75

• The profit from buy ng and ho d ng shares


s s mp y the October 2002 S&P va ue m nus the
Apr 1872 S&P va ue Compute the profit from the buy-and-ho d strategy n ce G7 w th
the B1590–B24 formu a

As you can see, the buy-and-ho d profit of $849 45 s far worse than the profit from the mov ng-
average trad ng ru e Of course, th s so ut on gnores the transact on costs ncurred n buy ng and
se ng stocks If transact on costs are arge, th s m ght w pe out the excess profits the mov ng-average
trad ng strategy earns

In the game of craps, two dice are tossed. If the total of the dice on the first roll is 2, 3, or 12,
you lose. If the total of the dice on the first roll is 7 or 11, you win. Otherwise, the game keeps
going. How can I write a formula to determine the status of the game after the first roll?

The fact that you ose n craps f you throw a 2, 3, or 12 can be conven ent y mode ed by p ac ng an
OR formu a w th n an IF formu a In ce B5 of the Craps worksheet of the Ifstatement x sx fi e, shown
n F gure 11-5, enter the IF(OR(A5=2,A5=3,A5=12),” ose”,IF(OR(A5=7,A5=11),”w n”,”keep go ng”)) for-
mu a Th s formu a s then cop ed from B5 to B6 B7 The formu a d sp ays ose f a 2, 3, or 12 s entered
n ce A5 It d sp ays w n f a 7 or 11 s entered, and t d sp ays keep go ng for any other va ue

FIGURE 11-5  Use F statements to mode the first ro n craps.

In most pro forma financial statements, cash is used as the plug to make assets and liabilities
balance. I know that using debt as the plug would be more realistic. How can I set up a pro
forma statement having debt as the plug?

A pro forma statement s bas ca y a pred ct on of a company’s financ a future A pro forma requ res
construct on of a company’s future ba ance sheets and ncome statements The ba ance sheet pro-
v des a snapshot of the company’s assets and ab t es at any po nt n t me; an ncome statement te s
you how the company’s financ a status s chang ng at any po nt n t me Pro forma statements can
he p a company determ ne ts future needs for debt; they are a so key parts of mode s that stock ana-
ysts use to determ ne whether a stock s proper y va ued In the Proforma x sx fi e, the free cash flows
(FCFs) were generated for a company for the next four years F gure 11-6 shows the ba ance sheet,
and F gure 11-7 shows the ncome statement

F statements  Chapter 11   99


FIGURE 11-6  Th s s a pro forma assumpt ons statement and ba ance sheet.

FIGURE 11-7  Th s s a pro forma ncome statement.

Co umn D conta ns nformat on about the company’s status (dur ng year 0) The bas c assumpt ons
are as fo ows

■ Sa es growth (SG) s 2 percent per year

■ In t a sa es are $1,000

■ Interest rate on debt s 10 percent

■ D v dend payout s 5 percent of net ncome

■ The tax rate s 53 percent

■ Cost of goods so d (COGS) s 75 percent of sa es

■ Deprec at on s 10 percent of gross fixed assets

■ L qu d assets earn 9 percent

■ Current assets are 15 percent of sa es

■ Current ab t es are 7 percent of sa es

100  Chapter 11  F statements


Ass gn the names n the ce range C3 C10 to the ce s n the range D3 D10 Then, dur ng each
Year t, bas c finance and account ng mp y the fo ow ng re at onsh ps, wh ch are then mp emented n
a ser es of formu as

■ Formula 11.1 Year t+1 sa es=(Year t sa es)*(1+SG) You can compute sa es dur ng each year
by copy ng the D28*(1+SG) formu a from E28 to F28 H28

■ Formula 11.2 Year t COGS=COGS*(Year t sa es) Each year’s COGS s computed by copy ng


the formu a COGS*E28 from E29 to F29 H29

■ Formula 11.3  If Year t assets>Year t ab t es, Year t debt must be set equa to Year t tota
assets – Year t current ab t es – Year t equ ty Otherw se, Year t debt equa s 0 You can
compute each year’s debt n E21 H21 w th the IF(E18>E20+E24,E18–E20–E24,0) formu a If
Year t tota assets are greater than Year t tota ab t es, th s formu a sets Year t debt to Year
t tota assets – Year t current ab t es – Year t equ ty Th s equa zes, or ba ances, assets and
ab t es Otherw se, you set Year t debt equa to 0 In th s case, Year t cash and marketab e
secur t es are used to ba ance assets and ab t es

■ Formula 11.4 Year t current ab t es = (CL/Sa es rat o)*(Year t sa es) In E20 H20, use the
$H$4*E28 formu a to compute current ab t es for each year (copy ng th s formu a from E20
to F20 H20)

■ Formula 11.5 Year t equ ty = Year t stock +Year t reta ned earn ngs In E24 H24, you can
compute equ ty by copy ng the SUM(E22 E23) formu a from E24 to F24 H24

■ Formula 11.6  If Year t debt s greater than 0, Year t cash and marketab e secur t es equa s
0 Otherw se, Year t cash and marketab e secur t es equa s MAX(0,Year t tota ab t es – Year
t current assets – Year t net fixed assets) In E13 H13, compute cash and marketab e secur t es
for each year by copy ng the IF(E21>0,0,MAX(0,E25–E14–E17)) formu a from E13 to F13 H13
If Year t debt s greater than 0, you need not use Year t cash and marketab e secur t es to
ba ance assets and ab t es In th s case, set Year t cash and marketab e secur t es equa to 0
Otherw se, set Year t cash and marketab e secur t es equa to Year t tota assets – Year t current
ab t es – Year t equ ty Th s ba ances assets and ab t es f Year t assets (w thout cash and
marketab e secur t es) are ess than Year t ab t es If debt does not ba ance assets and ab -
t es, th s creates qu d assets as the p ug that does ba ance assets and ab t es

■ Formula 11.7 Year t nterest expense = (Year t debt)*IRD In E33, compute nterest expense
by us ng the IRD*E21 formu a, copy ng th s formu a aga n to F33 H33

■ Formula 11.8 Year t nterest ncome = (Year t cash and marketab e secur t es)*LAIR In
E32 H32, compute nterest ncome by copy ng the LAIR*E13 formu a from E32 to F32 H32

■ Formula 11.9 Year t operat ng ncome = Year t sa es – Year t COGS – Year t deprec at on In


E31 H31, operat ng ncome s computed by copy ng the E28–E29–E30 formu a from E31 to
F31 H31

■ Formula 11.10 Year t d v dends = (Year t net ncome)*DIV In E39 H39, copy the E36*DIV
formu a from E39 to F39 H39 to compute d v dends for each year

F statements  Chapter 11   101


■ Formula 11.11 Year t + 1 beg nn ng reta ned earn ngs = Year t end ng reta ned earn ngs
Compute beg nn ng reta ned earn ngs each year n F38 H38, copy ng the E40 formu a from
F38 to G38 H38

■ Formula 11.12 Year t end of year reta ned earn ngs = Year t beg nn ng reta ned earn ngs +
Year t net ncome – Year t d v dends In E40 H40, compute each year’s end ng reta ned earn-
ngs by copy ng the E38+E36–E39 formu a from E40 to F40 H40

■ Formula 11.13 Year t ncome before taxes = Year t operat ng ncome – Year t nterest
expense + Year t cash ncome Compute ncome before taxes by copy ng the E31–E33+E32
formu a from E34 to F34 H34

■ Formula 11.14 Year t taxes = (Year t ncome before taxes)*TR Compute each year’s taxes n
E35 H35 by copy ng the TR*E34 formu a from E35 to F35 H35

■ Formula 11.15 Year t net ncome after taxes = (Year t ncome before taxes) – (Year t taxes)
In E36 H36, compute each year’s net ncome by copy ng the E34–E35 formu a from E36 to
F36 H36

■ Formula 11.16 Year t gross fixed assets = Year t net fixed assets + Year t accumu ated
deprec at on In ce s E15 H15, compute gross fixed assets for each year by copy ng the
E17+E16 formu a

■ Formula 11.17 Year t deprec at on = (Year t net fixed assets)*DEP For each year, you can use
the DEP*E15 formu a to compute deprec at on, copy ng the formu a from E30 to F30 H30

■ Formula 11.18 Year t accumu ated deprec at on = Year t – 1 accumu ated deprec at on +


Year t deprec at on For each year, use the D16+E30 formu a to compute accumu ated depre-
c at on by copy ng the formu a from E16 to F16 H16

■ Formula 11.19 Year t net fixed assets = Year t gross fixed assets – Year t accumu ated depre-
c at on In row 17, to compute net fixed assets, copy the E15–E16 formu a from E17 to F17 H17

■ Formula 11.20 Year t tota assets = Year t qu d assets + Year t net fixed assets + Year t cash
and marketab e secur t es By add ng qu d assets, current assets, and net fixed assets, you can
compute tota assets by copy ng the SUM(E13,E14,E17) formu a from E18 to F18 H18

■ Formula 11.21 Year t tota ab t es = Year t current ab t es + Year t debt + Year t equ ty


By copy ng the SUM(E20,E21,E24) formu a from E25 to F25 H25, you can compute tota ab -
t es for each per od Each year w ba ance because of your debt and qu d asset statements

Formu as 11 3 and 11 6 requ re the use of IF statements Th s worksheet w a so conta n c rcu ar


references (For more nformat on about so v ng c rcu ar references, see Chapter 10, “C rcu ar refer-
ences ”) For examp e, the fo ow ng re at onsh ps create a c rcu ar reference

■ Year t cash affects Year t tota assets

■ Year t tota assets affect Year t debt

■ Year t debt affects Year t cash

102  Chapter 11  F statements


Because the worksheet conta ns c rcu ar references, you need to c ck the File tab, choose Options
and then Formulas, and se ect the Enable Iterative Calculations check box As exp a ned n Chapter
10, th s enab es Exce to reso ve c rcu ar references Note that for each Year t, tota assets n row 18
equa tota ab t es n row 25 Th s shows the power of IF formu as comb ned w th c rcu ar references

When I copy a VLOOKUP formula to determine salaries of individual employees, I get a lot
of #N/A errors. Then when I average the employee salaries, I cannot get a numerical answer
because of the #N/A errors. Can I easily replace the #N/A errors with a blank space so I can
compute average salary?

The Errortrap x sx fi e (see F gure 11-8) conta ns sa ar es and names of five emp oyees n
the D3 E7 ce range In D11 D15 s a st of five peop e; compute the r sa ary by copy ng the
=VLOOKUP(D11,$D3 $E$7,2,Fa se) formu a from E11 to E12 E15 Unfortunate y, n ce s E13 and E14,
Exce d sp ays an #N/A error NA s the acronym for “not ava ab e ” Exce returns an #N/A error va ue
when a formu a cannot return an appropr ate resu t Because JR and Josh have no sted sa ary,
VLOOKUP cannot return a sa ary va ue for them Thus, when you compute average sa ary n E16 w th
the =AVERAGE(E11 E15) formu a, you get an #N/A error Many peop e manua y rep ace the #N/A
errors w th spaces so that the r average formu a w ca cu ate proper y (by gnor ng the spaces) The
IFERROR funct on makes rep ac ng errors w th a character (such as a space or a 0) easy The syntax of
IFERROR s IFERROR(va ue,va ue f error)

The first argument s the formu a you want ca cu ated, and the second argument s the va ue
to nsert n the ce f your formu a returns an error va ue (Other common error va ues are #DIV/0,
#NAME, #NUM, #REF, #VALUE; more on these ater n the sect on ) Therefore, copy ng the
­IFERROR(VLOOKUP(D11,$D$3 $E3 $E7,2,Fa se),” “) formu a from F11 to F12 F15 computes sa ary cor-
rect y for each actua emp oyee and enters a b ank space for peop e who are not actua emp oyees
The =AVERAGE(F11 F15) formu a now correct y computes the average sa ary for a sted emp oyees

FIGURE 11-8  Here s an examp e of how error trapp ng formu as trap formu as.

Exce 2010 and Exce 2013 prov de a new funct on, the AGGREGATE funct on, that enab es you to
perform ca cu at ons and gnore rows that conta n errors The syntax of the AGGREGATE funct on s
AGGREGATE(funct on number,opt on,array) Function number s a code between 1 and 19 that g ves

F statements  Chapter 11   103


My worksheet contains quarterly revenues for Wal-Mart. Can I easily compute the revenue for
each year and place it in the row containing the first quarter’s sales for that year?

The Wa martrev x sx fi e conta ns quarter y revenues ( n m ons of do ars) for Wa -Mart (See F gure
11-10 ) Rows 6, 10, 14, and so on conta n the revenues for the first quarter of each year In each of
these rows, you w compute tota revenues for the year n co umn E In other rows, co umn E shou d
be b ank You cou d enter the SUM(D6 D9) formu a n ce E6 and copy th s formu a to E10, E14, E18,
and so on, but there must be a better way Us ng an IF statement w th two neat Exce funct ons, (ROW
and MOD), g ves you an easy way to enter the formu a once and then copy t The ROW(cell ­reference)
funct on y e ds the row of reference The =ROW(A6) funct on y e ds a 6; f you are n row 6, the
=ROW() funct on wou d a so y e d a 6 The MOD(number,divisor) funct on y e ds the rema nder when
number s d v ded by divisor For examp e, MOD(9,4) y e ds 1, whereas MOD(6,3) y e ds 0 You want
your formu a to work on y n rows that eave a rema nder of 2 when d v ded by 4 Therefore, copy ng
the =IF(MOD(ROW(),4)= 2,SUM(D6 D9),” “) formu a from E6 to E7 E57 ensures that you add up rev-
enues for the current year on y n rows that eave a rema nder of 2 when d v ded by 4 Th s means that
you compute annua revenues on y n the first quarter of each year, wh ch s the goa

FIGURE 11-10  Th s s a summary of Wa Mart, annua revenues.

IF statements can get rather large. How many IF statements can I nest in a cell? What is the
maximum number of characters allowed in an Excel formula?

In Exce 2013, you can nest up to 64 IF statements n a ce In prev ous vers ons of Exce , you cou d
nest a max mum of seven IF statements In Exce 2010 (and Exce 2007), a ce can conta n up to
32,000 characters

F statements  Chapter 11   105


Problems
1. Suppose the pr ce of a product w change at dates n the future as fo ows

Date Price
On or before February 15, 2004 $8
From February 16, 2004, through Apr 10, 2005 $9
From Apr 11, 2005, through January 15, 2006 $10
After January 15, 2006 $11

Wr te a formu a that computes the pr ce of the product based on the date the product s so d

2. The B ue Yonder A r nes fl ght from Seatt e to New York has a capac ty of 250 peop e The
a r ne so d 270 t ckets for the fl ght at a pr ce of $300 per t cket T ckets are nonrefundab e
The var ab e cost of fly ng a passenger (most y food costs and fue costs) s $30 per passenger
If more than 250 peop e show up for the fl ght, the fl ght s overbooked, and B ue Yonder must
pay overbook ng compensat on of $350 per person to each overbooked passenger Deve op
a worksheet that computes B ue Yonder’s profit based on the number of customers who show
up for the fl ght

3. A major drug company s try ng to determ ne the correct p ant capac ty for a new drug A un t
of annua capac ty can be bu t for a cost of $10 Each un t of the drug se s for $12 and ncurs
var ab e costs of $2 The drug w be so d for 10 years Deve op a worksheet that computes
the company’s 10-year profit, g ven the chosen annua capac ty eve and the annua demand
for the drug Assume demand for the drug s the same each year You can gnore the t me
va ue of money n th s prob em

4. The drug company s produc ng a new drug The company has made the fo ow ng
assumpt ons

• Dur ng Year 1, 100,000 un ts w be so d


• Sa es w grow for three years and then dec ne for seven years
• Dur ng the growth per od, sa es w grow at a rate of 15 percent per year Dur ng the
dec ne, sa es w drop at a rate of 10 percent per year

Deve op a worksheet that uses the va ues for Year 1 sa es, the ength of the growth cyc e, the
ength of the dec ne cyc e, the growth rate dur ng the growth cyc e, and the rate of decrease
dur ng the dec ne cyc e to compute un t sa es for Years 1–11

5. You are b dd ng on a construct on project The ow b d gets the project You est mate the
project cost at $10,000 Four compan es are b dd ng aga nst you It costs $400 to prepare the
b d Wr te a formu a that (g ven the b ds of your four compet tors and your b d) computes
your profit

106  Chapter 11  F statements


6. We are b dd ng on a va uab e pa nt ng The h gh b d gets the pa nt ng We est mate the pa nt-
ng’s va ue at $10,000 Four compan es are b dd ng aga nst us It costs $400 to prepare the b d
Wr te a formu a that (g ven the b ds of our four compet tors and our b d) determ nes whether
we get the pa nt ng

7. A drug company be eves ts new drug w se 10,000 un ts dur ng 2004 It expects two
compet tors to enter the market The year n wh ch the first compet tor enters, the company
expects to ose 30 percent of ts market share The year n wh ch the second compet tor enters,
the company expects to ose 15 percent of ts market share The s ze of the market s grow ng
at 10 percent per year G ven va ues for the years n wh ch the two compet tors enter, deve op
a worksheet that computes the annua sa es for years 2004–2013

8. A c oth ng store has ordered 100,000 sw msu ts It costs $22 to produce a sw msu t It p ans to
se them unt August 31 at a pr ce of $40 and then mark the pr ce down to $30 G ven va ues
for demand through August 31 and after August 31, deve op a worksheet to compute the
profit from th s order

9. On each ro of the d ce after the first ron a game of craps, the ru es are as fo ows If the
game has not ended and the current ro matches the first ro , you w n the game If the game
has not ended and the current ro s a 7, you ose Otherw se, the game cont nues Deve op a
worksheet that te s you (g ven know edge of the first four ro s) the status of the game after
four d ce ro s

10. On the S&P mov ng-average examp e, suppose you st buy shares f the current pr ce exceeds
the 15-month mov ng average, but you se f the current pr ce s ess than the 5-month mov-
ng average Is th s strategy more profitab e than se ng when the current pr ce s ess than the
15-month mov ng average?

11. A European ca opt on g ves you the r ght to buy a share of stock at a spec fied future date for
a g ven exerc se pr ce A butterfly spread nvo ves buy ng one ca opt on w th a ow exerc se
pr ce, buy ng one ca opt on w th a h gh exerc se pr ce, and se ng two ca opt ons w th an
exerc se pr ce m dway between the ow and h gh exerc se pr ces Here s an examp e of a but-
terfly spread The current stock pr ce s $60 You buy a $54 s x-month European ca opt on for
$9, buy a $66 s x-month European ca opt on for $4, and se two $60 European ca opt ons
for the pr ce of $6 Compute the profit ( n do ars, not percentage) for th s transact on as a
funct on of s x-month stock pr ces rang ng from $40 to $80 When a trader purchases a but-
terfly spread, wh ch type of movement n the stock pr ce dur ng the next s x months s the
trader bett ng on?

12. Suppose a stock s current y se ng for $32 You buy a s x-month European ca opt on w th
an exerc se pr ce of $30 for $2 50 and se a s x-month European ca opt on w th an exerc se
pr ce of $35 for $1 Compute the profit of th s strategy ( n do ars) as a funct on of a s x-month
stock pr ce rang ng from $25 to $45 Why s th s strategy ca ed a bull spread? How wou d you
mod fy th s strategy to create a bear spread?

13. Recons der your pro forma examp e Suppose the nterest rate on your debt depends on
your financ a we -be ng More spec fica y, suppose that f your earn ngs before nterest and

F statements  Chapter 11   107


taxes (EBIT) are negat ve, your nterest rate on debt s 16 percent If your nterest expense s
more than 10 percent of EBIT and EBIT s pos t ve, your nterest rate on debt s 13 percent
Otherw se, your nterest rate s 10 percent Mod fy the pro forma to account for th s var ab e
nterest rate

14. Do th s prob em ndependent y of prob em 13 Suppose your firm wants a debt-to-equ ty rat o
of 50 percent dur ng each year How wou d you mod fy the pro forma? H nt You must keep
each year’s stock nonnegat ve and use stock and cash or marketab e secur t es to ba ance
assets and ab t es

15. Mart n Luther K ng Day occurs on the th rd Monday n January Wr te a formu a that computes
(g ven the year) the date of Mart n Luther K ng Day H nt F rst determ ne the day of the week
for January 1 of the g ven year

16. Thanksg v ng occurs on the fourth Thursday n November Wr te a formu a that computes
(g ven the year) the date of Thanksg v ng H nt F rst determ ne the day of the week for
November 1 of the g ven year

17. The first quarter of the year s January–March; the second quarter, Apr –June; the th rd quar-
ter, Ju y–September; and the fourth quarter, October–December Wr te a formu a that returns
(for any g ven date) the quarter of the year

18. Wr te a formu a that returns a person’s age, g ven her date of b rth

19. Labor Day s the first Monday n September Wr te a formu a that determ nes the date of Labor
Day for a g ven year

20. The Nancybonds x sx fi e g ves the bond rat ng for severa bonds n a prev ous and future
month You want to count effic ent y how many bonds were downgraded Unfortunate y, each
company s sted n more than one row Assum ng you have sorted the data on the company
name, how wou d you determ ne the number of downgraded bonds?

21. The Addresses x sx fi e g ves peop e’s names on one ne, the r street address on the next ne,
and the r c ty, state, and ZIP code on the fo ow ng ne How cou d you put each person’s
nformat on on one ne?

22. The Formatt ngDDAnum x sx fi e g ves a bunch of text str ngs, such as DDA, D, DDA1250045,
and so on A ce s proper y formatted f the first three characters are DDA and the ast seven
characters are a number one m on or arger Determ ne wh ch ce s are proper y formatted

23. Suppose the number of Group 1 members s sted n ce B1, the number of Group 2 members
s sted n ce B2, and the number of Group 3 members s sted n ce B3 The tota number
of group members s a ways 100 Suppose that Group 1 has 50 members, Group 2 has 30
members, and Group 3 has 20 members Effic ent y p ace a 1 for each Group 1 member n
co umn D, a 2 for each Group 2 member n co umn D, and a 3 for each Group 3 member n
co umn D Thus, co umn D shou d ( n th s examp e) have a 1 n D1 D50, a 2 n D51 D80, and a 3
n D81 D100

108  Chapter 11  F statements


24. The D v debypr ce x sx fi e conta ns un ts so d of each product and tota revenue You want
to determ ne the average pr ce for each product Of course, f un ts so d s 0, then there s no
average pr ce Error-trap the D v debypr ce x sx fi e to ensure that a products w th zero sa es
y e d the No Sa es message nstead of a #DIV!0 error

25. The Schoo of F ne Art has 100 ockers numbered 1 to 100 At present, a ockers are open
Beg n by c os ng every ocker whose number even y d v des by 3 Then togg e (togg ng means
open ng a c osed ocker and c os ng an open ocker) each ocker whose number s d v s b e by
4; then togg e each ocker whose number s d v s b e by 5, , and, fina y, togg e each ocker
whose number s d v s b e by 100 How many ockers are now open?

26. The Match st x sx fi e conta ns a st of peop e who bought your product n February and a st
of peop e who bought t n March Determ ne how many of your February customers pur-
chased your product n March

27. Set up a ca endar worksheet that takes a g ven month and year as nputs and te s you the day
of the week on wh ch each day of the month occurs

28. Some rows of co umn C of the Prob em28data x sx fi e conta n the word and Create formu as
n co umn D that p ace an X n a row of co umn D f and on y f co umn C n that row conta ns
the word and

29. Suppose you toss two 20-s ded d ce The 400 poss b e outcomes are (1, 1), (1, 2), , (20, 20)
Use IF statements to generate a 400 poss b e outcomes systemat ca y

30. Us ng the data n the Catsanddogs x sx fi e, determ ne how many t mes the text str ng cat or
dog occurs

F statements  Chapter 11   109


CHAPTER 12

Time and time functions

Questions answered in this chapter:


■ How can I enter t mes n Exce ?

■ How can I enter a t me and date n the same ce ?

■ How does Exce do computat ons w th t mes?

■ How can I have my worksheet a ways d sp ay the current t me?

■ How can I use the TIME funct on to create t mes?

■ How can I use the TIMEVALUE funct on to convert a text str ng to a t me?

■ How can I extract the hour, m nute, or second from a g ven t me?

■ G ven work start ng and end ng t mes, how can I determ ne the number of hours an emp oyee
worked?

■ I added up the tota t me an emp oyee worked, and I never get more than 24 hours What d d
I do wrong?

■ How can I eas y create a sequence of regu ar y spaced t me nterva s?

Reca from Chapter 6, “Dates and date funct ons,” that M crosoft Exce 2013 g ves the date January
1, 1900, the ser a number 1; January 2, 1900, the ser a number 2; and so on Exce a so ass gns ser a
numbers to t mes (as a fract on of a 24-hour day) The start ng po nt s m dn ght, so 3 00 A M has
a ser a number of 125, noon has a ser a number of 5, 6 00 P M has a ser a number of 75, and so
on If you comb ne a date and t me n a ce , the ser a number s the number of days after January 1,
1900, p us the t me fract on assoc ated w th the g ven t me Thus, enter ng January 1, 2007 n a ce
y e ds (when formatted as Genera ) a ser a number of 39083, whereas January 1, 2007, 6 00 A M
y e ds a ser a number of 39083 25

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

111

How can I enter times in Excel?

To nd cate t mes, you enter a co on ( ) after the hour and another co on before the seconds For
examp e, n fi e T me x sx (see F gure 12-1), the t me of 8 30 A M n ce C2 s entered s mp y as 8 30 or
8 30 AM In ce C3, 8 30 P M s entered as 8 30 PM As shown n ce D3, you cou d a so enter 8 30 P M
w th 24-hour m tary t me as 20 30 In ce A4, the t me s entered as 3 10 30 PM Th s represents 30
seconds after 3 10 P M

FIGURE 12-1  Th s figure shows examp es of t me formats.

How can I enter a time and date in the same cell?

S mp y put a space after the date and enter the t me In ce F13 of fi e T me x sx, January 1, 2007 5 35
s entered Of course, th s represents 5 35 A M on January 1, 2007 Exce mmed ate y reformatted th s
to 1/1/2007 5 35

How does Excel do computations with times?

When Exce computes d fferences n t mes, the resu t d sp ayed depends on the format used n the
ce F gure 12-2 d sp ays the var ous Exce t me formats

FIGURE 12-2  Th s figure shows the d fferent Exce t me formats.

In the T me x sx fi e (see F gure 12-2), the d fference between 8 30 P M and 8 30 A M n ce s F5


and H5 are d sp ayed w th the =C3–C2 formu a If you do not change the format, Exce th nks these
t mes are 12 hours apart and enters 12 00 PM, as shown n ce H5 In most cases, you’ want Exce
to portray these t mes as 5 days apart (Mu t p y ng by 24, you cou d convert th s t me d fference to
hours ) To make Exce show 5 n ce F5, format ce F5 as a number

In ce F7, the user tr ed to subtract an ear er t me from a ater t me w th the =D2–D3 formu a
Because he d d not reformat the ce , Exce d sp ays the dreaded ############## If he changes the

112  Chapter 12  T me and t me funct ons


ce conta n ng the formu a to the Number format (as n ce F8), he obta ns the correct t me d ffer-
ence, – 5 days

Ce s B17 and C17 g ve the start t mes for two jobs, whereas ce s B18 and C18 g ve the fin sh t mes
for the jobs (See F gure 12-3 ) If you want to ca cu ate how many hours t takes to comp ete each job,
copy the =B18–B17 formu a from B19 to C19 and reformat the ce as Number Thus, the first job took
29 18 days, and the second job took 28 97 days

FIGURE 12-3  Determ ne the t me needed to comp ete jobs.

How can I have my worksheet always display the current time?

The Exce =NOW() formu a g ves today’s date and the current t me For examp e, n ce G2 (see F gure
12-4) of fi e T me x sx, enter ng =NOW() y e ded 7/11/2013 6 51 because the screen capture was cre-
ated at 6 50 A M on Ju y 11, 2013 To compute the current t me, enter the =NOW()–TODAY() formu a
n ce H2 or I2 Ce H2 s formatted to show a t me (9 50 P M ), whereas ce I2 s formatted to show a
number ( 91 days) Th s represents the fact that 9 50 P M s 91 percent of the way between m dn ght
of one day and m dn ght of the next day

FIGURE 12-4  Use the Now() and Today() funct ons.

How can I use the TIME function to create times?

The TIME funct on has the TIME(hour,m nute,second) syntax G ven an hour, m nutes, and seconds,
the TIME funct on returns a t me of day The TIME funct on never returns a va ue exceed ng 24 hours

In ce A2 (see F gure 12-1), the =TIME(8,30,0) formu a y e ds 8 30 A M In ce A3, the


=TIME(20,30,0) formu a y e ds 8 30 P M In ce A4, the =TIME(15,10,30) formu a y e ds 3 10 30 P M
F na y, note that n ce A5, the =TIME(25,10,30) formu a treats the 25 as though t s 25 – 24 = 1 and
y e ds 1 10 30 A M

If the number of seconds does not show up n a ce , just se ect a T me format that d sp ays
seconds

How can I use the TIMEVALUE function to convert a text string to a time?

The TIMEVALUE funct on has the =TIMEVALUE(t metext) syntax, where t metext s a text str ng that
g ves a t me n a va d format Then TIMEVALUE returns the t me as a fract on between 0 and 1
(Th s means that the TIMEVALUE funct on gnores any date n t metext ) For examp e, n ce A7 (see
F gure 12-1), the =TIMEVALUE(“8 30”) formu a y e ds 0 354166667 because 8 30 A M s 35 4 percent of
the way between m dn ght of one day and m dn ght of the next day

T me and t me funct ons  Chapter 12   113


How can I extract the hour, minute, or second from a given time?

The Exce HOUR, MINUTE, and SECOND funct ons extract the appropr ate t me un t from a ce con-
ta n ng t me For examp e (as shown n F gure 12-1), enter ng the =HOUR(A4) formu a n ce C5 y e ds
15 (3 00 P M s 15 00 m tary t me) Enter ng the =M nute(A4) formu a n ce D5 y e ds 10, whereas
enter ng =SECOND(A4) n ce E5 y e ds 30

Given work starting and ending times, how can I determine the number of hours an employee
worked?

In ce s C10 D11 (see F gure 12-5), you can enter the t mes that Jane and Jack started and ended work
You want to figure out how ong each of them worked The prob em s that Jane fin shed work the
day after she started, so s mp e subtract on does not g ve the actua number of hours she worked
Copy ng the =IF(D10>C10,24*(D10–C10),24+24*(D10–C10)) formu a from C13 to C14 y e ds the cor-
rect resu t These ce s are formatted as Number If the fin sh t me s after the start t me, subtract ng
the start t me from the fin sh t me and mu t p y ng by 24 y e ds hours worked If the fin sh t me s
before the start t me, then 24*(fin sh t me – start t me) y e ds a negat ve number of hours, but add ng
24 hours fixes th ngs, assum ng the end of the sh ft was one day ater Thus, Jane worked 9 hours, and
Jack worked 8 5 hours

FIGURE 12-5  Compute the ength of t me emp oyees worked.

I added up the total time an employee worked, and I never get more than 24 hours. What did
I do wrong?

Ce s C31 D35 n F gure 12-6 g ve the number of hours (formatted as h mm) an emp oyee worked on
each day of her workweek In ce D36, the =SUM(D31 D35) formu a computes the tota number of
hours worked dur ng the week Exce d sp ays 14 48 Th s s c ear y wrong, but the fau t s not w th
the SUM funct on but w th the ce formatt ng W th the h mm format, Exce never d sp ays a va ue
exceed ng 24 hours You can choose a format (38 48 00) that d sp ays more than 24 hours, as ce D38
shows Then, summ ng up the hours worked each day d sp ays the correct number of hours worked
(38 hours and 48 m nutes)

FIGURE 12-6  Determ ne the tota hours worked dur ng the week.

114  Chapter 12  T me and t me funct ons


How can I easily create a sequence of regularly spaced time intervals?

Suppose a doctor takes appo ntments from 8 00 A M n 20-m nute segments up to 5 00 P M How
can you enter the st of poss b e appo ntment t mes n d fferent rows? Use the great AutoF fea-
ture n Exce (See F gure 12-7 ) Enter the first two t mes (8 00 A M and 8 20 A M ) n ce s L15 L16
Now se ect ce s L15 L16 and move the cursor to the ower-r ght corner of ce L16 unt you see
the b ack cross Drag the po nter down unt you see 5 00 P M (the ast appo ntment t me) From
ce s L15 L16, Exce has guessed (correct y!) that you want to enter t mes that are 20 m nutes apart
Enter ng Monday n a ce and Tuesday be ow t and us ng AutoF w y e d a sequence of Monday,
Tuesday, Wednesday,       , eventua y restart ng at Monday Enter ng 1/1/2007 n one ce , 2/1/2007 n
another ce , se ect ng these two ce s, and us ng AutoF y e ds a sequence of dates such as 1/1/2007,
2/1/2007, 3/1/2007, and so on

FIGURE 12-7  Enter a sequence of t mes.

Problems
1. Wr te a formu a that w return a t me 18 hours after the current t me

2. The Marathon x sx fi e g ves marathon race t mes for four runners Prob ems (a) through (c)
refer to th s data Compute the average t me of the runners

a. How much faster was John than J ?

b. How many tota m nutes d d each runner take?

c. How many tota seconds d d each runner take?

3. The Jobshop x sx fi e g ves the start t me and date for severa jobs and the t me requ red to
comp ete each job Determ ne the comp et on t me for each job

T me and t me funct ons  Chapter 12   115


CHAPTER 13

The Paste Special command

Questions answered in this chapter:


■ How can I move the resu ts of ca cu at ons (not the formu as) to a d fferent part of a
worksheet?

■ I have a st of names n a co umn How can I make the st appear n a row nstead of a
co umn?

■ I’ve down oaded US T-b nterest rates from a webs te nto Exce The data d sp ays a 5 when
the nterest rate s 5 percent, 8 when the nterest rate s 8 percent, and so on How can I eas y
d v de my resu ts by 100 so that a 5 percent nterest rate, for examp e, s d sp ayed as 05?

W th the Paste Spec a command n M crosoft Exce 2013, you can eas y man pu ate worksheet data
In th s chapter, you see how to use the Paste Spec a command to perform the fo ow ng types of
operat ons

■ Paste on y the va ues n ce s (not the formu as) n a d fferent part of a worksheet

■ Transpose data n co umns to rows and v ce versa

■ Transform a range of numbers by add ng, subtract ng, d v d ng, or mu t p y ng each number n
the range by a g ven constant

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

How can I move the results of calculations (not the formulas) to a different part of a
worksheet?

In the Paste Spec a Va ue worksheet n the Pastespec a x sx fi e, the E4 H9 ce range conta ns the
names, games, tota po nts, and po nts per game for five 10- to 11-year-o d basketba p ayers from
B oom ngton, Ind ana In the H5 H9 ce range, use the data n ce s F5 G9 to compute each ch d’s
po nts per game, as shown n F gure 13-1 Suppose you want to copy th s data and the ca cu ated
po nts per game—but not the formu as that perform the ca cu at ons—to a d fferent ce range
(E13 H18, for examp e) Just se ect the E4 H9 range, press Ctr +C, and then move to the upper- eft
corner of the range where you want to copy the data (ce E13 n th s examp e) Next, r ght-c ck the
upper- eft corner ce n the target range, choose Paste Special, and then fi n the Paste Special

117

d a og box as nd cated n F gure 13-2 After c ck ng OK, the E13 H18 range conta ns the data but not
the formu as from the E4 H9 ce range You can check th s by c ck ng ce H16 You see a va ue (7) but
not the formu a that was used to compute Gregory’s average po nts per game Note that f you use
the Paste Spec a command, se ect Values, and then paste the data nto the same range from wh ch
you cop ed the data, your formu as d sappear from the worksheet

FIGURE 13-1  Use the Paste Spec a command to paste on y va ues.

FIGURE 13-2  The Paste Spec a d a og box w th Va ues se ected. Se ect ng Va ues pastes on y va ues and not
formu as.

I have a list of names in a column. How can I make the list appear in a row instead of a
column?

To rea gn data from a row to a co umn (or v ce versa), copy the data and then use the Paste Spec a
command w th Transpose se ected Essent a y, Transpose n the Paste Spec a d a og box fl ps
se ected ce s around so that the first row of the cop ed range becomes the first co umn of the range
you paste data nto and v ce versa For an examp e, ook at the Paste Spec a Transpose worksheet n
the Pastespec a x sx fi e, shown n F gure 13-3

Suppose that you want to st the p ayers’ names n one row (start ng n ce E13) Se ect the E5 E9
range and then press Ctr +C to copy the data R ght-c ck ce E13, c ck Paste Special, and se ect
Transpose n the Paste Special d a og box After you c ck OK, Exce transposes the p ayers’ names
nto one row

118  Chapter 13  The Paste Spec a command


FIGURE 13-3  Use the Transpose opt on n the Paste Spec a d a og box to transpose a row of data nto a co umn or
a co umn of data nto a row.

Suppose you want to transpose the spreadsheet content n E4 H9 to a range beg nn ng n ce E17
Beg n by se ect ng the E4 H9 range Next, press Ctr +C Now move to the upper- eft corner of the
range where you want to put the transposed nformat on (E17) R ght-c ck and choose Paste Special,
se ect Transpose, and then c ck OK You see that the content of E4 H9 s transposed (turned on ts
s de), as shown n F gure 13-3 Note that n F20 J20, Exce was smart enough to adjust the po nts-per-
game formu a so that the average for each p ayer s now computed from data n the same co umn
nstead of n the same row

Note  When you select Paste Special and click Paste Link instead of OK, the transposed
cells are linked to the original cells, and changes you make to the original data are reflected
in the copy. By changing the value in cell F5 to 7, the value in cell F18 becomes 7 as well,
and cell F20 will display Dan’s average as 4 points per game.

I’ve downloaded US T-bill interest rates from a website into Excel. The data displays a 5 when
the interest rate is 5 percent, 8 when the interest rate is 8 percent, and so on. How can I easily
divide my results by 100 so that a 5 percent interest rate, for example, is displayed as .05?

The Paste Spec a D v de Before worksheet n the Pastespec a x sx fi e (see F gure 13-4) conta ns the
annua rate of nterest pa d by three-month US T-b s for each month between January 1970 and
February 1987 In January 1970, the annua rate on a three-month T-b was 8 01 percent Suppose
you want to earn annua nterest on $1 nvested at the current T-b rate The formu a to ca cu ate the
rate s (1 + (annua rate)/100) It wou d be eas er to compute earned nterest f the co umn of annua
nterest rates were d v ded by 100

The Operat ons area of the Paste Spec a d a og box enab es you to add, subtract, mu t p y, or
d v de each number n a range by a g ven number, prov d ng an easy way to d v de each nterest
rate by 100 Here you want to d v de each number n co umn D To beg n, enter your d v sor (100)
You can enter t anywhere n the worksheet—F5 n th s nstance (See F gure 13-4 ) W th F5 se ected,
press Ctrl+C You see the mov ng ants surround ng ce F5 Se ect the range of numbers you want to

The Paste Spec a command  Chapter 13   119


mod fy To se ect a the data n co umn D, c ck n ce D10, press Ctrl+Shift, and then press the down
arrow key Th s shortcut s a usefu tr ck for se ect ng a ta ce range (To se ect a w de set of data
sted n one row, move to the first data po nt, press Ctrl+Shift, and then press the right arrow key )
R ght-c ck and choose Paste Special and then se ect Divide n the Paste Spec a d a og box, as shown
n F gure 13-5

FIGURE 13-4  Th s figure shows the data for us ng D v de n the Paste Spec a d a og box to d v de a data range by
a constant.

FIGURE 13-5  You can app y an opt on n the Operat on area of the Paste Spec a d a og box to a range of ce s.

After you c ck OK, Exce d v des each se ected number n co umn D by 100 The resu ts are shown
n F gure 13-6 If you had se ected Add, D10 wou d d sp ay 108 01; f you had se ected Subtract, D10
wou d d sp ay –91 99; and f you had se ected Mu t p y, D10 wou d d sp ay 801

120  Chapter 13  The Paste Spec a command


FIGURE 13-6  These are the resu ts of us ng D v de n the Paste Spec a d a og box.

Problems
1. The Mavs x sx fi e conta ns stat st cs for the great 2002–2003 Da as Maver cks basketba team
P ayer names are sted n co umn A, stat st ca categor es are sted n row 3, and stat st ca
resu ts are sted n rows 4–20 Change the worksheet so that a p ayer names are sted n the
same row and a stat st ca categor es are sted n the same co umn

2. F e d goa percentage, free throw percentage, and three-po nt percentage are sted as dec -
ma s For examp e, Steve Nash made 91 9 percent of h s free throws, wh ch s sted as 919
Change the worksheet so that a shoot ng percentages are sted as a number from 1 through
100

3. The Productpaste x sx fi e conta ns data on quarter y sa es for four products Copy th s data to
another range so that quarter y sa es are read across nstead of down L nk your cop ed data
to the or g na data so that your computat on of annua sa es n the cop ed data range reflect
changes entered n rows 5–8

4. The Productsa espaste x sx fi e conta ns sa es of Products X, Y, and Z ( n thousands of un ts)


Convert th s sa es data to sa es n actua un ts H nt Remember you can use the Ctr key (as
exp a ned n Chapter 1, “Range names”) to se ect a noncont guous range of ce s

The Paste Spec a command  Chapter 13   121


CHAPTER 14

Three-dimensional formulas

Question answered in this chapter:


■ Is there an easy way to set up a mu t p e-worksheet workbook n wh ch each worksheet has a
s m ar structure? Can I eas y create formu as that nvo ve ce s n mu t p e worksheets?

In many bus ness s tuat ons, you have to set up workbooks n wh ch each worksheet has a s m ar
format or structure Here are some examp es

■ You want to track your company’s sa es n each reg on of the country n a separate worksheet
and then summar ze tota sa es n a summary worksheet

■ You want to track your company’s sa es for each month n a separate worksheet and then
summar ze year-to-date sa es n a summary worksheet

In th s chapter, you earn how to set up workbooks n wh ch the nd v dua worksheets have a
s m ar structure Th s chapter a so d scusses three-d mens ona formu as, wh ch enab e you to wr te
formu as eas y to perform ca cu at ons on ce s n mu t p e worksheets

Answer to this chapter’s question


Th s sect on prov des the answer to the quest on that s sted at the beg nn ng of the chapter

Is there an easy way to set up a multiple-worksheet workbook in which each worksheet has a
similar structure? Can I easily create formulas that involve cells in multiple worksheets?

Suppose you want to set up a workbook that conta ns a separate worksheet to track sa es n each
reg on (East, South, M dwest, and West) of the Un ted States You a so want to summar ze tota sa es
n a summary worksheet In each worksheet, you want to track your product’s pr ce, un t cost, and
un ts so d as we as your fixed cost and profits In the summary worksheet, you want to track just tota
profit and un ts so d You want your nd v dua reg on worksheets to ook ke F gure 14-1

FIGURE 14-1  Th s figure shows sa es n the East.

123

To set up th s structure, you enter the product pr ce n ce C3 of each worksheet, the un t cost n
ce C4, the un ts so d n ce C5, and the fixed cost n ce C6 Then, n ce C7, you compute the East
reg on profit w th the (C3-C4)*C5-C6 formu a You want the same structure n the worksheets for the
other reg ons It turns out you need to enter the head ngs and formu a n on y one worksheet, and
then Exce automat ca y cop es them to the other reg on’s worksheets

To beg n, open a b ank workbook, wh ch by defau t conta ns one worksheet By c ck ng the Insert
Worksheet con to the r ght of the ast-named worksheet (or by press ng Sh ft+F11), nsert four new
worksheets so that your workbook conta ns five worksheets Name the first four worksheets East,
South, Midwest, and West Name the ast worksheet Summary A sa es w be tota ed n the
Summary worksheet (By the way, f you se ect Options on the File tab and then choose General, you
can change the number of worksheets nc uded n a workbook by defau t )

To set up the reg ona worksheets, se ect the first worksheet (East); ho d down the Sh ft key and
se ect the ast nd v dua worksheet (West) Now, whatever you enter n the East worksheet s dup -
cated n the other reg ona worksheets S mp y type Pr ce n ce B3, Un t Cost n ce B4, Un ts So d n
ce B5, F xed Cost n ce B6, and Profit n ce B7 F na y, enter the (C3-C4)*C5-C6 formu a n ce C7
Now c ck the ast sheet to eave th s data entry procedure You see that each reg ona worksheet has
the same head ngs n co umn B and the correct Profit formu a n ce C7

You are now ready to use three-d mens ona formu as to compute tota un ts so d and profit In
ce C5, you compute tota un ts so d Remember that you entered un ts so d for each reg on n ce
C5 Move your cursor to ce C5 of the Summary worksheet where you want to compute tota un ts
so d Type =SUM( and then move your cursor to the first ce you want to tota (ce C5 of sheet East)
Next, ho d down the Shift key and c ck the name of the ast worksheet you want to tota ( n th s case,
West) Last, enter a r ght (c os ng) parenthes s n the formu a bar, and you see the SUM(east west!C5)
formu a entered n ce C5 of the Summary sheet Th s formu a s an examp e of a three-d mens ona
formu a Most Exce formu as operate n two d mens ons (rows and co umns) A three-d mens ona
formu a operates n a th rd d mens on across worksheets Th s formu a te s Exce to sum ce C5 n
a worksheets, start ng w th the East worksheet and end ng w th the West worksheet If you wanted
to, you cou d have typed th s formu a n ce C5 of the Summary worksheet Copy ng th s formu a
and past ng t to ce C7 of the Summary worksheet computes your company’s tota profit (See
F gure 14-2 )

FIGURE 14-2  Th s figure summar zes un t sa es and profit.

124  Chapter 14  Three d mens ona formu as


In Chapter 22, “The INDIRECT funct on,” you earn how the INDIRECT funct on can summar ze data
n d fferent worksheets Later, you earn about four other methods you can use to summar ze data n
mu t p e worksheets and or workbooks

■ P votTab es (Chapter 43)

■ Data Conso date (Chapter 52)

■ Data Mode (Chapter 44)

■ PowerP vot (Chapter 45)

Problem
1. You own s x oca coffee shops The revenues and customer count for each coffee shop are
g ven n the fo ow ng tab e

Shop Revenues Customer Count


1 $8,000 1,950

2 $7,000 1,800
3 $9,000 2,200
4 $8,400 2,000
5 $5,900 1,400
6 $10,100 2,500

Set up a workbook that makes t easy to enter revenue and customer count for each store and
create a summary worksheet (us ng three-d mens ona formu as) that computes tota week y
revenue and customer count

Three d mens ona formu as  Chapter 14   125


CHAPTER 15

The Auditing tool and


Inquire add-in

Questions answered in this chapter:


■ I’ve just been handed a five thousand–row worksheet that computes the net present va ue
(NPV) of a new car In the worksheet, my financ a ana yst made an assumpt on about the
annua percentage of the growth n the product’s pr ce Wh ch ce s n the worksheet are
affected by th s assumpt on?

■ I th nk my financ a ana yst made an error comput ng Year 1 before-tax profit Wh ch ce s n


the worksheet mode were used for th s ca cu at on?

■ How does the aud t ng too work when I’m work ng w th data n more than one worksheet or
workbook?

■ What s the new Inqu re add- n and how can I nsta t?

■ What nformat on does the Inqu re add- n show about a workbook?

■ How does the Inqu re add- n compare workbooks?

■ How does the Inqu re add- n show the re at onsh ps between ce formu as?

■ How does the Inqu re add- n show the re at onsh ps between worksheets?

When you hear the word structure, you m ght often th nk about the structure of a bu d ng The struc-
ture of a worksheet mode refers to the way nput assumpt ons (data such as un t sa es, pr ce, and un t
cost) are used to compute outputs of nterest such as NPV, profit, or cost The M crosoft Exce 2013
aud t ng too prov des an easy method for document ng the structure of a worksheet or workbook,
wh ch makes understand ng the og c under y ng comp ex worksheet mode s eas er To v ew the
aud t ng opt ons n Exce , c ck the Formulas tab on the r bbon and then v ew the Formula Auditing
group (See F gure 15-1 )

Th s chapter d scusses the Trace Precedents, Trace Dependents, and Remove Arrows commands
Here, th s chapter ho ds a br ef d scuss on of the other e ements of the Formu a Aud t ng group The
Eva uate Formu a command s d scussed n Chapter 21, “The OFFSET funct on ”

127

FIGURE 15-1  Th s figure shows the Formu a Aud t ng too bar.

C ck ng the Show Formu as con, shown n F gure 15-1, serves as a sw tch that togg es the d sp ay
of formu as n ce s and the d sp ay of the va ues that resu t from the formu as You can a so press
Ctr +~ to togg e between show ng formu as n ce s and show ng the formu as’ resu ts Formu as
can a so be shown n a spreadsheet by us ng the new FORMULATEXT funct on n Exce 2013 The
ISFORMULATEXT x sx fi e (see F gure 15-2) ustrates the use of th s funct on

FIGURE 15-2  Th s figure shows the usage of the ISFORMULA and FORMULATEXT funct ons.

The numbers 1, 2, and 3 are entered n co umn A and, n co umn B, they are mu t p ed by 5
Copy ng the =FORMULATEXT(B4) formu a from E4 to E5 E6 causes the formu as from co umn B to
appear n co umn E

Co umns C and D ustrate the use of another new Exce 2013 funct on, ISFORMULA Th s formu a
returns TRUE f a ce conta ns a formu a and FALSE otherw se If you copy the =ISFORMULA(A4) for-
mu a from C4 to C4 D6, you see that co umn B conta ns formu as, and co umn A does not

Error Check ng, shown n F gure 15-1, checks your worksheet for errors and g ves you he p on the
errors To ustrate how the Exce Error Trap capab ty works, ook aga n at the Errortrap x sx fi e from
Chapter 10, “C rcu ar references ” (See F gure 15-3 )

C ck ng the drop-down arrow y e ds three opt ons Error Check ng, Trace Errors, and C rcu ar
References Your workbook conta ns no c rcu ar references, so C rcu ar Reference s d mmed If
the workbook conta ned any c rcu ar references, Exce wou d h gh ght them If you se ect Error
Check ng, Exce beg ns to check for errors The first error t finds s n ce E13; the d a og box shown n
F gure 15-4 opens C ck ng He p On Th s Error eads you to further nformat on about the error Show
Ca cu at on Steps enab es you to step through the ca cu at on of the formu a Ignore Error c oses the

128  Chapter 15  The Aud t ng too and nqu re add n


d a og box Ed t In Formu a Bar enab es you to ed t the formu a Se ect ng Prev ous returns you to the
prev ous y found error, and Next sends you to the d a og box for the next error

FIGURE 15-3  Th s figure ustrates Error Check ng and Trace Errors.

FIGURE 15-4  Th s figure shows the Error Check ng d a og box.

If you se ect Trace Errors from the drop-down menu and the act ve ce conta ns an error, the ce s
needed to compute the act ve ce are nd cated by b ue arrows or a b ue rectang e For examp e, n
F gure 15-3, ce D13 and the D3 E7 ce range are needed to compute ce E13 (Th s ce generated an
#N/A error )

The Aud t ng too and nqu re add n   Chapter 15   129


By us ng the Watch W ndow, you can se ect a ce or ce s and then, no matter where you are n
the workbook, you see how the va ue of the se ected ce s changes For examp e, after se ect ng the
Watch W ndow, you can se ect Add Watch and add a formu a (say to ce C3 n Sheet 1) Now, even
f you are work ng n a d fferent workbook, the Watch W ndow shows you how ce C3 of Sheet 1
changes

Trace Precedents and Trace Dependents ocate and d sp ay precedents and dependents for work-
sheet ce s or formu as A precedent s any ce whose va ue s needed to compute a se ected formu a’s
va ue For examp e, f you were ana yz ng a d rect-ma campa gn, you wou d make assumpt ons
about the number of etters ma ed and the response rate for the ma ng Then you cou d compute
the number of responses as response rate*letters mailed In th s case, the response rate and tota
etters ma ed are precedents of the ce conta n ng the formu a used to compute tota responses A
dependent s any ce conta n ng a formu a whose va ues can’t be computed w thout know edge of a
se ected ce In the prev ous examp e, the ce conta n ng the tota number of responses s a depen-
dent of the ce conta n ng the response rate Exce marks precedents and dependents w th b ue
arrows when you use the aud t ng too The Remove Arrows button c ears the d sp ay of the arrows

Let’s app y the aud t ng too to some pract ca prob ems

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

I’ve just been handed a five thousand–row worksheet that computes the net present value
(NPV) of a new car. In the worksheet, my financial analyst made an assumption about the
annual percentage of the growth in the product’s price. Which cells in the worksheet are
affected by this assumption?

The Or g na Mode worksheet n the NPVaud t x sx fi e conta ns ca cu at ons that compute the NPV
of after-tax profits for a car expected to be ava ab e from the manufacturer for five years (See
F gure 15-5 ) Pr ce and cost are n thousands of do ars The parameter va ues assumed for the ana ys s
are g ven n ce s C1 C8 (w th assoc ated range names sted n ce s B1 B8) Assume that the pr ce of
the product w ncrease by 3 percent per year Wh ch ce s n the worksheet are dependents of th s
assumpt on?

To answer th s quest on, se ect ce C8 (the ce conta n ng the assumpt on of 3 percent pr ce


growth) and then c ck the Trace Dependents button n the Formula Auditing group on the
Formulas tab Exce d sp ays the set of arrows, shown n F gure 15-6, po nt ng to d rect dependents of
ce C8 Note that for Trace Dependents or Trace Precedents (see the fo ow ng) to work correct y, the
ent re r bbon must show before c ck ng Trace Dependents Press ng Contro +F1 serves as a togg e
between just the r bbon tabs and a opt ons show ng on the r bbon

130  Chapter 15  The Aud t ng too and nqu re add n


FIGURE 15-5  You can use the aud t ng too to trace formu as n comp ex spreadsheets.

By c ck ng the Trace Dependents button once, Exce po nts to the ce s that directly depend on the
pr ce growth assumpt on In F gure 15-6, you can see that on y the un t pr ces for Years 2–5 depend
d rect y on th s assumpt on C ck ng Trace Dependents repeated y shows a formu as whose ca cu a-
t on requ res the va ue for annua pr ce growth, as shown n F gure 15-7

FIGURE 15-6  Trace d rect y dependent ce s.

The Aud t ng too and nqu re add n   Chapter 15   131


FIGURE 15-7  C ck ng Trace Dependents repeated y shows a the dependents of the pr ce growth assumpt on.

You can see that n add t on to un t pr ce n Years 2–5, the pr ce growth assumpt on affects Years
2–5 revenue, before-tax profits, tax pa d, after-tax profits, and NPV You can remove the arrows by
c ck ng the Remove Arrows button

The keystroke comb nat on of CONTROL+] h gh ghts a d rect dependents of the act ve ce
n b ue; the keystroke comb nat on of CONTROL+SHIFT+] h gh ghts n b ue a dependents of the
act ve ce

I think my financial analyst made an error in computing Year 1 before-tax profit. Which cells
in the worksheet model were used for this calculation?

Now you want to find the precedents for ce B15, the ce s needed to compute Year 1 before-tax
profit Se ect ce B15 and then c ck the Trace Precedents button once You see the arrows shown n
F gure 15-8

As you can see, the ce s needed to compute before-tax Year 1 profit d rect y are Year 1 revenues
and Year 1 cost (Before-tax Year 1 profit equa s Year 1 revenue m nus Year 1 cost ) Repeated y
c ck ng the Trace Precedents button y e ds a precedents of Year 1 before-tax profit, as shown n
F gure 15-9

132  Chapter 15  The Aud t ng too and nqu re add n


FIGURE 15-8  These are the d rect precedents for Year 1 before tax profit.

FIGURE 15-9  C ck Trace Precedents repeated y to show a precedents of Year 1 before tax profit.

Here the on y nput assumpt ons that nfluence Year 1 before-tax profit are Year 1 sa es, Year 1
pr ce, and Year 1 cost

The Aud t ng too and nqu re add n   Chapter 15   133


How does the auditing tool work when I’m working with data in more than one worksheet or
workbook?

Cons der the s mp e worksheet mode n the Aud ttwosheets x sx workbook, shown n F gure 15-10
The formu a n the Profit worksheet computes a company’s profit (un t sa es*(pr ce – var ab e cost) –
fixed cost) from nformat on conta ned n the Data worksheet

FIGURE 15-10  Th s figure shows data for us ng the aud t ng too on mu t p e worksheets.

Suppose you want to know the precedents of the profit formu a Se ect ce D7 n the Profit work-
sheet and then c ck Trace Precedents n the Formula Auditing group on the Formulas tab You see
a dotted ne, an arrow, and the worksheet con shown n F gure 15-11

FIGURE 15-11  Th s s the resu t of trac ng precedents w th data on mu t p e worksheets.

The worksheet con nd cates that the precedents of the profit formu a e n another worksheet
Doub e-c ck ng the dotted ne opens the Go To d a og box, shown n F gure 15-12

Now you can c ck any of the sted precedents (ce s D4 D7 n the Data worksheet), and Exce w
send you to the precedent you se ected

134  Chapter 15  The Aud t ng too and nqu re add n


FIGURE 15-12  W th the Go To d a og box, you can aud t data n mu t p e worksheets.

What is the new Inquire add-in and how can I install it?

If you own Exce 2013 Profess ona P us, you have access to the Inqu re add- n, a more soph st cated
vers on of the aud t ng too that enab es you to

■ Der ve many nterest ng stat st cs about the current workbook

■ Compare two workbooks to determ ne how they d ffer

■ Create a soph st cated d agram of the ce s that are precedents or dependents of the
current ce

■ Create a soph st cated d agram of the nterre at onsh ps between worksheets n the current
workbook

■ C ean excess formatt ng from a workbook

■ L st the passwords assoc ated w th the workbook

■ To nsta the Inqu re add- n, proceed as fo ows

1. Se ect File on the r bbon and choose Options

2. Choose Add-Ins Se ect COM Add-ins and c ck GO

3. Se ect Inquire Add-in and c ck OK You shou d now see the INQUIRE tab on the r bbon

The Aud t ng too and nqu re add n   Chapter 15   135


What information does the Inquire add-in show about a workbook?

Use Inqu re to ana yze your NPVaud t x sx workbook Open the workbook and se ect the Inquire r b-
bon tab The menu shown n F gure 15-13 appears

FIGURE 15-13  Th s s the nqu re menu.

Se ect ng Workbook Analysis y e ds the resu t ng stat st cs

After se ect ng Workbook Ana ys s, the Workbook Ana ys s Report d a og box opens You can
check any features for wh ch you want deta s or se ect Summary to check off a opt ons F gure
15-14 shows the resu ts when Formu as s se ected On the r ght, you can see a 123 ce s that conta n
formu as n the workbook

FIGURE 15-14  nqu re shows you the ocat on of a formu as n a workbook.

How does Inquire compare workbooks?

Often, the ana yst hands h s workbook off to a co eague who makes changes n the workbook The
Inqu re add- n makes t easy to compare two workbooks and dent fy d fferences between them To
ustrate how Inqu re compares workbooks, open the Prodm xtemp x sx fi e Th s workbook (wh ch s
d scussed further n Chapter 29, “Us ng So ver to determ ne the opt ma product m x”) conta ns data
but no formu as, wh ch are needed to determ ne a profit-max m z ng product m x The Prodm x x sx

136  Chapter 15  The Aud t ng too and nqu re add n


fi e conta ns formu as needed to eva uate the product m x After open ng th s workbook, the Inqu re
add- n can be used to compare these workbooks Se ect Compare Files; you are prompted to st the
fi es you want compared After se ect ng the fi es, you obta n the resu ts shown n F gure 15-15 On
the r ght, the ce s n Prodm x x sx that were changed are h gh ghted

FIGURE 15-15  nqu re compares two workbooks.

How does Inquire show the relationships between cell formulas?

To ustrate how Inqu re d sp ays ce re at onsh ps, return to the NPVaud t x sx fi e If you want to ook
at the ce re at onsh ps nvo v ng ce B15, p ace your cursor n ce B15 and se ect Cell Relationship;
choose Trace Both to d sp ay both the dependents and precedents of ce B15 The resu t ng d agram
s shown n F gure 15-16

FIGURE 15-16  Th s figure shows the ce re at onsh ps nvo v ng ce B15.

How does Inquire show the relationships between worksheets?

When a workbook nvo ves mu t p e worksheets, t s often d fficu t to understand how the work-
sheets are re ated The Inqu re add- n makes t easy to determ ne how worksheets are re ated
To ustrate how Inqu re sheds ght on the re at onsh p between two worksheets, reopen the
Aud ttwosheetstemp x sx fi e and se ect Worksheet Relationships from the Inqu re r bbon tab

The Aud t ng too and nqu re add n   Chapter 15   137


F gure 15-17 shows the resu ts From F gure 15-17, t s apparent that nformat on from the Data work-
sheet s needed to compute the resu ts n the Profit worksheet

FIGURE 15-17  nqu re shows re at onsh ps between worksheets.

Problems
1. In the car NPV examp e, determ ne the fo ow ng

• The d rect dependents and a dependents of the nterest rate


• The d rect dependents and a dependents of the tax rate
• The d rect precedents and a precedents for Year 4 un t sa es
• The d rect precedents and a precedents for Year 3 costs
2. For the Prodm x x sx fi e, determ ne

• The precedents of profit


• The dependents of amount of Product 1 produced
3. In the Prodm x x sx fi e, use the Inqu re add- n to d agram the dependents of Product 1
produced

4. In the Prodm x x sx fi e, use the Inqu re add- n to d agram the precedents of profit

138  Chapter 15  The Aud t ng too and nqu re add n


CHAPTER 16

Sensitivity analysis with data tables

Questions answered in this chapter:


■ I’m th nk ng of start ng a store n the oca ma to se gourmet emonade Before open ng the
store, I’m cur ous about how my profit, revenue, and var ab e costs w depend on the pr ce I
charge and the un t cost

■ I ntend to bu d a new house The amount of money I need to borrow (w th a 15-year repay-
ment per od) depends on the pr ce for wh ch I se my current house I’m a so unsure about
the annua nterest rate I’ rece ve when I c ose Can I determ ne how my month y payments
w depend on the amount borrowed and the annua nterest rate?

■ A major Internet company s th nk ng of purchas ng another on ne reta er The reta er’s


current annua revenues are $100 m on, w th expenses of $150 m on Current project ons
nd cate that the reta er’s revenues are grow ng at 25 percent per year, and ts expenses are
grow ng at 5 percent per year You know project ons m ght be n error, however, and wou d
ke to know, for a var ety of assumpt ons about annua revenue and expense growth, the
number of years before the reta er w show a profit

Most worksheet mode s conta n assumpt ons about certa n parameters or nputs to the mode In the
emonade examp e, the nputs nc ude

■ The pr ce for wh ch a g ass of emonade s so d

■ The un t cost of produc ng a g ass of emonade

■ The sens t v ty of demand for emonade to pr ce charged

■ The annua fixed cost of runn ng a emonade stand

Based on nput assumpt ons, you can compute outputs of nterest For the emonade examp e, the
outputs of nterest m ght nc ude

■ Annua profit

■ Annua revenue

■ Annua var ab e cost

Desp te best ntent ons, assumpt ons about nput va ues can be n error For examp e, your best
guess about the var ab e cost of produc ng a g ass of emonade m ght be $0 45, but t’s poss b e

139

that your assumpt on s n error Sensitivity analysis determ nes how a spreadsheet’s outputs vary n
response to changes to ts nputs For examp e, you m ght want to see how a change n product pr ce
affects year y profit, revenue, and var ab e cost W th a data tab e n M crosoft Exce 2013, you can
eas y vary one or two nputs and perform a sens t v ty ana ys s W th a one-way data tab e, you can
determ ne how chang ng one nput changes any number of outputs W th a two-way data tab e, you
can determ ne how chang ng two nputs changes a s ng e output Th s chapter’s three examp es show
how easy t s to use a data tab e and obta n mean ngfu sens t v ty resu ts

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

I’m thinking of starting a store in the local mall to sell gourmet lemonade. Before opening the
store, I’m curious about how my profit, revenue, and variable costs will depend on the price I
charge and the unit cost.

The work requ red for th s ana ys s s n the Lemonade x sx fi e (See F gure 16-1, F gure 16-2, and
F gure 16-4 ) The nput assumpt ons are g ven n the D1 D4 range Assume that annua demand for
emonade (see the formu a n ce D2) equa s 65000–9000*pr ce (Chapter 83, “Est mat ng a demand
curve,” conta ns a d scuss on of how to est mate a demand curve ) The names created n C1 C7 cor-
respond to ce s D1 D7

Annua revenue was computed n ce D5 w th the demand*pr ce formu a In ce D6, the annua
var ab e cost was computed w th the un t cost*demand formu a F na y, n ce D7, profit was com-
puted by us ng the revenue – fixed cost – var ab e cost formu a

FIGURE 16-1  These are the nputs that change the profitab ty of a emonade store.

Suppose that you want to know how changes n pr ce (for examp e, from $1 00 through $4 00
n $0 25 ncrements) affect annua profit, revenue, and var ab e cost Because you’re chang ng on y
one nput, a one-way data tab e w so ve the prob em The data tab e s shown n F gure 16-2

To set up a one-way data tab e, beg n by st ng nput va ues n a co umn The pr ces of nterest
(rang ng from $1 00 through $4 00 n $0 25 ncrements) are sted n the C11 C23 range Next, move
over one co umn and up one row from the st of nput va ues, and there the formu as are sted that
you want the data tab e to ca cu ate The formu a for profit s entered n ce D10, the formu a for
revenue n ce E10, and the formu a for var ab e cost n ce F10

140  Chapter 16  Sens t v ty ana ys s w th data tab es


FIGURE 16-2  Th s s a one way data tab e w th vary ng pr ces.

Now se ect the tab e range (C10 F23) The tab e range beg ns one row above the first nput; ts
ast row s the row conta n ng the ast nput va ue The first co umn n the tab e range s the co umn
conta n ng the nputs; ts ast co umn s the ast co umn conta n ng an output After se ect ng the tab e
range, c ck the Data tab on the r bbon In the Data Tools group, choose What-If Analysis and then
choose Data Table Now fi n the Data Table d a og box as shown n F gure 16-3

FIGURE 16-3  Create a data tab e.

For the co umn nput ce , you use the ce n wh ch you want the sted nputs—that s, the va ues
sted n the first co umn of the data tab e range—to be ass gned Because the sted nputs are pr ces,
you can choose D1 as the co umn nput ce After you c ck OK, Exce creates the one-way data tab e
shown n F gure 16-4

FIGURE 16-4  Th s s a one way data tab e w th vary ng pr ces.

In the D11 F11 range, profit, revenue, and var ab e cost are computed for a pr ce of $1 00 In ce s
D12 F12, profit, revenue, and var ab e cost are computed for a pr ce of $1 25 and on through the
range of pr ces The profit-max m z ng pr ce among a sted pr ces s $3 75 A pr ce of $3 75 wou d

Sens t v ty ana ys s w th data tab es  Chapter 16   141


produce an annua profit of $58,125 00, annua revenue of $117,187 50, and an annua var ab e cost of
$14,062 50

Suppose you want to determ ne how annua profit var es as pr ce var es from $1 50 through $5 00
( n $0 25 ncrements) and un t cost var es from $0 30 through $0 60 ( n $0 05 ncrements) Because
you’re chang ng two nputs here, you need a two-way data tab e (See F gure 16-5 ) L st the va ues for
one nput down the first co umn of the tab e range (use the H11 H25 range for the pr ce va ues) and
the va ues for the other nput n the first row of the tab e range (In th s examp e, the I10 O10 range
ho ds the st of un t cost va ues ) A two-way data tab e can have on y one output ce , and the formu a
for the output must be p aced n the upper- eft corner of the tab e range Therefore, p ace the profit
formu a n ce H10

FIGURE 16-5  A two way data tab e shows profit as a funct on of pr ce and un t var ab e cost.

Se ect the tab e range (ce s H10 O25) and c ck the Data tab In the Data Tools group, choose
What-If Analysis and then se ect Data Table Ce D1 (pr ce) s the co umn nput ce , and ce D3
(un t var ab e cost) s the row nput ce These sett ngs ensure that the va ues n the first co umn of
the tab e range are used as pr ces, and the va ues n the first row of the tab e range are used as un t
var ab e costs After c ck ng OK, you see the two-way data tab e shown n F gure 16-5 As an exam-
p e, n ce K19, when you charge $3 50 and the un t var ab e cost s $0 40, the annua profit equa s
$58,850 00 For each un t cost, the profit-max m z ng pr ce has been h gh ghted Note that as the un t
cost ncreases, the profit-max m z ng pr ce ncreases because some of the cost ncrease s passed on
to customers Of course, you can on y guarantee that the profit-max m z ng pr ce n the data tab e s
w th n $0 25 of the actua profit-max m z ng pr ce When you earn about Exce So ver n Chapter 83,
you earn how to determ ne (to the penny) the exact profit-max m z ng pr ce

Here are some other notes on th s prob em

■ As you change nput va ues n a worksheet, the va ues ca cu ated by a data tab e change, too
For examp e, f you ncreased fixed cost by $10,000, a profit numbers n the data tab e wou d
be reduced by $10,000

■ You can’t de ete or ed t a port on of a data tab e If you want to save the va ues n a data tab e,
se ect the tab e range, copy the va ues, and then r ght-c ck and se ect Paste Special Choose
Values from the Paste Special menu If you take th s step, however, changes to your work-
sheet nputs no onger cause the data tab e ca cu at ons to update

142  Chapter 16  Sens t v ty ana ys s w th data tab es


■ When sett ng up a two-way data tab e, be carefu not to m x up your row and co umn nput
ce s A m x-up w cause nonsens ca resu ts

■ Most peop e set the r worksheet ca cu at on mode to Automat c W th th s sett ng, any change
n your worksheet w cause a your data tab es to be reca cu ated Usua y, you want th s, but
f your data tab es are arge, automat c reca cu at on can be ncred b y s ow If the constant
reca cu at on of data tab es s s ow ng your work down, c ck the File tab on the r bbon, choose
Options, and then c ck the Formulas tab Se ect Automatic Except For Data Tables When
Automat c Except For Data Tab es s se ected, a your data tab es reca cu ate on y when you
press the F9 (reca cu at on) key A ternat ve y, you can c ck the Calculation Options button
( n the Calculation group on the Formulas tab) and then choose Automatic Except For
Data Tables

I intend to build a new house. The amount of money I need to borrow (with a 15-year repay-
ment period) depends on the price for which I sell my current house. I’m also unsure about
the annual interest rate I’ll receive when I close. Can I determine how my monthly payments
will depend on the amount borrowed and the annual interest rate?

The rea power of data tab es becomes ev dent when you comb ne a data tab e w th one of the Exce
funct ons In th s examp e, you use a two-way data tab e to vary two nputs (the amount borrowed
and the annua nterest rate) to the Exce PMT funct on and determ ne how the month y payment var-
es as these nputs change (The PMT funct on s d scussed n deta n Chapter 9, “More Exce financ a
funct ons ”) The work for th s examp e s n the Mortgagedt x sx fi e, shown n F gure 16-6

Suppose you’re borrow ng money on a 15-year mortgage, for wh ch month y payments are made
at the end of each month Input the amount borrowed n ce D2, the number of months n the
mortgage (180) n D3, and annua nterest rate n D4 Assoc ate the range names n ce s C2 C4 w th
ce s D2 D4 Based on these nputs, compute the month y payment n D5 w th the -PMT(Annua nt
rate/12,Number of Months,Amt Borrowed) formu a

FIGURE 16-6  You can use a data tab e to determ ne how mortgage payments vary as the amount borrowed and
the nterest rate change.

You th nk that the amount borrowed w range (depend ng on the pr ce for wh ch you se your
current house) between $300,000 and $650,000 and that your annua nterest rate w range between
5 percent and 8 percent In preparat on for creat ng a data tab e, enter the amounts borrowed n the
C8 C15 range and poss b e nterest rate va ues n the D7 J7 range Ce C7 conta ns the output you
want to reca cu ate for var ous nput comb nat ons Therefore, set ce C7 equa to ce D5 Se ect the

Sens t v ty ana ys s w th data tab es  Chapter 16   143


tab e range (C7 J15), choose What-If Analysis on the Data tab, and then se ect Data Table Because
numbers n the first co umn of the tab e range are amounts borrowed, the co umn nput ce s D2
Numbers n the first row of the tab e are annua nterest rates, so your row nput ce s D4 After you
c ck OK, you see the data tab e shown n F gure 16-6 Th s tab e shows, for examp e, that f you bor-
row $400,000 at an annua rate of 6 percent, your month y payments wou d be just over $3,375 The
data tab e a so shows that at a ow nterest rate (for examp e, 5 percent), an ncrease of $50,000 n the
amount borrowed ra ses the month y payment by around $395, whereas at a h gh nterest rate (such
as 8 percent), an ncrease of $50,000 n the amount borrowed ra ses the month y payment by about
$478

A major Internet company is thinking of purchasing another online retailer. The retailer’s
current annual revenues are $100 million, with expenses of $150 million. Current projections
indicate that the retailer’s revenues are growing at 25 percent per year, and its expenses are
growing at 5 percent per year. You know projections might be in error, however, and would
like to know, for a variety of assumptions about annual revenue and expense growth, the
number of years before the retailer will show a profit.

You want to determ ne the number of years needed to break even, us ng annua growth rates n rev-
enue from 10 percent through 50 percent and annua expense growth rates from 2 percent through
20 percent Assume a so that f the firm cannot break even n 13 years, you’ say t cannot break even
Your work s n the Bezos x sx fi e, shown n F gure 16-7 and F gure 16-8

H de co umns A and B and rows 16–18 To h de co umns A and B, first se ect any ce s n co umns A
and B (or se ect the co umn head ngs) and then c ck the Home tab In the Cells group, c ck Format,
po nt to Hide & Unhide, and se ect Hide Columns To h de rows 16–18, se ect any ce s n those rows
(or se ect the row head ngs) and repeat the prev ous procedure, se ect ng Hide Rows The Format
V s b ty opt ons a so nc ude Unh de Rows and Unh de Co umns If you rece ve a worksheet w th
many h dden rows and co umns and want to d sp ay a of them qu ck y, you can se ect the ent re
worksheet by c ck ng the Select All button at the ntersect on of the co umn and row head ngs Now
se ect ng Unh de Rows or Unh de Co umns w d sp ay a h dden rows or co umns n the worksheet

In row 11, project the firm’s revenue out 13 years (based on the annua revenue growth
rate assumed n E7) by copy ng the E11*(1+$E$7) formu a from F11 to G11 R11 In row 12, project the
firm’s expenses out 13 years (based on the annua expense growth rate assumed n E8) by copy ng the
E12*(1+$E$8) formu a from F12 to G12 R12 (See F gure 16-7 )

FIGURE 16-7  You can use a data tab e to ca cu ate how many years t w take to break even.

144  Chapter 16  Sens t v ty ana ys s w th data tab es


You wou d ke to use a two-way data tab e to determ ne how vary ng the growth rates for rev-
enues and expenses affects the years needed to break even You need one ce whose va ue a ways
te s you the number of years needed to break even Because you can break even dur ng any of the
next 13 years, th s m ght seem ke a ta order

Beg n by us ng an IF statement for each year n row 13 to determ ne whether you break even dur-
ng the year The IF statement returns the number of the year f you break even dur ng the year or 0
otherw se Determ ne the year you break even n ce E15 by add ng a the numbers n row 13 F na y,
you can use ce E15 as the output ce for a two-way data tab e

Copy the IF(AND(E11<E12,F11>F12),F10,0) formu a from ce F13 to G13 R13 Th s formu a shows
that you break even for the first t me dur ng a year f, and on y f, dur ng the prev ous year, revenues
are ess than expenses and, dur ng the current year, revenues are greater than expenses If th s s the
case, the year number s entered n row 13; otherw se, 0 s entered

Now, n ce E15, you can determ ne the break even year ( f any) w th the IF(SUM(F13 R13)>0,SUM
(F13 R13),”No BE”) formu a If you do not break even dur ng the next 13 years, the formu a returns the
“No BE” text str ng

Now, enter the annua revenue growth rates (10 percent through 50 percent) n the E21 E61 range
Enter annua expense growth rates (2 percent to 20 percent) n the F20 X20 range Ensure that the
year-of-break even formu a s cop ed to ce E20 w th the =E15 formu a Se ect the E20 X61 tab e
range, c ck What-If Analysis on the Data tab, and then choose Data Table Se ect ce E7 (revenue
growth rate) as the co umn nput ce and ce E8 (expense growth rate) as the row nput ce W th
these sett ngs, you obta n the two-way data tab e shown n F gure 16-8

FIGURE 16-8  Th s figure shows a two way data tab e.

Note, for examp e, that f expenses grow at 4 percent a year, a 10-percent annua growth n rev-
enue w resu t n break ng even n e ght years, whereas a 50-percent annua growth n revenue w
resu t n break ng even n on y two years! A so note that f expenses grow at 12 percent per year and
revenues grow at 14 percent per year, you w not break even by the end of 13 years

Sens t v ty ana ys s w th data tab es  Chapter 16   145


Problems
1. You’ve been ass gned to ana yze the profitab ty of B C nton’s autob ography The fo ow ng
assumpt ons have been made

• B s rece v ng a one-t me roya ty payment of $12 m on


• The fixed cost of produc ng the hardcover vers on of the book s $1 m on

• The var ab e cost of produc ng each hardcover book s $4


• The pub sher’s net from book sa es per hardcover un t so d s $15
• The pub sher expects to se 1 m on hardcover cop es
• The fixed cost of produc ng the paperback s $100,000
• The var ab e cost of produc ng each paperback book s $1
• The pub sher’s net from book sa es per paperback un t so d s $4
• Paperback sa es w be doub e hardcover sa es
Use th s nformat on to answer the fo ow ng quest ons

• How w the pub sher’s before-tax profit vary as hardcover sa es vary from 100,000
through 1 m on cop es?

• How does the pubsher’s before-tax profit vary as hardcover sa es vary from 100,000
through 1 m on cop es and the rat o of paperback sa es to hardcover sa es var es from 1
through 2 4?

2. The annua demand for a product equa s 500 - 3p + 10a 5 where p s the pr ce of the product
n do ars and a s hundreds of do ars spent on advert s ng the product The annua fixed cost
of se ng the product s $10,000, and the un t var ab e cost of produc ng the product s $12
Determ ne a pr ce (w th n $10) and amount of advert s ng (w th n $100) that max m zes profit

3. Recons der your hedg ng examp e from Chapter 11, “IF statements ” For stock pr ces n s x
months that range from $20 through $65 and the number of puts purchased var es from 0
through 100 ( n ncrements of 10), determ ne the percentage return on your portfo o

4. For your mortgage examp e, suppose you know the annua nterest rate w be 5 5 percent
Create a tab e that shows the d fference n payments among a 15-year, 20-year, and 30-year
mortgage for amounts borrowed from $300,000 through $600,000 ( n $50,000 ncrements)

5. Current y, you se 40,000 un ts of a product for $45 each The un t var ab e cost of produc ng
the product s $5 You are th nk ng of cutt ng the product pr ce by 30 percent You are sure
th s w ncrease sa es by an amount from 10 percent through 50 percent Perform a sens t v-
ty ana ys s to show how profit w change as a funct on of the percentage ncrease n sa es
Ignore fixed costs

146  Chapter 16  Sens t v ty ana ys s w th data tab es


6. Assume that at the end of each of the next 40 years, you put the same amount n your ret re-
ment fund and earn the same nterest rate each year Show how the amount of money you
w have at ret rement changes as you vary your annua contr but on from $5,000 through
$25,000 and the rate of nterest var es from 3 percent through 15 percent

7. The payback period for a project s the number of years needed for a project’s future profits to
pay back the project’s n t a nvestment A project requ res a $300 m on nvestment at T me
0 The project y e ds profit for 10 years, and T me 1 cash flow w be between $30 m on and
$100 m on Annua cash flow growth w be from 5 percent through 25 percent a year How
does the project payback depend on the Year 1 cash flow and cash flow growth rates?

8. A software deve opment company s th nk ng of trans at ng a software product nto Swah


Current y, 200,000 un ts of the product are so d per year at a pr ce of $100 each Un t var -
ab e cost s $20 The fixed cost of trans at on s $5 m on Trans at ng the product nto Swah
w ncrease sa es dur ng each of the next three years by some unknown percentage over the
current eve of 200,000 un ts Show how the change n profit resu t ng from the trans at on
depends on the percentage ncrease n product sa es You can gnore the t me va ue of money
and taxes n your ca cu at ons

9. The C tyd stances x sx fi e g ves at tude and ong tude for severa US c t es It a so has a for-
mu a that determ nes the d stance between two c t es by us ng a g ven at tude and ong tude
Create a tab e that computes the d stance between any pa r of c t es sted

10. You have begun sav ng for your ch d’s co ege educat on You p an to save $5,000 per year
and want to know the amount of money you w have n the co ege fund for annua rates of
return on your nvestment from 4 percent through 12 percent after sav ng for 10–15 years

11. If you earn nterest at percentage rate r per year and compound your nterest n t mes per
year, then n y years, $1 w grow to (1 + (r/n))ny do ars Assum ng a 10 percent annua nterest
rate, create a tab e show ng the factor by wh ch $1 w grow n 5–15 years for da y, month y,
quarter y, and sem annua compound ng

12. Assume you have $100 n the bank Each year, you w thdraw x percent (rang ng from 4 percent
through 10 percent) of your or g na ba ance For annua growth rates of 3 percent through
10 percent per year, determ ne how many years t w take before you run out of money H nt
You shou d use the IFERROR funct on (d scussed n Chapter 11) because f your annua growth
rate exceeds the w thdrawa rate, you w never run out of money

13. If you earn nterest at an annua rate of x percent per year, n n years, $1 w
become (1 + x­)n­
do ars For annua rates of nterest from 1 percent through 20 percent, determ ne exact y
when ( n years) $1 w doub e

14. You are borrow ng $200,000 and mak ng payments at the end of each month For an annua
nterest rate rang ng from 5 percent through 10 percent and oan durat ons of 10, 15, 20, 25,
and 30 years, determ ne the tota nterest pa d on the oan

Sens t v ty ana ys s w th data tab es  Chapter 16   147


15. You are sav ng for your ch d’s co ege fund You w contr bute the same amount of money to
the fund at the end of each year Your goa s to end up w th $100,000 For annua nvestment
returns rang ng from 4 percent through 15 percent and number of years nvest ng vary ng
from 5–15 years, determ ne your requ red annua contr but on

16. The Ant trustdata x sx fi e g ves the start ng and end ng years for many court cases Determ ne
the number of court cases act ve dur ng each year

17. You can ret re at age 62 and rece ve $8,000 per year or ret re at age 65 and rece ve $10,000
per year What s the d fference ( n today’s do ars) between these two cho ces as you vary the
annua rate at wh ch you d scount cash flows between 2 percent and 10 percent and vary age
of death between 70 and 84?

148  Chapter 16  Sens t v ty ana ys s w th data tab es


C HAP TE R 17

The Goal Seek command

Questions answered in this chapter:


■ For a g ven pr ce, how many g asses of emonade does a emonade store need to se per year
to break even?

■ We want to pay off our mortgage n 15 years The annua nterest rate s 6 percent The bank
to d us we can afford month y payments of $2,000 How much can we borrow?

■ I a ways had troub e w th story prob ems n h gh schoo a gebra Can Exce make so v ng story
prob ems eas er?

The Goa Seek feature n M crosoft Exce 2013 enab es you to compute a va ue for a worksheet nput
that makes the va ue of a g ven formu a match the goa you spec fy For examp e, n the emonade
store examp e n Chapter 16, “Sens t v ty ana ys s w th data tab es,” suppose you have fixed overhead
costs, fixed per-un t costs, and a fixed sa es pr ce G ven th s nformat on, you can use Goa Seek to
ca cu ate the number of g asses of emonade you need to se to break even Essent a y, Goa Seek
embeds a powerfu equat on so ver n your worksheet To use Goa Seek, you need to prov de Exce
w th three p eces of nformat on

■ Set Cell  Spec fies that the ce conta ns the formu a that ca cu ates the nformat on you’re
seek ng In the emonade examp e, Set Ce wou d conta n the formu a for profit

■ To Value  Spec fies the numer ca va ue for the goa that’s ca cu ated n Set Ce In the em-
onade examp e, because you want to determ ne the sa es vo ume that represents the break-
even po nt, To Va ue wou d be 0

■ By Changing Cell  Spec fies the nput ce that Exce changes unt Set Ce ca cu ates the goa
defined n the To Va ue ce In the emonade examp e, By Chang ng Ce wou d conta n annua
emonade sa es

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

149

For a given price, how many glasses of lemonade does a lemonade store need to sell per year
to break even?

The work for th s sect on s n the Lemonadegs x sx fi e, wh ch s shown n F gure 17-1 As n


Chapter 16, assume an annua fixed cost of $45,000 00 and a var ab e un t cost of $0 45 Assume
a pr ce of $3 00 The quest on s how many g asses of emonade do you need to se each year to
break even

FIGURE 17-1  Use th s data to set up the Goa Seek feature to perform a break even ana ys s.

To start, nsert any number for demand n ce D2 In the What-If Analysis group on the Data tab,
c ck Goal Seek Now fi n the Goa Seek d a og box as shown n F gure 17-2

FIGURE 17-2  The Goa Seek d a og box s fi ed n w th entr es for a break even ana ys s.

The d a og box nd cates that you want to change ce D2 (annua demand, or sa es) unt ce D7
(profit) h ts a va ue of 0 After you c ck OK, you get the resu t that’s shown n F gure 17-1 If you se
approx mate y 17,647 g asses of emonade per year (or 48 g asses per day), you’ break even To find
the va ue you’re seek ng, Exce var es the demand n ce D2 (a ternat ng between h gh and ow va ues)
unt t finds a va ue that makes profit equa $0 If a prob em has more than one so ut on, Goa Seek
w st d sp ay on y one answer

We want to pay off our mortgage in 15 years. The annual interest rate is 6 percent. The bank
told us we can afford monthly payments of $2,000. How much can we borrow?

You can beg n to answer th s quest on by sett ng up a worksheet to compute the month y payments
on a 15-year oan (assume payments at the end of the month) as a funct on of the annua nterest rate
and a tr a oan amount Look at the work done n the Paymentgs x sx fi e and n F gure 17-3

In ce E6, the –PMT(annua nt rate/12,years,amt borrowed) formu a computes the month y pay-
ment assoc ated w th the amount borrowed, wh ch s sted n ce E5 F ng n the Goa Seek d a og
box as shown n F gure 17-4 ca cu ates the amount borrowed that resu ts n month y payments equa
to $2,000 W th a m t of $2,000 for month y payments, you can borrow up to $237,007 03

150  Chapter 17  The Goa Seek command


FIGURE 17-3  You can use data such as th s w th the Goa Seek feature to determ ne the amount you can borrow
based on a set month y payment.

FIGURE 17-4  The Goa Seek d a og box s set up to ca cu ate the mortgage examp e.

I always had trouble with story problems in high school algebra. Can Excel make solving story
problems easier?

If you th nk back to h gh schoo a gebra, most story prob ems requ red you to choose a var ab e ( t
was usua y ca ed x) that so ved a part cu ar equat on Goa Seek s an equat on so ver, so t’s perfect y
su ted to so v ng story prob ems Here’s a typ ca h gh schoo a gebra prob em

Maria and Edmund have a lover’s quarrel while honeymooning in Seattle. Maria storms into her
Mazda Miata and drives 64 miles per hour toward her mother’s home in Los Angeles. Two hours
after Maria leaves, Edmund jumps into his BMW in hot pursuit, driving 80 miles per hour. How
many miles will each person have traveled when Edmund catches Maria?

You can find the so ut on n the Mar a x sx fi e, shown n F gure 17-5

FIGURE 17-5  Goa Seek can he p you so ve story prob ems.

Set Ce w be the d fference between the d stances Mar a and Edmund have trave ed You can
set th s to a va ue of 0 by chang ng the number of hours Mar a dr ves Of course, Edmund dr ves two
hours ess than Mar a

Enter a tr a number of hours that Mar a dr ves n ce D2 Assoc ate the range names n the
C2 C8 ce range w th ce s D2 D8 Because Edmund dr ves two fewer hours than Mar a, enter the
T me Mar a dr ves–2 formu a n ce D4 In ce s D6 and D7, use the fact that distance = speed*time
to compute the tota d stance Mar a and Edmund trave The d fference between the d stances s

The Goa Seek command  Chapter 17   151


computed n ce D8 w th the Mar a d stance–Edmund d stance formu a Now you can fi n the Goa
Seek d a og box as shown n F gure 17-6

FIGURE 17-6  The Goa Seek d a og box s fi ed n to so ve an a gebra story prob em.

Change Mar a’s hours of dr v ng (ce D2) unt the d fference between the m es each trave s (ce
D8) equa s 0 As you can see, after Mar a dr ves 10 hours and Edmund 8 hours, they w each have
dr ven a d stance of 640 m es

Problems
1. From Prob em 1 n Chapter 16, determ ne how many hardcover books must be so d to
break even

2. From the car net present va ue (NPV) examp e n Chapter 15, “The aud t ng too and Inqu re
add- n,” by what rate do annua sa es need to grow for tota NPV to equa $1 m on?

3. What va ue of Year 1 un t cost wou d ncrease your NPV n the car examp e n Chapter 15 to
$1 m on?

4. In your mortgage examp e, suppose you need to borrow $200,000 for 15 years If your max -
mum payments are m ted to $2,000 per month, how h gh an annua nterest rate can you
to erate?

5. How cou d you use Goa Seek to determ ne a project’s nterna rate of return (IRR)?

6. At the end of each of the next 40 years, you w put $20,000 n your ret rement fund What
rate of return on your nvestments do you need to have $2 m on ava ab e for ret rement n
40 years?

7. You expect to earn 10 percent per year on your ret rement nvestments At the end of each of
the next 40 years, you want to put the same amount of money n your ret rement portfo o
How much money do you need to put n each year to have $2 m on n your account when
you ret re?

152  Chapter 17  The Goa Seek command


CHAPTER 18

Using the Scenario Manager for


sensitivity analysis

Question answered in this chapter:


■ I’d ke to create best, worst, and most ke y scenar os for a firm’s sa es of an automob e
mode by vary ng the va ues of Year 1 sa es, annua sa es growth, and Year 1 sa es pr ce Data
tab es for sens t v ty ana ys s enab e me to vary on y one or two nputs, so I can’t use a data
tab e Does Exce have a too I can use to vary more than two nputs n a sens t v ty ana ys s?

You can use the Scenar o Manager to perform sens t v ty ana ys s by vary ng as many as 32 nput
ce s W th the Scenar o Manager, you first define the set of nput ce s you want to vary Name your
scenar o and enter the va ue of each nput ce for each scenar o F na y, se ect the output ce s (a so
ca ed result cells) that you want to track The Scenar o Manager then creates a beaut fu report con-
ta n ng the nputs and the va ues of the output ce s for each scenar o

Answer to this chapter’s question


Th s sect on prov des the answer to the quest on that s sted at the beg nn ng of the chapter

I’d like to create best, worst, and most likely scenarios for a firm’s sales of an automobile
model by varying the values of Year 1 sales, annual sales growth, and Year 1 sales price. Data
tables for sensitivity analysis enable me to vary only one or two inputs, so I can’t use a data
table. Does Excel have a tool I can use to vary more than two inputs in a sensitivity analysis?

Suppose you want to create the fo ow ng three scenar os re ated to the net present va ue (NPV) of a
car, us ng the examp e n Chapter 15, “The Aud t ng too and Inqu re add- n ”

Year 1 sales Annual sales growth Year 1 sales price


Best case $20,000 20% $10.00
Most ke y case $10,000 10% $7.50
Worst case $5,000 2% $5.00

For each scenar o, you want to ook at the firm’s NPV and each year’s after-tax profit The work s
n the NPVaud tscenar o x sx fi e F gure 18-1 shows the worksheet mode (conta ned n the Or g na

155

Mode worksheet), and F gure 18-2 shows the scenar o report (conta ned n the Scenar o Summary
worksheet)

FIGURE 18-1  Th s s the data on wh ch the scenar os are based.

FIGURE 18-2  Th s s the scenar o summary report.

To beg n defin ng the best-case scenar o, c ck the Data tab and then choose Scenario Manager
n the What-If Analysis menu n the Data Tools group C ck the Add button and fi n the Add
Scenario d a og box as shown n F gure 18-3

FIGURE 18-3  These are the data nputs for the best case scenar o.

156  Chapter 18  Us ng the Scenar o Manager for sens t v ty ana ys s


Enter a name for the scenar o (Best) and se ect C2 C4 as the nput ce s conta n ng the va ues that
define the scenar o After you c ck OK n the Add Scenario d a og box, fi n the Scenario Values
d a og box w th the nput va ues that define the best case, as shown n F gure 18-4

FIGURE 18-4  Define the nput va ues for the best case scenar o.

When you c ck Add n the Scenario Values d a og box, you can enter the data for the most- ke y
and worst-case scenar os After enter ng data for a three scenar os, c ck OK n the Scenario Values
d a og box The Scenario Manager d a og box, shown n F gure 18-5, sts the scenar os you created
When you c ck Summary n the Scenario Manager d a og box, you can choose the resu t ce s that
w be d sp ayed n scenar o reports F gure 18-6 shows how you nd cated that you want the sce-
nar o summary report n the Scenar o Summary d a og box to track each year’s after-tax profit (ce s
B17 F17) as we as tota NPV (ce B19)

FIGURE 18-5  The Scenar o Manager d a og box d sp ays each scenar o you define.

FIGURE 18-6  Use the Scenar o Summary d a og box to se ect the resu t ce s for the summary report.

Because the resu t ce s come from more than one range, you can separate the B17 F17 and B19
ranges w th a comma (You cou d a so have pressed the Ctr key to se ect and enter mu t p e ranges )
After se ect ng Scenario Summary ( nstead of P votTab e), c ck OK, and Exce creates the beaut fu

Us ng the Scenar o Manager for sens t v ty ana ys s  Chapter 18   157


Scenar o Summary report p ctured ear er, n F gure 18-2 Not ce that Exce nc udes a co umn,
abe ed Current Va ues, for the va ues that were or g na y p aced n the worksheet The worst case
oses money (a oss of $13,345 75), whereas the best case s qu te profitab e (a profit of $226,892 67)
Because the worst-case pr ce s ess than your var ab e cost, the worst case oses money n each year

Remarks
■ Scenar o P votTab e Report n the Scenar o Summary d a og box presents the scenar o resu ts
n a P votTab e format

■ Suppose you se ect a scenar o n the Scenar o Manager d a og box and then c ck the Show
button The nput ce s’ va ues for the se ected scenar o then appear n the worksheet, and
Exce reca cu ates a formu as Th s too s great for present ng a s de show of your scenar os

■ It’s hard to create a ot of scenar os w th the Scenar o Manager because you need to nput
each nd v dua scenar o’s va ues Monte Car o s mu at on (see Chapter 73, “Introduct on to
Monte Car o s mu at on”) makes t easy to create many scenar os When you use the Monte
Car o s mu at on method, you can find nformat on such as the probab ty that the NPV of a
project’s cash flows s nonnegat ve—an mportant measure because t s the probab ty that
the project adds va ue to the company

■ C ck ng the m nus (–) s gn n row 5 of the Scenar o Summary report h des the Assumpt on
ce s and shows on y resu ts C ck ng the p us (+) s gn restores the fu report

■ Suppose you send a fi e to severa peop e, and each adds h s own scenar os After each person
returns the fi e conta n ng the scenar os to you, you can merge a the scenar os nto one
workbook by open ng each person’s vers on of the workbook, c ck ng the Merge button n
the Scenario Manager d a og box n the or g na workbook, and then se ect ng the work-
books conta n ng the scenar os you want to merge Exce merges the se ected scenar os n the
or g na workbook

Problems
1. De ete the best-case scenar o and run another scenar o report

2. Add a scenar o named H gh Pr ce, n wh ch Year 1 pr ce equa s $15, and the other two nputs
rema n at the r most- ke y va ues

158  Chapter 18  Us ng the Scenar o Manager for sens t v ty ana ys s


CHAPTER 19

The COUNTIF, COUNTIFS, COUNT,


COUNTA, and COUNTBLANK
functions

Questions answered in this chapter:


■ Suppose I have a st of songs that were p ayed on the rad o For each song, I know the s nger,
the date the song was p ayed, and the ength of the song How can I answer quest ons such as
these about the songs n the st

• How many were sung by each s nger?


• How many were not sung by my favor te s nger?
• How many were at east four m nutes ong?
• How many were onger than the average ength of a songs on the st?
• How many were sung by s ngers whose ast names beg n w th S?
• How many were sung by s ngers whose ast names conta n exact y s x etters?
• How many were p ayed after June 15, 2005?
• How many were p ayed before 2009?
• How many were exact y four m nutes ong?
• How many were sung by my favor te s nger and were exact y four m nutes ong?
• How many were sung by my favor te s nger and were three to four m nutes ong?
■ In a more genera context, how can I perform operat ons such as the fo ow ng

• Count the number of ce s n a range conta n ng numbers


• Count the number of b ank ce s n a range
• Count the number of nonb ank ce s n a range

161

You often need to count the number of ce s n a range that meet a g ven cr ter on For examp e,
f a worksheet conta ns nformat on about makeup sa es, you m ght want to count the number of
sa es transact ons made by the sa esperson named Jenn fer or the number of sa es transact ons that
occurred after June 10 The COUNTIF funct on enab es you to count the number of ce s, n a range
that meet cr ter a that are defined based on one row or co umn of the worksheet

The syntax of the COUNTIF funct on s COUNTIF(range,cr ter on)

■ Range s the range of ce s n wh ch you want to count ce s meet ng a g ven cr ter on

■ Cr ter on s a number, date, or express on that determ nes whether to count a g ven ce n
the range

The syntax of COUNTIFS s COUNTIFS(range1,cr ter on1,range2,cr ter on2,…,range n,cr ter on n)

COUNTIFS counts the number of rows for wh ch the range1 entry meets cr ter on1, the range2
entry meets cr ter on2, the range n entry meets cr ter on n, and so on Thus, COUNTIFS a ows the
cr ter a to nvo ve more than one co umn or mu t p e cond t ons n one co umn Other funct ons
that a ow for mu t p e cr ter a are d scussed n Chapter 20, “The SUMIF, AVERAGEIF, SUMIFS, and
AVERAGEIFS funct ons,” and Chapter 48, “Summar z ng data w th database stat st ca funct ons ”

The key to us ng the COUNTIF funct on (and s m ar funct ons) successfu y s understand ng
the w de var ety of cr ter a that M crosoft Exce accepts The types of cr ter a you can use are best
exp a ned through the use of examp es In add t on to examp es of the COUNTIF funct on, th s chapter
prov des examp es of the COUNT, COUNTA, and COUNTBLANK funct ons

■ The COUNT funct on counts the number of ce s n a range conta n ng numbers

■ The COUNTA funct on counts the number of nonb ank ce s n a range

■ The COUNTBLANK funct on counts the number of b ank ce s n a range

As an ustrat on of how to use these funct ons, cons der a database (Rock x sx fi e) that g ves the
fo ow ng nformat on for each song p ayed on rad o stat on WKRP

■ The s nger

■ The date the song was p ayed

■ The ength of the song

F gure 19-1 shows a subset of the data

162  Chapter 19  The COUNT F, COUNT FS, COUNT, COUNTA, and COUNTBLANK funct ons
FIGURE 19-1  Th s s the song database used for the COUNTIF examp es.

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

How many songs were sung by each singer?

To beg n, se ect the first row of the database, the D6 G6 range Se ect the who e database by press-
ng Ctr +Sh ft+down arrow In the Defined Names group on the Formulas tab, c ck Create From
Selection and then choose Top Row Th s names the D7 D957 range Song Numb, the E7 E957 range
S nger, the F7 F957 range Date, and the G7 G957 range M nutes To determ ne how many songs
were sung by each s nger, copy the COUNTIF(S nger,B5) formu a from C5 to C6 C12 In ce C5, th s
formu a now d sp ays the number of ce s n the S nger range that match the va ue n B5 (Em nem)
The database conta ns 114 songs sung by Em nem S m ar y, Cher sang 112 songs, and so on, as you
can see n F gure 19-2 You cou d a so have found the number of songs sung by Em nem w th the
COUNTIF(S nger,”Em nem”) formu a Note that you must enc ose text such as Em nem n quotat on
marks (““) and that cr ter a are not case sens t ve

FIGURE 19-2 Use COUNTIF to determ ne how many songs were sung by each s nger.

How many songs were not sung by Eminem?

To so ve th s prob em, you need to know that Exce nterprets the character comb nat on <> as “not
equa to ” The COUNTIF(S nger,”<>Em nem”) formu a, entered n ce C15, te s you that 837 songs n
the database were not sung by Em nem, as you can see n F gure 19-3 You must enc ose <>Em nem

The COUNT F, COUNT FS, COUNT, COUNTA, and COUNTBLANK funct ons  Chapter 19   163
n quotat on marks because Exce treats the not-equa -to (<>) character comb nat on as text, and
Em nem s, of course, text You cou d obta n the same resu t by us ng the COUNTIF(S nger,”<>”&B5)
formu a, wh ch uses the ampersand (&) symbo to concatenate the reference to ce B5 and the <>
operator

FIGURE 19-3  You can comb ne the COUNTIF funct on w th the not equa to operator (<>).

How many songs were at least four minutes long?

In ce C16, you can compute the number of songs p ayed that asted at east four m nutes by us ng
the COUNTIF(M nutes,”>=4”) formu a You need to enc ose >=4 n quotat on marks because the
greater-than or equa -to (>=) character comb nat on, ke <>, s treated as text You can see that 477
songs asted at east four m nutes

How many songs were longer than the average length of all songs on the list?

To answer th s quest on, first compute the average ength of a song w th the AVERAGE(M nutes) for-
mu a n ce G5 Then, n ce C17, compute the number of songs that ast onger than the average w th
the COUNTIF(M nutes,”>”&G5) formu a You can refer to another ce ( n th s case, G5) n the cr ter a
by us ng the & character You can see that 477 songs asted onger than average, wh ch matches the
number of songs ast ng at east 4 m nutes These numbers match because t s assumed the ength of
each song was an nteger For a song to ast at east 3 48 m nutes, t has to ast at east 4 m nutes

How many songs were sung by singers whose last names begin with S?

To answer th s quest on, use a w dcard character, the aster sk (*), n the cr ter a An aster sk represents
any sequence of characters Thus, the COUNTIF(S nger,”S*”) formu a n ce C18 p cks up any song
sung by a s nger whose ast name beg ns w th S (The cr ter a are not case sens t ve ) Two hundred
th rty-two songs were sung by s ngers w th ast names that beg n w th S Th s number s s mp y the
tota of the songs sung by Bruce Spr ngsteen and Br tney Spears (103 + 129 = 232)

How many songs were sung by singers whose last names contain exactly six letters?

Th s examp e uses the quest on mark (?) w dcard character The quest on mark matches any charac-
ter Therefore, enter ng the COUNTIF(S nger,”??????”) formu a n ce C19 counts the number of songs
sung by s ngers hav ng s x etters n the r ast name The resu t s 243 (Two s ngers have ast names of
s x characters, Br tney Spears and Em nem, who together sang a tota of 243 songs—129 + 114 = 243 )

164  Chapter 19  The COUNT F, COUNT FS, COUNT, COUNTA, and COUNTBLANK funct ons
How many songs were played after June 15, 2005?

The cr ter a you use w th COUNTIF funct ons hand e dates based on a date’s ser a number (A ater
date s cons dered arger than an ear er date ) The COUNTIF(Date,”>6/15/2005”) formu a n ce C20
te s you that 98 songs were p ayed after June 15, 2005

How many songs were played before 2009?

Here, you want your cr ter a to p ck up a dates on or before December 31, 2008 Enter the
COUNTIF(Date,”<=12/31/2008”) formu a n ce C21 You can see that 951 songs (wh ch turns out to be
a the songs) were p ayed before the start of 2009

How many songs were exactly four minutes long?

In ce C22, compute the number of songs ast ng exact y four m nutes w th the COUNTIF(M nutes,4)
formu a Th s formu a counts the number of ce s n the G7 G957 range conta n ng a 4 As you can
see, 247 songs asted exact y four m nutes In a s m ar fash on, ce C23 shows that 230 songs asted
exact y five m nutes

How many songs played were sung by Bruce Springsteen and were exactly four minutes long?

You want to count each row n wh ch an entry n the S nger co umn s Spr ngsteen and an entry  n the
M nutes co umn s 4 Because th s quest on nvo ves more than one cr ter on, th s s a job for the won-
derfu COUNTIFS funct on Enter the =COUNTIFS(S nger,”Spr ngsteen”,M nutes,4) formu a n ce  C24

Th s formu a counts any row n wh ch S nger s Spr ngsteen and M nutes equa s 4 Bruce
Spr ngsteen sang 24 songs that were exact y four m nutes ong Your favor te Spr ngsteen song m ght
be “Thunder Road,” but that song s more than four m nutes ong Use the funct on w zard to nput
formu as nvo v ng the COUNTIFS funct on Don’t forget that you can paste range names nto your
formu a w th the F3 key

How many songs played were sung by Madonna and were three to four minutes long?

Because you are dea ng w th mu t p e cr ter a, th s s aga n a job for COUNTIFS Enter ng the
­=COUNTIFS(S nger,”Madonna”,M nutes,”<=4”,M nutes,”>=3”) formu a n ce C25 counts a rows n
wh ch Madonna sang a song that was from three to four m nutes ong These are exact y the rows you
want to count It turns out that Madonna sang 70 songs that were from three to four m nutes ong
(Maybe your favor te one s “Crazy for You!”)

How can I count the number of cells in a range containing numbers?

The COUNT funct on counts the number of ce s n a range conta n ng a numer c va ue For examp e,
the COUNT(B5 C14) formu a n ce C2 d sp ays 9 because n ne ce s (the ce s n C5 C13) n the B5 C14
range conta n numbers (See F gure 19-2 )

How can I count the number of blank cells in a range?

The COUNTBLANK funct on counts the number of b ank ce s n a range For examp e, the
COUNTBLANK(B5 C14) formu a entered n ce C4 returns a va ue of 2 because two ce s (B14 and C14)
n the B5 C14 range conta n b anks

The COUNT F, COUNT FS, COUNT, COUNTA, and COUNTBLANK funct ons  Chapter 19   165
How do I count the number of nonblank cells in a range?

The COUNTA funct on returns the number of nonb ank ce s n a range For examp e, the
COUNTA(B5 C14) formu a n ce C3 returns 18 because 18 ce s n the B5 C14 range are not b ank

Remarks
In the rema nder of the book, a ternat ve methods are d scussed to answer quest ons nvo v ng two or
more cr ter a (such as how many Br tney Spears songs were p ayed before June 10, 2005)

■ Database stat st ca funct ons are d scussed n Chapter 48

■ Array formu as are d scussed n Chapter 87, “Array formu as and funct ons ”

Problems
The fo ow ng quest ons refer to the Rock x sx fi e

1. How many songs were not sung by Br tney Spears?

2. How many songs were p ayed before June 15, 2004?

3. How many songs were p ayed between June 1, 2004, and Ju y 4, 2006? H nt Take the d ffer-
ence between two COUNTIF funct ons

4. How many songs were sung by s ngers whose ast names beg n w th M?

5. How many songs were sung by s ngers whose names conta n an e?

6. Create a formu a that a ways y e ds the number of songs p ayed today H nt Use the TODAY()
funct on

7. For the D4 G15 ce range, count the ce s conta n ng a numer c va ue Count the number of
b ank ce s Count the number of nonb ank ce s

8. How many songs sung by Barry Man ow were p ayed n 2004?

9. How many songs at east 4 m nutes ong and sung by Mandy Moore were p ayed n 2007 or
ear er?

10. How many songs exact y three m nutes ong and sung by Br tney Spears were p ayed ater
than 2004?

11. The NBA x sx fi e conta ns the fo ow ng nformat on

• Co umns A and B conta n the name of each NBA team and a code number for each team
For examp e, Team 1 s At anta

• Co umn C conta ns the home team for each game


166  Chapter 19  The COUNT F, COUNT FS, COUNT, COUNTA, and COUNTBLANK funct ons
• Co umn D conta ns the v s t ng team for each game
• Co umn E conta ns po nts scored by the home team
• Co umn F conta ns po nts scored by the v s t ng team
From th s data, compute the number of games p ayed by each team

12. The Matchthesecond x sx fi e g ves a st of names Some names occur more than once
Determ ne the row n wh ch, for examp e, the second occurrence of the name “Dave” occurs
Set up a worksheet n wh ch you can enter a person’s name and a pos t ve nteger (such as n)
and t returns the row n wh ch the name occurs for the nth t me

13. The Numbers x sx fi e conta ns a set of numbers Count how many of these numbers are
between 1 and 12, nc us ve

The COUNT F, COUNT FS, COUNT, COUNTA, and COUNTBLANK funct ons  Chapter 19   167
CHAPTER 20

The SUMIF, AVERAGEIF, SUMIFS,


and AVERAGEIFS functions

Questions answered in this chapter:


■ I’m a sa es manager for a makeup company and have summar zed the fo ow ng nformat on
for each sa es transact on sa esperson, date of sa e, un ts so d (or returned), and tota pr ce
rece ved (or pa d out for returns) How can I answer the fo ow ng quest ons?

• What s the tota do ar amount of merchand se so d by each sa esperson?


• How many un ts were returned?
• What s the tota do ar amount of sa es n or after 2005?
• How many un ts of p g oss were so d? How much revenue d d p g oss sa es br ng n?
• What s the tota do ar amount of sa es by someone other than a spec fic sa esperson?
• What s the average number of un ts so d n each transact on by a spec fic sa esperson?
• What s the tota do ar amount of pst ck so d by a spec fic sa esperson?
• What s the average quant ty ( n un ts) of pst ck n each sa e by a spec fic sa esperson?
• Among transact ons nvo v ng at east 50 un ts, what s the average quant ty of pst ck n
each sa e by a spec fic sa esperson?

• Among transact ons of more than $100, what s the tota do ar amount of pst ck so d by a
spec fic sa esperson? What s the tota do ar amount from transact ons of ess than $100?

If you want to sum a the entr es n one co umn (or row) that match cr ter a that depend on another
co umn (or row), the SUMIF funct on gets the job done The syntax of the SUMIF funct on s
SUMIF(range,cr ter on,[sum range])

■ Range s the range of ce s that you want to eva uate w th a cr ter on

■ Cr ter on s a number, date, or express on that determ nes whether a g ven ce n the sum
range s added

■ Sum range s the range of ce s that are added If sum range s om tted, t s assumed to be the
same as range

169

The ru es for cr ter a you can use w th the SUMIF funct on are dent ca to the ru es used for the
COUNTIF funct on For nformat on about the COUNTIF funct on, see Chapter 19, “The COUNTIF,
COUNTIFS, COUNT, COUNTA, and COUNTBLANK funct ons ”

The AVERAGEIF funct on has the AVERAGEIF(range,cr ter on,[average range]) syntax AVERAGEIF
averages the range of ce s meet ng a cr ter on

M crosoft Exce 2013 nc udes three funct ons ( ntroduced n Exce 2007) that you can use to flag
rows that nvo ve mu t p e cr ter a COUNTIFS (d scussed n Chapter 19), SUMIFS, and AVERAGEIFS
Other funct ons you can use to do ca cu at ons nvo v ng mu t p e cr ter a are d scussed n Chapter 48,
“Summar z ng data w th database stat st ca funct ons ” Array funct ons (see Chapter 87, “Array func-
t ons and formu as”) can a so be used to hand e ca cu at ons nvo v ng mu t p e cr ter a

The syntax of SUMIFS s SUMIFS(sum range,range1,cr ter on1,range2,cr ter on2, , rangeN,
­cr ter onN) SUMIFS sums up every entry n the sum range for wh ch cr ter on1 (based on range1)
and cr ter on2 (based on range2), , cr ter onN (based on rangeN) are a sat sfied In a s m -
ar fash on, the AVERAGEIFS funct on has the AVERAGEIFS(sum range,range1,cr ter on1,range2,­
cr ter on2,       ,rangeN,cr ter onN) syntax AVERAGEIFS averages every entry n the sumrange for wh ch
­cr ter on1 (based on range1) and cr ter on2 (based on range2), , cr ter onN (based on rangeN) are
a sat sfied

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

What is the total dollar amount of merchandise sold by each salesperson?

The work for the prob ems n th s chapter s n the Makeup2007 x sx fi e F gure 20-1 shows a subset of
the data

FIGURE 20-1  Th s s the data you use for SUM F examp es.

As usua , beg n by abe ng the data n co umns G through L w th the correspond ng names n
ce s G4 L4 For examp e, the Product range name corresponds to the J5 J1904 range To compute the
tota amount so d by each sa esperson (see F gure 20-2), copy the SUMIF(Name,A5,Do ars) formu a

170  Chapter 20  The SUM F, AVERAGE F, SUM FS, and AVERAGE FS funct ons
from ce B5 to B6 B13 Th s formu a adds up every entry n the Do ars co umn that conta ns the name
Em ee n the Name co umn and shows that Em ee so d $25,258 87 worth of makeup Of course, the
=SUMIF(Name,”Em ee”,Do ars) formu a wou d y e d the same resu t

FIGURE 20-2  These are the resu ts of SUMIF computat ons.

How many units were returned?

In ce B16, the SUMIF(Un ts,”<0”,Un ts) formu a tota s every number ess than 0 n the Un ts co umn
(co umn K) The resu t s –922 Insert ng a m nus s gn n front of the SUMIF formu a shows that 922
un ts were returned (Reca that when the sum range argument s om tted from a SUMIF funct on,
Exce assumes that sum range equa s range Therefore, the –SUMIF(Un ts,”<0”) formu a wou d a so
y e d 922 )

What is the total dollar amount of sales in or after 2005?

In ce B17, the SUMIF(Date,”>=1/1/2005”,Do ars) formu a tota s every entry n the Do ar co umn
(co umn L) that conta ns a date on or after 1/1/2005 n the Date co umn The formu a shows that
$157,854 32 worth of makeup was so d n 2005 or ater

How many units of lip gloss were sold? How much revenue did lip gloss sales bring in?

In ce B18, the SUMIF(Product,” p g oss”,Un ts) formu a tota s every ce n the Un ts co umn that
conta ns the text “ p g oss” n the Product co umn (co umn J) You can see that 16,333 un ts of p
g oss were so d Th s s the net sa es amount; transact ons n wh ch un ts of p g oss were returned are
counted as negat ve sa es

In a s m ar fash on, n ce B19, the SUMIF(Product,” p g oss”,Do ars) formu a te s you that a net
amount of $49,834 64 worth of p g oss was so d Th s ca cu at on counts refunds assoc ated w th
returns as negat ve revenue

What is the total dollar amount of sales by someone other than Jen?

In ce B20, the SUMIF(Name,”<>Jen”,Do ars) formu a sums the do ar amount of a transact ons that
do not have Jen n the Name co umn You find that sa espeop e other than Jen so d $211,786 51 worth
of makeup

The SUM F, AVERAGE F, SUM FS, and AVERAGE FS funct ons  Chapter 20   171
What is the average number of units sold in each transaction by a specific salesperson?

Th s s a job for the AVERAGEIF funct on Enter ng the =AVERAGEIF(Name,”Jen”,Un ts) formu a n ce
B26 averages every entry n the Un ts co umn that conta ns Jen n the Name co umn Jen’s average
transact on s ze was 43 548 un ts You can ver fy th s n ce C26 w th the =SUMIF(Name,”Jen”,Un ts)
/COUNTIF(Name,”Jen”) formu a

What is the total dollar amount of lipstick sold by Jen?

Th s ca cu at on nvo ves two cr ter a (Name=”Jen” and Product=” pst ck”) Therefore, you need to
compute the quant ty you’re ook ng for n ce B21 w th the =SUMIFS(Do ars,Name,”Jen”,Product,
” pst ck”) formu a The tota do ar amount of a transact ons n wh ch Jen so d pst ck s $3,953

What is the average quantity (in units) of lipstick in each sale by Zaret?

Th s ca cu at on requ res the AVERAGEIFS funct on Compute the quant ty n ce B22 w th the
­=AVERAGEIFS(Un ts,Name,”Zaret”,Product,” pst ck”) formu a For the sa es transact ons n wh ch Zaret
so d pst ck, the average number of un ts so d s 33

Among transactions involving at least 50 units, what is the average quantity of lipstick in each
sale by Zaret?

Here aga n, use AVERAGEIFS but add a cr ter on to ensure that the number of un ts so d n each
transact on was at east 50 In ce B23, enter the =AVERAGEIF(Un ts,Name,”Zaret”,Product,” pst ck”,
Un ts,”>=50”) formu a In a transact ons n wh ch Zaret so d at east 50 un ts of pst ck, the average
transact on s ze s 68 un ts

Among transactions of more than $100, what is the total dollar amount of lipstick sold by
Jen? What is the total dollar amount from transactions of less than $100?

Because the cr ter a are Name=Jen, Product= pst ck, and some statement about the do ar s ze of
each order, you need to use the SUMIFS funct on In ce B24, compute the tota amount n transac-
t ons n wh ch Jen so d pst ck and the do ar amount was at east $100 w th the =SUMIFS(Do ars,­
Name,”Jen”,Product,” pst ck”,Do ars”>=100”) formu a Jen so d $3,583 worth of pst ck n such
transact ons In pst ck transact ons nvo v ng ess than $100, you can see n ce B25 that the answer s
$370 (The formu a s =SUMIFS(Do ars,Name,”Jen”,Product,” pst ck”,Do ars,”<100” ) Note that $370 +
$3,583 equa s the tota revenue Jen generated from pst ck sa es (computed n ce B21)

Problems
1. For each product, determ ne the tota number of un ts and do ar vo ume so d

2. Determ ne the tota revenue earned before December 10, 2005

3. Determ ne the tota un ts so d by sa espeop e whose ast names beg n w th C

4. Determ ne the tota revenue earned by peop e who have five etters n the r names

5. How many un ts were so d by peop e other than Co een?

172  Chapter 20  The SUM F, AVERAGE F, SUM FS, and AVERAGE FS funct ons
6. How many un ts of makeup were so d from January 15, 2004, through February 15, 2005?

7. The NBA x sx fi e conta ns the fo ow ng nformat on

• Co umns A and B st the name of each NBA team and a code number for each team For
examp e, team 1 s At anta and so on

• Co umn C sts the home team for each game

• Co umn D sts the v s t ng team for each game

• Co umn E sts po nts scored by the home team

• Co umn F sts po nts scored by the v s t ng team

From th s data, compute for each team the average number of po nts the team scored per
game and the average number of po nts the team gave up

8. The Toysrus x sx fi e conta ns sa es revenue ( n mons of do ars) dur ng each quarter for the
years 1997–2001 and the first two quarters of 2002 Use th s data to compute a seasona ndex
for each quarter of the year For examp e, f average sa es dur ng the first quarter were 80
percent of the overa average sa es per quarter, the first quarter wou d have a seasona ndex
of 0 8

9. The Sum frows x sx fi e conta ns sa es data dur ng severa w nter, spr ng, summer, and fa quar-
ters Determ ne average sa es dur ng the w nter, spr ng, summer, and fa quarters

10. Aga n, by us ng the Makeup2007 x sx fi e, determ ne how much revenue was made on sa es
transact ons nvo v ng at east 50 un ts of makeup

11. How many un ts of p g oss d d C c se n 2004?

12. What s the average number of un ts of foundat on so d by Em ee?

13. What s the average do ar s ze of a foundat on sa e by Betsy after the end of 2004?

14. In transact ons n wh ch Ash ey so d at east 40 un ts of pst ck, what s the tota do ar
amount?

15. Create a tab e that conta ns sa es of each product by each person

16. Create a tab e that, when you enter a year n your worksheet, conta ns sa es of each product
by a person dur ng that year

17. From the Numbers x sx fi e, find the tota of a numbers between 5 and 15, nc us ve

18. From the Numbers x sx fi e, find the average of a numbers between 10 and 25, nc us ve

The SUM F, AVERAGE F, SUM FS, and AVERAGE FS funct ons  Chapter 20   173
CHAPTER 21

The OFFSET function

Questions answered in this chapter:


■ How can I create a reference to a range of ce s that s a spec fied number of rows and co -
umns from a ce or another range of ce s?

■ How can I perform a ookup operat on based on the r ght most co umn n a tab e range
nstead of the eft most co umn?

■ I often down oad software product sa es nformat on sted by country I need to track rev-
enues from Iran as we as costs and un ts so d, but the data about Iran sn’t a ways n the same
ocat on n the worksheet Can I create a formu a that w a ways p ck out Iran’s revenues,
costs, and un ts so d?

■ Each drug my company deve ops goes through three stages of deve opment I have a st of
the cost by month for each drug, and I know the ength n months of each deve opment stage
Can I create formu as that compute the tota cost ncurred for each drug dur ng each stage of
deve opment?

■ I run a sma v deo store In a worksheet, my accountant has sted the name of each mov e
and the number of cop es n stock Unfortunate y, he comb ned th s nformat on n one ce for
each mov e How can I extract the number of cop es of each mov e n stock to a separate ce ?

■ How does the Exce Eva uate Formu a feature work?

■ How can I wr te a formu a that a ways returns the ast number n a co umn?

■ How can I set up a range name that automat ca y nc udes new data?

■ I am chart ng my company’s month y un t sa es Each month, I down oad the most recent
month’s un t sa es I wou d ke my chart to update automat ca y Is there an easy way to
accomp sh th s?

Use the OFFSET funct on to create a reference to a range that s a spec fied number of rows and
co umns away from a ce or range of ce s Bas ca y, to create a reference to a range of ce s, you first
spec fy a reference ce You then nd cate the number of rows and co umns away from the reference
ce that you want to create your range For examp e, by us ng the OFFSET funct on, I can create a
reference to a ce range that conta ns two rows and three co umns and beg ns two co umns to the
r ght and one row above the current ce You can ca cu ate the spec fied number of rows and co umns
to move from a reference ce by us ng other M crosoft Exce funct ons

175

The syntax of the OFFSET funct on s OFFSET(reference,rows moved,co umns moved,he ght,w dth)

■ Reference s a ce or range of ce s from wh ch the offset beg ns If you spec fy a range of ce s,


the ce s must be adjacent to each other

■ Rows moved s the number of rows away from the reference ce or range that you want the
range reference to start (the upper- eft ce n the offset range) A negat ve number of rows
moves you up from the reference; a pos t ve number of rows moves you down For examp e, f
reference equa s C5 and rows moved equa s –1, you move to row 4 If rows moved equa s +1,
you move to row 6 If rows moved equa s 0, you stay at row 5

■ Co umns moved s the number of co umns away from the reference ce or range that you
want the range reference to start A negat ve number of co umns moves you eft from the
reference; a pos t ve number of co umns moves you r ght For examp e, f reference equa s C5
and co umns moved equa s –1, you move to co umn B If co umns moved equa s +1, you move
to co umn D If co umns moved equa s 0, you stay at co umn C

■ He ght and w dth are opt ona arguments that g ve the number of rows and co umns n the
offset range If he ght or w dth s om tted, the OFFSET funct on creates a range for wh ch the
va ue of he ght or w dth equa s the he ght or w dth of the reference ce or range

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

How can I create a reference to a range of cells that is a specified number of rows and col-
umns from a cell or another range of cells?

The Offsetexamp e x sx fi e, shown n F gure 21-1, prov des some examp es of the OFFSET funct on n
act on

FIGURE 21-1  Th s figure shows the use of the OFFSET funct on n comb nat on w th the SUM funct on.

For examp e, n ce B10, enter the formu a shown n ce A10 SUM(OFFSET(B7,–1,1,2,1)) Th s for-
mu a beg ns n ce B7 It moves one row up and one co umn to the r ght, wh ch takes you to ce C6
The formu a now se ects a range cons st ng of two rows and one co umn, wh ch y e ds range C6 C7

176  Chapter 21  The OFFSET funct on


The SUM funct on adds the numbers n th s range, wh ch y e ds 2 + 6 = 8 The other two examp es
shown n F gure 21-1 work the same way The fo ow ng sect ons show you how to app y the OFFSET
funct on to so ve some prob ems from major US compan es

How can I perform a lookup operation based on the right most column in a table range
instead of the left most column?

In F gure 21-2 (see the Lefthand ookup x sx workbook) are sted the members of the 2002–2003
Da as Maver cks NBA basketba team and the r fie d goa percentages If you’re asked to find the
p ayer w th a spec fic fie d goa percentage, you cou d eas y so ve that prob em by us ng a VLOOKUP
funct on But what you rea y want to do s a left-side lookup, wh ch nvo ves find ng the fie d goa
percentage for a p ayer by us ng h s name A VLOOKUP funct on can’t perform a eft-s de ookup, but
a eft-s de ookup s s mp e f you comb ne the MATCH and OFFSET funct ons

FIGURE 21-2  You can do a eft s de ookup by us ng the MATCH and OFFSET funct ons.

F rst, enter the p ayer’s name n ce D7 and then use a reference ce of B7 (the fie d goa percent-
age co umn header) w th the OFFSET funct on To find the p ayer’s fie d goa percentage, move down
to the row be ow row 7, where the p ayer’s name appears Th s s a job for the MATCH funct on The
MATCH funct on port on of the OFFSET(B7,MATCH(D7,$C$8 $C$22,0),0) formu a moves down to the
row conta n ng the spec fied p ayer’s name and then moves over 0 co umns Because the reference
cons sts of one ce , om tt ng the he ght and w dth arguments of the OFFSET funct on ensures that the
range th s formu a returns s a so one ce Thus, you p ck up the p ayer’s fie d goa percentage

I often download software product sales information listed by country. I need to track reve-
nues from Iran as well as costs and units sold, but the data about Iran isn’t always in the same
location in the worksheet. Can I create a formula that will always pick out Iran’s revenues,
costs, and units sold?

The As ansa es x sx fi e (see F gure 21-3) conta ns data for un ts so d, sa es revenue, and var ab e cost
for software so d to severa countr es n As a and the M dd e East Each month, when you down oad
the month y financ a reports, the ocat on of each country n the worksheet changes, so you need
formu as that a ways return (for a g ven country) the correct un ts so d, revenue, and var ab e cost

The OFFSET funct on  Chapter 21   177


FIGURE 21-3  You can use the OFFSET funct on n ca cu at ons when you re work ng w th data that aren t a ways n
the same ocat on n a worksheet.

By copy ng the OFFSET($C$6,MATCH($C21,$C$7 $C$17,0),D20) formu a from D21 to E21 F21, you
can compute the resu t you want Th s formu a sets reference equa to ce C6 (wh ch conta ns the
words Country/Reg on) and then moves over one co umn (to ce D20) to find un ts so d and down to
the row conta n ng the country sted n C21 In ce E21, the reference to D20 now refers to E20 and
becomes a 2, so you move over two co umns to the r ght of co umn C to find revenue In ce E21,
the reference to D20 now refers to F20 and becomes a 3, so you move three co umns to the r ght of
co umn C to find var ab e cost

Each drug my company develops goes through three stages of development. I have a list of
the cost by month for each drug, and I know how many months each development stage took
for each drug. Can I create formulas that compute the total cost incurred for each drug dur-
ing each stage of development?

The Offsetcost x sx fi e conta ns the month y costs ncurred to deve op five drugs and, for each drug,
the number of months requ red to comp ete each phase A subset of the data s shown n F gure 21-4

The goa s to determ ne for each drug the tota cost ncurred dur ng each deve opment phase In
ce s D4 D6, you compute the tota deve opment costs for Phases 1–3 for Drug 1 Compute Phase 1
costs for Drug 1 by us ng a ce reference of D10, w th rows moved and co umns moved equa to 0
Sett ng he ght equa to the number of months n Phase 1 and w dth equa to 1 captures a Phase 1
costs Compute Phase 1 costs for Drug 1 n ce D4 w th the SUM(OFFSET(D10,0,0,D1,1)) formu a Next,
n ce D5, compute Phase 2 tota costs for Drug 1 by us ng the SUM(OFFSET(D10,D1,0,D2,1)) formu a
Start w th a ce reference of D10 (the first month of costs) and move down the number of rows equa
to the ength of Phase 1 Th s takes you to the beg nn ng of Phase 2 Sett ng he ght equa to the va ue

178  Chapter 21  The OFFSET funct on


n ce D2 ensures that you nc ude a Phase 2 costs F na y, n ce D6, find the Phase 3 deve opment
costs for Drug 1 by us ng the SUM(OFFSET(D10,D1+D2,0,D3,1)) formu a In th s formu a, you start from
the first month of sa es and move down the number of rows equa to the tota t me needed for Phases
1 and 2 Th s takes you to the beg nn ng of Phase 3 where, n ce D3, you tota the number of rows to
capture Phase 3 costs Then, by copy ng the formu as n D4 D6 to E4 H6, you can compute tota costs
for Phase 1 through Phase 3 for Drug 2 through Drug 5 For examp e, for Drug 2, tota Phase 1 costs
equa $313, tota Phase 2 costs equa $789, and tota Phase 3 costs equa $876

FIGURE 21-4  Use the OFFSET funct on to compute deve opment costs for Phase 1 through Phase 3.

I run a small video store. In a worksheet, my accountant has listed the name of each movie
and the number of copies in stock. Unfortunately, he combined this information into one
cell for each movie. How can I extract the number of copies of each movie in stock to a
separate cell?

The Mov estemp x sx fi e conta ns the name of each mov e and the number of cop es n stock n the
C2 C12 range

FIGURE 21-5  Use the OFFSET funct on to show th s mov e examp e.

The OFFSET funct on  Chapter 21   179


As shown n Co umn B of F gure 21-5 (see the Mov es worksheet of the Mov es x sx workbook), you
want to extract the number of cop es owned of each mov e to a separate ce If the number of cop es
were sted to the eft of a mov e’s t t e, th s prob em wou d be easy; you cou d use the FIND funct on
to ocate the first space and then use the LEFT funct on to return a the data to the eft of the first
space (See Chapter 5, “Text funct ons,” for a d scuss on of how to use the LEFT and FIND funct ons
as we as other funct ons you can use to work w th text ) Unfortunate y, th s techn que doesn’t work
when the number of cop es s sted to the r ght of the mov e t t e For a one-word mov e t t e, for
examp e, the number of cop es s to the r ght of the first space, but for a four-word mov e t t e, the
number of cop es s to the r ght of the fourth space

One way to so ve th s prob em s to c ck the Data tab on the r bbon and, n the Data Too s group,
c ck Text To Co umns to p ace each word n a t t e and the number of cop es n separate co umns You
can use the COUNTA funct on to count the tota number of words n a t t e, nc ud ng the number of
tems as a word, for each mov e You can then use the OFFSET funct on to ocate the number of tems

To beg n, nsert enough co umns to the r ght of the data to a ow each word n the mov es’ t t es
and the number of tems to be extracted to a separate co umn You cou d use s x co umns (Ra ders
of the Lost Ark requ res s x co umns), as you can see n F gure 21-5 Then you can se ect the C2 C12
ce range and choose Text To Columns on the Data tab Se ect Delimited n the Convert Text To
Columns Wizard and use the space character as the de m t ng character After se ect ng ce D2 as
the dest nat on ce , the resu ts show n co umns D through I of F gure 21-5

Now, count the number of words n each mov e’s ce (count ng the number of tems as a word) by
copy ng the COUNTA(D2 I2) formu a from A2 to A3 A12 The resu ts are shown n F gure 21-5

F na y, by copy ng the OFFSET(C2,0,A2) formu a from B2 to B3 B12, you can ocate the number of
cop es of each mov e n stock Th s formu a beg ns at the reference ce conta n ng the mov e t t e and
moves over the number of co umns equa to the number of words n the t t e ce Because the refer-
ence ce conta ns on y one ce , you can om t the he ght and w dth arguments of the OFFSET funct on
so that the funct on uses on y the ce conta n ng the ast word (the number of cop es) of the t t e ce

Of course, as shown n F gure 21-6 and the worksheet, you cou d use F ash F to extract the num-
ber of cop es of each mov e Enter 40 n ce D2 and 12 n ce D3; press Enter and then press Ctr +E

FIGURE 21-6  Use F ash F to extract the number of tems n stock.

180  Chapter 21  The OFFSET funct on


How does the Excel Evaluate Formula feature work?

If you se ect any port on of a ce formu a and then press F9, Exce d sp ays the va ue created by
that port on of the formu a When you have fin shed rev ew ng the eva uated va ue, you must press
Esc, or the va ue w rep ace the formu a Th s tr ck makes debugg ng and understand ng comp ex
formu as eas er Thus, t m ght be eas er to understand what the OFFSET port on of the formu a
does f you app y th s tr ck to any of the formu as n th s chapter For examp e, n the Offsetcost x sx
fi e, ce E4 generates tota Phase 1 cost w th the =SUM(OFFSET(E10,0,0,E1,1)) formu a If you move
the cursor over OFFSET(E10,0,0,E1,1), h gh ght th s part of the formu a, and then se ect F9, you see
=SUM({135,120,58}), wh ch nd cates that the OFFSET port on of the formu a n ce D4 uses the correct
ce s (D10 D12) Be sure you press Esc to ex t th s procedure, or you w mod fy the formu a!

Another way to see how a comp ex formu a works s to use the Eva uate Formu a command Move
the cursor to E4 and c ck the Formulas tab on the r bbon In the Formula Auditing group, choose
Evaluate Formula (See F gure 21-7 ) C ck the Evaluate button ( t ooks ke a magn fy ng g ass), and
Exce s mp fies the formu a step by step unt you see the formu a’s resu t After c ck ng Evaluate
tw ce, the formu a appears as =SUM($E$10 E$12), so you know that n ce E4, you have se ected the
Phase 1 ce s for Drug 2, wh ch s what you wanted

FIGURE 21-7  Th s s the Eva uate Formu a d a og box.

How can I write a formula that always returns the last number in a column?

You often down oad new data nto a worksheet Can you wr te a formu a that a ways returns sa es
dur ng the most recent month? (See the Mostrecent x sx fi e and F gure 21-8 )

FIGURE 21-8  F nd the ast number n a co umn.

Enter the OFFSET(B6,COUNT(B B),0,1,1) formu a n ce D4

The OFFSET funct on  Chapter 21   181


Th s formu a beg ns n ce B6 and moves down the number of rows equa to the number of
numer ca entr es n co umn B Th s takes you to the most recent month of sa es, wh ch s se ected
because 1,1 returns on y one ce

How can I set up a range name that automatically includes new data?

Peop e who use Exce often add rows or co umns of data to a range of data they use to create a
P votTab e or to perform another type of ana ys s Usua y, they s mp y update the range of ce s
referred to n the r formu a and then rerun the ana ys s However, you can use dynam c range names
and never have to update the range of data referred to n a formu a or P votTab e The range auto-
mat ca y updates Here s an examp e

The Dynam crange x sx fi e shows entr es from a human resources (HR) database (See F gure 21-9 )

FIGURE 21-9  Th s figure shows an examp e of a dynam c range.

Current y, n ne rows and four co umns conta n data Wou dn’t t be n ce f you cou d create a range
name that wou d automat ca y nc ude more rows and co umns when you add peop e or fie ds of
nformat on to the database?

To create a dynam c range, c ck the Formulas tab and, n the Defined Names group, choose
Name Manager C ck New and define a range, as shown n F gure 21-10

FIGURE 21-10  Create a dynam c range.

182  Chapter 21  The OFFSET funct on


The range starts n the upper- eft corner ce A1 Because you want ce A1 to be the upper-
eft corner of the named range, you choose rows moved and co umns moved to equa 0 The
se ected range has number of rows=number of nonb ank entr es n co umn A, and number of
co umns=number of nonb ank entr es n row 1 Thus, f you add peop e or data fie ds, the formu a
automat ca y expands to nc ude them The do ar s gns ($) are needed so that the defined range w
not sh ft f you move around the worksheet

To try th s out, enter the =SUM(data) formu a n ce G11 At present, th s formu a tota s a num-
bers n the A1 D10 range and y e ds $448,278

Now add the name Mered th to row 11, enter a sa ary of $10,000 n B11, enter a var ab e for
M stakes (add the word M stakes) n E1, and enter 1,000 n E11 The =SUM(data) formu a now nc udes
the 10,000 and 1,000 and automat ca y updates to $459,278

I am charting my company’s monthly unit sales. Each month, I download the most recent
month’s unit sales. I would like my chart to update automatically. Is there an easy way to
accomplish this?

The Chartdynam crange x sx workbook (see F gure 21-11) conta ns the un ts so d of your company’s
product As you can see, the un ts so d have been charted us ng an XY (scatter) chart

FIGURE 21-11  You can use the OFFSET funct on to update th s chart dynam ca y.

Beg nn ng n row 19, you down oad new sa es data Is there an easy way to ensure that the chart
automat ca y nc udes the new data?

The key to updat ng the chart s to use the OFFSET funct on to create dynam c range names for
both the Months co umn and the Un ts So d co umn As new data s entered, the dynam c range
for un t sa es automat ca y nc udes a sa es data, and the dynam c range for months nc udes each
month number After creat ng these ranges, you can mod fy the chart, rep ac ng the data ranges used
n the chart w th the dynam c ranges The chart now updates as new data s entered

To beg n, c ck Define Names on the Formulas tab on the r bbon to open the New Name d a og
box Create a range named Un ts by fi ng n the d a og box as shown n F gure 21-12

The OFFSET funct on  Chapter 21   183


FIGURE 21-12  Create a dynam c range name for the un ts so d.

Enter ng =OFFSET(‘dynam c range’!$C$3,0,0,COUNT(!$C $C),1) n the Refers To area of the d a og


box creates a range one co umn w de beg nn ng n ce C3, wh ch conta ns the first un t sa es data
po nt The range w conta n as many numbers as there are n co umn C, wh ch s der ved by the por-
t on of the formu a that reads COUNT(‘dynam c range’!$C $C) As new data s entered n co umn C, the
data s automat ca y nc uded n the range named Un ts

Next, create a dynam c range named Month for the months entered n co umn B The formu a s
shown n F gure 21-13

FIGURE 21-13  Th s s the formu a that defines a dynam c range named Month.

Now c ck any po nt n the chart In the formu a box, you see the SERIES(‘dynam c
range’!$C$2,’dynam c range’!$B$3 $B$18,’dynam c range’!$C$3 $C$18,1) formu a Th s formu a s the
way Exce retr eves the data requ red to p ot the chart Rep ace the $B$3 $B$18 and $C$3 $C18 ranges
w th the dynam c range names as fo ows

SERIES(‘dynamic range’!$C$2,Chartdynamicrange.xlsx!Month,Chartdynamicrange
.xlsx!Units,1)

If a b ank space s sted above any new data, th s method won’t work Enter some new data, and
you’ see that t s nc uded n the chart

Remarks
The Exce Tab e feature makes t easy to set th ngs up so that charts and formu as automat ca y ncor-
porate new data See Chapter 25, “Tab es,” for a d scuss on of th s feature

184  Chapter 21  The OFFSET funct on


Problems
1. The C21p1 x sx fi e conta ns data about un t sa es for 11 products from 1999 to 2003 Wr te a
formu a us ng the MATCH and OFFSET funct ons that determ nes the sa es of a g ven product
dur ng a g ven year Can you th nk of a way to so ve th s prob em w thout us ng the MATCH
and OFFSET funct ons?

2. A common y suggested mov ng average trad ng ru e s to buy a stock when ts pr ce moves


above the average of the past D months and to se t when ts pr ce moves be ow the average
of the past D months Chapter 11, “IF statements,” showed that for D = 15, th s trad ng ru e
outperformed the Standard & Poor’s 500 by a substant a amount By comb n ng a one-way
data tab e w th the OFFSET funct on, determ ne the va ue of D that max m zes trad ng profit
(exc ud ng transact ons costs) You can find pert nent data n the Matrad ngru e x sx fi e

3. A common y suggested mov ng average trad ng ru e s to buy a stock when ts pr ce moves


above the average of the past B months and to se t when ts pr ce moves be ow the average
of the past S months Chapter 11 shows that for B = S = 15, th s trad ng ru e outperformed
the Standard & Poor’s 500 by a substant a amount By comb n ng a two-way data tab e w th
the OFFSET funct on, determ ne the va ues of B and S that max m ze trad ng profit (exc ud ng
transact ons costs) You’ find data for th s prob em n the Matrad ngru e x sx fi e

4. The Lagged x sx fi e conta ns data about the number of magaz ne ads p aced by US Army
recru t ng dur ng each of 60 consecut ve months For each month, the k-month agged num-
ber of ads s defined to equa the number of ads p aced k months ago For months 7–60, you
want to compute the 1-month agged and 2-month through 6-month agged va ues of the
number of ads Use the OFFSET funct on to compute these agged va ues effic ent y

5. The Ver zondata x sx fi e g ves sa es of four Ver zon phones n five reg ons Determ ne an effi-
c ent method to enter the reg on, type of phone, and sa es of each phone for each of the 20
reg on–product comb nat ons nto one row

6. The Ag ngdata x sx fi e g ves the number of nsurance c a ms projected to be rece ved da y


and the number of nsurance company workers ava ab e Each day, a worker can process
up to 30 c a ms Workers process the o dest c a ms n the system first Ce s H6 AL6 conta n
the number of c a ms a ready n the system on January 1, before new c a ms arr ve Set up a
worksheet to track the ag ng of the c a ms That s, for each day, how many 1-day-o d , 2-day-
o d,       30-day-o d, and over-30-day-o d c a ms w be n the system?

7. Each row of the DVDsa es x sx fi e conta ns month y sa es of a DVD Wr te a formu a to deter-


m ne sa es for each DVD dur ng ts first s x months on the market

8. To obta n a go fer’s hand cap, you average the 10 owest of the go fer’s ast 20 rounds Then
you subtract 80 and round to the nearest nteger Thus, f the 10 owest of the ast 20 rounds
add up to 864, the hand cap wou d be 6 The Go fdata x sx fi e conta ns a go fer’s scores
Beg nn ng n row 24, compute the go fer’s hand cap after each round Assume that f the tenth
best score n the ast 20 rounds occurs more than once, a rounds nc ud ng that score w be

The OFFSET funct on  Chapter 21   185


nc uded n the hand cap ca cu at on Note that the =ROUND(x,0) Exce funct on w round x
to the nearest nteger

9. Each row of the Carsumdata x sx fi e conta ns sa es data for a product (car, tra n, or p ane) from
January through Ju y, and you enter a month and a product n the worksheet Wr te a formu a
that g ves the tota sa es of that product dur ng the g ven month

10. The Ver zon x sx fi e conta ns month y returns on Ver zon stock Use the OFFSET funct on to
extract a the January returns to one co umn, a the February returns to one co umn, and so
on

11. The Casesens t ve x sx fi e conta ns product codes and product pr ces Note that the prod-
uct codes are case sens t ve For examp e, DAG32 s not the same product as dag32 Wr te a
formu a that g ves the product pr ce for any product code H nt You m ght need to use the
EXACT funct on The EXACT(ce 1,ce 2) formu a y e ds True f ce 1 and ce 2 have exact y the
same contents EXACT d fferent ates between uppercase and owercase etters

12. The Reversed x sx fi e conta ns a co umn of numbers Use the OFFSET funct on to reverse the
numbers so that the number on the bottom occurs on the top and so on

13. The D agona x sx fi e conta ns a matr x of numbers Determ ne how to put the d agona e e-
ments of the matr x n a s ng e co umn

14. The Yeartodate x sx fi e conta ns a company’s month y sa es from 2008 through 2014 Wr te a
formu a that returns the year’s cumu at ve sa es to date for a g ven year and month of a year
For examp e, f you enter a 6 for the month and 2010 for the year, your formu a shou d com-
pute tota sa es for the January–June 2010 per od

15. Show how you m ght create a graph of month y sa es that a ways d sp ays just the ast s x
months of sa es

16. The Transact ondata x sx fi e conta ns sa es transact ons n d v s ons A, B, C, D, and E of a drug
company Use the OFFSET funct on to mod fy th s data so that the sa es for each d v s on
appear n a s ng e row

186  Chapter 21  The OFFSET funct on


CHAPTER 22

The INDIRECT function

Questions answered in this chapter:


■ My worksheet formu as often conta n references to ce s, ranges, or both Rather than change
these references n my formu as, can I p ace the references n the r own ce s so that I can eas-
y change my ce or range references w thout chang ng my under y ng formu as?

■ Each worksheet n a workbook sts month y sa es of a product n ce D1 Is there an easy way


to wr te and copy a formu a that sts each month’s product sa es n one worksheet?

■ Suppose I tota the va ues n the A5 A10 range w th the SUM(A5 A10) formu a If I nsert
a b ank row somewhere between rows 5 and 10, my formu a updates automat ca y to
SUM(A5 A11) How can I wr te a formu a so that when I nsert a b ank row between rows 5 and
10, my formu a st tota s the va ues n the or g na range, A5 A10?

■ How can I use the INDIRECT funct on n a formu a to read the range name port on of a for-
mu a n a worksheet?

■ My workbook conta ns sa es n each country for each of my company’s products How can I
eas y poo th s data n a s ng e summary worksheet?

■ Is there an easy way to st a the worksheets n a workbook?

The INDIRECT funct on s probab y one of the most d fficu t M crosoft Exce funct ons to master
Know ng how to use the INDIRECT funct on, however, enab es you to so ve many seem ng y unso v-
ab e prob ems Essentially, any reference to a cell within the INDIRECT portion of a formula results in
the immediate evaluation of the cell reference to equal the content of the cell. To ustrate the use of
INDIRECT, ook at the Ind rects mp eex x sx fi e, wh ch s shown n F gure 22-1

FIGURE 22-1  Here s a s mp e examp e of the INDIRECT funct on.

In ce C4, enter formu a =INDIRECT(A4) Exce returns the va ue 6 because the reference to A4
s mmed ate y rep aced by the text str ng “B4”, and the formu a s eva uated as =B4, wh ch y e ds
the va ue 6 S m ar y, enter ng the =INDIRECT(A5) formu a n ce C5 returns the va ue n ce B5,
wh ch  s 9

187

Answers to this chapter’s questions
Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

My worksheet formulas often contain references to cells, ranges, or both. Rather than change
these references in my formulas, can I place the references in their own cells so that I can eas-
ily change my cell or range references without changing my underlying formulas?

In th s examp e, the data you use s conta ned n the Sum nd rect x sx fi e, shown n F gure 22-2 The
B4 H16 ce range sts month y sa es data for s x products dur ng a 12-month per od

You current y ca cu ate tota sa es of each product dur ng months 2–12 An easy way to make th s
ca cu at on s to copy the SUM(C6 C16) formu a from C18 to D18 H18 Suppose, however, that you
want to change wh ch months are tota ed For examp e, you m ght want tota sa es for months 3–12
You cou d change the formu a n ce C18 to SUM(C7 C16) and then copy th s formu a to D18 H18,
but us ng th s approach s prob emat c because you have to copy the formu a n C18 to D18 H18 and,
w thout ook ng at the formu as, nobody knows wh ch rows are be ng added

FIGURE 22-2  You can use the INDIRECT funct on to change ce references n formu as w thout chang ng the
formu as themse ves.

The INDIRECT funct on prov des another approach P ace the start ng and end ng rows of your
summat on n ce s D2 and E2 Then, by us ng the INDIRECT funct on, a you need to do s change the
start ng and end ng row references n D2 and E2, and the sums are updated to nc ude the rows you
want A so, by ook ng at the va ues n D2 and E2, you can see at a g ance wh ch rows (months) are
be ng added You just need to copy the SUM(INDIRECT(C$3&$D$2&’’ ’’&C$3&$E$2)) formu a from C18
to D18 H18

If you want to see how Exce eva uates a reference to the INDIRECT funct on, use the fo ow ng
tr ck C ck n part of the formu a (for examp e, C$3) and then press F9 Exce shows you the va ue
of the se ected port on of the formu a For examp e, C$3 eva uates to C Be sure to press Esc to
undo the change Every ce reference w th n the INDIRECT port on of th s formu a s eva uated to
equa  the contents of the ce C$3 s eva uated as C, $D$2 s eva uated as 6, and $E$2 s eva uated as
16 W th the ampersand (&) nc uded as the concatenat on symbo , Exce eva uates th s formu a as
SUM(C6 C16), wh ch s exact y what you want The formu a n C18 returns the va ue 38 + 91 + . . . 69

188  Chapter 22  The ND RECT funct on


= 607 In ce D18, the formu a eva uates as SUM(D6 D16), wh ch s the resu t you want If you want to
add up sa es dur ng months 4 through 6, you s mp y enter 8 n D2 and 10 n E2, and then the formu a
n C18 returns 33 + 82 + 75 = 190 (For nformat on about us ng the ampersand to concatenate va -
ues, see Chapter 5, “Text funct ons ”)

Each worksheet in a workbook lists monthly sales of a product in cell D1. Is there an easy way
to write and copy a formula that lists each month’s product sales in one worksheet?

The Ind rectmu t sheet x sx fi e (see F gure 22-3) conta ns seven worksheets In each worksheet, ce
D1 conta ns data about the sa es of a product dur ng a part cu ar month Suppose Sheet 1 conta ns
Month 1 sa es, Sheet 2 conta ns Month 2 sa es, and so on For examp e, sa es n Month 1 equa s 1, n
Month 2 t equa s 4, and so on

FIGURE 22-3  Th s figure shows month y sa es (months 1 7) of a product sted by us ng the INDIRECT funct on.

Now suppose you want to comp e a st of each month’s sa es nto one worksheet A ted ous
approach wou d be to st Month 1 sa es w th the =Sheet1!D1 formu a, Month 2 sa es w th the
=Sheet2!D1 formu a, and so on unt you st Month 7 sa es w th the =Sheet7!D1 formu a If you
have 100 months of data, th s approach s t me consum ng and error prone A much more e egant
approach s to st Month 1 sa es n ce E10 of Sheet1 w th the INDIRECT($C$10&D10&’’!D1’’) formu a
Exce eva uates $C$10 as “Sheet”, D10 as “1”, and ‘’!D1’’ as the text str ng “!D1” The who e formu a
s eva uated as =Sheet1!D1, wh ch y e ds Month 1 sa es, ocated n ce D1 of Sheet1 Copy ng th s
formu a to the E11 E16 range sts the entr es n ce D1 of Sheet 2 through Sheet 7 When the formu a
n ce E10 s cop ed to ce E11, the reference to D10 changes to D11, and ce E11 returns the va ue
ocated at Sheet2!D1

Suppose I total the values in the A5:A10 range with the SUM(A5:A10) formula. If I insert
a blank row somewhere between rows 5 and 10, my formula updates automatically to
SUM(A5:A11). How can I write a formula so that when I insert a blank row between rows 5 and
10, my formula still totals the values in the original range, A5:A10?

The SUM(A5 A10) worksheet n the Ind rect nsertrow x sx fi e (shown n F gure 22-4) ustrates severa
ways to tota the numbers n ce range A5 A10 In ce A12, you can enter the trad t ona SUM(A5 A10)
formu a, wh ch y e ds 6+7+8+9+1+2=33

The ND RECT funct on  Chapter 22   189


S m ar y, the SUM($A$5 $A$10) formu a n ce E9 y e ds a va ue of 33 However, f you nsert a row
between rows 5 and 10, both formu as attempt to tota the ce s n the A5 A11 range

FIGURE 22-4  Th s figure shows severa ways to sum the va ues n the A5:A10 ce range.

W th the INDIRECT funct on, you have at east two ways to tota the va ues n the A5 A10 range
Enter the SUM(INDIRECT(‘’A5 A10’’)) formu a n ce F9 Because Exce treats INDIRECT(‘’A5 A10’’) as
the text str ng ‘’A5 A10’’, f you nsert a row n the worksheet, th s formu a st tota s the entr es n the
A5 A10 ce range

Another way to use the INDIRECT funct on to tota the entr es n the A5 A10 range s the
S­ UM(INDIRECT(‘’A’’&C4&’’ A’’&D4)) formu a, wh ch s the formu a entered n ce C6 Exce treats
the reference to C4 as a 5 and the reference to D4 as a 10, so th s formu a becomes SUM(A5 A10)
Insert ng a b ank row between row 5 and row 10 has no effect on th s formu a because the reference
to C4 s st treated as a 5, and the reference to D4 s st treated as a 10 In F gure 22-5, you can see
the sums ca cu ated by the four formu as after a b ank row s nserted be ow row 7 You can find th s
data on the Row Inserted worksheet n the Ind rect nsertrow x sx fi e

As you can see, the c ass c SUM formu as, wh ch do not use the INDIRECT funct on, have changed
to add up the entr es n the A5 A11 range, so these formu as st y e d a va ue of 33 The two SUM
formu as that do use the INDIRECT funct on cont nue to add up the entr es n the A5 A10 range, so
the va ue of 2 (now n ce A11) s no onger nc uded n the ca cu ated sum The SUM formu as that
use the INDIRECT funct on y e d a va ue of 31

FIGURE 22-5  Th s figure shows the resu ts of SUM formu as after nsert ng a b ank row n the or g na range.

190  Chapter 22  The ND RECT funct on


How can I use the INDIRECT function in a formula to read the range name portion of a for-
mula in a worksheet?

Suppose you have named severa ranges n a worksheet to correspond to quarter y product sa es
(See F gure 22-6 and the Ind rectrange x sx fi e ) For examp e, the D4 E6 range (named Quarter1) con-
ta ns fict t ous first-quarter sa es of var ous M crosoft products

FIGURE 22-6  Use the INDIRECT funct on to create a reference to a range name w th n a formu a.

It wou d be great to wr te a formu a that can eas y be cop ed and that then y e ds the sa es
of each product n each quarter n a s ng e rectangu ar range of the worksheet, as shown n
H17 J20 You wou d th nk you cou d enter the =VLOOKUP(H$16,$G17,2,FALSE) formu a n ce
H17 and then copy th s formu a to the H17 J20 range Unfortunate y, Exce does not recogn ze
$G17 as referr ng to the Quarter1 range name Rather, Exce just th nks $G17 s the text str ng
“Quarter1” The formu a, therefore, returns an #NA error To remedy th s prob em, s mp y enter the
­=VLOOKUP(H$16,INDIRECT($G17),2,FALSE) formu a n ce H17 and then copy th s formu a to the
H17 J20 range Th s works perfect y! INDIRECT($G17) s eva uated as Quarter1 and s now recogn zed
as a range name You have now eas y generated sa es data of a products dur ng a four quarters

My workbook contains sales in each country for each of my company’s products. How can I
easily pool this data in a single summary worksheet?

Ce s E7 E9 of the Ind rectconso date x sx fi e conta n sa es of cars, trucks, and p anes on each cont -
nent Each cont nent has ts own worksheet How can you summar ze th s data n a s ng e sheet?

In the Summary worksheet, create the summary shown n F gure 22-7

FIGURE 22-7  Use the INDIRECT funct on to create a summary of product sa es.

The ND RECT funct on  Chapter 22   191


Copy the INDIRECT(E$6&”!”&$C7) formu a from ce E7 to the E7 I9 range Th s formu a creates the
=LA!E7 formu a, wh ch ca cu ates car sa es n Lat n Amer ca Copy ng th s formu a p cks off the sa es
for each type of product on each cont nent

In the Another Summary worksheet (see F gure 22-7), you can create the same tab e n a s ght y
d fferent manner; you can automate the generat on of the ce addresses from wh ch to pu car, truck,
and p ane sa es by copy ng the ADDRESS(ROW(),COLUMN()+2) formu a from C7 to C8 C9 Th s gener-
ates co umn E n the ce address and then rows 8 and 9 The ROW() funct on entered n a ce returns
the ce ’s row number, and the COLUMN() funct on entered by tse f n a ce returns the co umn num-
ber of the current ce ( n th s case, 3) When entered as part of the th rd argument of the ADDRESS
funct on, the term COLUMN()+2 effect ve y returns the co umn abe for the ce two co umns to the
r ght of the current ce ( n th s case, co umn E) Then you can copy the INDIRECT(E$6&”!”&$C7) for-
mu a from ce E7 to the E7 I9 range

Is there an easy way to list all the worksheets in a workbook?

In the prev ous examp e, t was easy to st the worksheet names Suppose you had a workbook w th
100 or more worksheets If you want to un eash the fu power of the INDIRECT funct on to pu data
from a subset of these worksheets, you need an effic ent method for st ng the name of each work-
sheet n a workbook To st a worksheet names n a workbook effic ent y, proceed as fo ows (See
workbook Worksheetnames x sm and F gure 22-8 and F gure 22-9 )

1. As shown n F gure 22-8, on the Formulas tab, se ect Define Names; n the New Name
d a og box, create a range name Ca the range Worksheets w th the =GET WORKBOOK(1)
formu a

GET WORKBOOK(1) s a macro, so the fi e suffix must be x sm

2. Se ect a hor zonta array conta n ng as many rows as your workbook has worksheets, a though
n th s examp e, t s easy to see that there are on y three worksheets If you do not know the
number of worksheets n a workbook, you can use the Exce 2013 SHEETS() funct on In ce
H13, the SHEETS() funct on returns the number of worksheets n a workbook ( n th s case, 3)

By the way, the new Exce 2013 SHEET() formu a enters the number of the current worksheet
n the workbook If you entered =SHEET() anywhere n the Bob worksheet, the formu a wou d
enter 1; anywhere n the A en worksheet, 2; anywhere n the J worksheet, 3

3. In the eft corner of the se ected range ( n th s case, H15), type =Worksheet and press
Ctr +Sh ft+Enter

The Worksheet range name acts as an array formu a (see Chapter 87, “Us ng array funct ons,”
for more d scuss on of array formu as), so you must press Ctr +Sh ft+Enter for the formu a to
work In the H15 J15 ce range, you now see the workbook name enc osed n square brackets
fo owed by the worksheet names, sted n the order of the worksheets

To return each worksheet name to a separate ce , just use the RIGHT and FIND funct ons from
Chapter 5 to extract each worksheet name by pu ng out a characters to the r ght of the square
bracket Copy the =RIGHT(I15,LEN(I15)-FIND(“]”,I15,1)) formu a from H16 to I16 J16 You now see the

192  Chapter 22  The ND RECT funct on


worksheet names sted n the H16 J16 range However, f the worksheet names change, the H15 J15
range rema ns unchanged If you want the worksheet names to update after they are changed, you
must de ete the contents of H15 J15 and reenter the Worksheet array formu a

FIGURE 22-8  Create a range name that can be used to extract worksheet names.

FIGURE 22-9  Worksheet names are extracted n Row 16 and number of sheets s pu ed, us ng the SHEET()
funct on.

Problems
1. The ADDRESS funct on y e ds the actua ce address assoc ated w th a row and co umn
For examp e, the ADDRESS(3,4) formu a y e ds $D$3 What resu t wou d be obta ned f you
entered formu a =INDIRECT(ADDRESS(3,4))?

2. The P23 2 x sx workbook conta ns data for the sa es of five products n four reg ons (East,
West, North, and South) Use the INDIRECT funct on to create formu as that enab e you to
ca cu ate the tota sa es of any comb nat on of consecut ve y numbered products eas y, such
as Product 1 through Product 3, Product 2 through Product 5, and so on

The ND RECT funct on  Chapter 22   193


3. The P23 3 x sx fi e conta ns s x worksheets Sheet 1 conta ns Month 1 sa es for Product 1
through Product 4 These sa es are a ways sted n the E5 H5 range Use the INDIRECT func-
t on to tabu ate the sa es of each product effic ent y by month n a separate worksheet

4. Wr te a formu a that tota s the entr es n the G2 K2 ce range even f you nsert one or more
co umns between co umns G and K

5. The Marketbasketdata x sx fi e conta ns sa es of var ous tems For each row, a 1 n co umns B
through K nd cates a purchased tem, whereas a 0 marks an tem that was not purchased In
the Day Week co umn, a 1 means the transact on was on a Monday, a 2 means the transac-
t on was on a Tuesday, and so on For each tem sted n K9 K14, ca cu ate the percentage of
transact ons n wh ch the tem was purchased In add t on, ca cu ate the fract on of transac-
t ons tak ng p ace on each day

6. The Ver zon nd rectdata x sx fi e conta ns each emp oyee’s hours of work and emp oyee rat ng
for January–May Set up a conso dat on sheet that enab es you to choose any person and
then report that person’s hours of work dur ng each month a ong w th her overa rat ng for
the month

194  Chapter 22  The ND RECT funct on


CHAPTER 23

Conditional formatting

Questions answered in this chapter:


■ How can I v sua y nd cate whether recent temperature data s cons stent w th
g oba  warm ng?

■ How does the H gh ght Ce s cond t ona formatt ng feature work?

■ How can I check or custom ze my ru es?

■ How do data bars work?

■ How does Exce 2013 treat negat ve data bars?

■ How do co or sca es work?

■ How do con sets work?

■ How can I co or-code month y stock returns so that every good month s nd cated n one
co or and every bad month n another?

■ G ven quarter y corporate revenues, how can I nd cate quarters n wh ch revenues ncreased
over the prev ous quarter n one co or and quarters n wh ch revenues decreased from the
prev ous quarter n another co or?

■ G ven a st of dates, how can I nd cate weekend dates n a spec fic co or?

■ Our basketba coach has g ven each p ayer a rat ng between 1 and 10 based on the p ayer’s
ab ty to p ay guard, forward, or center Can I set up a worksheet that v sua y nd cates the
ab ty of each p ayer to p ay the pos t on to wh ch she’s ass gned?

■ What does Stop If True n the Manage Ru es d a og box do?

■ How can I use the Format Pa nter to copy a cond t ona format?

Use cond t ona formatt ng to spec fy formatt ng for a ce range on the bas s of the contents of the
ce range For examp e, g ven exam scores for students, you can use cond t ona formatt ng to d s-
p ay the names of students n red who have a fina average of at east 90 Bas ca y, when you set up
cond t ons to format a range of ce s, M crosoft Exce 2013 checks each ce n the range to determ ne
whether any of the cond t ons you spec fied (such as exam score >90) s sat sfied Exce app es the
format you chose to a the ce s that sat sfy the cond t on If the content of a ce does not sat sfy any
of the cond t ons, the formatt ng of the ce rema ns unchanged In Exce 2007, cond t ona formatt ng

195

was comp ete y rev sed and expanded Exce 2010 added some m nor mprovements to cond t ona
formatt ng In th s chapter, you see how to use a the cond t ona formatt ng features nc uded n
Exce 2013

To v ew the cond t ona formatt ng opt ons, first se ect the range you want to format Then, on the
Home tab, n the Styles group, c ck the Conditional Formatting arrow (see F gure 23-1) to open a
menu of cond t ona formatt ng opt ons, as shown n F gure 23-2

FIGURE 23-1  Th s figure shows the cond t ona formatt ng command.

FIGURE 23-2  These are the cond t ona formatt ng opt ons.

Here s a short exp anat on of each opt on

■ Highlight Cells Rules  These ru es enab e you to ass gn a format to ce s whose contents
meet one of the fo ow ng cr ter a

• Are w th n a spec fic numer ca range


• Match a spec fic text str ng
• Are w th n a spec fic range of dates (re at ve to the current date)
• Occur more than once (or on y once) n the se ected range
196  Chapter 23  Cond t ona formatt ng
■ Top/Bottom Rules  Use these ru es to ass gn a format to any of the fo ow ng

• N argest or sma est va ues n a range For examp e, N = 10 w h gh ght the 10 argest or
10 sma est va ues n a range

• Top or bottom n percent of numbers n a range


• Numbers above or be ow the average of a the numbers n a range

■ Data Bars, Color Scales, and Icon Sets  Use these formats to dent fy arge, sma , or nter-
med ate va ues n the se ected range eas y Larger data bars are assoc ated w th arger num-
bers W th co or sca es, you m ght, for examp e, have sma er va ues appear n red and arger
va ues n b ue w th a smooth trans t on app ed as va ues n the range ncrease from sma to
arge W th con sets, you can use as many as five symbo s to dent fy d fferent ranges of va -
ues For examp e, you m ght d sp ay an arrow po nt ng up to nd cate a arge va ue, po nt ng to
the r ght to nd cate an ntermed ate va ue, and po nt ng down to nd cate a sma va ue

■ New Rule  Use th s ru e to create your own formu a to determ ne whether a ce shou d have
a spec fic format For examp e, f a ce exceeds the va ue of the ce above t, you cou d app y
the co or green to the ce If the ce s the fifth- argest va ue n ts co umn, you cou d app y
the co or red to the ce , and so on

■ Clear Rules  Use these ru es to de ete a cond t ona formats you have created for a se ected
range or for the ent re worksheet

■ Manage Rules  Use these ru es to v ew, ed t, and de ete cond t ona formatt ng ru es; create
new ru es; or change the order n wh ch Exce app es the cond t ona formatt ng ru es you
have set

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

How can I visually indicate whether recent temperature data is consistent with
global warming?

Th s quest on offers a perfect opportun ty to app y the Top/Bottom cond t ona formatt ng ru es
The G oba warm ng2011 x sx fi e (F gure 23-4 shows a subset of th s data) conta ns the average wor d
temperatures for years 1881 through 2011 If g oba warm ng has occurred, you wou d expect the
numbers n recent years to be arger than the numbers n ear er years To determ ne whether recent
years are warmer, try to h gh ght the 20 warmest years n red Se ect the F5 F135 range conta n ng the
temperatures On the Home tab, n the Styles group, c ck Conditional Formatting and then se ect
Top/Bottom Rules Se ect Top 10 Items and fi n the d a og box as shown n F gure 23-3

Cond t ona formatt ng  Chapter 23   197


FIGURE 23-3  H gh ght the 20 h ghest temperatures n red.

Note  Opening the drop-down list on the right side of Figure 23-3 displays a list of options,
including Custom Format. Selecting this option displays the Format Cells dialog box, in
which you create a custom format that is applied when the conditional formatting condi-
tion is satisfied.

Now se ect the G5 G135 range, return to Top/Bottom Rules, and se ect Top 10% Accept ng the
defau t se ect on of 10 h gh ghts the top 10 percent of the temperatures n red and the bottom 10
percent n green Note that a years n the bottom 10 percent were 1918 or ear er, and a years n
the top 10 percent were 1997 or ater F na y, n co umn H, h gh ght above-average temperatures
n green and be ow-average temperatures n red Note that a years ear er than 1936 had be ow-
average temperatures, whereas a years after 1976 had above-average temperatures Cond t ona
formatt ng s a powerfu too that can be used to demonstrate that the earth (for whatever reasons)
seems to have become warmer recent y

FIGURE 23-4  Use cond t ona formatt ng to mp ement Top/Bottom Ru es.

How does the Highlight Cells conditional formatting feature work?

The H gh ghtce s x sx fi e (see F gure 23-5) demonstrates how the H gh ght Ce s feature s used For
examp e, suppose you want to h gh ght a dup cate names n C2 C11 n red S mp y se ect the C2 C11
ce range, choose Conditional Formatting n the Styles group on the Home tab, choose Highlight
Cells Rules and Duplicate Values, and then choose Light Red Fill With Dark Red Text C ck OK to
app y the ru e so that a names occurr ng more than once (John and Josh) are h gh ghted n red

198  Chapter 23  Cond t ona formatt ng


FIGURE 23-5  Use H gh ght Ce s Ru es.

Now suppose you want to h gh ght n red a ce s n the D2 D11 range that conta n the text “Er c”
Se ect the D2 D11 ce range, c ck Conditional Formatting, choose Highlight Cells Rules, and then
se ect Text That Contains Type Er c n the eft box and choose Light Red Fill With Dark Red Text
on the r ght As shown n F gure 23-5, both Er c and Er ca are h gh ghted (Er ca conta ns the “Er c”
text str ng )

Suppose you have a st of dates (such as n E2 E11), and you want to h gh ght any ce that con-
ta ns yesterday’s date n green and any other date dur ng the past seven days n red (See the R ght
Way worksheet n the H gh ghtce s x sx fi e ) Assume (as n F gure 23-5) that the current date s Ju y
19, 2013 Note that ce E3 conta ns the =TODAY()–1 formu a, so ce E3 a ways d sp ays yesterday’s
date Ce E4 conta ns the =TODAY()–5 formu a

Beg n by se ect ng the ce range you want to format (E2 E11) Se ect A Date Occurring and
then se ect Yesterday w th Green Fill With Dark Green Text C ck Conditional Formatting and
Highlight Cells Rules and aga n choose A Date Occurring In the A Date Occurring d a og box,
se ect In The Last 7 Days and Light Red Fill With Dark Red Text Formatt ng ru es created ater
have precedence over ru es created ear er (un ess you change the order of precedence, as exp a ned
n the next sect on of th s chapter) Th s exp a ns why 7/18/2013 s formatted n red rather than n
green

How can I check or customize my rules?

After creat ng cond t ona formatt ng ru es, you can v ew your ru es by choos ng Manage Rules
on the Conditional Formatting menu For examp e, se ect the dates n E2 E11, c ck Conditional
Formatting, and choose Manage Rules; you see the ru es d sp ayed n F gure 23-6 You can see that
the Last 7 Days formatt ng ru e w be app ed before the Yesterday formatt ng ru e Th s s because
the format p aced n a ce s based on the first matched ru e

Cond t ona formatt ng  Chapter 23   199


FIGURE 23-6  Th s figure shows the Cond t ona Formatt ng Ru es Manager d a og box.

In the Cond t ona Formatt ng Ru es Manager d a og box, you can do the fo ow ng

■ Create a ru e by c ck ng the New Rule button

■ Ed t or change a ru e by c ck ng the Edit Rule button

■ De ete a ru e by se ect ng t and then c ck ng the Delete Rule button

■ Change the order of precedence by se ect ng a ru e and then c ck ng the up arrow or down
arrow

To ustrate the use of the Cond t ona Formatt ng Ru es Manager d a og box, copy the prev ous
worksheet (r ght-c ck the worksheet tab, c ck Move Or Copy, and then se ect the Create A Copy
check box) to the R ght Way worksheet of the H gh ghtce s x sx fi e Se ect the Yesterday ru e and
c ck the up arrow The Yesterday ru e now has h gher precedence than the Last 7 Days ru e, so E3 w
be formatted green and not red F gure 23-7 shows how the Cond t ona Formatt ng Ru es Manager
d a og box ooks, and F gure 23-8 shows that ce E3 s green and ce E4 s red as you wanted

FIGURE 23-7  Now Yesterday has a h gher pr or ty than Last 7 Days.

200  Chapter 23  Cond t ona formatt ng


FIGURE 23-8  After you change the precedence of ru es, yesterday s now formatted n green.

How do data bars work?

When you have a ong st of numbers, t’s n ce to have a v sua nd cator that enab es you to dent fy
arge and sma numbers eas y Data bars, co or sca es, and con sets (a ntroduced n Exce 2007) are
perfect too s for d sp ay ng d fferences n a st of numbers

F gure 23-9 (see the Databars x sx fi e) shows the use of data bars Beg n by app y ng the defau t
data bars to the data n D6 D15 Se ect the data n D6 D15, c ck Conditional Formatting, and then
choose Data Bars Se ect b ue data bars and choose Gradient Fill to create the format shown n
co umn D of F gure 23-9 Ce s conta n ng arger numbers conta n onger b ue bars The defau t opt on
s to assoc ate the shortest data bar w th the sma est number n the se ected range and the ongest
data bar w th the argest number As you can see n co umn D, the s ze of the data bars s d rect y pro-
port ona to the data va ue; that s, the data bar for 4 s tw ce as arge as the data bar for 2, and so on

FIGURE 23-9  V sua y d st ngu sh numer c va ues by us ng data bars.

If, after c ck ng Data Bars, you choose More Rules, the New Formatting Rule d a og box shown
n F gure 23-10 opens (You can a so d sp ay th s d a og box by choos ng Manage Rules and Edit Rule
or by doub e-c ck ng a ru e ) In th s d a og box, you can change the cr ter a used to ass gn no data
bar and the ongest data bars to ce s In E6 E15, ass gn no data bar to numbers ess than or equa to 3
and the ongest bar to any number greater than or equa to 8 As shown n F gure 23-9, a numbers n
co umn E that are ess than or equa to 3 have no data bar, a numbers that are greater than or equa
to 8 have the ongest bar, and the numbers between 3 and 8 have graduated bars Note that n the
Edit Formatting Rule d a og box, you can se ect the Show Bar Only check box to d sp ay on y the
co or bar and not the ce va ue n the cond t ona y formatted ce s

Cond t ona formatt ng  Chapter 23   201


FIGURE 23-10  You can custom ze your data bars by us ng th s d a og box.

Next, n co umn F, ass gn no bar to numbers n the bottom 20 percent of the F6 F15 range and the
ongest bar to numbers n the top 20 percent In other words, a numbers < = 1 + 2(21 – 1) = 5 have
no data bar, and a numbers > = 1 + 8(21 – 1 )= 17 have the ongest data bar F gure 23-9 shows
that n co umn F, the first five numbers have no data bar, and the numbers 17 and 21 have the ongest
data bar

In the G6 G13 ce range, assoc ate no data bar w th a numbers at or be ow the twent eth per-
cent e of the data (3) and assoc ate the ongest data bar w th a numbers at or above the e ght eth
percent e of the data (17) From the Bar Direction st, you can spec fy whether your data bars beg n
at the r ght or eft border of the ce

Exce 2013 a ows so d shad ng for data bars and enab es you to or ent data bars assoc ated w th
negat ve va ues so that they run n a d rect on oppos te to pos t ve va ues After se ect ng Negative
Values and Axis from the Edit the Rule Description d a og box, you can move the ax s from the
norma pos t on n the center of the ce or make the negat ve data bars open to the eft (the defau t)
or to the r ght The Negat vedatabars x sx fi e and F gure 23-11 show how so d data bars appear for
a data set conta n ng negat ve numbers The ast two co umns n F gure 23-11 use the Automat c Ax s
sett ng, wh ch a ocates more space to the pos t ve entr es because they are arger n magn tude than
the negat ve va ues

202  Chapter 23  Cond t ona formatt ng


FIGURE 23-11  Th s figure shows data bars for negat ve va ues w th both so d and grad ent shad ng.

How do color scales work?

Use co or sca es to summar ze some data sets L ke H gh ght Ce s Ru es, a co or sca e uses ce
shad ng to d sp ay the d fferences n ce va ues Th s sect on descr bes an examp e of a three-co or
sca e (The Co orsca e nvestment x sx fi e and F gure 23-12 ustrate the use of a three-co or sca e
Note rows 19–75 are h dden; to d sp ay them, se ect rows 18 and 76, r ght-c ck the se ect on, and
then c ck Unhide ) Se ect the annua returns on Stocks, T-B s, and T-Bonds n ce s B8 D89 Choose
Conditional Formatting, Color Scales, and then More Rules to d sp ay the Edit Formatting Rule
d a og box, wh ch s fi ed n as shown n F gure 23-13

FIGURE 23-12  Th s figure shows three co or sca es.

Choose the co or red to nd cate the owest return, green to nd cate the h ghest return, and
orange to nd cate the return at the m dpo nt Amaz ng y, Exce makes sma changes to the co or
shad ng of each ce based on the va ue n the ce In co umn B of F gure 23-12, the owest return s
shaded red Note that 1931 and 2008 (as we a know) were very poor years for stocks As the returns
approach the fift eth percent e, the ce co or gradua y changes to ye ow Then, as the returns
ncrease from the fift eth percent e toward the argest return, the ce co or changes from ye ow to
green Most of the green and red ce s are assoc ated w th stocks because annua stock returns are

Cond t ona formatt ng  Chapter 23   203


more var ab e than bond or T-b returns Th s var ab ty causes arge and sma stock returns to occur
qu te frequent y V rtua y a annua returns for T-B s or T-Bonds are ye ow because the ow var ab -
ty of annua returns on these nvestments means that ntermed ate returns occur most of the t me

FIGURE 23-13  Custom ze a three co or sca e.

Some two-co or sca es were created n the Sca es consdatabars x sx fi e shown n F gure 23-14
To do th s, se ect the range of ce s; c ck Conditional Formatting and choose Color Scales You
can se ect the co or comb nat on you want from the g ven st or create your own by choos ng
More Rules

You can choose a two-co or sca e that nd cates ower va ues n wh te and h gher va ues n
dark b ue

■ In the D19 D28 ce range, choose to make the owest va ue wh te and the h ghest va ue b ue
As numbers ncrease, the ce shad ng becomes darker

■ In the E19 E28 range, choose to make va ues ess than or equa to 3 wh te and va ues greater
than or equa to 8 b ue For numbers between 3 and 8, as numbers ncrease, the ce shad ng
becomes darker

■ In the F19 F28 range, choose to make va ues n the bottom 20 percent of the range wh te
and numbers n the top 20 percent b ue For numbers n the m dd e 60 percent, ce shad ng
becomes darker as numbers ncrease

FIGURE 23-14  Th s figure shows two co or sca es.

204  Chapter 23  Cond t ona formatt ng


How do icon sets work?

You can a so d sp ay numer ca d fferences by us ng con sets (See F gure 23-15 and the
Sca es consdatabars x sx fi e ) An con set cons sts of three to five symbo s You define cr ter a to
assoc ate an con w th each va ue n a ce range For examp e, you m ght use a down arrow for sma
numbers, an up arrow for arge numbers, and a hor zonta arrow for ntermed ate va ues The E32 F41
ce range conta ns two ustrat ons of the use of con sets For each co umn, you can use the red
down arrow, the ye ow hor zonta arrow, and the green up arrow, for nstance

FIGURE 23-15  Th s figure shows how con sets w th arrows are used to summar ze data.

You can ass gn cons to a range of numer ca va ues as fo ows

1. After se ect ng the numbers n E32 E41, choose Conditional Formatting and Icon Sets;
choose More Rules and the 3 Arrows (Colored) con set from the Icon Styles st In co umn
E, you want numbers ess than 4 to d sp ay a down arrow, numbers from 4 to 8 to d sp ay a
hor zonta arrow, and numbers 8 or arger to d sp ay an up arrow To accomp sh th s goa , set
the opt ons n the Edit Formatting Rule d a og box as shown n F gure 23-16

FIGURE 23-16  Ass gn cons to numer ca va ues.

2. In a s m ar fash on, set up a formatt ng ru e for F31 F42 so that up arrows are p aced n
ce s conta n ng numbers n the e ght eth percent e or above of a va ues (>=8), and down

Cond t ona formatt ng  Chapter 23   205


arrows are p aced n ce s conta n ng numbers n the bottom 20 percent of a va ues (<=1)
F gure 23-17 d sp ays the configured formatt ng sett ngs

FIGURE 23-17  Ass gn cons to percent e va ues.

Opt ona sett ngs nc ude Reverse Icon Order, wh ch assoc ates the cons on the eft w th sma
numbers and the cons on the r ght w th arger numbers, and Show Icon On y, wh ch h des the
contents of the ce In Exce 2013, you can h de a subset of cons You can a so custom ze con sets
In the Custom ze Icons worksheet n the H stor ca nvest x sx fi e, you can use three cons to summa-
r ze nvestment returns The top th rd of the returns appear w th a gray up arrow; the bottom th rd
of the returns conta n a red down arrow You can h de the flat arrow con for the m dd e th rd of the
returns F gure 23-18 shows the resu t ng cons, and F gure 23-19 shows the d a og box (accessed
from Manage Ru es) that creates th s formatt ng You can custom ze the three-gray-arrow con set by
rep ac ng the gray down arrow w th a red arrow

FIGURE 23-18  Th s figure shows a custom zed con set w th a h dden con.

206  Chapter 23  Cond t ona formatt ng


FIGURE 23-19  Th s figure shows the d a og box for custom z ng and h d ng cons.

How can I color-code monthly stock returns so that every good month is indicated in one
color and every bad month in another?

The Sandp x sx fi e, shown n F gure 23-20, conta ns month y va ues and returns on the Standard &
Poor’s stock ndex Suppose that you want to h gh ght each month n green n wh ch the S&P ndex
went up by more than 3 percent and h gh ght each month n red n wh ch t went down more than 3
percent

Beg n by mov ng to ce C10 (the first month conta n ng an S&P return) and se ect ng a month y
returns by press ng Ctr +Sh ft+down arrow Choose Conditional Formatting, Manage Rules, and
New Rule and se ect Format Only Cells That Contain F n the d a og box as shown n F gure
23-21 You can te Exce to format ce s n the se ected range that are >0 03 and, after c ck ng
Format, se ect the format to use (a green fi )

Not ce that the sts for fonts and font s ze aren’t ava ab e, so your cho ce of formatt ng can’t
change these attr butes You can use the Fill tab to shade ce s n a co or you choose and use the
Borders tab to create a border for ce s that sat sfy your cond t ona cr ter a After c ck ng OK n the
Format Cells d a og box, you return to the Conditional Formatting d a og box You can now se ect
New Rule aga n and, n a s m ar fash on, set th ngs up so that a ce s conta n ng numbers that are
ess than –0 03 have a red fi (See F gure 23-22 )

When you c ck OK, a months w th an S&P return that’s greater than 3 percent (see ce C23, for
examp e) are d sp ayed n green, and a months w th an S&P return of ess than –3 percent (see ce
C18) are d sp ayed n red Ce s n wh ch the month y returns don’t meet e ther of these cond t ons
ma nta n the r or g na formatt ng

Cond t ona formatt ng  Chapter 23   207


FIGURE 23-20  Cond t ona formatt ng h gh ghts returns n the S&P stock ndex.

FIGURE 23-21  App y spec a formatt ng to S&P returns greater than 3 percent.

208  Chapter 23  Cond t ona formatt ng


FIGURE 23-22  Co or stock returns of ess than 3 percent n red and greater than 3 percent n green.

Here are some usefu t ps concern ng cond t ona formatt ng

■ To de ete cond t ona formatt ng (or any format) app ed to a range of ce s, s mp y se ect the
range of ce s, c ck Conditional Formatting, choose Clear Rules, and then choose Clear
Rules From Selected Cells

■ To se ect a the ce s n a worksheet to wh ch cond t ona formatt ng app es, press F5 to open
the Go To d a og box In the d a og box, c ck Special, se ect Conditional Formats, and then
c ck OK

■ If you want to ed t a cond t ona formatt ng ru e, choose Manage Rules and then doub e-c ck
the ru e or c ck Edit Rules

■ You can de ete a spec fic cond t ona formatt ng ru e by choos ng Manage Rules, se ect ng
the ru e, and then choos ng Delete Rule

Not ce that after both ru es are defined, the red formatt ng ru e s sted first (because t was cre-
ated more recent y than the green formatt ng ru e) In the Cond t ona Formatt ng Ru es Manager d a-
og box, ru es are sted n order of precedence In th s examp e, t does not matter wh ch ru e s sted
first because no ce can sat sfy the cr ter a for both ru es If ru es confl ct, however, the ru e sted first
takes precedence To change the order of cond t ona formatt ng ru es, se ect the ru e and c ck the up
arrow to move the ru e up n precedence or the down arrow to move the ru e down n precedence

Given quarterly corporate revenues, how can I indicate quarters in which revenues increased
over the previous quarter in one color and quarters in which revenues decreased from the
previous quarter in another color?

The Amazon x sx fi e conta ns quarter y revenues ( n m ons) for Amazon com from 1995 through
2009 (See F gure 23-23 ) You want to h gh ght quarters n wh ch revenues ncreased over the prev -
ous quarter n green and h gh ght quarters n wh ch revenues decreased over the prev ous quarter
n red

Cond t ona formatt ng  Chapter 23   209


Use A Formula n the Conditional Formatting Rules Manager d a og box enab es you to spec fy
a formu a that defines cond t ons that Exce checks before t app es formatt ng to a ce Th s sect on
uses th s opt on, but before you use th s formu a opt on, ook at how Exce eva uates some og ca
funct ons The work s n the Log ca examp es x sx fi e

FIGURE 23-23  H gh ght ncreased sa es n green and decreased sa es n red.

What happens when you type a formu a such as =B3<2 n ce B4? If the va ue n B3 s a number
sma er than 2, Exce returns the va ue True n ce B4; otherw se, Exce returns False You can refer to
the Log ca examp es x sx fi e, shown n F gure 23-24, for other examp es ke th s, nc ud ng comb na-
t ons of AND, OR, and NOT n formu as

■ In ce B6, the =OR(B3<3,C3>5) formu a returns the va ue True f e ther of the cond t ons, B3<3
or C3>5, s true Because the va ue of C3 s greater than 5, Exce returns True

■ In ce B7, the =AND(B3=3,C3>5) formu a returns True f B3=3 and C3>5 Because B3 s not
equa to 3, Exce returns False In ce B8, however, the =AND(B3>3,C3>5) formu a returns True
because B3>3 and C3>5 are both true

210  Chapter 23  Cond t ona formatt ng


■ In ce B9, the =NOT(B3<2) formu a returns True because B3<2 wou d return False, and a not-
fa se va ue becomes True

FIGURE 23-24  Th s figure shows og ca funct ons.

Now ook at how Use A Formu a enab es you to create a cond t ona format n a range of
ce s Beg n by se ect ng the range of ce s to wh ch you want to app y a cond t ona format C ck
Conditional Formatting and choose Manage Rules to open the Conditional Formatting Rules
Manager d a og box Choose New Rule and then se ect Use A Formula To Determine Which Cells
To Format (the ast opt on, a so ca ed the formula option) To use the formu a opt on, you enter a
formu a (the formu a must start w th an equa s s gn) that s true f and on y f you want the ce n
the upper- eft corner to be ass gned the chosen format Your og ca formu a can be cop ed ke an
ord nary formu a to the rema nder of the se ected range, so use do ar s gns ($) jud c ous y to ensure
that for each ce of the se ected range the formu a w be true f and on y f you want your format to
app y to the ce Choose Format and then enter the formatt ng you want C ck OK After c ck ng OK
n the Conditional Formatting d a og box, your formu a and formatt ng are cop ed to the who e ce
range The formatt ng s app ed to any ce n the se ected range that sat sfies the cond t on defined
n the formu a

Now return to the Amazon x sx fi e, and you w h gh ght n green the quarters n wh ch revenues
ncrease Se ect the E6 E61 range (there s no pr or quarter to wh ch you can compare the revenue
figure n ce E5) and then nstruct Exce to h gh ght a ce ’s va ue n green f t s arger than the ce ’s
va ue above t F gure 23-25 shows how to set up the ru e

If you enter =E6>E5 by po nt ng to the appropr ate ce s, be sure you remove the $ s gns from the
formu a n the Cond t ona Formatt ng d a og box, or the formu a won’t be cop ed Probab y the eas -
est way to nsert or de ete do ar s gns s to use the F4 key When you h gh ght a ce reference such as
A3, press ng F4 nc udes or de etes do ar s gns n the fo ow ng order A3, $A$3, A$3, $A3 Thus, f you
start w th $A$3, press ng F4 changes the ce reference to A$3 The formu a n th s examp e ensures
that ce E6 s co ored green f and on y f sa es n that quarter exceed the prev ous quarter After
c ck ng OK, you’ find that a quarters n wh ch revenue ncreased are co ored green In ce E7, for
examp e, the formu a was cop ed n the usua way, becom ng =E7>E6

Cond t ona formatt ng  Chapter 23   211


FIGURE 23-25  Th s figure shows cond t ona formatt ng sett ngs that w d sp ay n green the quarters n wh ch
revenue ncreased.

To add the cond t on for formatt ng ce s n wh ch revenue decreased, se ect the E6 E61 range
aga n, open the Conditional Formatting Rules Manager d a og box, choose New Rule, and then
se ect Use A Formula To Determine Which Cells To Format Enter the =E6<E5 formu a and then
c ck Format On the Fill tab, change the fi co or to red and then c ck OK tw ce The Conditional
Formatting Rules Manager d a og box opens, as shown n F gure 23-26

FIGURE 23-26  These cond t ons w d sp ay quarters n wh ch revenue ncreased n green and quarters n wh ch
revenue decreased n red.

You can use the formu a opt on w th co or sca es, data bars, and con sets Se ect the opt on when
sett ng the cr ter a for your co or sca e, data bars, or con sets

212  Chapter 23  Cond t ona formatt ng


Given a list of dates, how can I indicate weekend dates in a specific color?

The Weekendformatt ng x sx fi e (see F gure 23-27) conta ns severa dates You want to h gh ght a
Saturdays and Sundays n red To do th s, copy the WEEKDAY(C6,2) formu a from ce D6 to D7 D69
Choos ng Type=2 for the WEEKDAY funct on returns a 1 for each Monday, a 2 for each Tuesday, and
so on, so that the funct on returns a 6 for each Saturday and a 7 for each Sunday

FIGURE 23-27  Use the WEEKDAY funct on to h gh ght weekend days n red.

Se ect the D6 D69 range, c ck Conditional Formatting, and then choose Manage Rules C ck
New Rule and the formu a opt on and fi n the d a og box as shown n F gure 23-28

Cond t ona formatt ng  Chapter 23   213


FIGURE 23-28  Use the Ed t Formatt ng Ru e d a og box setup to d sp ay weekend days n red.

After you c ck OK, each date whose weekday s equa to 6 (for Saturday) or 7 (for Sunday) s
co ored red The =OR(D6=6,D6=7) formu a mp es that a ce entry of 6 or 7 w act vate the red font
co or You cou d have a so used Format Only Cells That Contain and >=6 or >5 to obta n the same
formatt ng

Our basketball coach has given each player a rating between 1 and 10 based on the player’s
ability to play guard, forward, or center. Can I set up a worksheet that visually indicates the
ability of each player to play the position to which she’s assigned?

The Basketba x sx fi e, shown n F gure 23-29, conta ns rat ngs g ven to 20 p ayers for each pos t on
and the pos t on (1=Guard, 2=Forward, 3=Center) p ayed by each p ayer The goa here s to fi w th
red the ce conta n ng the rat ng for each p ayer for the pos t on to wh ch she’s ass gned

214  Chapter 23  Cond t ona formatt ng


FIGURE 23-29  Th s worksheet rates each p ayer s ab ty to p ay a pos t on.

Beg n by se ect ng the C3 E22 range, wh ch conta ns the p ayers’ rat ngs C ck Conditional
Formatting and choose Manage Rules Choose New Rule and then choose the formu a opt on
Now fi n the d a og box as shown F gure 23-30

The =$A3=C$1 formu a compares the p ayer’s ass gned pos t on to the co umn head ng (1, 2,
or 3) n row 1 If the p ayer’s ass gned pos t on s set to 1 (Guard), her rat ng n co umn C, wh ch s her
guard rat ng, appears n red S m ar y, f the p ayer’s ass gned pos t on s set to 2, her forward rat ng
n co umn D appears n red F na y, f the ass gned pos t on s set to 3, her center rat ng n co umn E
appears n red Note that f you do not nc ude the do ar s gn w th the A and the 1 n the formu a, t
w not copy down and across correct y

Cond t ona formatt ng  Chapter 23   215


FIGURE 23-30  Use the Ed t Formatt ng Ru e d a og box setup to show p ayer rat ngs n red fi .

Note a so that Exce 2013 a ows cond t ona formats created w th formu as to reference data n
other worksheets

What does the Stop If True option in the Manage Rules dialog box do?

Suppose that Stop If True s se ected for a ru e If a ce sat sfies th s ru e, a ower precedent ru es are
gnored Use the Income x sx fi e to ustrate the use of Stop If True Th s fi e shows med an ncome
for each US state for years between 1984 and 2010 Suppose (as shown n F gure 23-31) that you want
to have up arrows show for the 10 states that have the h ghest 2010 med an ncome and no cons
to appear for any other states The key s to make the first ru e No Format for the states w th the 40
owest med an ncomes and then to se ect Stop If True Then create the des red con set

The sett ngs that h de the arrows for the 40 states w th the owest 40 med an 2010 ncomes are
shown n F gure 23-32

216  Chapter 23  Cond t ona formatt ng


FIGURE 23-31  Use up arrows to h gh ght the 10 states w th argest med an ncome.

FIGURE 23-32  Th s figure shows the sett ngs that ensure that on y the top 10 med an ncomes are h gh ghted
w th up arrows.

Cond t ona formatt ng  Chapter 23   217


The sett ngs for the second ru e are shown n F gure 23-33 Note that the top 20 percent of states
nvo ves 2 * 50 = 10 states The rema n ng sett ngs are of no mportance

FIGURE 23-33  Th s figure shows the sett ngs that ensure that the top 10 states n med an ncome get an up arrow.

How can I use the Format Painter to copy a conditional format?

The Format Pa nter con (see the pa ntbrush shown n F gure 23-34) enab es you to pa nt the format
( nc ud ng cond t ona formats) from any ce or group of ce s to any group of ce s Se ect the ce or
group of ce s w th the format you want to copy and c ck the Format Pa nter con Use the pa ntbrush
to se ect the ce s where you want the format cop ed

FIGURE 23-34  Th s figure shows the Format Pa nter con.

218  Chapter 23  Cond t ona formatt ng


If you want to copy a format to a range that nc udes nonadjacent ce s, doub e-c ck the Format
Pa nter and se ect a the ce s where you want the format cop ed To turn off the Format Pa nter, c ck
the Format Pa nter con

Problems
1. Us ng the data n the Sandp x sx fi e, use cond t ona formatt ng n the fo ow ng s tuat ons

• Format n bo d each month n wh ch the va ue of the S&P ndex ncreased and under ne
each month n wh ch the va ue of the S&P ndex decreased

• H gh ght n green each month n wh ch the S&P ndex changed by a max mum of 2
percent

• H gh ght the argest S&P ndex va ue n red and the sma est n purp e

2. Us ng the data n the Toysrusformat x sx fi e, h gh ght a fourth-quarter revenues n b ue and


first-quarter revenues n red

3. The Test x sx fi e conta ns exam scores for students The top 10 students rece ve an A, the next
20 students rece ve a B, and a other students rece ve a C H gh ght the A grades n red, the B
grades n green, and the C grades n b ue H nt The LARGE(D4:D63,10) funct on g ves you the
tenth-h ghest grade on the test

4. In the Weekendformatt ng x sx fi e, h gh ght a weekdays n red H gh ght n b ue a days that


occur n the first 10 days of the month

5. Suppose each worker n the M crosoft finance department has been ass gned to one of four
groups The superv sor of each group has rated each worker on a 0–10 sca e, and each worker
has rated h s sat sfact on w th each of the four groups (See the Sat ssuper x sx fi e ) Based on
the group to wh ch each worker s ass gned, h gh ght the superv sor rat ng and the worker
sat sfact on rat ng for each worker

6. The Var anceana ys s x sx fi e conta ns month y profit forecasts and month y actua sa es The
sa es var ance for a month equa s

actualsales – predictedsales
predictedsales

H gh ght n red a months w th a favorab e var ance of at east 20 percent and h gh ght n
green a months w th an unfavorab e var ance of more than 20 percent

7. For your drug cost examp e from Chapter 21, “The OFFSET funct on,” format the worksheet
so that a Phase 1 costs are d sp ayed n red, a Phase 2 costs are d sp ayed n green, and a
Phase 3 costs are d sp ayed n purp e

8. The Names x sx fi e conta ns a st of names H gh ght a dup cates n green and a names
conta n ng Ja n red

Cond t ona formatt ng  Chapter 23   219


9. The Duedates x sx fi e conta ns due dates for var ous nvo ces H gh ght n red a nvo ces due
by the end of the next month

10. In the H stor ca nvest x sx fi e, set up cond t ona formatt ng w th three cons so that 10
percent of returns have an up arrow, 10 percent have a down arrow, and 80 percent have a
hor zonta arrow

11. The Nbasa ar es x sx fi e conta ns sa ar es of NBA p ayers n m


ons of do ars Set up data bars
to summar ze th s data P ayers mak ng ess than $1 m on shou d have the shortest data bar,
and p ayers mak ng more than $15 m on shou d have the ongest data bar

12. Set up a three-co or sca e to summar ze the NBA sa ary data Change the co or of the bottom
10 percent of a sa ar es to green and the top 10 percent to red

13. Use five cons to summar ze the NBA p ayer data Create break po nts for cons at $3 m on,
$6 m on, $9 m on, and $12 m on

14. How cou d you set th ngs up so that no cons are shown for p ayers who have sa ar es between
$7 m on and $8 m on? H nt Use Stop If True

15. The Fract ondefect ve x sx fi e conta ns the percentage of defect ve un ts produced da y


A day’s product on s cons dered acceptab e f 2 percent or ess of the tems produced are
defect ve H gh ght a acceptab e days w th a green flag In another worksheet, h gh ght a
acceptab e days w th a red flag H nt Use Stop If True to ensure that no con occurs n any ce
conta n ng a number greater than 2

16. Summar ze the g oba warm ng data w th a three-co or sca e Lower temperatures shou d be
b ue, ntermed ate temperatures shou d be ye ow, and h gher temperatures shou d be red

17. Suppose you are sav ng for your ch d’s co ege fund You w contr bute the same amount of
money to the fund at the end of each year Your goa s to end up w th $100,000 For annua
nvestment returns rang ng from 4 percent to 15 percent and number of years nvest ng
vary ng from 5 to 15 years, determ ne your requ red annua contr but on Suppose you can
save $10,000 per year Use cond t ona formatt ng to h gh ght the m n mum number of years
needed for each annua return rate to accumu ate $100,000

18. The Amazon x sx fi e conta ns quarter y revenues for Amazon com Use cond t ona formatt ng
to ensure that sa es dur ng each quarter are h gh ghted n a d fferent co or

19. Set up cond t ona formatt ng that co ors the A1 H8 ce range ke a checkerboard, w th a ter-
nat ng wh te and b ack co or ng H nt The ROW() funct on g ves the row number of a ce , and
the COLUMN() funct on g ves the co umn number of a ce

20. When students take V v an’s account ng exam, they are to d to enter the r ema a as on
a Scantron Often, they make a m stake V v an has a st of the actua ema a ases for the
students n the c ass She wou d ke to h gh ght n ye ow the ema a ases students enter that
are not true a ases Th s w he p her correct them eas y The Scantrons x sx fi e conta ns the
necessary data He p V v an out!

220  Chapter 23  Cond t ona formatt ng


21. The Top5 x sx fi e conta ns the revenues each year of 50 compan es For each year, h gh ght
the compan es that have the five argest revenues H nt The LARGE(B1:B50,5) funct on wou d
return the fifth argest number n the B1 B50 range

22. The Threet mes x sx fi e conta ns a st of names H gh ght n red each name that appears at
east three t mes

23. The GNP x sx fi e conta ns quarter y US gross nat ona product Take advantage of the fact that
data bars hand e negat ve va ues to summar ze quarter y GNP percentage growth rates

24. Us ng the data n the G oba warm ng2011temp x sx fi e, h gh ght the years (not the tempera-
tures) n wh ch the temperature s above average

25. The Accountsums x sx fi e (see F gure 23-35) shows week y sa ar es n thousands of do ars
( sted n chrono og ca order) pa d to severa top-notch consu tants For examp e, dur ng the
first week, Br tney made $91,000 and, dur ng the ast week, made $57,000

• Use the Formu a opt on to h gh ght each person’s name n ye ow

• Use the Formu a opt on to h gh ght each person’s first week of sa ary n orange

FIGURE 23-35  Th s figure shows the data for Prob em 25.

Cond t ona formatt ng  Chapter 23   221


26. The Shad ng x sx fi e conta ns 27 quarters of sa es

• Shade a ternate rows n green and ye ow


• A ternate y shade four rows n green, four rows n ye ow, and so on

222  Chapter 23  Cond t ona formatt ng


CHAPTER 24

Sorting in Excel

Questions answered in this chapter:


■ How can I sort sa es transact on data so that transact ons are sorted first by sa esperson and
then by product, by un ts so d, and n chrono og ca order from o dest to most recent?

■ I have a ways wanted to sort my data based on ce co or or font co or Is th s poss b e n


Exce  2013?

■ I ove the great con sets descr bed n Chapter 23, “Cond t ona formatt ng ” Can I sort my data
based on the con n the ce ?

■ My worksheet nc udes a co umn conta n ng the month n wh ch each sa e occurred When


I sort by th s co umn, I get e ther Apr (first month a phabet ca y) or October ( ast month
a phabet ca y) on top How can I sort by th s co umn so that the months are chrono og ca y
sorted, that s, January transact ons on top, fo owed by February and the fo ow ng months?

■ Can I sort data w thout us ng the Sort d a og box?

A most every user of M crosoft Exce has at one t me or another sorted co umns of data a phabet ca y
or by numer ca va ue Look at some examp es of how powerfu sort ng s n Exce 2013

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

How can I sort sales transaction data so that transactions are sorted first by salesperson and
then by product, by units sold, and in chronological order from oldest to most recent?

JAC s a sma company that se s makeup The Makeup worksheet n the Makeupsorttemp x sx fi e
n the Temp ates fo der for th s chapter (see F gure 24-1) conta ns the fo ow ng sa es transact on
nformat on

■ Transact on number

■ Name of sa esperson

■ Date of transact on

■ Product so d

223

■ Un ts so d

■ Do ars rece ved

■ Locat on of transact on

FIGURE 24-1  Th s figure shows the sa es transact on data before sort ng.

You want to sort the data so that

■ Transact ons are sted a phabet ca y by sa esperson You want to sort n the usua A-to-Z
order so that a of Ash ey’s transact ons are first and a of Zaret’s transact ons are ast

■ Each person’s transact ons are sorted a phabet ca y by product Thus, Ash ey’s eye ner trans-
act ons w be fo owed by Ash ey’s foundat on transact ons and so on

■ For each sa esperson and product, transact ons are sted by number of un ts so d ( n descend-
ng order)

■ If a sa esperson makes two or more sa es of the same product for the same number of un ts,
transact ons are sted n chrono og ca order

In vers ons of Exce before Exce 2007, t was d fficu t to sort by more than three cr ter a Now Exce
enab es you to app y up to 64 cr ter a n one sort To sort the sa es data, you need to se ect the data
(ce range E3 K1894) first Two easy ways to se ect these data are as fo ows

■ Pos t on the cursor n the upper- eft corner of the data (ce E3) and then press Ctr +Sh ft+r ght
arrow fo owed by Ctr +Sh ft+down arrow

■ Pos t on the cursor anywhere n the ce range and press Ctr +Sh ft+*

224  Chapter 24  Sort ng n Exce


On the Data tab, n the Sort & Filter group, choose Sort to open the Sort d a og box shown n
F gure 24-2

FIGURE 24-2  The Sort d a og box s not yet fi ed n.

Because row 3 conta ns head ngs for the data co umns, se ect the My Data Has Headers check
box Se ect the fo ow ng four cr ter a n the order shown

1. Sort by the Name co umn so that va ues (th s means ce contents) are n A-to-Z order

2. Sort by the Product co umn so that va ues are n A-to-Z order

3. Sort by the Un ts co umn so that va ues are n order from argest to sma est

4. Sort by the Date co umn so that va ues are n chrono og ca order from o dest to newest

The d a og box now ooks ke F gure 24-3

FIGURE 24-3  The Sort d a og box s set up for the sa es sort ng examp e.

Sort ng n Exce   Chapter 24   225


The resu t of your sort s shown n F gure 24-4

FIGURE 24-4  Th s figure shows the sorted sa es transact on data.

Note that a of Ash ey’s transact ons are sted first, w th eye ner fo owed by foundat on and so
on Eye ner transact ons are sted from the argest number of un ts so d to the sma est In the case of
a t e (see rows 6 and 7), the transact ons are sted n chrono og ca order

Us ng the Sort d a og box, you can eas y add sort cr ter a (Add Leve ), de ete sort cr ter a (De ete
Leve ), copy the sett ngs that define a eve of the sort (Copy Leve ), or spec fy whether your data has
headers By se ect ng Options, you can make the sort operat on case sens t ve or even sort data for
wh ch each data tem s sted n a d fferent co umn ( nstead of the more common s tuat on n wh ch
each case s n a d fferent row)

I have always wanted to sort my data based on cell color or font color. Is this possible in
Excel 2013?

In Exce 2013, sort ng on ce or font co or s s mp e Cons der the Makeup worksheet n the
Makeupsorttemp x sx fi e Severa names n co umn F are h gh ghted n d fferent co ors For examp e,
C c n ce F620 s h gh ghted n red, and Co een n ce F833 s h gh ghted n ye ow Suppose you
want names w th green fi on top, fo owed by ye ow and then by red, w th the rest of the rows on
the bottom To sort the Name co umn by co or, s mp y se ect the range you want to sort (E3 K1894),
c ck Sort, and choose Add Level Se ect the Name co umn, c ck the Sort On sett ng, and se ect
Cell Color (Se ect ng Font Color sorts by font co or ) For the first eve , se ect green from the Order

226  Chapter 24  Sort ng n Exce


st, se ect ye ow for the second eve , and se ect red for the th rd eve The comp eted d a og box s
shown n F gure 24-5 The resu t ng sort s shown n the Co ors worksheet of the Makeupsort x sx fi e
n the Pract ce F es fo der for th s chapter and n F gure 24-6

FIGURE 24-5  The Sort d a og box s set up to sort by co or.

FIGURE 24-6  Th s figure shows the resu ts of sort ng by co or.

I love the great icon sets described in Chapter 23. Can I sort my data based on the icon in
the cell?

To sort by con, se ect Cell Icon from the Sort On st n the Sort d a og box In the Order st, choose
the con you want on top for the first eve and so on

Sort ng n Exce   Chapter 24   227


My worksheet includes a column containing the month in which each sale occurred. When
I sort by this column, I get either April (first month alphabetically) or October (last month
alphabetically) on top. How can I sort by this column so that the months are chronologically
sorted, that is, January transactions on top, followed by February and the following months?

The Dates worksheet n the Makeupsorttemp x sx fi e conta ns a st of months (See F gure 24-7 ) You
wou d ke to sort the months so that they appear n chrono og ca order beg nn ng w th January
Beg n by se ect ng the D6 D15 range and sort ng co umn D by va ues When se ect ng the order, se ect
Custom List and then se ect the opt on, beg nn ng w th January, February, March Note that you
cou d a so have sorted by the day of the week The comp eted d a og box s shown n F gure 24-8,
w th the resu t ng sort shown n F gure 24-9

Note that n the Custom Lists d a og box, you can create a custom sort order st Se ect New L st;
under L st Entr es, type the entr es n the order you want to sort by and then c ck Add Your new st
s now nc uded as a menu se ect on For examp e, f you enter Jack, John, and A an n L st Entr es (on
d fferent nes or separated by commas), a entr es w th Jack wou d be sted first, fo owed by John
st ngs, w th A an st ngs at the end

FIGURE 24-7  Th s figure shows the months to be sorted.

228  Chapter 24  Sort ng n Exce


FIGURE 24-8  The Sort d a og box s set up to sort by month.

FIGURE 24-9  The months are sorted n chrono og ca order.

Can I sort data without using the Sort dialog box?

Somet mes sort ng data w thout us ng the Sort d a og box s more conven ent To ustrate how th s
s done, suppose aga n that you want to sort the sa es transact on data n the Makeup worksheet n
the Makeupsort x sx fi e so that transact ons are sorted first by sa esperson and then by product, by
un ts so d, and, fina y, n chrono og ca order from the o dest to the most recent To beg n, se ect
the east mportant co umn to sort on first, wh ch s the date co umn (G3 G1894) Next, n the Sort &
Filter group on the Data tab, c ck the Sort A To Z button (see F gure 25-10) and, w th Expand The
Selection se ected, c ck Sort so that a the co umns are sorted The Sort A To Z button sorts numer -
ca data so that the sma est numbers or o dest dates are on top and sorts text so that A precedes B
and so on

Sort ng n Exce   Chapter 24   229


FIGURE 24-10  The Sort con can be used to sort w thout the Sort d a og box.

The Sort Z To A button sorts numer ca data so that the argest numbers or most recent dates are
on top and sorts text data so that Z precedes Y

Next, sort by the second east mportant co umn (Un ts) Z To A because you want arger sa es on
top Then sort from A to Z by Product, and, fina y, from A to Z by sa esperson These steps ach eve
the same resu ts as shown n F gure 24-4

Problems
1. In the Makeupsort x sx fi e, sort the sa es data a phabet ca y by ocat on and then by product
type, name, date of sa e, and un ts so d

2. The Sortday x sx fi e conta ns hours worked on d fferent days of the week Sort the data so
that Monday data s fo owed by Tuesday data and so on

3. The Sort cons x sx fi e conta ns annua nvestment returns w th an up arrow used to nd cate
good years, a hor zonta arrow used to nd cate average years, and a red down arrow used to
nd cate bad years Sort the data by the cons n the Stock co umn w th up arrows on top, fo -
owed by hor zonta arrows and then red down arrows

4. The Makeupsortfont x sx fi e conta ns your makeup data w th certa n dates shown n b ue, red,
or brown font Sort the data so that brown dates are on top, fo owed by red dates and then
b ue dates

230  Chapter 24  Sort ng n Exce


CHAPTER 25

Tables

Questions answered in this chapter:


■ I have entered the number of un ts so d and tota revenue for each sa esperson n a work-
sheet, and I can eas y compute average pr ce for each sa esperson How can I create a n ce
format that s automat ca y cop ed f I enter new data? In add t on, s there an easy way to
copy my formu as automat ca y when new data s added?

■ I have entered severa years of natura gas pr ces n my worksheet, and I created a n ce ne
chart d sp ay ng the month y var at on n pr ces Can I set th ngs up so that when I add new
gas pr ce data, my chart automat ca y updates?

■ For each sa es transact on, I have the sa esperson, date, product, ocat on, and s ze of the
transact on Can I eas y summar ze, for examp e, tota pst ck sa es by Jen or Co een n
the East?

■ How do Tab e S cers (new to Exce 2013) he p us s ce and d ce data n an Exce tab e?

■ How can I eas y refer to port ons of a tab e n other parts of my workbook?

■ Do cond t ona formats automat ca y app y to new data added to a tab e?

When most of us use M crosoft Exce , we often enter new data Then we manua y update our for-
mu as, formats, and charts What a drag! Now the Exce 2013 Tab e capab t es make th s drudgery a
th ng of the past

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

I have entered the number of units sold and total revenue for each salesperson in a work-
sheet, and I can easily compute average price for each salesperson. How can I create a nice
format that is automatically copied if I enter new data? In addition, is there an easy way to
copy my formulas automatically when new data is added?

The Tab eexamp etemp x sx fi e n the Temp ates fo der for th s chapter (see F gure 25-1) conta ns un ts
so d and revenue data for each of s x sa espersons You know that new data w be added beg nn ng
n row 12 and, n co umn H, you wou d ke to ca cu ate the average pr ce (Un ts/Revenue) generated

231

by each sa esperson You wou d ke to create an attract ve format for the data and have the formu a
for average pr ce cop ed automat ca y as new data s added

FIGURE 25-1  Th s figure shows the data for creat ng a tab e.

By creat ng a tab e, your formu as and formatt ng can be automat ca y updated when you add
data Beg n by se ect ng the current range of data and headers (E5 G11) C ck Table on the Insert tab
or press Ctr +T After ensur ng that the My Table Has Headers box s se ected, you w see that the
tab e range (E5 G11) s formatted beaut fu y Th s formatt ng w cont nue automat ca y whenever
new data s entered n the tab e When you are work ng n a tab e, many sty es and opt ons are ava -
ab e on the Table Tools Design tab (See F gure 25-2 ) Th s tab s v s b e on y when the act ve ce s
w th n a tab e You can se ect a formatt ng sty e that w be app ed to the current tab e data and to
any new data that s added to the tab e

Note that the co umn head ngs have arrows, as you can see n F gure 25-3 These arrows serve as
funct ona ty you can use to sort or fi ter the tab e (more on fi ter ng when how to summar ze eas y,
for examp e, tota pst ck sa es by Jen or Co een n the East s d scussed ater n th s chapter)

FIGURE 25-2  Th s figure shows the tab e des gn opt ons.

FIGURE 25-3  Th s s a tab e formatted w th fi ters.

232  Chapter 25  Tab es


The ce s n the se ected tab e (exc ud ng the headers) are g ven the name Tab e1 by defau t The
name has been changed to Sa es n the Propert es group on the Des gn tab If you c ck the Formulas
tab and then choose Name Manager, you can see that the E6 G12 range s named Sa es The beauty
of th s range name (and the tab e) s that the range dynam ca y expands to nc ude new rows added
to the bottom of the tab e and new co umns added to the r ght of the tab e In Chapter 21, “The
OFFSET funct on,” you used the OFFSET funct on to create a dynam c range, but the new tab e capa-
b t es make creat on of a dynam c range easy

Suppose that n D15 you want to compute tota revenue Beg n by typ ng =SUM(S; M crosoft
Exce  offers you the opt on to comp ete the entry automat ca y w th the Sa es tab e range Imp ement
AutoComp ete by doub e-c ck ng the range name You can a so mp ement AutoComp ete by mov ng
the cursor to Sa es and press ng the Tab key Then, when you see =SUM(Sa es and type an open ng
bracket ( [ ), Formu a AutoComp ete offers the opt on to comp ete the formu a w th co umn head ngs
from the Sa es tab e (See F gure 25-4 ) You can comp ete your formu a as =SUM(Sa es[Revenue]) and
ca cu ate tota revenue as $155,480 (See F gure 25-5 ) (You w see an examp e of se ect ng the entr es
n the AutoComplete box that beg n w th number s gns [#] when tab e structure s d scussed ater n
th s chapter )

FIGURE 25-4  Here are AutoComp ete opt ons for a tab e.

If new rows of data are added, the data n these rows s automat ca y accounted for n the formu a
To ustrate th s dea, you can add new data n row 12 Amanda so d 400 un ts for $5,000 As shown n
F gure 25-6, the tota revenue has ncreased by $5,000 to $160,480

The formatt ng has been extended to row 12 as we , and the tota revenue formu a has been
updated to nc ude Amanda’s data Even f data s added w th n the tab e ( nstead of at the bottom),
everyth ng w be updated n a cons stent fash on

Tab es  Chapter 25   233


FIGURE 25-5  Th s figure shows tota revenue for or g na data.

FIGURE 25-6  New data s added to the tab e n row 12.

Now suppose that you want to compute the pr ce per un t earned by each sa esperson n co umn
H Type Un t Pr ce n H5 as the co umn head ng and, wh e n ce H6, po nt to ce G6 The formu a
s now [@Revenue] Type a s ash (/) and po nt to ce F6 and press Enter An amaz ng th ng happens
Exce automat ca y cop es the formu a down to the bottom of the tab e n ce H12, as shown n
F gure 25-7 If you open any ce n co umn H, the formu a appears as [@Revenue]/[@Un ts] Of course,
=[@Revenue]/[@Un ts] s a ot eas er to understand than =G6/F6 Th s formu a can be nterpreted as
d v d ng whatever s n the current row n the Revenue co umn by whatever s n the current row n the

234  Chapter 25  Tab es


Un ts co umn If you now add new data to the first three co umns of the tab e, your pr ce formu a w
automat ca y copy down

FIGURE 25-7  The Tab e feature causes the un t pr ce formu a to AutoCopy.

If you c ck anywhere n a tab e, the Table Tools contextua tab appears on the r bbon and offers
cho ces, nc ud ng the fo ow ng

■ Change Table Name  Can be used to rename a tab e, such as chang ng the name from
Tab e1 (the defau t) to Sa es

■ Convert to Range  Converts the tab e range to norma ce s and removes the tab e structure

■ Resize Table  Adds or subtracts rows and/or co umns to the defined tab e range

■ Remove Duplicates  Removes rows that conta n dup cates For examp e, se ect ng on y the
Name co umn n the Remove Duplicates d a og box ensures that a name w not occur more
than once Se ect ng both the Name and Un ts co umns ensures that no rows n the tab e w
match both Name and Un ts and or other co umn names

■ Header Row  If se ected, d sp ays the header row If c eared, the header row s not d sp ayed

■ Total Row  Tota Row s d scussed when tab e structure s exp a ned ater n th s chapter

■ First Column  If se ected, app es a spec a format to the first co umn of the tab e

■ Last Column  If se ected, ass gns a spec a format to the ast co umn of the tab e

■ Banded Rows  If se ected, g ves the even-numbered rows n the tab e a d fferent format
than odd-numbered rows

■ Banded Columns  If se ected, g ves odd-numbered co umns n the tab e a d fferent format
than even-numbered co umns

Tab es  Chapter 25   235


■ Table Styles  Can be se ected from any of the tab e formats shown n th s group If the tab e
expands or contracts, the format w be cons stent y app ed

I have entered several years of natural gas prices in my worksheet, and I created a nice line
chart displaying the monthly variation in prices. Can I set things up so that when I add new
gas price data, my chart automatically updates?

In the Gaspr ces507 x sx fi e, the Or g na worksheet conta ns natura gas pr ces per thousand feet from
Ju y 2002 through December 2004 (See F gure 25-8 ) As prev ous y descr bed, you can se ect B4 C34
(conta n ng months and pr ces) and press Ctr +T to create a tab e from th s range, and then you can
create a ne graph to d sp ay th s data by choos ng Line n the Charts group on the Insert tab and
se ect ng the fourth type of ne graph The ne graph a ready created s shown n F gure 25-9

FIGURE 25-8  Here s the gas pr ce data for 2002 2004.

Next, you can copy th s worksheet (by r ght-c ck ng the worksheet name, choos ng Move Or
Copy Sheet, and then se ect ng Make A Copy) and add gas pr ces through Ju y 2006 (The data now
extends to row 53 ) The new worksheet s named New Data Note that the ne graph n th s worksheet
automat ca y updates to nc ude the new data (See F gure 25-10 )

236  Chapter 25  Tab es


FIGURE 25-9  Gas pr ce ne graph: 2002 2004 data.

FIGURE 25-10  Here s a gas pr ce ne graph show ng data for 2002 through 2006.

Th s examp e ustrates that f you base your chart on a tab e, new data w automat ca y be
nc uded n the chart

Tab es  Chapter 25   237


For each sales transaction, I have the salesperson, date, product, location, and size of the
transaction. Can I easily summarize, for example, total lipstick sales by Jen or Colleen in
the East?

The Tab emakeuptemp x sx fi e from the temp ate fo der conta ns sa es transact ons (See F gure
25-11 ) For each transact on, you have the fo ow ng nformat on transact on number, name, date,
product, ocat on, do ars, and un ts so d If you format th s data as a tab e, you can add a tota row
for the Un ts and Do ars co umns and then use the fi ter arrows to make the tota row nc ude the
subset of transact ons you want To beg n, p ace the cursor anywhere w th n the data and create a
tab e by press ng Ctr +T Note that f you scro through the tab e, the header row rema ns v s b e
W th the cursor n the tab e, se ect the Total Row check box n the Table Style Options group on
the Design tab By defau t, Exce enters the tota number of rows n the tab e n ce K1895, wh ch you
can de ete After first se ect ng the ce n wh ch the arrows appear, c ck the arrows to the r ght of ce s
I1895 and J1895 and then c ck Sum Th s tota s a entr es n the tab e’s Un ts and Do ars co umns
Thus, the tota revenue s current y $239,912 67, and 78,707 un ts were so d (See F gure 25-12 and the
Tab emakeuptota s x sx fi e )

FIGURE 25-11  Th s tab e shows makeup sa es data.

FIGURE 25-12  Th s figure shows the tota revenue and un ts so d.

238  Chapter 25  Tab es


To make the tota s reflect on y pst ck sa es n the East by e ther Ash ey or Ha agan, c ck the arrow
n F3 (to the r ght of the Name header) C ear the Select All check box so that no names are se ected,
se ect the check boxes for Ash ey and Ha agan (see F gure 25-13), and c ck OK Next, c ck the
Product arrow, se ect the Lipstick check box, and then c ck the Location arrow and se ect the East
check box You now see a the data fitt ng the fi ter ng cr ter a n F gure 25-14 and n the S cers work-
sheet of the Tab emakeuptota s x sx fi e You’ see that Ash ey and Ha agan so d 564 un ts of pst ck
n the East for a tota of $1,716 56 Th s tab e fi ter ng feature makes t easy to compute tota s for any
subset of rows n an Exce worksheet If you want, you can a so copy the rows nvo v ng Co een or Jen
se ng pst ck n the East and paste them e sewhere

FIGURE 25-13  F ter on names from the tab e.

Tab es  Chapter 25   239


FIGURE 25-14  Subtota s are fi tered for un ts and revenue.

How do Table slicers (new to Excel 2013) help us slice and dice data in an Excel table?

In Exce 2010, s cers were ntroduced to s mp fy the fi ter ng of P votTab es (See Chapter 43, “Us ng
P votTab es and S cers to descr be data,” for deta s ) In Exce 2013, s cers can now be used to fi ter
tab es The advantage of s cers s that you can eas y see the fi ter opt ons and se ect on To create fi -
ters for your Makeup examp e, p ace your cursor ns de the tab e and, on the Insert tab, se ect Slicers
from the Filters group To create s cers for Name, Product, and Locat on, se ect them as shown n
F gure 25-15

The s cers are shown n F gure 25-16 In a s cer, you can fi ter on mu t p e tems by us ng the Sh ft
key to se ect adjacent tems or the Contro key to se ect nonadjacent tems

Your s cers n F gure 25-16 fi ter on a sa es nvo v ng Ash ey and Ha agan se ng pst ck n the
East Note that the Tota s row and v s b e rows are dent ca to F gure 25-14 To remove a fi ters, c ck
the fi ter con ocated at the r ght corner of the s cer

You can res ze a s cer by se ect ng t and dragg ng the edges or corners When you se ect a s cer,
you can configure t by us ng the Slicer Tools Options tab on the r bbon On th s tab, you can mod fy
many features of the s cer, nc ud ng the s cer sty e, s cer name, the number of co umns, and the
s cer’s s ze

240  Chapter 25  Tab es


FIGURE 25-15  Create s cers for Name, Product, and Locat on.

FIGURE 25-16  Use s cers to fi ter a tab e.

Tab es  Chapter 25   241


How can I easily refer to portions of a table in other parts of my workbook?

The Tab estructure x sx fi e shows many examp es of how you can refer to parts of a tab e when
you are work ng outs de the tab e’s range These references are often ca ed structured references
(See F gure 25-17 ) When you enter a tab e name n a formu a fo owed by an open ng bracket ([),
AutoComp ete makes the co umn names and the fo ow ng tab e spec fics ava ab e for se ect on

■ Table Name  A ce s n the tab e, exc ud ng the header and tota rows

■ #All  A ce s n the tab e, nc ud ng the tota row ( f any)

■ #Data  A ce s n the tab e except for the first row and the tota row

■ #Headers  Just the header row

■ #Totals  Just the tota row If there s no tota row, th s returns an empty ce range

■ #This Row  A tab e entr es n the current row

A co umn reference nc udes a ce s n a tab e co umn, exc ud ng the header and tota row entr es
( f any)

Here are some examp es of how tab e spec fiers can be used n formu as

■ In ce B8, the =SUM(Tab e1[@]) formu a sums the entr es n row 8 (41+28+49+40)

■ In ce C15, the =COUNTA(Tab e1[#A ]) formu a y e ds 55 because the tab e conta ns 55


entr es

■ In ce C16, the =COUNTA([Tab e1]) formu a y e ds 45 because the header and tota rows are
not counted In ce C17, the =COUNTA(Tab e[#data]) formu a y e ds 45 because the D5 H13
ce range s referenced

■ In ce C18, the =COUNTA(Tab e1[#Headers]) formu a y e ds 5 because on y the header row


(D4 H4) s referenced

■ In ce C19, the =SUM(Tab e1[Q1]) formu a y e ds 367 because the formu a sums the entr es n
E5 E13

■ In ce C20, the =SUM(Tab e1[#Tota s]) formu a sums up a entr es n the tota row and y e ds
1,340, wh ch s the tota sum of a tab e entr es

■ In ce C21, the =SUM(Tab e1[[#Data],[Q1] [Q3]]) formu a sums up a data entr es that are n
co umns Q1 Q3, nc us ve (ce s E5 G13) Thus, co umn names separated by a co on nc ude a
data entr es between and nc ud ng the co umn name before the co on and the co umn name
after the co on

Of course, a these formu as are automat ca y updated f new data s added to the tab e

242  Chapter 25  Tab es


FIGURE 25-17  Th s tab e shows structured references.

Do conditional formats automatically apply to new data added to a table?

Yes, cond t ona formats automat ca y nc ude new tab e data (See F gure 25-18 ) To ustrate, a con-
d t ona format was p aced n worksheet Or g na of fi e Tab estructure x sx to h gh ght the three arg-
est Q1 sa es n co umn E Entr es n rows 7, 12, and 13 were h gh ghted In worksheet Add B ggersa e,
the entry 90 was added n ce E14 Th s becomes the argest entry n the co umn and s mmed ate y
h gh ghted Ce E7 s no onger h gh ghted because t s no onger one of the three argest numbers
n co umn E of the tab e

FIGURE 25-18  Cond t ona formatt ng extends automat ca y to new tab e data.

Tab es  Chapter 25   243


Problems
1. The S ngers x sx fi e conta ns a st of songs sung by d fferent s ngers as we as the ength of
each song Set up your worksheet to compute the tota number of songs sung by Em nem and
the average ength of each song If new data s added, your formu as shou d automat ca y
update

2. In the Tab eexamp e x sx fi e, set th ngs up so that each sa esperson’s rank accord ng to tota
revenue and un ts so d s nc uded n the worksheet If new data s nc uded, your ranks shou d
automat ca y update You m ght find t conven ent to use the RANK.EQ funct on The syntax
of the RANK funct on s =RANK EQ(number,array,0) Th s funct on y e ds the rank of a number
n a range array; rank=1 s the argest number

3. The Lookupdata x sx fi e conta ns product codes and pr ces Set up the worksheet so that you
can enter a product code, and your worksheet w return the product pr ce When new prod-
ucts are ntroduced, your formu a shou d st work

4. The Product ookup x sx fi e conta ns the product sa es made each day of the week Set up a
formu a that returns the sa e of any product on any g ven day If new products are added to
the data, your formu a shou d be ab e to nc ude sa es for those products

5. The Tab ep e x sx fi e conta ns sa es nformat on for d fferent products so d n a sma genera


store You want to set up a p e chart to summar ze th s data If new product categor es are
added, the p e chart shou d automat ca y nc ude the new data

6. The Tab exnpvdata x sx fi e sts cash flows rece ved by a sma bus ness Set up a formu a to
compute (as of January 5, 2007) the net present va ue (NPV) of a cash flows Assume an
annua d scount rate of 10 percent If new cash flows are entered, your formu a shou d auto-
mat ca y nc ude them

7. The N kedata x sx fi e conta ns quarter y sa es revenues for N ke Create a graph of N ke sa es


that automat ca y nc udes new sa es revenue data

8. For the data n fi e Tab emakeuptemp x sx, determ ne tota un ts and revenue for a p g oss
or pst ck so d by Jen or Ash ey n the South or East

9. The C osest x sx fi e conta ns peop e’s names and sa ar es Set up a worksheet that takes any
number and finds the person whose sa ary s c osest to that number Your worksheet shou d
accomp sh th s goa even f new names are added or ex st ng names are de eted from the st

10. The Adagency x sx fi e conta ns sa ar es and ages for emp oyees of an ad agency Set up a
spreadsheet that w compute the average sa ary and age of the agency’s emp oyees Your
ca cu at ons shou d automat ca y update f the agency h res or fires workers
CHAPTER 26

Spinner buttons, scroll bars, option


buttons, check boxes, combo
boxes, and group list boxes

Questions answered in this chapter:


■ I need to run a sens t v ty ana ys s that has many key nputs, such as Year 1 sa es, annua sa es
growth, Year 1 pr ce, and un t cost How can I qu ck y vary these nputs and see the effect of
the var at on on the ca cu at on of net present va ue, for examp e?

■ How can I set up a s mp e check box that togg es cond t ona formatt ng on and off?

■ How can I set up my worksheet so that my supp y-cha n personne can c ck a button to
choose whether we charge a h gh, ow, or med um pr ce for a product?

■ How can I create an easy way for a user of my worksheet to enter a day of the week w thout
hav ng to type any text?

User forms enab e peop e who use M crosoft Exce 2013 to add a var ety of usefu contro s to a
worksheet In th s chapter, you’ see how easy t s to use sp nner buttons, scro bars, check boxes,
opt on buttons, combo boxes, and st boxes To access Exce user forms, c ck the Developer tab on
the r bbon and choose Insert n the Controls group to d sp ay the forms contro s (not to be confused
w th Act veX contro s, wh ch are usua y used w th n the M crosoft V sua Bas c for App cat ons [VBA]
programm ng anguage)

Note  To display the Developer tab, click the File tab and then choose Options. Choose
Customize Ribbon and then select Developer in the Main Tabs list.

The user forms d scussed n th s chapter are shown n F gures 26-1 through 26-6 (See a so the
Contro s x sx fi e n the Pract ce fi es fo der for th s chapter )

245

FIGURE 26-1  Th s s the sp nner button.

FIGURE 26-2  Th s s the scro bar.

FIGURE 26-3  Th s s a check box.

FIGURE 26-4  Th s s an opt on button.

FIGURE 26-5  Th s s a combo box.

FIGURE 26-6  Th s s a st box.

246  Chapter 26  Sp nner buttons, scro bars, opt on buttons, check boxes, combo boxes, and group st boxes
Answers to this chapter’s questions
Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

F rst, see how to use sp nner buttons and scro bars

As d scussed n Chapter 18, “Us ng the Scenar o Manager for sens t v ty ana ys s,” you use the
Scenar o Manager to change a group of nput ce s to see how var ous outputs change Unfortunate y,
the Scenar o Manager requ res you to enter each scenar o nd v dua y, wh ch makes creat ng more
than a few scenar os d fficu t For examp e, suppose you be eve that four key nputs to the car net
present va ue (NPV) mode are Year 1 sa es, Sa es growth, Year 1 pr ce, and Year 1 cost (See the
NPVsp nners x sx fi e ) You’d ke to see how NPV changes as the nputs change n the fo ow ng
ranges

Input Low value High value


Year 1 sa es $5,000 $30,000
Annua sa es growth 0% 50%
Year 1 pr ce $6 $20
Year 1 cost $2 $15

Us ng the Scenar o Manager to generate the scenar os n wh ch the nput ce s vary w th n the
g ven ranges wou d be very t me-consum ng By us ng spinner buttons, however, a user can qu ck y
generate a host of scenar os that vary each nput between ts ow and h gh va ue A sp nner button s
a contro that s nked to a spec fic ce As you c ck the up or down arrow on the sp nner button, the
va ue of the nked ce changes You can see how formu as of nterest (such as one that ca cu ates a
car’s NPV) change n response to changes n the nputs

I need to run a sensitivity analysis that has many key inputs, such as Year 1 sales, annual sales
growth, Year 1 price, and Year 1 unit cost. How can I quickly vary these inputs and see the
effect of the variation on the calculation of net present value, for example?

Here’s how to create sp nner buttons by wh ch you can vary Year 1 sa es, sa es growth, Year 1 pr ce,
and Year1 cost w th n the ranges you want The Or g na Mode worksheet (see the NPVsp nnerstemp
x sx fi e n the Temp ates fo der) s shown n F gure 26-7

Sp nner buttons, scro bars, opt on buttons, check boxes, combo boxes, and group st boxes  Chapter 26   247
FIGURE 26-7  Th s figure shows the Or g na Mode worksheet w thout any sp nner buttons.

To create the sp nner buttons, se ect the rows n wh ch you want to nsert sp nner buttons ( n th s
examp e, rows 2–5) and then ncrease the he ght of the rows by r ght-c ck ng and se ect ng Format,
Row, and Height A row he ght of 27 s usua y enough to accommodate the sp nner button arrows
A ternat ve y, ho d down the A t key wh e you draw the contro so that t fits the ce

D sp ay the User Forms menu by c ck ng Insert n the Controls group on the Developer tab
C ck the sp nner button form contro (shown n F gure 26-1) and drag t to where you want t to
appear n your worksheet (ce D2) You see a p us s gn (+) Press ng the eft mouse button anchors
the sp nner button where you want t, and you can draw the shape for the sp nner button To change
the shape of a form contro or to move the contro , p ace the cursor on the contro and ho d down
the Ctr key When the po nter turns nto a four-headed arrow, drag the contro to move t When the
po nter appears as a two-headed arrow, you can drag the contro to res ze t

A sp nner button now appears n ce D2 After configur ng the sp nner button, you can use t to
change the va ue of Year1 sa es R ght-c ck the sp nner button and, on the shortcut menu, c ck Copy
R ght-c ck ce D3 and then c ck Paste A so, paste the sp nner button nto ce s D4 and D5 You
shou d now see four sp nner buttons as shown n F gure 26-8

248  Chapter 26  Sp nner buttons, scro bars, opt on buttons, check boxes, combo boxes, and group st boxes
FIGURE 26-8  Sp nner buttons are p aced n worksheet ce s.

Now you need to nk each sp nner button to an nput ce To nk the sp nner button n D2 to ce
C2, r ght-c ck the sp nner button n ce D2 and then c ck Format Control F n the Format Control
d a og box as shown n F gure 26-9

FIGURE 26-9  Use the Format Contro d a og box to nk Year1sa es to a sp nner button.

Sp nner buttons, scro bars, opt on buttons, check boxes, combo boxes, and group st boxes  Chapter 26   249
The current va ue s not mportant The rest of the sett ngs te Exce that th s sp nner button s
nked to the va ues n ce C2 (Year1sa es); that each c ck of the up arrow w ncrease the va ue n
C2 by 1,000; and that each c ck of the down arrow w decrease the va ue n C2 by 1,000 When the
va ue n C2 reaches 30,000, c ck ng the up arrow w not ncrease t; when the va ue n C2 reaches
5,000, c ck ng the down arrow w not decrease the va ue

Use the Format Control d a og box to nk the sp nner button n D4 to Year1pr ce (ce C4) For
the current va ue, 9 was used The m n mum va ue s 6, the max mum va ue s 20, and the ncrementa
change s 1 C ck ng the sp nner button arrows n ce D4 var es the Year1pr ce between $6 and $20 n
$1 ncrements

To nk the sp nner button n ce D5 to Year1 cost (ce D5), 6 was used for the current va ue, 2 for
the m n mum va ue, 15 for the max mum va ue, and 1 as the ncrementa change C ck ng the sp nner
button arrows n ce D5 changes Year1 cost from $2 to $15 n $1 ncrements

L nk ng the sp nner button n ce D3 to Sa es growth s tr ck er You want the sp nner button con-
tro to change sa es growth to 0 percent, 1 percent, 50 percent The prob em s that the m n mum
ncrement a sp nner button va ue can change s 1 Therefore, you need to nk th s sp nner button to
a dummy va ue n ce E3 and p ace the E3/100 formu a n ce C3 Now, as ce E3 var es from 1 to 50,
sa es growth var es between 1 percent and 50 percent F gure 26-10 shows how to nk th s sp n-
ner button to ce E3 Remember that sa es growth n ce C3 s s mp y the number n ce E3 d v ded
by 100

By the way, f the cursor s w th n the contro and you ho d down the Contro key, you can eas y
use the hand es to res ze a contro

250  Chapter 26  Sp nner buttons, scro bars, opt on buttons, check boxes, combo boxes, and group st boxes
FIGURE 26-10  These are the Format Contro d a og box sett ngs that nk the sp nner button n ce D3 to ce E3.

By c ck ng a sp nner button arrow, you can eas y see how chang ng a s ng e nput ce —g ven the
va ues for the other nputs sted n the worksheet—changes the car’s NPV To see the effect of the
changes, you can se ect ce F9, c ck Freeze Panes on the View menu, and then c ck Freeze Panes
aga n Th s command freezes the data above row 9 and to the eft of co umn F You can now use the
scro bars on the r ght of the w ndow to arrange t as you see t n F gure 26-11

Sp nner buttons, scro bars, opt on buttons, check boxes, combo boxes, and group st boxes  Chapter 26   251
FIGURE 26-11  You can freeze panes to see the resu ts of ca cu at ons n other parts of a worksheet.

G ven the va ues of the other nputs, c ck ng the sa es growth sp nner button arrows shows that a
1 percent ncrease n sa es growth s worth about $2,000 (To return the worksheet to ts norma state,
c ck Freeze Panes on the View menu, fo owed by Unfreeze Panes )

The scro bar contro s very s m ar to the sp nner button The ma n d fference s that by mov ng
the cursor over the gray area n the m dd e of the scro bar, you can cause the nked ce to change n
va ue cont nuous y By se ect ng Format Control on the shortcut menu and chang ng the va ue under
Page Change n the Format Control d a og box, you can contro the speed w th wh ch the nked ce
changes

How can I set up a simple check box that toggles conditional formatting on and off?

A check box s a form of contro that spec fies a va ue of True n a ce when the box s se ected
and False when the box s c eared Check boxes can be used to create togg e sw tches that turn a

252  Chapter 26  Sp nner buttons, scro bars, opt on buttons, check boxes, combo boxes, and group st boxes
part cu ar feature on or off As an examp e, see how to use a check box to turn the cond t ona for-
matt ng feature on or off

Suppose a worksheet conta ns month y sa es, and you want to co or the five argest sa es n green
and the five sma est sa es n red (See the Checkbox x sx fi e ) You enter the =LARGE(Sa es,5) formu a
n ce G4, wh ch computes the fifth- argest sa es va ue In ce H4, you compute the fifth-sma est sa es
va ue w th the =SMALL(Sa es,5) formu a (See F gure 26-12 )

FIGURE 26-12 Use a check box to turn cond t ona formatt ng on and off.

Next, you create a check box and configure t to enter True or False n ce F1 On the Developer
tab, c ck Insert and se ect the check box (see F gure 26-3) from the Forms Controls pa ette Drag
the check box to ce G9 and change ts text to read Turn Formatting On Or Off R ght-c ck the
check box, c ck Format Control, and fi n the d a og box as shown n F gure 26-13

Sp nner buttons, scro bars, opt on buttons, check boxes, combo boxes, and group st boxes  Chapter 26   253
FIGURE 26-13 Th s s the Format Contro d a og box for a check box.

Now, whenever you se ect the check box, True s p aced n F1, and whenever you c ear the check
box, Fa se s p aced n ce F1

After se ect ng the D4 D29 ce range, c ck Conditional Formatting n the Styles group on the
Home tab and then c ck New Rule Enter the formu as shown n F gure 26-14 and F gure 26-15
to co or the top five sa es green and the bottom five sa es red Note that the AND($F$1) port on of
the formu a ensures that the formatt ng can be app ed f ce F1 s True The check box determ nes
whether ce F1 s True or False, so f the check box s not se ected, the ce s w not turn green or red

If you want, you can se ect ce F1 and change the font co or to wh te to h de True and Fa se

254  Chapter 26  Sp nner buttons, scro bars, opt on buttons, check boxes, combo boxes, and group st boxes
FIGURE 26-14  Th s figure shows the format to turn the five argest ce s green.

FIGURE 26-15  Th s figure shows the format to turn the five sma est ce s red.

Sp nner buttons, scro bars, opt on buttons, check boxes, combo boxes, and group st boxes  Chapter 26   255
How can I set up my worksheet so that my supply-chain personnel can click a button to
choose whether we charge a high, low, or medium price for a product?

Suppose that you can charge one of three pr ces for a product h gh, med um, or ow These pr ces are
sted n ce s B7 B9 of the Opt onbuttons x sx fi e You cou d eas y use a ookup tab e to pr nt the pr ce
f a user typed n H gh, Med um, or Low It’s better des gn, however, f the user can se ect an opt on
button that says H gh Pr ce, Med um Pr ce, or Low Pr ce, and a formu a automat ca y computes the
pr ce (See F gure 26-16 )

To use opt on buttons, you first draw a group box (see F gure 26-5) after choos ng th s contro
from the User Forms menu Then you drag an opt on button for each cho ce nto the group box
Because you have three pr ce eve s, you need to drag three opt on buttons nto the group box R ght-
c ck any opt on button and then use the Format Control command to nk any one of the opt on
buttons to a ce The first opt on button was nked to ce E4 A the opt on buttons n the group box
are now nked to the same ce Se ect ng the first opt on button enters a 1 n ce E4, se ect ng the
second opt on button enters a 2 n ce E4, and se ect ng the th rd opt on button enters a 3 n ce E4

FIGURE 26-16  Use opt on buttons to se ect product pr ce.

Enter ng the =INDEX(A7 A9,E4,1) formu a n ce E7 returns the pr ce descr pt on correspond ng to the
se ected opt on button In ce F7, the =VLOOKUP(E7,A7 B9,2,FALSE) formu a computes the pr ce cor-
respond ng to the se ected opt on button

256  Chapter 26  Sp nner buttons, scro bars, opt on buttons, check boxes, combo boxes, and group st boxes
How can I create an easy way for a user of my spreadsheet to select a day of the week without
having to type any text?

The Combobox x sx fi e shows how to create a combo box or a st box (see F gure 26-17) a user can
c ck to se ect an tem eas y from a st (Data va dat on a so makes t easy to create drop-down boxes;
see Chapter 40, “Va dat ng data ”) The goa here s to compute the number of hours an emp oyee
worked on a g ven day The hours worked each day are sted n ce s G9 G15 You can use a combo
box or st box to se ect an entry from a st If the combo box or st box s nked to a ce (by Format
Contro ), a 1 s p aced n the nked ce f the first entry n the box s se ected; f the second entry
n the st s se ected, a 2 s entered n the nked ce and so on To set up the worksheet, c ck the
Developer tab, choose Insert, and then drag a combo box from the Form Controls menu to C5
and a st box to D16 R ght-c ck the combo box and choose Format Control Se ect the F9 F15
nput range (wh ch conta ns days of the week) and nk ce A8 Now r ght-c ck the st box and se ect
Format Control Se ect the F9 F15 nput range and nk ce A13 After these steps, f you se ect
Tuesday from the combo box and Fr day from the st box, for examp e, you see a 2 n A8 and a 5
n A13

In ce F3, the =INDEX(F9 F15,A8,1) formu a sts the day of the week correspond ng to the combo
box se ect on In ce G3, the =VLOOKUP(F3,$F$9 $G$15,2,Fa se) formu a ocates the number of hours
worked for the day se ected n the combo box In a s m ar fash on, the formu as n F4 and G4 st the
day of the week and hours worked for the day se ected n the st box

FIGURE 26-17  Use combo boxes and st boxes to se ect the day of the week.

Sp nner buttons, scro bars, opt on buttons, check boxes, combo boxes, and group st boxes  Chapter 26   257
Problems
1. Add a sp nner button for the car NPV examp e that enab es you to vary the tax rate between
30 percent and 50 percent

2. Add a sp nner button for the car NPV examp e that enab es you to vary the nterest rate
between 5 percent and 20 percent

3. The Format Contro d a og box a ows a m n mum va ue of 0 Desp te th s m tat on, can you
figure out a way to use a sp nner button to vary sa es growth between –10 percent and 20
percent?

4. Us ng the emonade examp e n Chapter 16, “Sens t v ty ana ys s w th data tab es,” create sp n-
ner buttons that a ow the nputs to vary w th n the fo ow ng ranges

Input Low value High value


Pr ce $2.00 $5.00
Un t cost $0.20 $1.00
F xed cost $20,000.00 $100,000.00

Us ng the mortgage payment examp e n Chapter 17, “The Goa Seek command,” create sp n-
ner buttons that a ow nputs to vary w th n the fo ow ng ranges

Input Low value High value


Amount borrowed $270,000 $800,000
Number of months of payments 120 360
Annua nterest rate 4% 10%

For the weekend examp e used n Chapter 23, “Cond t ona formatt ng,” set up a check box
that turns cond t ona formatt ng on or off

5. In the financ a formu as descr bed n Chapter 9, “More Exce financ a funct ons,” you used a
ast argument of 1 to nd cate end-of-month cash flows and 0 to nd cate beg nn ng-of-month
cash flows Exce recogn zes True as equ va ent to a 1 and Fa se as equ va ent to 0 Set up a
worksheet n wh ch a user can enter the number of months of a oan, pr nc pa , and annua
nterest rate to find the month y payment Then use a check box to se ect whether the pay-
ments are at the beg nn ng or end of the month

258  Chapter 26  Sp nner buttons, scro bars, opt on buttons, check boxes, combo boxes, and group st boxes
6. Us ng the data for Prob em 15 n Chapter 21, “The OFFSET funct on,” create a sp nner to graph
the ast few months of sa es (rang ng from 3 to 8 months)

7. The Supp ers x sx fi e conta ns the un t pr ce you pay to each of your supp ers and the un ts
purchased Create a st box by wh ch to p ck the supp er and return the un t pr ce and un ts
purchased

Sp nner buttons, scro bars, opt on buttons, check boxes, combo boxes, and group st boxes  Chapter 26   259
CHAPTER 27

The analytics revolution

Questions answered in this chapter:


■ What s ana yt cs?

■ What s pred ct ve ana yt cs?

■ What s prescr pt ve ana yt cs?

■ Why has ana yt cs ncreased n mportance?

■ How mportant s ana yt cs to your organ zat on?

■ What do you need to know to do ana yt cs?

■ What d fficu t es can occur when undertak ng an ana yt cs mp ementat on?

■ What trends w affect future deve opments n ana yt cs?

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

What is analytics?

Ana yt cs s the pract ce of us ng data to he p make dec s ons that meet the organ zat on’s object ves
better Typ ca object ves nc ude max m z ng profit, m n m z ng cost, reduc ng financ a r sk, mprov-
ng hea th care and educat ona outcomes, reduc ng cr me, and other cons derat ons Of course,
the use of data to make dec s ons s not a recent phenomenon For examp e, the Greek ph osopher
Tha es used opt ons (see Chapter 77, “Pr c ng Stock Opt ons”) to ncrease profits and decrease the r sk
ncurred by rent ng out o ve presses The term analytics became popu ar after the 2007 pub cat on
of Thomas Davenport’s book, Competing on Analytics (Boston Harvard Bus ness Schoo Press, 2007)

What is predictive analytics?

Pred ct ve ana yt cs s s mp y us ng data to make accurate pred ct ons about quant t es of nterest
Some examp es nc ude

■ Pred ct ng the outcome of pres dent a e ect ons (see Chapter 58, “Incorporat ng qua tat ve
factors nto mu t p e regress on”)

261

■ Pred ct ng the outcome of NFL games (see Chapter 34, “Us ng So ver to rate sports teams”)

■ Determ n ng how p acement of a product n a store determ nes product sa es (see Chapter 60,
“Ana ys s of var ance One-way ANOVA”)

■ Determ n ng how course of treatment affects chance of surv va from cancer

■ Determ n ng how the market ng m x (advert s ng, pr ce cuts, putt ng product on d sp ay)
affects da y sa es of 3M Scotch tape Th s s d fficu t because seasona ty a so affects sa es, and
the pred ct on mode must adjust for the effect of seasona ty on sa es

■ What s the chance of each team to w n the NCAA tournament? (See Chapter 76, “Fun and
games S mu at ng gamb ng and sport ng event probab t es ”)

■ Chapters 34 and 76 and Chapters 53–64 cover top cs n pred ct ve ana yt cs

What is prescriptive analytics?

Prescr pt ve ana yt cs nvo ves us ng mathemat ca mode s, usua y data dr ven, to he p make dec s ons
that max m ze or m n m ze an appropr ate object ve Some examp es nc ude

■ What product pr ce max m zes profit? (See Chapters 83–86 )

■ What product m x max m zes E L y’s month y profit? (See Chapter 29, “Us ng So ver to deter-
m ne the opt ma product m x ”)

■ How can I schedu e my workforce to m n m ze operat ng costs? (See Chapter 30, “Us ng So ver
to schedu e your workforce ”)

■ How can a company m n m ze the cost of sh pp ng products from p ants to customers? (See
Chapter 31, “Us ng So ver to so ve transportat on or d str but on prob ems ”)

■ How can an organ zat on choose projects that max m ze corporate object ves subject to
m ted resources? For examp e, g ven m ted cap ta and programmers, how can M crosoft
max m ze the profitab ty generated from new products? How can your oca schoo board
use m ted funds to max m ze the h gh schoo graduat on rate? These top cs are d scussed n
Chapter 32, “Us ng So ver for cap ta budget ng ”

■ How much money do I need to save each year to have enough money for ret rement? (See
Chapter 33, “Us ng So ver for financ a p ann ng ”)

■ How can book es set po nt spreads that ensure that they earn a profit? (See Chapter 34 )

■ Where shou d warehouses be ocated to m n m ze the d stance sh pments must trave ? (See
Chapter 35, “Warehouse ocat on and the GRG Mu t start and Evo ut onary So ver eng nes ”)

■ How shou d workers be ass gned to jobs to make both bosses and emp oyees happy? (See
Chapter 36, “Pena t es and the Evo ut onary So ver ”)

■ In what order shou d your UPS dr ver drop off packages to m n m ze the t me needed to
de ver a packages? (See Chapter 37, “The trave ng sa esperson prob em ”)

262  Chapter 27  The ana yt cs revo ut on


■ How many Va ent ne’s Day cards shou d Ha mark pr nt to max m ze expected profit? (See
Chapter 73 )

■ What shou d a company b d on a construct on project to max m ze ts expected profit? (See


Chapter 74, “Ca cu at ng an opt ma b d ”)

■ What asset a ocat on m n m zes the r sk needed to obta n a des red expected return? (See
Chapter 75, “S mu at ng stock pr ces and asset a ocat on mode ng ”)

Why has analytics increased in importance?

Ana yt cs has recent y become more mportant for severa reasons F rst, much more usefu data s
ava ab e For examp e, FACTUAL s a start-up company that s try ng to co ect all data that m ght be
usefu ; t has a database conta n ng the ocat on of a US gas stat ons and nutr t ona nformat on on
a tems so d by a grocery cha n New sources of usefu data are be ng generated at a rap d y ncreas-
ng rate For examp e, start ng w th the 2013–2014 season, a NBA arenas w have cameras that track
the ocat on of each p ayer and the ba every second dur ng the game

In add t on to more data be ng ava ab e, computers and programs are gett ng faster a the t me,
mak ng t eas er to hand e b g data sets For examp e, PowerP vot (see Chapter 45, “PowerP vot”)
makes t easy to create bus ness nte gence (BI) reports based on hundreds of m ons of rows of
data Software that s not M crosoft Exce –based, such as SAS and HADOOP, make t re at ve y easy to
process and ana yze huge data sets

How important is analytics to your organization?

The mportance of ana yt cs to an organ zat on depends on the benefits ga ned from an ana yt cs
approach ba anced aga nst the costs of mp ementat on For examp e, do the benefits obta ned from
eva uat ng teachers through ana yt cs outwe gh the costs?

Look ng at the use of ana yt cs n profess ona sports sheds a ot of ght on the mportance of
ana yt cs In baseba (th nk Moneyba ), much read y ava ab e data can be used to eva uate baseba
p ayers Th s data s re at ve y easy to ana yze, so a most every major eague team has an ana yt cs
department In the past, few NBA teams had ana yt cs departments At the 2013 S oan Conference
on Sports Ana yt cs, on y one team (the Lakers, and we know how they performed—poor y) was not
represented However, not that many NFL teams have ana yt cs departments, perhaps because many
mportant prob ems n footba ana yt cs are d fficu t to so ve For examp e, n baseba and basketba ,
t s not that d fficu t to est mate a fa r va ue for a p ayer In footba , th s s much more d fficu t How
can we est mate the va ue of a great pass b ocker when there are few ava ab e stat st cs measur ng
the performance of offens ve nemen?

What do you need to know to do analytics?

Many un vers t es are deve op ng undergraduate, graduate, and on ne programs to cert fy ana yt-
cs profess ona s Ana ogous to the Cert fied Pub c Accountant (CPA) exam, INFORMS (Inst tute for
Operat ons Research and Management Sc ence) ntroduced an exam n 2013 to cert fy peop e as
cert fied ana yt cs profess ona s At a m n mum, the ana yt cs profess ona shou d have know edge of
the fo ow ng top cs

The ana yt cs revo ut on  Chapter 27   263


■ How to man pu ate data n any form Th s nc udes man pu at on of nonquant tat ve data such
as tweets on Tw tter

■ How to br ng d sparate data sets together so they can be used n an ana yt cs study For
examp e, a fast food restaurant m ght want to reduce emp oyee turnover Th s wou d requ re
what was known about each emp oyee (educat on, age, test scores, and other stat st cs) as
we as the emp oyee’s performance h story Then a mode cou d be deve oped that pred cts
emp oyee turnover based on what was known when the emp oyee was h red Unfortunate y, at
many firms, data on emp oyee h res and emp oyee performance res des n separate databases
that do not ta k to one another

■ Good sk s to ana yze and man pu ate data n Exce

■ How to ana yze b g data sets by us ng a stat st ca package such as R, SPSS, or SAS

■ Know edge of stat st cs, nc ud ng a forms of pred ct ve ana yt cs and c ass ficat on a gor thms
For examp e, how can a person be c ass fied as a ke y cand date for a heart attack?

■ Know ng how s mu at on can mode uncerta n s tuat ons such as the future va ue of your 401k
portfo o or the queue at the hosp ta emergency room

■ Us ng opt m zat on to find the best way to do someth ng For examp e, what space a ocat on
to d fferent products max m zes a department store’s profits?

What difficulties can occur when undertaking an analytics implementation?

Severa prob ems can ar se dur ng an ana yt cs mp ementat on

■ Often, t s d fficu t to agree on the r ght metr c to eva uate success For examp e, unt Saber
metr cs guru B James came a ong, everyone thought fie ders shou d be eva uated based on
fie d ng percentage, wh ch s the fract on of ba s h t near a fie der that are successfu y fie ded
C ear y, th s metr c does not account for the fact that a s ow-footed shortstop a ows many
ba s to go to the outfie d and turn nto h ts B James created range factor, wh ch s a much
better measure of fie d ng performance For a shortstop, for examp e, range factor s put-
outs + ass sts per nn ng for the p ayer, d v ded by average putouts + ass sts per nn ng for a
shortstops A range factor exceed ng 1 nd cates that a p ayer gets to many ba s the average
shortstop m sses Ozz e Sm th s genera y cons dered one of the greatest fie d ng shortstops
of a t me H s career fie d ng percentage of 966 s not great, but dur ng h s best years, h s
range factor was superb Of course, Ozz e p ayed on art fic a turf, and th s makes h s range
factor even more amaz ng The mora s not to hes tate to quest on metr cs that you th nk are
not reflect ve of your organ zat on’s actua performance

■ As prev ous y ment oned, often data sources needed for an ana yt cs project do not ta k to
each other For examp e, a software company wanted to pred ct future revenues It knew that
future revenues depended on tr a vers ons that had been sent to potent a customers and
persona sa es ca s on potent a customers Unfortunate y, the sa es data and the customer
data were n d fferent databases that d d not commun cate, so the project suffered a huge
and unnecessary de ay

264  Chapter 27  The ana yt cs revo ut on


■ In a pred ct ve ana yt cs study, ana ysts often do not know what data s needed to make
better dec s ons I suggest work ng backward After determ n ng what you want to forecast,
th nk about the var ab es that m ght he p you pred ct the var ab e of nterest Here are some
examp es of s tuat ons n wh ch a new set of data needed to be created to comp ete an ana yt-
cs project

• Noted sports ana yt cs persona ty Jeff Sagar n and the author wanted to determ ne a
method to eva uate the defens ve ab ty of NBA p ayers Because the NBA box score
nc udes few defens ve (stea s and b ocks) stat st cs, a new set of data was needed We
reasoned that a good defens ve p ayer wou d cause h s team to g ve up few po nts when he
was n the game, and h s absence wou d cause th s team to g ve up more po nts when the
p ayer was out We created a data set sted for a m nutes the p ayers were on the court
and the number of po nts g ven up Us ng th s data, we cou d dent fy the defens ve contr -
but ons of great defenders such as Ron Artest, Kev n Garnett, and Marc Gaso

• Un ted Hea th wanted to reduce hea th care costs ncurred by ts emp oyees It determ ned
that t needed to know whether emp oyees were be ng treated for cond t ons that cou d
cause h gh future hea th care costs D abetes causes arge future hea th care costs (and
horr b e prob ems) Un ted Hea th pa d emp oyees $450 to be screened for d abetes and
other cond t ons An amaz ng 30 percent of emp oyees were d abet c or pre-d abet c and
d d not know t Treat ng those pat ents enab ed Un ted Hea th to keep hea th costs flat and
mprove future qua ty of fe for ts emp oyees

What trends will affect future developments in analytics?

Faster computers and better a gor thms for ana yz ng data and perform ng opt m zat ons v rtua y
ensure that ana yt cs w become more mportant n the future Improvements n v sua zat on w
make t eas er for the nov ce ana yst to spot patterns n comp ex data Chapter 46, “Power V ew,” d s-
cusses the exc t ng capab ty of Exce 2013 Power V ew to create beaut fu , ns ghtfu v sua zat ons In
Chapter 52, “Chart ng tr cks,” you earn many exc t ng chart ng tr cks that he p you create charts that
ead to better understand ng of data

Probab y the most mportant trend n ana yt cs n the near future s that many ana yt cs app -
cat ons w be ava ab e anywhere, anyt me on mob e dev ces For examp e, n 2011, San Ramon,
Ca forn a, deve oped a smartphone app cat on that s gned up peop e who know card opu monary
resusc tat on (CPR) so they cou d perform CPR on a person near them who needs t When a 911 ca
arr ves and an ambu ance cannot get there n t me, a text message s sent to any reg stered person,
g v ng the ocat on of the str cken person Th s enab es the person to rece ve CPR much more
qu ck y

Another trend n ana yt cs w be an ncrease n rea -t me pred ct ons that ead to act on n rea
t me For examp e, f pred ct ons nd cate a Target store w run out of Peps by 11 A M , the ana yt cs
app cat on w know the ocat on of a Peps trucks, and a message w be sent to the truck, te ng
the dr ver to restock Peps by 11 A M

The ana yt cs revo ut on  Chapter 27   265


CHAPTER 28

Introducing optimization with


Excel Solver

In many s tuat ons, you want to find the best way to do someth ng More forma y, you want to find
the va ues of certa n ce s n a worksheet that optimize (max m ze or m n m ze) a certa n object ve
M crosoft Exce So ver he ps you answer opt m zat on prob ems such as the fo ow ng ones

■ How can a arge drug company determ ne the month y product m x that max m zes corporate
profitab ty at ts Ind anapo s p ant?

■ If M crosoft produces Xbox conso es at three ocat ons, how can t m n m ze the cost of meet-
ng demand for them?

■ What pr ce for Xbox conso es and games w max m ze profit from Xbox sa es for M crosoft?

■ M crosoft wou d ke to undertake 20 strateg c n t at ves that w t e up money and sk ed


programmers for the next five years It does not have enough resources for a 20 projects;
wh ch ones shou d t undertake?

■ How do bookmakers find the best set of rat ngs to set accurate po nt spreads for NFL teams?

■ How shou d I a ocate my ret rement portfo o among h gh-tech stocks, va ue stocks, bonds,
cash, and go d?

An opt m zat on mode has three parts the target ce , the chang ng ce s, and the constra nts The
target cell represents the object ve or goa You want to m n m ze or max m ze the amount n the tar-
get ce In the quest on about a drug company’s product m x g ven ear er, the p ant manager wou d
presumab y want to max m ze the profitab ty of the p ant dur ng each month The ce that measures
profitab ty wou d be the target ce The target ce s for each s tuat on descr bed at the beg nn ng of
the chapter are sted n Tab e 28-1

Keep n m nd, however, that n some s tuat ons, you m ght have mu t p e target ce s For examp e,
M crosoft m ght have a secondary goa to max m ze Xbox market share

267

To act vate So ver, c ck the File tab, choose Options, and then c ck Add-Ins In the Manage box
at the bottom of the d a og box, se ect Excel Add-Ins and c ck Go Se ect the Solver Add-In check
box n the Add-Ins d a og box and c ck OK After So ver s act vated, you can run So ver by c ck ng
Solver n the Analysis group on the Data tab F gure 28-1 shows the Solver Parameters d a og box
In the next few chapters, you see how to use th s d a og box to configure the target ce , chang ng
ce s, and constra nts for a So ver mode

FIGURE 28-1  Th s figure shows the So ver Parameters d a og box.

Beg nn ng w th Exce 2010, So ver has been great y revamped and mproved The pr mary change
s the presence of the Se ect A So v ng Method st From th s st, you must se ect the appropr ate
so ut on eng ne for your opt m zat on prob em

■ The S mp ex LP eng ne so ves near opt m zat on prob ems As you w see n Chapters 29–32,
a near opt m zat on prob em s one n wh ch the target ce and constra nts are a created by
add ng terms of the (chang ng ce )*(constant) form

■ The GRG non near eng ne so ves opt m zat on prob ems n wh ch the target ce or some of
the constra nts are not near and are computed by us ng common mathemat ca operat ons

ntroduc ng opt m zat on w th Exce So ver  Chapter 28   269


such as mu t p y ng or d v d ng chang ng ce s, ra s ng chang ng ce s to a power, exponent a
or tr gonometr c funct ons nvo v ng chang ng ce s, and so on The GRG eng ne nc udes a
powerfu Mu t start opt on that enab es you to so ve many prob ems that were so ved ncor-
rect y w th prev ous vers ons of Exce Chapters 33 through 35 d scuss the GRG non near
eng ne

■ The Evo ut onary So ver eng ne s used when your target ce or constra nts conta n non­
smooth funct ons that reference chang ng ce s A nonsmooth funct on s one whose s ope
abrupt y changes For examp e, when x = 0, the s ope of the abso ute va ue of x abrupt y
changes from –1 to 1 If your target ce or constra nts conta n IF, SUMIF, COUNTIF, SUMIFS,
COUNTIFS, AVERAGEIF, AVERAGEIFS, ABS, MAX, or MIN funct ons that reference the chang ng
ce s, you are us ng nonsmooth funct ons, and the Evo ut onary So ver eng ne probab y has the
best shot at find ng a good so ut on to your opt m zat on prob em The Evo ut onary So ver
eng ne s d scussed n Chapter 36, “Pena t es and the Evo ut onary So ver,” and Chapter 37,
“The trave ng sa esperson prob em ”

After you have nput the target ce , chang ng ce s, and constra nts, what does So ver do? To
answer th s quest on, you need some background n So ver term no ogy Any spec ficat on of the
chang ng ce s that sat sfies the mode ’s constra nts s a feasible solution For nstance, any product m x
that sat sfies the fo ow ng three cond t ons wou d be a feas b e so ut on

■ Does not use more raw mater a or abor than s ava ab e

■ Does not produce more of each product than s demanded

■ Does not produce a negat ve amount of any product

Essent a y, So ver searches a feas b e so ut ons and finds the one that has the best target ce va ue
(the argest va ue for max mum opt m zat on, the sma est for m n mum opt m zat on) Such a so u-
t on s ca ed an optimal solution As you’ see n Chapter 29, “Us ng So ver to determ ne the opt ma
product m x,” some So ver mode s have no opt ma so ut on, and some have a un que so ut on Other
So ver mode s have mu t p e (actua y, an nfin te number of) opt ma so ut ons In the next chapter,
you’ beg n your study of So ver examp es by exam n ng the drug company product m x prob em

Problems
For each s tuat on descr bed, dent fy the target ce , chang ng ce s, and constra nts

1. I am borrow ng $100,000 for a 15-year mortgage The annua rate of nterest s 8 percent
How can I determ ne my month y mortgage payment?

2. How shou d an auto company a ocate ts advert s ng budget between d fferent advert s ng
formats?

3. How shou d c t es transport students to more d stant schoo s to obta n rac a ba ance?

4. If a c ty has on y one hosp ta , where shou d t be ocated?

270  Chapter 28  ntroduc ng opt m zat on w th Exce So ver


5. How shou d a drug company a ocate ts sa es force’s efforts among ts products?

6. A drug company has a ocated $2 b on to purchas ng b otech compan es Wh ch compan es


shou d t buy?

7. The tax rate charged to a drug company depends on the country n wh ch a product s pro-
duced How can a drug company determ ne where each drug shou d be made?

ntroduc ng opt m zat on w th Exce So ver  Chapter 28   271


CHAPTER 29

Using Solver to determine the


optimal product mix

Questions answered in this chapter:


■ How can I determ ne the month y product m x that max m zes profitab ty?

■ Does a So ver mode a ways have a so ut on?

■ What does t mean f a So ver mode y e ds the Set Va ues Do Not Converge resu t?

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

How can I determine the monthly product mix that maximizes profitability?

Compan es often need to determ ne the quant ty of each product to produce on a month y bas s In
ts s mp est form, the product m x prob em nvo ves how to determ ne the amount of each product
that shou d be produced dur ng a month to max m ze profits Product m x must usua y adhere to the
fo ow ng constra nts

■ Product m x can’t use more resources than are ava ab e

■ Because demand for each product s m ted, you don’t want to produce more of t dur ng a
month than demand d ctates because the excess product on s wasted (for examp e, a per sh-
ab e drug)

Now, so ve the fo ow ng examp e of the product m x prob em You can find a feas b e so ut on to
th s prob em n the Feas b e So ut on worksheet of the Prodm x x sx fi e, shown n F gure 29-1 Tr a
va ues for the amount produced of each drug have been entered n row 2

273

FIGURE 29-1  Th s figure shows a feas b e product m x.

You work for a drug company that produces s x products at ts p ant Product on of each product
requ res abor and raw mater a Row 4 n F gure 29-1 shows the hours of abor needed to produce
a pound of each product, and row 5 shows the pounds of raw mater a needed to produce a pound
of each product For examp e, produc ng a pound of Product 1 requ res s x hours of abor and 3 2
pounds of raw mater a For each drug, the pr ce per pound s g ven n row 6, the un t cost per pound
s g ven n row 7, and the profit contr but on per pound s g ven n row 9 For examp e, Product 2 se s
for $11 00 per pound, ncurs a un t cost of $5 70 per pound, and contr butes $5 30 profit per pound
The month’s demand for each drug s g ven n row 8 For examp e, demand for Product 3 s 1,041
pounds Th s month, 4,500 hours of abor and 1,600 pounds of raw mater a are ava ab e How can
th s company max m ze ts month y profit?

If you knew noth ng about So ver, you m ght attack th s prob em by construct ng a worksheet to
track profit and resource usage assoc ated w th the product m x Then you cou d use tr a and error
to vary the product m x to opt m ze profit w thout us ng more abor or raw mater a than s ava ab e
or produc ng any drug n excess of demand You use So ver n th s process on y at the tr a -and-error
stage Essent a y, So ver s an opt m zat on eng ne that flaw ess y performs the tr a -and-error search

A key to so v ng the product m x prob em s to compute the resource usage and profit assoc ated
w th any g ven product m x effic ent y An mportant too that you can use to make th s computat on
s the SUMPRODUCT funct on It mu t p es correspond ng va ues n ce ranges and returns the sum of
those va ues Each ce range used n a SUMPRODUCT eva uat on must have the same d mens ons, so
you can use SUMPRODUCT w th two rows or two co umns but not w th one co umn and one row

As an examp e of how you can use the SUMPRODUCT funct on n the product m x examp e, com-
pute resource usage Labor usage s ca cu ated by the fo ow ng formu a

(Labor used per pound of drug 1)*(Drug 1 pounds produced)+(Labor used per pound of drug 2)
*(Drug 2 pounds produced)+...(Labor used per pound of drug 6)*(Drug 6 pounds produced)

274  Chapter 29  Us ng So ver to determ ne the opt ma product m x


You cou d compute abor usage n a more ted ous fash on as D2*D4+E2*E4+F2*F4+G2*G4+
H2*H4+I2*I4 S m ar y, raw mater a usage cou d be computed as D2*D5+E2*E5+F2*F5+G2*G5+
H2*H5+I2*I5 However, enter ng these formu as n a worksheet for s x products s t me-consum ng
Imag ne how ong t wou d take f you were work ng w th a company that produced, for examp e,
50 products at ts p ant A much eas er way to compute abor and raw mater a usage s to copy the
SUMPRODUCT($D$2 $I$2,D4 I4) formu a from D14 to D15 Th s formu a computes D2*D4+E2*E4+F2
*F4+G2*G4+H2*H4+I2*I4 (wh ch s the abor usage) but s much eas er to enter Use the $ s gn w th
the D2 I2 range so that when you copy the formu a, you st capture the product m x from row 2 The
formu a n ce D15 computes raw mater a usage

In a s m ar fash on, profit s determ ned by the fo ow ng formu a

(Drug 1 profit per pound)*(Drug 1 pounds produced)+(Drug 2 profit per pound)
*(Drug 2 pounds produced)+...(Drug 6 profit per pound)*(Drug 6 pounds produced)

Profit s eas y computed n ce D12 w th the SUMPRODUCT(D9 I9,$D$2 $I$2) formu a

You now can dent fy the three components of the product m x So ver mode

■ Target cell  The goa s to max m ze profit (computed n ce D12)

■ Changing cells  The number of pounds produced of each product s sted n the D2 I2 ce
range

■ Constraints  You have the fo ow ng constra nts

• Do not use more abor or raw mater a than s ava ab e That s, the va ues n ce s D14 D15
(the resources used) must be ess than or equa to the va ues n ce s F14 F15 (the ava ab e
resources)

• Do not produce more of a drug than s n demand That s, the va ues n the D2 I2 ce s
(pounds produced of each drug) must be ess than or equa to the demand for each drug
( sted n ce s D8 I8)

• You can’t produce a negat ve amount of any drug


Th s chapter shows you how to enter the target ce , chang ng ce s, and constra nts nto So ver
Then a you need to do s c ck the So ve button to find a profit-max m z ng product m x

To beg n, c ck the Data tab and, n the Analysis group, c ck Solver

Note  As explained in Chapter 28, “Introducing optimization with Excel Solver,” Solver is
activated by clicking the File tab and then choosing Options and Add-Ins. In the Manage
list, click Excel Add-ins and click Go. Select the Solver Add-In check box and then
click OK.

The Solver Parameters d a og box opens, as shown n F gure 29-2

Us ng So ver to determ ne the opt ma product m x  Chapter 29   275


FIGURE 29-2  Th s figure shows the So ver Parameters d a og box.

C ck the Set Objective box and then se ect the profit ce (ce D12) C ck the By Changing
Variable Cells box and then po nt to the D2 I2 range, wh ch conta ns the pounds produced of each
drug The d a og box shou d now ook ke F gure 29-3

276  Chapter 29  Us ng So ver to determ ne the opt ma product m x


FIGURE 29-3  Th s figure shows the So ver Parameters d a og box w th target ce and chang ng ce s defined.

You’re now ready to add constra nts to the mode C ck the Add button The Add Constraint
d a og box opens, as shown n F gure 29-4

FIGURE 29-4  Th s figure shows the Add Constra nt d a og box.

Us ng So ver to determ ne the opt ma product m x  Chapter 29   277


To add the resource usage constra nts, c ck the Cell Reference box and then se ect the D14 D15
range After confirm ng the se ect on of <= from the m dd e st, c ck the Constraint box and then
se ect the F14 F15 ce range The Add Constraint d a og box shou d now ook ke F gure 29-5

FIGURE 29-5  Th s figure shows the Add Constra nt d a og box w th the resource usage constra nts entered.

You have now ensured that when So ver tr es d fferent va ues for the chang ng ce s, on y comb na-
t ons that sat sfy both D14<=F14 ( abor used s ess than or equa to abor ava ab e) and D15<=F15
(raw mater a used s ess than or equa to raw mater a ava ab e) are cons dered C ck Add to enter
the demand constra nts, fi ng n the Add Constraint d a og box as shown n F gure 29-6

FIGURE 29-6  Th s figure shows the Add Constra nt d a og box w th the demand constra nts entered.

Add ng these constra nts ensures that when So ver tr es d fferent comb nat ons for the chang ng
ce va ues, on y comb nat ons that sat sfy the fo ow ng parameters are cons dered

■ D2<=D8 (the amount produced of Drug 1 s ess than or equa to the demand for Drug 1)

■ E2<=E8 (the amount produced of Drug 2 s ess than or equa to the demand for Drug 2)

■ F2<=F8 (the amount produced of Drug 3 s ess than or equa to the demand for Drug 3)

■ G2<=G8 (the amount produced of Drug 4 s ess than or equa to the demand for Drug 4)

■ H2<=H8 (the amount produced of Drug 5 s ess than or equa to the demand for Drug 5)

■ I2<=I8 (the amount produced of Drug 6 s ess than or equa to the demand for Drug 6)

C ck OK n the Add Constraint d a og box The Solver Parameters d a og box shou d ook ke
F gure 29-7

278  Chapter 29  Us ng So ver to determ ne the opt ma product m x


FIGURE 29-7  Th s s the fina So ver Parameters d a og box for the product m x prob em.

Se ect ng the Make Unconstrained Variables Non-Negative check box ensures that a the
chang ng ce s are forced to be greater than or equa to 0

Next, choose S mp ex LP from the Se ect A So v ng Method st You choose the S mp ex LP eng ne
because the product m x prob em s a spec a type of So ver prob em ca ed a linear mode Essent a y,
a So ver mode s near under the fo ow ng cond t ons

■ The target ce s computed by add ng together the terms of the (chang ng ce )*(constant)
form

■ Each constra nt sat sfies the linear model requirement Th s means that each constra nt s eva u-
ated by add ng together the terms of the (chang ng ce )*(constant) form and compar ng the
sums to a constant

Why s th s So ver prob em near? Your target ce (profit) s computed as fo ows

(Drug 1 profit per pound)*(Drug 1 pounds produced)+(Drug 2 profit per pound)
*(Drug 2 pounds produced)+...(Drug 6 profit per pound)*(Drug 6 pounds produced)

Us ng So ver to determ ne the opt ma product m x  Chapter 29   279


Th s computat on fo ows a pattern n wh ch the target ce ’s va ue s der ved by add ng together
terms of the (chang ng ce )*(constant) form

Your abor constra nt s eva uated by compar ng the va ue der ved from (Labor used per pound of
Drug 1)*(Drug 1 pounds produced)+(Labor used per pound of Drug 2)*(Drug 2 pounds produced)+
(Labor used per pound of Drug 6)*(Drug 6 pounds produced) to the abor ava ab e

Therefore, the abor constra nt s eva uated by add ng together the terms of the (chang ng
ce )*(constant) form and compar ng the sums to a constant Both the abor constra nt and the raw
mater a constra nt sat sfy the near mode requ rement

The demand constra nts take the fo ow ng form

(Drug 1 produced)<=(Drug 1 Demand)
(Drug 2 produced)<=(Drug 2 Demand)
...
(Drug 6 produced)<=(Drug 6 Demand)

Each demand constra nt a so sat sfies the near mode requ rement because each s eva uated
by add ng together the terms of the (chang ng ce )*(constant) form and compar ng the sums to a
constant

Know ng that the product m x mode s a near mode , why shou d you care?

■ If a So ver mode s near and you se ect S mp ex LP, So ver s guaranteed to find the opt ma
so ut on to the So ver mode If a So ver mode s not near, So ver m ght or m ght not find the
opt ma so ut on

■ If a So ver mode s near and you se ect S mp ex LP, So ver uses a very effic ent a gor thm (the
s mp ex method) to find the mode ’s opt ma so ut on If a So ver mode s near and you do
not se ect S mp ex LP, So ver uses a very neffic ent a gor thm (the GRG2 method) and m ght
have d fficu ty find ng the mode ’s opt ma so ut on

After you c ck Solve, So ver ca cu ates an opt ma so ut on ( f one ex sts) for the product m x
mode As stated n Chapter 28, an opt ma so ut on to the product m x mode wou d be a set of
chang ng ce va ues (pounds produced of each drug) that max m zes profit over the set of a fea-
s b e so ut ons Aga n, a feas b e so ut on s a set of chang ng ce va ues sat sfy ng a constra nts The
chang ng ce va ues shown n F gure 29-8 are a feas b e so ut on because a product on eve s are
nonnegat ve, product on eve s do not exceed demand, and resource usage does not exceed ava ab e
resources

280  Chapter 29  Us ng So ver to determ ne the opt ma product m x


FIGURE 29-8  A feas b e so ut on to the product m x prob em fits w th n constra nts.

The chang ng ce va ues shown n F gure 29-9 represent an infeasible solution for the fo ow ng
reasons

■ You produce more of Drug 5 than the demand for t

■ You use more abor than s ava ab e

■ You use more raw mater a than s ava ab e

FIGURE 29-9  An nfeas b e so ut on to the product m x prob em doesn t fit w th n the defined constra nts.

Us ng So ver to determ ne the opt ma product m x  Chapter 29   281


FIGURE 29-10  Th s s the opt ma so ut on to the product m x prob em.

Your drug company can max m ze ts month y profit at a eve of $6,625 20 by produc ng 596 67
pounds of Drug 4; 1,084 pounds of Drug 5; and none of the other drugs You can’t determ ne whether
you can ach eve the max mum profit of $6,625 20 n other ways A you can be sure of s that w th
your m ted resources and demand, you cannot make more than $6,625 20 th s month

Does a Solver model always have a solution?

Suppose that demand for each product must be met (See the No Feas b e So ut on worksheet
n the Prodm x x sx fi e ) You then have to change your demand constra nts from D2 I2<=D8 I8 to
D2 I2>=D8 I8 To do th s, open Solver, se ect the D2 I2<=D8 I8 constra nt, and then c ck Change The
Change Constraint d a og box, shown n F gure 29-11, opens

FIGURE 29-11  Th s s the Change Constra nt d a og box.

As shown n F gure 29-12, se ect >= and then c ck OK You’ve now ensured that So ver w con-
s der chang ng on y ce va ues that meet a demands When you c ck Solve, you’ see the message,
“So ver cou d not find a feas b e so ut on ” Th s message does not mean that you made a m stake n
your mode but, rather, that w th m ted resources, you can’t meet demand for a products So ver s

282  Chapter 29  Us ng So ver to determ ne the opt ma product m x


s mp y te ng you that f you want to meet demand for each product, you need to add more abor,
more raw mater a , or both

FIGURE 29-12 Demand constra nt now ensures that demand s met.

What does it mean if a Solver model yields the Set Values Do Not Converge result?

What happens f you a ow un m ted demand for each product and negat ve quant t es to be pro-
duced of each drug? (You can see th s So ver prob em on the Set Va ues Do Not Converge worksheet
n the Prodm x x sx fi e ) To find the opt ma so ut on for th s s tuat on, open Solver and c ear the
Make Unconstrained Variables Non-Negative check box In the Solver Parameters d a og box,
se ect the D2 I2<=D8 I8 demand constra nt and then c ck Delete to remove the constra nt When you
c ck Solve, So ver returns the Set Ce Va ues Do Not Converge message Th s message means that f
the target ce s to be max m zed (as n th s examp e), there are feas b e so ut ons w th arb trar y arge
target ce va ues For examp e, f you wanted to make a b on do ars n profit, So ver cou d find a
feas b e so ut on to make that eve of profit (see Prob em 7) (If the target ce s to be m n m zed, the
Set Ce Va ues Do Not Converge message means there are feas b e so ut ons w th arb trar y sma tar-
get ce va ues ) In th s s tuat on, by a ow ng negat ve product on of a drug, you create resources that
can be used to produce arb trar y arge amounts of other drugs G ven your un m ted demand, you
can make un m ted profit In a rea s tuat on, you can’t make an nfin te amount of money In short, f
you see Set Va ues Do Not Converge, your mode does have an error

Problems
1. Suppose your drug company can purchase up to 500 hours of abor at $1 more per hour than
current abor costs How can t max m ze profit?

2. At a ch p manufactur ng p ant, four techn c ans (A, B, C, and D) produce three products
(Products 1, 2, and 3) Th s month, the ch p manufacturer can se 80 un ts of Product 1, 50
un ts of Product 2, and, at most, 50 un ts of Product 3 Techn c an A can make on y Products
1 and 3 Techn c an B can make on y Products 1 and 2 Techn c an C can make on y Product 3
Techn c an D can make on y Product 2 For each un t produced, the products contr bute the

Us ng So ver to determ ne the opt ma product m x  Chapter 29   283


fo ow ng profit Product 1, $6; Product 2, $7; and Product 3, $10 The t me ( n hours) each
techn c an needs to manufacture a product s as fo ows

Product Technician A Technician B Technician C Technician D


1 2 2.5 Cannot do Cannot do
2 Cannot do 3 Cannot do 3.5
3 3 Cannot do 4 Cannot do

Each techn c an can work up to 120 hours per month How can the ch p manufacturer max -
m ze ts month y profit? Assume a fract ona number of un ts can be produced

3. A computer manufactur ng p ant produces m ce, keyboards, and v deo game joyst cks The
per-un t profit, per-un t abor usage, month y demand, and per-un t mach ne-t me usage are
g ven n the fo ow ng tab e

Mice Keyboards Joysticks


Profit/un t $8 $11 $9
Labor usage/un t .2 hour .3 hour .24 hour
Mach ne t me/un t .04 hour .055 hour .04 hour
Month y demand 15,000 29,000 11,000

Each month, a tota of 13,000 abor hours and 3,000 hours of mach ne t me are ava ab e How
can the manufacturer max m ze ts month y profit contr but on from the p ant?

4. Reso ve your drug examp e, assum ng that a m n mum demand of 200 un ts for each drug
must be met

5. Jason makes d amond brace ets, neck aces, and earr ngs He wants to work a max mum of
160 hours per month He has 800 ounces of d amonds The profit, abor t me, and ounces of
d amonds requ red to produce each product are as fo ows If demand for each product s
un m ted, how can Jason max m ze h s profit?

Product Unit profit Labor hours per unit Ounces of diamonds per unit
Brace et $300 .35 1.2
Neck ace $200 .15 .75
Earr ngs $100 .05 .5

In your product m x examp e, suppose that whenever you se more than 400 pounds of any
product, you must g ve a $1 per pound d scount on each pound above 400 so d How does
th s change the answer to the prob em?

6. If demand s un m ted and negat ve product on s a owed, find a feas b e so ut on that earns a
b on do ars

7. Assum ng un m ted demand and un m ted resources, find a feas b e so ut on that earns $1
b on n profit

284  Chapter 29  Us ng So ver to determ ne the opt ma product m x


CHAPTER 30

Using Solver to schedule your


workforce

Question answered in this chapter:


■ How can I schedu e my workforce effic ent y to meet abor demands?

Many organ zat ons (such as banks, restaurants, and posta serv ce compan es) know what the r abor
requ rements are at d fferent t mes of the day, and they need a method to schedu e the r workforce
effic ent y You can use So ver to so ve workforce schedu ng prob ems eas y

Answer to this chapter’s question


Th s sect on prov des the answer to the quest on that s sted at the beg nn ng of the chapter

How can I schedule my workforce efficiently to meet labor demands?

Bank 24 processes checks seven days a week The number of workers needed each day to process
checks s shown n row 14 of the Bank24 x sx fi e, wh ch appears n F gure 30-1 For examp e, 13 work-
ers are needed on Tuesday, 15 workers are needed on Wednesday, and so on A bank emp oyees
work five consecut ve days What s the m n mum number of emp oyees Bank 24 can have and st
meet ts abor requ rements?

FIGURE 30-1  Th s figure shows the data you use to work through the bank workforce schedu ng prob em.

285

■ Target cell  M n m ze tota number of emp oyees

■ Changing cells  Number of emp oyees who start work (the first of five consecut ve days)
each day of the week Each chang ng ce must be a nonnegat ve nteger

■ Constraints  For each day of the week, the number of emp oyees who are work ng must
be greater than or equa to the number of emp oyees requ red—(Number of emp oyees
work ng)>=(Needed emp oyees)

To set up the mode for th s prob em, you need to track the number of emp oyees work ng each
day Beg n by enter ng tr a va ues n the A5 A11 ce range for the number of emp oyees who start
the r five-day sh ft each day For examp e, n A5, 1 s entered, nd cat ng that 1 emp oyee beg ns work
on Monday and works Monday through Fr day Each day’s requ red workers are entered n the C14 I14
range

To track the number of emp oyees work ng each day, a 1 or a 0 s entered n each ce n the C5 I11
range The va ue 1 nd cates that the emp oyees who started work ng on the day des gnated n the
ce ’s row are work ng on the day assoc ated w th the ce ’s co umn For examp e, the 1 n ce G5
nd cates that emp oyees who started work ng on Monday are work ng on Fr day; the 0 n ce H5
nd cates that the emp oyees who started work ng on Monday are not work ng on Saturday

By copy ng the =SUMPRODUCT($A$5:$A$11,C5:C11) formu a from C12 to D12 I12, you can com-
pute the number of emp oyees work ng each day For examp e, n ce C12, th s formu a eva uates to
=A5+A8+A9+A10+A11, wh ch equa s (Number start ng on Monday) + (Number start ng on Thursday)
+ (Number start ng on Fr day) + (Number start ng on Saturday) + (Number start ng on Sunday) Th s
tota s ndeed the number of peop e work ng on Monday

After comput ng the tota number of emp oyees n ce A3 w th the =SUM(A5 A11) formu a, you
can enter a mode n So ver as shown n F gure 30-2

In the target ce (A3), you want to m n m ze the number of tota emp oyees The C12 I12>=C14 I14
constra nt ensures that the number of emp oyees work ng each day s at east as arge as the number
needed each day The A5 A11= nteger constra nt ensures that the number of emp oyees beg nn ng
work each day s an nteger To add th s constra nt, c ck Add n the Solver Parameters d a og box
and fi n the Add Constraint d a og box as shown n F gure 30-3

Note that th s mode s near because the target ce s created by add ng together chang ng ce s,
and the constra nt s created by compar ng the resu t obta ned by add ng together the product of
each chang ng ce t mes a constant (e ther 1 or 0) to the requ red number of workers Therefore, you
se ect the S mp ex LP eng ne Because you cannot start a negat ve number of workers on a day, se ect
Make Unconstrained Variables Non-Negative After c ck ng Solve, you find the opt ma so ut on
that was shown ear er, n F gure 30-1

286  Chapter 30  Us ng So ver to schedu e your workforce


FIGURE 30-2  The So ver Parameters d a og box s fi ed n to so ve the workforce prob em.

FIGURE 30-3  Th s constra nt defines the number of workers who start each day as an nteger.

A tota of 20 emp oyees s needed One emp oyee starts on Monday, three start on Tuesday, four
start on Thursday, one starts on Fr day, two start on Saturday, and n ne start on Sunday Note that th s
mode actua y has mu t p e opt ma so ut ons that use 20 workers If you run So ver aga n, you m ght
very we find one of these a ternat ve opt ma so ut ons

Us ng So ver to schedu e your workforce  Chapter 30   287


Problems
1. Suppose Bank 24 had 22 emp oyees and that the goa was to schedu e emp oyees so that
they wou d have the max mum number of weekend days off How shou d the workers be
schedu ed?

2. Suppose Bank 24 emp oyees are pa d $150 per day the first five days they work and can work
a day of overt me at a cost of $350 How shou d the bank schedu e ts emp oyees?

3. The number of te ephone reservat on operators needed by an a r ne dur ng each t me of day


s as fo ows

Time Operators needed


M dn ght 4 A.M. 12
4 A.M. 8 A.M. 16
8 A.M. noon 22
Noon 4 P.M. 30
4 P.M. 8 P.M. 31
8 P.M. m dn ght 22

Each operator works one of the fo ow ng s x-hour sh fts m dn ght to 6 00 A M , 6 00 A M to


noon, noon to 6 00 P M , 6 00 P M to m dn ght What s the m n mum number of operators
needed?

4. Shown n F gure 30-4 are the number of peop e n d fferent demograph c groups who watch
var ous TV shows and the cost ( n thousands of do ars) of p ac ng a 30-second ad on each
show For examp e, t costs $160,000 to p ace a 30-second ad on Friends The show s watched
by 6 m on ma es between the ages of 18 and 35, 3 m on ma es between 36 and 55, 1 m -
on ma es over 55, 9 m on fema es between 18 and 35, 4 m on fema es between 36 and 55,
and 2 m on fema es over 55 The data a so nc udes the number of peop e n each group ( n
m ons) that you want to see the ad For examp e, the advert ser wants at east 60 m on 18
to 35-year-o d ma es to see ts ads What s the cheapest way to meet these goa s?

288  Chapter 30  Us ng So ver to schedu e your workforce


CHAPTER 31

Using Solver to solve


transportation or distribution
problems

Question answered in this chapter:


■ How can a drug company determ ne at wh ch ocat on t shou d produce drugs and from
wh ch ocat on t shou d sh p drugs to customers?

Many compan es manufacture products at d fferent ocat ons (often ca ed supply points) and sh p
the r products to customers (often ca ed demand points) A natura quest on s, “What s the east
expens ve way to produce and sh p products to customers and st meet demand?” Th s type of
prob em s ca ed a transportation problem A transportat on prob em can be set up as a near So ver
mode w th the fo ow ng spec ficat ons

■ Target cell  M n m ze tota product on and sh pp ng cost

■ Changing cells  Th s s the amount produced at each supp y po nt that s sh pped to each
demand po nt

■ Constraints  The amount sh pped from each supp y po nt can’t exceed p ant capac ty Each
demand po nt must rece ve ts requ red demand In add t on, each chang ng ce must be
nonnegat ve

Answer to this chapter’s question


Th s sect on prov des the answer to the quest on that s sted at the beg nn ng of the chapter

How can a drug company determine at which location it should produce drugs and from
which location it should ship drugs to customers?

You can fo ow a ong w th th s prob em by ook ng at the Transport x sx fi e Suppose a company pro-
duces a certa n drug at ts Los Ange es, At anta, and New York fac t es Each month, the Los Ange es
p ant can produce up to 10,000 pounds of the drug At anta can produce up to 12,000 pounds, and
New York can produce up to 14,000 pounds The company must sh p the number of pounds sted n
ce s B2 E2 each month to the four reg ons of the Un ted States—East, M dwest, South, and West—as

291

shown n F gure 31-1 For examp e, the West reg on must rece ve at east 13,000 pounds of the drug
each month The cost per pound of produc ng a drug at each p ant and sh pp ng the drug to each
reg on of the country s g ven n ce s B4 E6 For examp e, t costs $3 50 to produce one pound of the
drug n Los Ange es and sh p t to the M dwest reg on What s the cheapest way to de ver the quan-
t ty of the drug each reg on needs?

FIGURE 31-1  Th s s data for a transportat on prob em.

To express the target ce , you need to track tota sh pp ng cost After enter ng tr a va ues n the
B10 E12 ce range for sh pments from each supp y po nt to each reg on, you can compute tota sh p-
p ng cost as fo ows

(Amount sent from LA to East)*(Cost per pound of sending drug from LA to East)
+(Amount sent from LA to Midwest)*(Cost per pound of sending drug from LA to Midwest)
+(Amount sent from LA to South)*(Cost per pound of sending drug from LA to South)
+(Amount sent from LA to West)*(Cost per pound of sending drug from LA to West)
+...(Amount sent from New York City to West)
*(Cost per pound of sending drug from New York City to West)

The SUMPRODUCT funct on can mu t p y correspond ng e ements n two rectang es (as ong as the
rectang es are the same s ze) and add the products together The B4 E6 ce range has been named
Costs and the chang ng ce s range (B10 E12) Sh pped Therefore, tota sh pp ng and product on cost
s computed n ce B18 w th the SUMPRODUCT(costs,sh pped) formu a

To express the prob em’s constra nts, first compute the tota sh pped from each supp y po nt By
enter ng the SUM(B10 E10) formu a n ce F10, you can compute the tota number of pounds sh pped
from Los Ange es as (LA sh pped to East) + (LA sh pped to M dwest) + (LA sh pped to South) + (LA
sh pped to West) Copy ng th s formu a to F11 F12 computes the tota sh pped from At anta and

292  Chapter 31  Us ng So ver to so ve transportat on or d str but on prob ems


New York C ty Later, you’ add a constra nt (ca ed a supply constraint) that ensures that the amount
sh pped from each ocat on does not exceed the p ant’s capac ty

Next, compute the tota rece ved by each demand po nt Beg n by enter ng the SUM(B10 B12) for-
mu a n ce B13 Th s formu a computes the tota number of pounds rece ved n the East as (Pounds
sh pped from LA to East) + (Pounds sh pped from At anta to East) + (Pounds sh pped from New York
C ty to East) By copy ng th s formu a from B13 to C13 E13, you compute the pounds of the drug
rece ved by the M dwest, South, and West reg ons Later, you’ add a constra nt (ca ed a demand
constraint) that ensures that each reg on rece ves the amount of the drug t requ res

Open the Solver Parameters d a og box (c ck Solver n the Analysis group on the Data tab) and
fi t n as shown n F gure 31-2

FIGURE 31-2  So ver s set up to so ve your transportat on prob em.

You want to m n m ze tota sh pp ng cost (computed n ce B18) The chang ng ce s are the
number of pounds sh pped from each p ant to each reg on of the country (These amounts are sted
n the range named Sh pped, cons st ng of ce s B10 E12 ) The F10 F12<=H10 H12 constra nt (the
supp y constra nt) ensures that the amount sent from each p ant does not exceed ts capac ty The

Us ng So ver to so ve transportat on or d str but on prob ems  Chapter 31   293


B13 E13>=B15 E15 constra nt (the demand constra nt) ensures that each reg on rece ves at east the
amount of the drug t needs

Th s mode s a near So ver mode because the target ce s created by add ng together the terms
of the form (chang ng ce )*(constant), and both your supp y and demand constra nts are created by
compar ng the sum of chang ng ce s to a constant Because the mode s near, choose the S mp ex
LP eng ne C ear y, sh pments must be nonnegat ve, so se ect the Make Unconstrained Variables
Non-Negative check box

After c ck ng Solve n the Solver Parameters d a og box, you are presented w th the opt ma
so ut on shown ear er, n F gure 31-1 The m n mum cost of meet ng customer demand s $86,800
Th s m n mum cost can be ach eved f the company uses the fo ow ng product on and sh pp ng
schedu e

■ Sh p 10,000 pounds from Los Ange es to the West reg on

■ Sh p 3,000 pounds from At anta to the West reg on and the same amount from At anta to the
M dwest reg on Sh p 6,000 pounds from At anta to the South reg on

■ Sh p 9,000 pounds from New York C ty to the East reg on and 3,000 pounds from New York
C ty to the M dwest reg on

Problems
1. The fo ow ng tab e g ves the d stances between Boston, Ch cago, Da as, Los Ange es, and
M am Each c ty requ res 40,000 k owatt hours (kWh) of power, and Ch cago, Da as, and
M am are capab e of produc ng 70,000 kWh Assume that sh pp ng 1,000 kWh over 100
m es costs $4 From where shou d power be sent to m n m ze the cost of meet ng each c ty’s
demand?

Boston Chicago Dallas Los Angeles Miami


Ch cago 983 0 1205 2112 1390
Da as 1815 1205 0 801 1332
M am 1539 1390 1332 2757 0

2. Reso ve th s chapter’s examp e assum ng that demand n the West reg on ncreases to 13,000

3. Your company produces and se s drugs at severa ocat ons The dec s on of where to pro-
duce goods for each sa es ocat on can have a huge mpact on profitab ty The mode here s
s m ar to the mode used n th s chapter to determ ne where drugs shou d be produced Use
the fo ow ng assumpt ons

• You produce drugs at s x ocat ons and se to customers n s x areas

294  Chapter 31  Us ng So ver to so ve transportat on or d str but on prob ems


CHAPTER 32

Using Solver for capital budgeting

Question answered in this chapter:


■ How can a company use So ver to determ ne wh ch projects t shou d undertake?

Each year, a company such as E L y needs to determ ne wh ch drugs to deve op; a company such
as M crosoft, wh ch software programs to deve op; a company such as Proctor & Gamb e, wh ch new
consumer products to deve op So ver can he p a company make these dec s ons

Answer to this chapter’s question


Th s sect on prov des the answer to the quest on that s sted at the beg nn ng of the chapter

How can a company use Solver to determine which projects it should undertake?

Most corporat ons want to undertake projects that contr bute the greatest net present va ue (NPV),
subject to m ted resources (usua y cap ta and abor) Say that a software deve opment company s
try ng to determ ne wh ch of 20 software projects t shou d undertake The NPV ( n m ons of do ars)
contr buted by each project as we as the cap ta ( n m ons of do ars) and the number of pro-
grammers needed dur ng each of the next three years s g ven on the Bas c Mode worksheet n the
Capbudget x sx fi e, shown n F gure 32-1 For examp e, Project 2 y e ds $908 m on It requ res $151
m on dur ng Year 1, $269 m on dur ng Year 2, and $248 m on dur ng Year 3 Project 2 requ res
139 programmers dur ng Year 1, 86 programmers dur ng Year 2, and 83 programmers dur ng Year 3
Ce s E4 G4 show the cap ta ( n m ons of do ars) ava ab e dur ng each of the three years, and ce s
H4 J4 nd cate how many programmers are ava ab e For examp e, dur ng Year 1, up to $2 5 b on n
cap ta and 900 programmers are ava ab e

297

FIGURE 32-1  Th s s data you w use w th So ver to determ ne wh ch projects to undertake.

The company must dec de whether t shou d undertake each project Assume that the com-
pany can’t undertake a fract on of a software project; f 0 5 of the needed resources s a ocated, for
examp e, the company wou d have a nonwork ng program that wou d br ng n $0 revenue!

The tr ck n mode ng s tuat ons n wh ch you e ther do or don’t do someth ng s to use binary
changing cells A b nary chang ng ce a ways equa s 0 or 1 When a b nary chang ng ce that cor-
responds to a project equa s 1, you do the project If a b nary chang ng ce that corresponds to a
project equa s 0, you don’t do the project You set up So ver to use a range of b nary chang ng ce s
by add ng a constra nt; se ect the chang ng ce s you want to use and then choose Bin from the st n
the Add Constraint d a og box

W th th s background, you’re ready to so ve the software project se ect on prob em As w th any


So ver mode , you shou d beg n by dent fy ng the target ce , the chang ng ce s, and the constra nts

■ Target cell  Max m ze the NPV generated by se ected projects

■ Changing cells  Look for a 0 or 1 b nary chang ng ce for each project Locate these ce s n
the A6 A25 range (named the do t range) For examp e, a 1 n ce A6 nd cates that you under-
take Project 1; a 0 n ce A6 nd cates that you don’t undertake Project 1

■ Constraints  You need to ensure that for each Year t (t = 1, 2, 3), Year t cap ta used s ess
than or equa to Year t cap ta ava ab e, and Year t abor used s ess than or equa to Year t
abor ava ab e

As you can see, the worksheet must compute the NPV, the cap ta used annua y, and the program-
mers used each year for any se ect on of projects In ce B2, use the SUMPRODUCT(do t,NPV) formu a
to compute the tota NPV generated by se ected projects (The NPV range name refers to the C6 C25

298  Chapter 32  Us ng So ver for cap ta budget ng


range ) For every project w th a 1 n co umn A, th s formu a p cks up the NPV of the project, and for
every project w th a 0 n co umn A, th s formu a does not p ck up the NPV of the project Therefore,
you can compute the NPV of a projects, and the target ce s near because t s computed by sum-
m ng terms that fo ow the (chang ng ce )*(constant) form In a s m ar fash on, compute the cap ta
used each year and the abor used each year by copy ng the SUMPRODUCT(doit,E6:E25) formu a from
E2 to F2 J2

Now fi n the Solver Parameters d a og box as shown n F gure 32-2

FIGURE 32-2 The So ver Parameters d a og box s set up for the project se ect on mode .

The goa s to max m ze the NPV of se ected projects (ce B2) The chang ng ce s (the range named
do t) are the b nary chang ng ce s for each project The E2 J2<=E4 J4 constra nt ensures that dur-
ng each year, the cap ta and abor used are ess than or equa to the cap ta and abor ava ab e To
add the constra nt that makes the chang ng ce s b nary, c ck Add n the Solver Parameters d a-
og box and then se ect Bin from the st n the m dd e of the Add Constraint d a og box The Add
Constraint d a og box shou d appear as shown n F gure 32-3

Us ng So ver for cap ta budget ng  Chapter 32   299


FIGURE 32-3  Use B n n the Add Constra nt d a og box to set up b nary chang ng ce s ce s that d sp ay e ther a
0 or a 1.

Th s mode s near because the target ce s computed as the sum of terms that have the (chang-
ng ce )*(constant) form and because the resource usage constra nts are computed by compar ng the
sum of (chang ng ce s)*(constants) to a constant Therefore, se ect the S mp ex LP eng ne

W th the Solver Parameters d a og box fi ed n, c ck Solve and get the resu ts shown ear er, n
F gure 32-1 The company can obta n a max mum NPV of $9,293 b on ($9 293 b on) by choos ng
Projects 2, 3, 6–10, 14–16, 19, and 20

Handling other constraints


Somet mes project se ect on mode s have other constra nts For examp e, suppose that f you se ect
Project 3, you must a so se ect Project 4 Because the current opt ma so ut on se ects Project 3 but
not Project 4, th s te s you that the current so ut on can’t rema n opt ma To so ve th s prob em, add
the constra nt that the b nary chang ng ce for Project 3 s ess than or equa to the b nary chang ng
ce for Project 4

You can find th s examp e on the If 3 then 4 worksheet n the Capbudget x sx fi e, wh ch s shown
n F gure 32-4 Ce L9 refers to the b nary va ue re ated to Project 3, and ce L12 to the b nary va ue
re ated to Project 4 By add ng the L9<=L12 constra nt, f you choose Project 3, L9 equa s 1, and th s
constra nt forces L12 (the Project 4 b nary) to equa 1 Th s constra nt must a so eave the b nary va ue
n the chang ng ce of Project 4 unrestr cted f you do not se ect Project 3 If you do not se ect Project
3, L9 equa s 0, and the constra nt a ows the Project 4 b nary to equa 0 or 1, wh ch s what you want
The new opt ma so ut on s shown n F gure 32-4

Now suppose that you can do on y four projects from among Projects 1 through 10 (See the At
Most 4 Of P1–P10 worksheet, shown n F gure 32-5 ) In ce L8, you compute the sum of the b nary
va ues assoc ated w th Projects 1 through 10 w th the SUM(A6:A15) formu a Then add the L8<=L10
constra nt, wh ch ensures that at most, 4 of the first 10 projects are se ected The new opt ma so ut on
s shown n F gure 32-5 The NPV has dropped to $9 014 b on

300  Chapter 32  Us ng So ver for cap ta budget ng


FIGURE 32-4  Th s s the new opt ma so ut on for f Project 3 s se ect on requ res we do Project 4.

FIGURE 32-5  Opt ma so ut on when on y 4 of Projects 1 10 can be se ected.

Solving binary and integer programming problems


L near So ver mode s n wh ch some or a chang ng ce s are requ red to be b nary or an nteger are
usua y harder to so ve than near mode s n wh ch a chang ng ce s are a owed to be fract ons For
th s reason, ana ysts are often sat sfied w th a near-opt ma so ut on to a b nary or nteger program-
m ng prob em If your So ver mode runs for a ong t me, you m ght want to cons der adjust ng the
Integer Opt ma ty (former y ca ed To erance) sett ng n the So ver Opt ons d a og box (See F gure
32-6 ) For examp e, a To erance sett ng of 5 means that So ver w stop the first t me t finds a feas b e
so ut on that s w th n 0 5 percent of the theoret ca opt ma target ce va ue (The theoret ca opt -
ma target ce va ue s the opt ma target va ue found when the b nary and nteger constra nts are

Us ng So ver for cap ta budget ng  Chapter 32   301


om tted ) Often you’ be faced w th a cho ce between find ng an answer w th n 10 percent of opt -
ma n 10 m nutes or find ng an opt ma so ut on n two weeks of computer t me! The defau t Integer
Opt ma ty va ue s 5%, wh ch means that So ver stops when t finds a target ce va ue w th n 5 per-
cent of the theoret ca opt ma target ce va ue When the software deve opment examp e was first
so ved, the Integer Opt ma ty was set to 5% and found an opt ma target ce va ue of 9269 When the
Integer Opt ma ty va ue was changed to 0 50%, a better target ce va ue (9293) was obta ned

FIGURE 32-6  Th s figure shows adjustment of the nteger Opt ma ty opt on.

302  Chapter 32  Us ng So ver for cap ta budget ng


Problems
1. A company has n ne projects under cons derat on The NPV added by each project and the
cap ta requ red for each project dur ng the next two years s shown n the fo ow ng tab e
(A numbers are n m ons ) For examp e, Project 1 w add $14 m on n NPV and requ re
expend tures of $12 m on dur ng Year 1 and $3 m on dur ng Year 2 Dur ng Year 1, $50 m -
on n cap ta s ava ab e for projects, and $20 m on s ava ab e dur ng Year 2

NPV Year 1 expenditure Year 2 expenditure


Project 1 14 12 3
Project 2 17 54 7
Project 3 17 6 6
Project 4 15 6 2
Project 5 40 32 35
Project 6 12 6 6
Project 7 14 48 4
Project 8 10 36 3
Project 9 12 18 3

• If you can’t undertake a fract on of a project but must undertake e ther a or none of t,
how can you max m ze NPV?

• Suppose that f Project 4 s undertaken, Project 5 must be undertaken How can you max -
m ze NPV?

2. A pub sh ng company s try ng to determ ne wh ch of 36 books t shou d pub sh th s year The


Pressdata x sx fi e g ves the fo ow ng nformat on about each book

• Projected revenue and deve opment costs ( n thousands of do ars)


• Pages n each book
• Whether the book s geared toward an aud ence of software deve opers ( nd cated by a 1
n co umn E)

The company can pub sh books w th a tota of up to 8,500 pages th s year and must pub sh
at east four books geared toward software deve opers How can the company max m ze ts
profit?

3. In the SEND + MORE = MONEY equat on, each etter represents a d fferent d g t from 0–9
Wh ch d g t s assoc ated w th each etter?

Us ng So ver for cap ta budget ng  Chapter 32   303


4. J s try ng to determ ne her c ass schedu e for the next semester A semester cons sts of two
seven-week ha f semesters J must take four courses dur ng each ha f semester There are
five t me s ots dur ng each semester Of course, J cannot take the same course tw ce J has
assoc ated a va ue w th each course and t me s ot Th s data s n the C assdata x sx fi e For
examp e, course 1 dur ng t me s ot 5 n semester 1 has a va ue of 5 Wh ch courses shou d J
take dur ng each semester to max m ze her tota va ue from the semester’s courses?

5. Use cond t ona formatt ng to h gh ght n ye ow fi each row correspond ng to a se ected


project

6. Use So ver to determ ne the m n mum number of co ns needed to make change for 92 cents

304  Chapter 32  Us ng So ver for cap ta budget ng


CHAPTER 33

Using Solver for financial planning

Questions answered in this chapter:


■ Can I use So ver to ver fy the accuracy of the Exce PMT funct on or to determ ne mortgage
payments for a var ab e nterest rate?

■ Can I use So ver to determ ne how much money I need to save for ret rement?

So ver can be a powerfu too for ana yz ng financ a p ann ng prob ems In many of these types of
prob ems, a quant ty such as the unpa d ba ance on a oan or the amount of money needed for ret re-
ment changes over t me For examp e, cons der a s tuat on n wh ch you borrow money Because on y
the non nterest port on of each month y payment reduces the unpa d oan ba ance, you know that
the fo ow ng equat on (Equat on 1) s true

(Unpaid loan balance at end of period t) = (Unpaid loan balance at beginning of period t)
– [(Month t payment) – (Month t interest paid)]

Now suppose that you are sav ng for ret rement Unt you ret re, you depos t at the beg nn ng of
each per od (say periods equa years) an amount of money n your ret rement account, and dur ng the
year, your ret rement fund s nvested and rece ves a return of some percentage Dur ng ret rement,
you w thdraw money at the beg nn ng of each year, and your ret rement fund st rece ves an nvest-
ment return You know that the fo ow ng equat on (Equat on 2) descr bes the re at onsh p among
contr but ons, w thdrawa s, and return

(Retirement savings at end of Year t+1) = (Retirement savings at end of Year t + retirement
contribution at beginning of Year t+1 – Year t+1 retirement withdrawal)
*(Investment return earned during Year t+1)

Comb n ng bas c re at onsh ps such as these w th So ver enab es you to answer a myr ad of nter-
est ng financ a p ann ng prob ems

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

305

Can I use Solver to verify the accuracy of the Excel PMT function or to determine mortgage
payments for a variable interest rate?

Reca that n Chapter 9, “More Exce financ a funct ons,” you found the month y payment (assum-
ng payments occur at the end of a month) on a 10-month oan for $8,000 at an annua nterest rate
of 10 percent to be $1,037 03 Cou d you have used So ver to determ ne your month y payment?
You’ find the answer n the PMT By So ver worksheet n the F nmathso ver x sx fi e, wh ch s shown n
F gure 33-1

FIGURE 33-1  Th s s the So ver mode for ca cu at ng the month y payment for a oan.

The key to th s mode s to use Equat on 1 (shown ear er n the chapter) to track the month y
beg nn ng ba ance The So ver target ce s to m n m ze the month y payment The chang ng ce s
the month y payment The on y constra nt s that the end ng ba ance n Month 10 equa s 0

Enter the beg nn ng ba ance n ce B5 You can enter a tr a month y payment n ce C5 and then
copy the month y payment to the C6 C14 range Because you assume that the payments occur at the
end of each month, nterest s ncurred on the ba ance at the beg nn ng of the month The month y
nterest rate (ce C1 s named Rate) s computed n D1 by d v d ng the annua rate of 0 08 by 12 The
nterest pa d each month s computed by copy ng the rate*B5 formu a from ce D5 to D6 D14 Each
month, th s formu a computes the nterest as 006666*(month’s beg nn ng ba ance) By copy ng the
(B5–(Payment–D5)) formu a from ce E5 to E6 E14, you use Equat on 1 to compute each month’s
end ng ba ance Because (Month t+1 beg nn ng ba ance) = (Month t end ng ba ance), each month’s
beg nn ng ba ance s computed by copy ng the =E5 formu a from ce B6 to B7 B14

You are now ready to use So ver to determ ne the month y payment To see how you’ve set up the
So ver Parameters d a og box, take a ook at F gure 33-2

306  Chapter 33  Us ng So ver for financ a p ann ng


FIGURE 33-2  The So ver Parameters d a og box s set up to determ ne mortgage payments.

The goa s to m n m ze the month y payment (ce C5) Note that the chang ng ce s the same as
the target ce The on y constra nt s that the end ng ba ance for Month 10 must equa 0 Add ng th s
constra nt ensures that the oan s pa d off After you choose the S mp ex LP eng ne and se ect the
nonnegat ve var ab es opt on, So ver ca cu ates a payment of $1,037 03, wh ch matches the amount
ca cu ated by the Exce PMT funct on

Th s mode s near because the target ce equa s the chang ng ce , and the constra nt s created
by add ng mu t p es of chang ng ce s

It shou d be ment oned that when So ver mode s nvo ve very arge or very sma numbers, So ver
somet mes th nks mode s that are near are not near To avo d th s prob em, t s good pract ce to
se ect Use Automatic Scaling n the Options d a og box Th s shou d ensure that So ver proper y
recogn zes near mode s as be ng near

Can I use Solver to determine how much money I need to save for retirement?

By us ng Equat on 2 (shown ear er n the chapter), you can eas y determ ne how much money a per-
son needs to save for ret rement Here’s an examp e

Us ng So ver for financ a p ann ng  Chapter 33   307


You are p ann ng for your ret rement, and at the beg nn ng of th s year and each of the next 39
years, you w contr bute some money to your ret rement fund Each year, you p an to ncrease your
ret rement contr but on by $500 When you ret re n 40 years, you p an to w thdraw (at the beg nn ng
of each year) $100,000 per year for 20 years You make the fo ow ng assumpt ons about the y e ds for
your ret rement nvestment portfo o

■ Dur ng the first 20 years of your nvest ng, the nvestments w earn 10 percent per year

■ Dur ng a other years, your nvestments w earn 5 percent per year

You assume that a contr but ons and w thdrawa s occur at the beg nn ng of the year G ven these
assumpt ons, what s the east amount of money you can contr bute th s year and st have enough to
make your ret rement w thdrawa s?

You can find the so ut on to th s quest on on the Ret re worksheet n the F nmathso ver x sx fi e,
shown n F gure 33-3 Note that many rows are h dden n the mode

Th s worksheet s mp y tracks your ret rement ba ance dur ng each of the next 60 years Each year,
you earn the nd cated nterest rate on the ret rement ba ance Beg n by enter ng a tr a va ue for
the Year 1 payment n ce C6 Copy ng the C6+500 formu a from ce C7 to C8 C45 ensures that the
ret rement contr but on ncreases by $500 per year dur ng Years 2 through 40 Enter n co umn D the
assumed return on your nvestments for each of the next 60 years In ce s E46 E65, enter the annua
$100,000 w thdrawa for Years 41 through 60 Copy ng the (B6+C6–E6)*(1+D6) formu a from F6 to
F7 F65 uses Equat on 2 to compute each year’s end ng ret rement account ba ance Copy ng the =F6
formu a from ce B7 to B8 B65 computes the beg nn ng ba ance for Years 2 through 60 Of course,
the Year 1 n t a ba ance s 0 Note that the 6.8704E-07 va ue n ce F65 s approx mate y 0, w th the
d fference the resu t of a round ng error

FIGURE 33-3  Here s ret rement p ann ng data that can be set up for ana ys s w th So ver.

308  Chapter 33  Us ng So ver for financ a p ann ng


The Solver Parameters d a og box for th s mode s shown n F gure 33-4 You want to m n m ze
your Year 1 contr but on (ce C6) The chang ng ce s a so your Year 1 contr but on (ce C6) Ensure
that you never run out of money dur ng ret rement by add ng the F46 F65>=0 constra nt so that the
end ng ba ance for Years 41 through 60 s nonnegat ve

FIGURE 33-4  The So ver Parameters d a og box s set up for the ret rement prob em.

After choos ng the S mp ex LP eng ne and se ect ng Make Unconstrained Variables Non-
Negative n the Solver Parameters d a og box, c ck Solve n the Solver Parameters d a og box;
you find that the first year’s contr but on shou d equa $1,387 87

Th s mode s near because the target ce equa s the chang ng ce , and the constra nt s created
by add ng mu t p es of chang ng ce s Note that because the return on the nvestments s not the
same each year, there s no easy way to use Exce financ a funct ons to so ve th s prob em So ver pro-
v des a genera framework that can be used to ana yze financ a p ann ng prob ems when mortgage
rates or nvestment returns are not constant

Us ng So ver for financ a p ann ng  Chapter 33   309


Problems
1. I am borrow ng $15,000 to buy a new car I w make 60 end-of-month payments The annua
nterest rate on the oan s 10 percent The car dea er s a fr end of m ne, and he w a ow me
to make the month y payment for Months 1–30 equa to one-ha f the payment for Months 31
through 60 What s the payment dur ng each month?

2. So ve the ret rement p ann ng prob em, assum ng that w thdrawa s occur at the end of each
year and contr but ons occur at the beg nn ng of each year

3. So ve the mortgage examp e, assum ng that payments are made at the beg nn ng of each
month

4. In the ret rement-p ann ng examp e, suppose that dur ng Year 1, your sa ary s $40,000 and
your sa ary ncreases 5 percent per year unt ret rement You want to save the same percent-
age of your sa ary each year you work What percentage of your sa ary shou d you save?

5. In the mortgage examp e, suppose that you want your month y payment to ncrease by $50
each month What shou d each month’s payment be?

6. Assume you want to take out a $300,000 oan on a 20-year mortgage w th end-of-month
payments The annua rate of nterest s 6 percent Twenty years from now, you need to make
an end ng ba oon payment of $40,000 Because you expect your ncome to ncrease, you
want to structure the oan so that at the beg nn ng of each year, your month y payments
ncrease by 2 percent Determ ne the amount of each year’s month y payment

7. B a r’s mother s sav ng for B a r’s co ege educat on The fo ow ng payments must be made at
the nd cated t mes

4 years from now 5 years from now 6 years from now 7 years from now
$24,000 $26,000 $28,000 $30,000

The fo ow ng nvestments are ava ab e

• Today, one year from now, two years from now, three years from now, and four years from
now, she can nvest money for one year and rece ve a 6 percent return

• Today, two years from now, and four years from now, she can nvest money for two years
and rece ve a 14 percent return

• Three years from now, she can nvest money for three years and rece ve an 18 percent
return

• Today, she can nvest money for seven years and rece ve a 65 percent return

What s the m n mum amount that B a r’s mother needs to comm t today to B a r’s co ege
educat on that ensures that she can pay her co ege b s?

310  Chapter 33  Us ng So ver for financ a p ann ng


8. I owe $10,000 on one cred t card that charges 18 percent annua nterest and $5,000 on
another cred t card that charges 12 percent annua nterest Interest for the month s based on
the month’s beg nn ng ba ance I can afford to make tota payments of $2,000 per month, and
the m n mum month y payment on each card s 10 percent of the card’s unpa d ba ance at the
beg nn ng of the month My goa s to pay off both cards n two years What s the m n mum
amount of nterest I need to pay?

Us ng So ver for financ a p ann ng  Chapter 33   311


CHAPTER 34

Using Solver to rate sports teams

Question answered in this chapter:


■ Can I use Exce to set NFL po nt spreads?

Many of us fo ow basketba , footba , hockey, or baseba Oddsmakers set po nt spreads on games


n a these sports and others For examp e, the bookmakers’ best guess was that the Ind anapo s
Co ts wou d w n the 2010 Super Bow by 7 po nts Instead, the New Or eans Sa nts won the game In
th s chapter, you see that So ver pred cted that the Sa nts were the better team and shou d have been
favored Now see how So ver can est mate the re at ve ab ty of NFL teams accurate y

Us ng a s mp e So ver mode , you can generate reasonab e po nt spreads for games based on the
scores of the 2009 season The work s n fi e Nfl2009apr 2010 x sx, shown n F gure 34-1 You use the
score of each game of the 2009 NFL season as nput data The chang ng ce for the So ver mode s a
rat ng for each team and the s ze of the home fie d advantage For examp e, f the Ind anapo s Co ts
have a rat ng of +5 and the New York Jets have a rat ng of +7, the Jets are cons dered two po nts bet-
ter than the Co ts

W th regard to the home-fie d edge, n most years, co ege and profess ona footba teams, as we
as profess ona basketba teams, tend to w n by an average of three po nts (whereas home co ege
basketba teams tend to w n by an average of five po nts) In your mode , however, you w define the
home edge as a chang ng ce and have So ver est mate the home edge You can define the outcome
of an NFL game to be the number of po nts by wh ch the home team outscores the v s tors and pre-
d ct the outcome of each game by us ng the fo ow ng equat on (Equat on 1)

(Pred cted po nts by wh ch home team outscores v s tors) = (Home edge)+(Home team rat ng)–(Away
Team rat ng)

For examp e, f the home-fie d edge equa s three po nts, when the Co ts host the Jets, the Co ts
w be a one-po nt favor te (3 + 5 – 7) If the Jets host the Co ts, the Jets w be a five-po nt favor te
(3 + 7 – 5) (The Tampa Bay–New Eng and game was p ayed n London, so there s no home edge for
th s game )

What target ce w y e d re ab e rat ngs? The goa s to find the set of va ues for team rat ngs and
home-fie d advantage that best pred cts the outcome of a games In short, you want the pred ct on
for each game to be as c ose as poss b e to the outcome of each game Th s suggests that you want
to m n m ze the sum over a games of (Actual outcome) – (Predicted outcome) However, the prob-
em w th us ng th s target s that pos t ve and negat ve pred ct on errors cance each other out For
examp e, f you over-pred ct the home-team marg n by 50 po nts n one game and under-pred ct the

313

home-team marg n by 50 po nts n another game, the target ce wou d y e d a va ue of 0, nd cat ng
perfect accuracy, when n fact you were off by 50 po nts a game You can remedy th s prob em by
m n m z ng the sum over a games by us ng the [(Actual Outcome) – (Predicted Outcome)]2 formu a
Now pos t ve and negat ve errors w not cance each other out

Answer to this chapter’s question


Th s sect on prov des the answer to the quest on that s sted at the beg nn ng of the chapter

Can I use Excel to set NFL point spreads?

See now how to determ ne accurate rat ngs for NFL teams by us ng the scores from the 2009 regu-
ar season You can find the data for th s prob em n the Nfl2009apr 2010 x sx fi e, wh ch s shown n
F gure 34-1

FIGURE 34-1  Th s s the data rat ng NFL teams that you use w th So ver.

To beg n, p ace a tr a home-fie d advantage va ue n ce B8

Start ng n row 5, co umns E and F conta n the home and away teams for each game For examp e,
the first game ( sted n row 5) s Tennessee p ay ng at P ttsburgh Co umn G conta ns the home
team’s score, and co umn H conta ns the v s t ng team’s score As you can see, the Stee ers beat the
T tans 13–10 You can now compute the outcome of each game (the number of po nts by wh ch the
home team beats the v s t ng team) by enter ng the =G5–H5 formu a n ce I5 By po nt ng to the
ower-r ght port on of th s ce and doub e-c ck ng, you can copy th s formu a down to the ast regu-
ar season game, wh ch appears n row 260 (By the way, an easy way to se ect a the data s to press
Ctr +Sh ft+down arrow Th s key comb nat on takes you to the ast row fi ed w th data—row 260 n
th s case )

314  Chapter 34  Us ng So ver to rate sports teams


In co umn J, use Equat on 1 to generate the pred ct on for each game The pred ct on for the first
game s computed n ce J5 as fo ows

=$B$8+VLOOKUP(E5,$B$12:$C$43,2,FALSE)-VLOOKUP(F5,$B$12:$C$43,2,FALSE)

Th s formu a creates a pred ct on for the first game by add ng the home edge to the home-
team rat ng and then subtract ng the v s t ng-team rat ng (Note that n row 103, the term $B$8
s de eted from the formu a because there was no home edge n the New Eng and–Tampa
Bay game ) The term VLOOKUP(E5,$B$12 $C$43,2,FALSE) ocates the home-team rat ng, and
VLOOKUP(F5,$B$12 $C$43,2,FALSE) ooks up the v s t ng team’s rat ng (For more nformat on about
us ng ookup funct ons, see Chapter 2, “Lookup funct ons ”) In co umn K, compute the squared error
(actual score – predicted score)2 for each game Your squared error for the first game s computed n
ce K5 w th the =(I5 – J5)2 formu a. After se ect ng the I5 K5 ce range, you can doub e-c ck and copy
the formu as down to row 260

Next, compute the target ce n ce K3 by summ ng a the squared errors w th the SUM(J5 J260)
formu a

Tip  You can enter a formula for a large column of numbers such as this by typing
=SUM( and then selecting the first cell in the range you want to add together. Press
Ctrl+Shift+down arrow to enter the range from the cell you selected to the bottom row in
the column and then add the closing parenthesis.

It s conven ent to make the average team rat ng equa to 0 A team w th a pos t ve rat ng s better
than average and a team w th a negat ve rat ng s worse than average Compute the average team
rat ng n ce C10 w th the AVERAGE(C12 C43) formu a

You can now fi n the Solver Parameters d a og box as shown n F gure 34-2

Us ng So ver to rate sports teams  Chapter 34   315


FIGURE 34-2  The So ver Parameters d a og box s set up for NFL rat ngs.

M n m ze the sum of the squared pred ct on errors for a games (computed n ce K3) by chang ng
each team’s rat ng ( sted n ce s C12 C43) and the home advantage (ce B8) The C10=0 constra nt
ensures that the average team rat ng s 0 From F gure 34-1, you can see that the home team has an
advantage of 2 26 po nts over the v s t ng team The 15 h ghest-rated teams are shown n F gure 34-3
Remember that the rat ngs sted n ce range E3 E34 are computed by So ver In the temp ate fi e, you
can start w th any numbers n these ce s, and So ver w st find the best rat ngs

316  Chapter 34  Us ng So ver to rate sports teams


FIGURE 34-3  These are the top 15 teams for the NFL 2009 season.

These rat ngs have the Sa nts around 5 po nts better than the Co ts, so th s mode wou d have
pred cted (before the p ayoffs) that the Sa nts wou d beat the Co ts by 5 po nts

Why is your model not a linear Solver model?


Th s mode s not near because the target ce adds together terms of the (Home Team Rat ng
+ Home-F e d Edge – V s t ng Team Rat ng)2 form Reca that for a So ver mode to be near,
the target ce must be created by add ng together terms w th the (chang ng ce )*(constant)
form Th s re at onsh p doesn’t ex st n th s case, so the mode s not near So ver does obta n
the correct answer, however, for any sports-rat ng mode n wh ch the target ce m n m zes the
sum of squared errors Note that the GRG non near eng ne was chosen because th s mode s
not near and d d not nvo ve nonmathemat ca funct ons such as IF statements I d d not se ect
Make Unconstra ned Var ab es Non-Negat ve because to have the team rat ngs average 0, you
must a ow some of the team rat ngs to be negat ve

Note  Recently, I found that the GRG Solver engine works poorly when automatic scaling
is checked. I recommend opening the Options dialog box and clearing Use Automatic
Scaling.

Us ng So ver to rate sports teams  Chapter 34   317


Problems
1-4. The Nfl0x x sx (x = 1, 2, 3, 4) fi es conta n scores for every regu ar season game dur ng the
200x NFL season Rate the teams for each season Dur ng each season, wh ch teams wou d you
forecast to have made the Super Bow ?

5. For the 2004 season, dev se a method to pred ct the actua score of each game H nt G ve
each team an offens ve rat ng and a defens ve rat ng Who had the best offense? Who had the
best defense?

6. True or fa se? An NFL team cou d ose every game and be an above-average team

7. The Nba01 02 x sx fi e conta ns scores for every game dur ng the 2001–2002 NBA season Rate
the teams

8. The Nba02 03 x sx fi e conta ns scores for every regu ar season game dur ng the 2002–2003
NBA season Rate the teams

9. The Wor dba x sx fi e conta ns a scores from the 2006 Wor d Basketba Champ onsh ps Rate
the teams Who were the best three teams?

10. Th s method of rat ng teams works fine for footba and basketba What prob ems ar se f you
app y these methods to hockey or baseba ?

11. The NFL2012data x sx fi e conta ns scores of a NFL 2012 regu ar season games Rate the
teams Even though the Co ts were 10–6, your rat ngs have the Co ts as a we -be ow-average
team Can you exp a n th s anoma y?

318  Chapter 34  Us ng So ver to rate sports teams


CHAPTER 35

Warehouse location and the


GRG Multistart and Evolutionary
Solver engines

Questions answered in this chapter:


■ Where n the Un ted States shou d an Internet sh pp ng company ocate a s ng e warehouse to
m n m ze the tota d stance that packages are sh pped?

■ Where n the Un ted States shou d an Internet sh pp ng company ocate two warehouses to
m n m ze the tota d stance that packages are sh pped?

In M crosoft Exce 2013, So ver has been b essed w th many new exc t ng capab t es Th s chapter
(and Chapter 36, “Pena t es and the Evo ut onary So ver,” and Chapter 37, “The trave ng sa esperson
prob em”) exp a ns how these a gor thms can he p you so ve many mportant opt m zat on prob ems

Understanding the GRG Multistart and Evolutionary Solver


engines
As was po nted out n Chapter 28, “Introduc ng opt m zat on w th Exce So ver,” the Exce 2013 So ver
uses three eng nes to so ve opt m zat on prob ems S mp ex LP, GRG Non near, and Evo ut onary The
fo ow ng sect ons prov de more deta s about how the atter two of these eng nes are used to so ve
opt m zat on prob ems

How does Solver solve linear Solver problems?


As was po nted out n Chapters 28 through 33, a So ver mode s near f a references to chang-
ng ce s n the target ce s and constra nts are created by add ng together terms of the (chang ng
ce s)*(constants) form For near mode s, you shou d a ways se ect the S mp ex LP eng ne, wh ch
s des gned to find so ut ons to near So ver mode s effic ent y The Exce 2013 So ver can hand e
prob ems w th up to 200 chang ng ce s and 100 constra nts Vers ons of So ver that can hand e arger
prob ems are ava ab e from the So ver com webs te

319

How does the GRG Nonlinear engine solve nonlinear
optimization models?
If your target ce , any of your constra nts, or both conta n references to chang ng ce s that are not of
the (chang ng ce )*(constant) form, you have a non near mode If x and y are chang ng ce s, refer-
ences such as the fo ow ng n the target ce , any constra nts, or both make your mode non near

■ x2

■ xy

■ snx

■ ex

■ xe2y

If your non near formu as nvo ve ord nary math operators such as the prev ous examp es, proper
use of the GRG Non near eng ne shou d qu ck y find the opt ma so ut on to your So ver mode To
ustrate how the GRG Non near eng ne works, suppose you want to max m ze –x 2 + 4x + 2 Th s
funct on s graphed n F gure 35-1

FIGURE 35-1  Th s s how the GRG Non near eng ne max m zes a funct on.

You can see that th s funct on s max m zed for x = 2 Not ce a so that for x = 2, the funct on has a
s ope of 0 The GRG Non near eng ne so ves th s prob em by try ng to find a po nt at wh ch the s ope
of the funct on s 0 S m ar y, f you want to m n m ze y = x 2, the GRG Non near eng ne so ves th s
prob em by determ n ng that the s ope of th s funct on s 0 for x = 0 See F gure 35-2

320  Chapter 35  Warehouse ocat on and the GRG Mu t start and Evo ut onary So ver eng nes
FIGURE 35-2  Th s s how the GRG Non near eng ne m n m zes a funct on.

Unfortunate y, many funct ons cannot be max m zed s mp y by ocat ng a po nt where the func-
t on’s s ope equa s 0 For examp e, suppose you want to max m ze the funct on shown n F gure 35-3,
when x ranges between –5 and +10

FIGURE 35-3  Th s s max m z ng a funct on w th mu t p e peaks.

You can see that th s funct on has more than one peak If you start w th a va ue of x near 1, you
w find the r ght so ut on to the (x = 1) prob em If you start near another peak—say near x = 5—you
w find a so ut on of x = 5, wh ch s ncorrect Because n most prob ems (espec a y those w th more
than one chang ng ce ) you do not know a good start ng po nt, t appears you have a major hurd e
to c ear Fortunate y, Exce 2013 has a Mu t start opt on You can se ect Multistart after choos ng
Options and then c ck ng the GRG Nonlinear tab When the Mu t start opt on s se ected, Exce
chooses many start ng so ut ons and finds the best answer after beg nn ng w th these start ng po nts
Th s approach usua y reso ves the mu t p e peak and va ey prob em

By the way, press ng Esc stops So ver A so, keep n m nd that GRG Mu t start works best when you
p ace reasonab e upper and ower bounds on your chang ng ce s (For examp e, you do not spec fy
chang ng ce <=100 m on )

Warehouse ocat on and the GRG Mu t start and Evo ut onary So ver eng nes  Chapter 35   321
The GRG eng ne a so runs nto troub e f the target ce , constra nts, or both use nonsmooth func-
t ons such as MAX, MIN, ABS, IF, SUMIF, COUNTIF, SUMIFS, COUNTIFS, and others that nvo ve chang-
ng ce s These funct ons create po nts where there s no un que y defined s ope because the s ope
changes abrupt y For examp e, suppose an opt m zat on prob em requ res you to mode the va ue of
a European ca opt on w th a $40 exerc se pr ce Th s ca opt on enab es you to buy the stock for $40
If the stock pr ce s s at exp rat on of the opt on, then the va ue of the ca opt on may be computed
w th the max(0,s-40) or IF(s>40,s-40,0) formu a re at onsh p graphed n F gure 35-4 It s c ear that
when s = 40, the opt on va ue has no s ope, so the GRG eng ne wou d break down

FIGURE 35-4  The opt on va ue has no s ope for a $40 stock pr ce.

As F gure 35-5 shows, So ver mode s that nc ude the abso ute va ue funct on (reca that the abso-
ute va ue of a number s just the d stance of the number from 0) w have no s ope for x = 0 In Exce ,
the ABS(x) funct on returns the abso ute va ue of a number x

FIGURE 35-5  The abso ute va ue funct on has no s ope for x = 0.

322  Chapter 35  Warehouse ocat on and the GRG Mu t start and Evo ut onary So ver eng nes
Opt m zat on prob ems n wh ch the target ce , any of the constra nts, or both have no s ope for
any chang ng ce va ues are ca ed nonsmooth opt m zat on prob ems Even GRG Mu t start has d f-
ficu ty w th these types of prob ems In these s tuat ons, you shou d app y the So ver Evo ut onary
eng ne For non near So ver mode s, So ver s m ted to 100 chang ng ce s and 100 constra nts

How does the Evolutionary Solver engine tackle nonsmooth


optimization problems?
Evo ut onary So ver n Exce 2013 s based on genet c a gor thms, a concept d scovered by John
Ho and, a computer sc ence professor at the Un vers ty of M ch gan To use the Evo ut onary So ver,
beg n by tak ng 50 to 100 po nts n the prob em’s feas b e reg on (that s, the set of po nts that meet
the constra nts) Th s set of po nts s ca ed the population Then, the target ce s eva uated for each
po nt Us ng the dea of surv va of the fittest from the theory of evo ut on, you change the po nts
n the popu at on n a way that ncreases the ke hood that future popu at on members are ocated
near prev ous popu at on members that have a good target ce va ue Because th s approach s based
on target ce va ues and not on s opes, mu t p e peaks and va eys pose no prob em A so, funct ons
that do not have s opes (the so-ca ed nonsmooth funct ons) a so become a ess mportant ssue The
Evo ut onary So ver eng ne ( ke GRG Mu t start) a so works best when reasonab e upper and ower
bounds are p aced on your chang ng ce s After you se ect the Evo ut onary So ver eng ne, t’s best
to choose Options, c ck the Evolutionary tab, and change the mutat on rate to 5 A so, se ect the
Required Bounds On Variables check box and ncrease the max mum t me w thout mprovement to
3,600 seconds Increas ng the mutat on rate decreases the ke hood that the So ver gets stuck near
a poor so ut on Increas ng the max mum t me w thout mprovement to 3,600 seconds enab es the
So ver to run unt t fa s to mprove the target ce for 3,600 seconds That way, the So ver keeps run-
n ng f you eave your computer

Now, use So ver to so ve two nterest ng fac ty ocat on prob ems

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

Where in the United States should an Internet shipping company locate a single warehouse to
minimize the total distance that packages are shipped?

The number of sh pments ( n thousands) made each year to var ous c t es s shown n F gure 35-6 (See
the One warehouse worksheet n the Warehouse oc x sx fi e )

Warehouse ocat on and the GRG Mu t start and Evo ut onary So ver eng nes  Chapter 35   323
FIGURE 35-6  Here s data for the s ng e warehouse prob em.

A key to th s mode s the fo ow ng formu a, wh ch g ves the approx mate d stance between two
US c t es hav ng a at tude and ong tude g ven by (Lat1, Long1) and (Lat2, Long2)

Distance = 69 * (Lat1 - Lat2)2 + (Long1 - Long2)2

To beg n, enter tr a va ues n ce s F4 G4 for the at tude and ong tude of the warehouse Next, by
copy ng the 69*SQRT((C7-$F$4)^2+(D7-$G$4)^2) formu a from F7 to F8 F27, you compute the approx-
mate d stance of each c ty from the warehouse Next, copy ng the E7*F7 formu a from G7 to G8 G27
computes the d stance trave ed by the sh pments to each c ty In ce H5, the SUM(G7 G27) formu a
computes the tota d stance trave ed by a sh pments Your target ce s to m n m ze H5 by chang ng
F4 G4 After you se ect the GRG Non near eng ne, the Solver Parameters d a og box appears, as n
F gure 35-7

After you c ck Solve, you’ find that the warehouse shou d be ocated at 36 81 degrees at tude
and 92 48 degrees ong tude, wh ch s near Spr ngfie d, M ssour (See F gure 35-6 )

324  Chapter 35  Warehouse ocat on and the GRG Mu t start and Evo ut onary So ver eng nes
FIGURE 35-7  Th s s the So ver Parameters d a og box for the One warehouse prob em.

Where in the United States should an Internet shipping company locate two warehouses to
minimize the total distance that packages are shipped?

The work for th s prob em s n the Two warehouses worksheet n the Warehouse oc x sx fi e, shown n
F gure 35-8

To beg n, enter tr a at tudes and ong tudes for the warehouses n F4 G5 Next, copy the
69*SQRT((C7-$F$4)^2+(D7-$G$4)^2) formu a from F7 to F8 F27 to compute the d stance of each c ty
from Warehouse 1 By copy ng the 69*SQRT((C7-$F$5)^2+(D7-$G$5)^2) formu a from G7 to G8 G27,
you compute the d stance from each c ty to Warehouse 2 Because the sh pments from each c ty w
be sent from the closer warehouse, you now compute the d stance of each c ty to the c oser ware-
house by copy ng the MIN(F7,G7) formu a from H7 to H8 H27. In I7 I27, you compute the d stance
trave ed by each c ty’s sh pments by copy ng the H7*E7 formu a from I7 to I8 I27. In ce I5, you com-
pute the tota d stance trave ed by sh pments w th the SUM(I7 I27) formu a

Warehouse ocat on and the GRG Mu t start and Evo ut onary So ver eng nes  Chapter 35   325
FIGURE 35-8  Th s figure shows a mode for ocat ng two warehouses.

You’re now ready to use So ver to determ ne the opt ma warehouse ocat ons The setup for the
So ver Parameters d a og box s shown n F gure 35-9

Beg n by se ect ng the GRG Non near eng ne and then use the poor so ut on, wh ch p aces each
warehouse at 0 at tude and ong tude Th s so ut on s poor for two reasons It ocates the warehouses
n Afr ca and t puts two warehouses n the same p ace After runn ng So ver, you find that So ver
recommends ocat ng both warehouses n the same p ace Of course, th s s a subopt ma so ut on
The prob em s twofo d The MIN funct on creates s tuat ons w th no s opes, and perhaps your target
ce , as a funct on of the four chang ng ce s, has mu t p e peaks and va eys If your target ce has
mu t p e peaks and va eys ( n four d mens ons), perhaps your poor start ng so ut on s not near the
owest va ey, wh ch s the true opt ma so ut on When you suspect mu t p e peaks and va eys ex st,
t s a good dea to use GRG Mu t start, wh ch tr es mu t p e start ng po nts and finds the best answer
from each Most of the t me, the best of the best Mu t start finds w be the opt ma so ut on to the
prob em To use Mu t start, p ace upper and ower bounds on the chang ng ce s For the bounds on
at tude chang ng ce s, you cou d se ect 0 and 90 degrees Th s ensures that the warehouse s north of
the equator For the bounds on ong tude chang ng ce s, choose 0 and 150, wh ch ensures that your
ocat on s west of Greenw ch, Eng and, and east of Anchorage, A aska

326  Chapter 35  Warehouse ocat on and the GRG Mu t start and Evo ut onary So ver eng nes
FIGURE 35-9  So ver s set up for ocat ng two warehouses.

After runn ng the GRG Mu t start eng ne, you find the tota d stance trave ed was 119,676 m es,
and the average d stance trave ed per sh pment s 502 m es The ocat ons of the warehouses are
shown n ce s F4 G5 of F gure 35-8 Warehouse 1 s ocated near Lex ngton, Kentucky; Warehouse 2 s
ocated near Lancaster, Ca forn a

To confirm that So ver found the opt ma so ut on, run the Evo ut onary So ver eng ne You find no
mprovement n the opt ma so ut on

Suppose you had set an upper bound for ong tude of 110 degrees After runn ng So ver, you
wou d have found that So ver recommends a ong tude near 110 degrees If you p ace bounds on a
chang ng ce and the So ver forces the chang ng ce to assume a va ue near a bound, you shou d
re ax the bound

Warehouse ocat on and the GRG Mu t start and Evo ut onary So ver eng nes  Chapter 35   327
Problems
1. F nd the opt ma so ut on to the warehouse prob em f three warehouses are a owed

2. Suppose you want to ocate a s ng e restroom so that company emp oyees have to trave the
sma est poss b e d stance per day when go ng to the bathroom Emp oyees work n four oca-
t ons w th n the p ant as descr bed n the fo ow ng tab e

X Y Number of employees
5 20 6
50 50 12
25 75 23
80 30 15

Assume that emp oyees a ways wa k n a north–south or east–west d rect on when go ng to


and from the restroom Where shou d the restroom be ocated? So ve Prob em 2 f the com-
pany wants to ocate two restrooms

328  Chapter 35  Warehouse ocat on and the GRG Mu t start and Evo ut onary So ver eng nes
CHAPTER 36

Penalties and the Evolutionary


Solver

Questions answered in this chapter:


■ What are the keys to us ng the Evo ut onary So ver successfu y?

■ How can I use the Evo ut onary So ver to ass gn 80 workers n M crosoft F nance to a job n
one of four workgroups?

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

What are the keys to using the Evolutionary Solver successfully?

Prev ous y, th s book stated that the Evo ut onary So ver shou d be used to find so ut ons to opt m za-
t on prob ems n wh ch the target ce , chang ng ce s, or both nvo ve nonsmooth funct ons such as IF,
ABS, MAX, MIN, COUNTIF, COUNTIFS, SUMIF, SUMIFS, AVERAGEIF, and AVERAGEIFS Before so v ng a
prob em w th the Evo ut onary So ver, you shou d do the fo ow ng n the Solver Parameters d a og
box

■ C ck Options, se ect the Evolutionary tab, and ncrease Mutation Rate to 50 Increas ng
the mutat on rate enab es the So ver to jump around n the set of poss b e so ut ons and avo d
be ng stuck n a port on of the set of poss b e so ut ons that does not conta n a good so ut on
to the So ver mode

■ Change Maximum Time Without Improvement to 3,600 seconds Increas ng Max mum
T me W thout Improvement ensures that f you eave your PC, M crosoft Exce w keep
ook ng for a so ut on for 3,600 seconds You can stop the So ver at any t me by press ng the
Esc key

■ P ace reasonab e ower and upper bounds on your chang ng ce s P ac ng bounds on the
chang ng ce s reduces the s ze of the reg on n wh ch So ver searches for an opt ma so ut on
Th s can great y speed So ver’s progress toward an opt ma so ut on The user can change
many other Evo ut onary So ver sett ngs, but Mutat on Rate and Max mum T me W thout
Improvement have been found to be the on y sett ngs that have a s gn ficant mpact on the
so ut on process
329

Everyth ng n fe has an ups de and a downs de, and the Evo ut onary So ver s no except on The
ups de of the Evo ut onary So ver s that t hand es nonsmooth funct ons we The downs de s that
constra nts that are not near funct ons of the chang ng ce s are not hand ed very we To hand e
most constra nts w th the Evo ut onary So ver, you shou d pena ze the target ce to make v o at on of
a constra nt a bad th ng Then the surv va of the fittest w do away w th any constra nt v o at on The
chapter’s next quest on shows how to use pena t es w th the Evo ut onary So ver

How can I use the Evolutionary Solver to assign 80 workers in Microsoft Finance to a job in
one of four workgroups?

You need to ass gn 80 emp oyees to four workgroups The head of each workgroup has rated each
emp oyee’s competence on a 0 to 10 sca e (10 equa s most competent) Each emp oyee has rated h s
sat sfact on w th each job ass gnment (aga n on a 0 to 10 sca e) For examp e, Worker 1 has been g ven
a 9 rat ng from the eader of Workgroup 1, and Worker 1 g ves Workgroup 4 a rat ng of 7

The work for th s quest on s n the Ass gn x sx fi e (See F gure 36-1 ) You want to ass gn between
18 and 22 peop e to each workgroup You cons der job competence to be tw ce as mportant as
emp oyee sat sfact on How can you ass gn emp oyees to workgroups to max m ze tota sat sfact on
and ensure that each d v s on has the requ red number of emp oyees?

FIGURE 36-1  Th s s the data for the job ass gnment prob em.

330  Chapter 36  Pena t es and the Evo ut onary So ver


In ce s A3 A82, enter tr a ass gnments of workers to workgroups Ass gn ng each worker to
Workgroup 1, for examp e, s an acceptab e start ng so ut on Copy ng the HLOOKUP(A3,Qua ,B3+1)
formu a from K3 to K3 K82 enab es you to ook up each emp oyee’s qua ficat ons for her ass gned
job Note that Qua refers to the C2 F82 range Next, copy ng the HLOOKUP(A3,Sat s,B3+1) formu a
from L3 to L3 L82 enab es you to ook up the emp oyee’s sat sfact on w th her ass gned job Sat s s the
range name for G2 J82

To dea w th the fact that each d v s on needs between 18 and 22 emp oyees, you need to count
how many emp oyees have been ass gned to each workgroup You can do th s n ce s N6 N9 by copy-
ng the COUNTIF($A$3 $A$82,M6) formu a from N6 to N7 N9 Next, n ce s O6 O9, determ ne whether
a workgroup has the ncorrect number of emp oyees by copy ng the IF(OR(N6<18,N6>22),1,0) formu a
from O6 to O7 O9

Now you’ see how to work on comput ng the target ce In K1 L1, you compute tota competence
and tota job qua ty by copy ng the SUM(K3 K82) formu a from K1 to K1 L1. To ensure that each
workgroup w have between 18 and 22 workers, you can pena ze the target ce Choose a pena ty
of 1,000 for each workgroup that has fewer than 18 or more than 22 workers There s no hard and
fast ru e to he p you determ ne an appropr ate pena ty In th s s tuat on, the average rat ng s 5 Th s
y e ds a target ce of 2*400 + 400 = 1,200 Therefore, t seems ke y that putt ng the wrong number
of peop e n any d v s on wou d not benefit the target ce by more than 1,000, so surv va of the fit-
test w k off any so ut on for wh ch a workgroup has too many or too few workers The appropr -
ate pena ty shou d not be too arge (100,000) because t somet mes makes the So ver gnore the rea
prob em If the pena ty s too sma , the So ver w not ach eve the goa you’ve set

In ce O10, compute the tota number of d v s ons that do not have the correct number of work-
ers w th the SUM(O6 O9) formu a Now you are fina y ready to compute the target ce n ce O12 by
add ng tw ce the tota competence to the tota job sat sfact on and subtract ng a pena ty of 1,000 for
each group that does not have the correct number of emp oyees Your fina target ce s computed
w th the 2*K1+L1–1000*O10 formu a.

You now can create the So ver mode for th s prob em You need to use the Evo ut onary So ver
because the COUNTIF and IF funct ons are nonsmooth funct ons of the chang ng ce s The mode s
shown n F gure 36-2

Max m ze the we ghted sum of workgroup and emp oyee sat sfact on ess the pena ty for an
ncorrect number of workers n a workgroup (ce O12) and then constra n each worker’s ass gnment
to be 1, 2, 3, or 4 The so ut on s shown n F gure 36-1 Each group has the r ght number of workers;
average emp oyee competence s 7 2, and average emp oyee sat sfact on s 6 3 Over a 80 workers,
the average of the r competence rat ngs s 4 4, and the overa average for sat sfact on rat ngs s 5, so
cond t ons have mproved qu te a ot over a random ass gnment

Pena t es and the Evo ut onary So ver  Chapter 36   331


FIGURE 36-2  Th s s the So ver mode for the worker ass gnment prob em.

If you had tr ed the GRG Non near eng ne (even w th Mu t start), the So ver wou d not have found
the opt ma so ut on because the mode nc udes nonsmooth funct ons Another t p about us ng the
Evo ut onary So ver s to use as few chang ng ce s as poss b e, and you w usua y be rewarded by
So ver tak ng ess t me to find an opt ma so ut on

Using conditional formatting to highlight each employee’s


ratings
You can use the cond t ona formatt ng feature to h gh ght n ye ow each emp oyee’s actua compe-
tence and sat sfact on (based on h s ass gnment) At ce C3, se ect the C3 J82 ce range Se ect New
Rule from Conditional Formatting on the Home tab, se ect Use A Formula To Determine Which
Cells To Format, and fi n the d a og box as shown n F gure 36-3

332  Chapter 36  Pena t es and the Evo ut onary So ver


FIGURE 36-3  Use cond t ona formatt ng to h gh ght worker qua ty and sat sfact on.

Th s formu a enters a ye ow format n ce C3 f and on y f the first worker s ass gned to


Workgroup 1 Exce cop es th s formu a across and down so that each worker’s qua ty and sat sfact on
rat ngs are h gh ghted on y for the workgroup to wh ch each emp oyee s ass gned

Problems
1. Use the Evo ut onary So ver to so ve Prob em 4 n Chapter 32, “Us ng So ver for cap ta
budget ng ”

2. So ve the two-warehouse prob ems n Chapter 35, “Warehouse ocat on and the GRG
Mu t start and Evo ut onary So ver eng nes,” assum ng that each warehouse can sh p, at most,
120,000 un ts

3. In the fict ona state of Po t c ans Care about U S , there are e ght congress ona d str cts Each
of 15 c t es must be ass gned to a congress ona d str ct, and each d str ct must be ass gned
between 150,000 and 250,000 voters The makeup of each d str ct s g ven n the fo ow ng
tab e Ass gn the c t es to d str cts to max m ze the number of d str cts won by the Democrats

City Rep Dem


1 80 34
2 43 61
3 40 44
4 20 24
5 40 114
6 40 64
7 70 34
8 50 44

Pena t es and the Evo ut onary So ver  Chapter 36   333


9 70 54
10 70 64
11 80 45
12 40 50
13 50 60
14 60 65
15 50 70

4. So ve the ass gnment of workers examp e, assum ng that worker sat sfact on s tw ce as mpor-
tant as the bosses’ rat ngs

5. Cook County Genera s attempt ng to deve op the work schedu e for ts 20 nurses Each nurse
w work four consecut ve days and s ass gned to one of the fo ow ng schedu es

Schedule Days worked


1 Monday Thursday
2 Tuesday Fr day
3 Wednesday Saturday
4 Thursday Sunday
5 Fr day Monday
6 Saturday Tuesday
7 Sunday Wednesday

Each nurse w be ass gned for the week to e ther the ICU or a pat ent ward Each nurse’s sat s-
fact on w th her ass gnment s g ven n the Nursejack edata x sx fi e For examp e, f Nurse 5 s
ass gned to the ICU, Nurse 5 g ves a perfect 10 rat ng to work schedu e 3

Each day, the ICU needs s x nurses, and the pat ent wards need five nurses Schedu e the
nurses to max m ze the r sat sfact on and meet hosp ta needs

You w need to know wh ch schedu es sat sfy nurse demand for d fferent days For examp e,
nurses start ng on Monday, Fr day, Saturday, and Sunday w work on Monday

334  Chapter 36  Pena t es and the Evo ut onary So ver


CHAPTER 37

The traveling salesperson problem

Questions answered in this chapter:


■ How can I use Exce to so ve sequenc ng prob ems?

■ How can I use Exce to so ve a trave ng sa esperson prob em (TSP)?

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

How can I use Excel to solve sequencing problems?

Many bus ness prob ems nvo ve the cho ce of an opt ma sequence Here are two examp es

■ In what order shou d a pr nt shop work on 10 jobs to m n m ze the tota t me by wh ch jobs fa


to meet the r due dates? Prob ems of th s type are ca ed job shop schedu ng prob ems

■ A sa esperson ves n Boston and wants to v s t 10 other c t es before return ng home In wh ch


order shou d he v s t the c t es to m n m ze the tota d stance he trave s? Th s s an examp e of
the c ass c TSP

Here are two other examp es of a TSP

■ A de very dr ver needs to make 20 stops today In wh ch order shou d she de ver packages to
m n m ze her t me on the road?

■ A robot must dr 10 ho es to produce a s ng e pr nted c rcu t board Wh ch order of dr ng


the ho es m n m zes the tota t me needed to produce a c rcu t board?

The M crosoft Exce 2013 So ver makes tack ng sequenc ng prob ems very easy S mp y choose
Evo ut onary So ver, se ect your chang ng ce s, and define A D fferent constra nts Configur ng con-
stra nts w th A D fferent ensures that f you have 10 chang ng ce s, Exce w ass gn the va ues of 1,
2, 10 to the chang ng ce s, w th each va ue occurr ng exact y once In genera , f you se ect a range
of n chang ng ce s to be d fferent, Exce ensures that the chang ng ce s assume the va ues of 1, 2, ,
n, w th each poss b e va ue occurr ng exact y once See how to use D f to so ve a trave ng sa esperson
prob em eas y

335

How can I use Excel to solve a traveling salesperson problem (TSP)?

So ve the fo ow ng prob em

W e Lowman s a sa esman who ves n Boston He needs to v s t each of the c t es sted n


F gure 37-1 and then return to Boston In what order shou d W e v s t the c t es to m n m ze the tota
d stance he trave s? Your work s n fi e Tsp x sx

FIGURE 37-1  Here s data for the TSP.

To mode th s prob em n a spreadsheet, you shou d note that any order ng or permutat on of the
numbers 1 through 11 represents an order for v s t ng c t es For examp e, the order of 2-4-6-8-10-1-
3-5-7-9-11 can be v ewed as trave ng from Boston (C ty 1) to Da as (C ty 3), to LA (C ty 5), and fina y
to SF (C ty 10) before return ng to Boston Because the order s v ewed from the ocat on of C ty 1,
there are 10! = 10 × 9 × 8 × 7 × 6 × 2 × 1 = 3,628,800 poss b e order ngs for W e to cons der

To beg n, you need to determ ne the tota d stance trave ed for any g ven order for v s t ng the
c t es The INDEX funct on s perfect for th s s tuat on Reca from Chapter 3, “The INDEX funct on,”
that the syntax of the INDEX funct on s INDEX(Range,row#,co umn#) Exce ooks n the range of ce s
named Range and p cks out the entry spec fied n row# and co umn# In th s case, you can use the
INDEX funct on to find the tota d stance trave ed n v s t ng a c t es

Beg n by enter ng an order of the ntegers 1 through 11 n the F16 F26 range Next, name the
G4 Q14 range distances and enter the INDEX(d stances,F26,F16) formu a n ce G16. Th s formu a
determ nes the d stance between the ast c ty sted ( n F26) and the first c ty sted ( n F16) Enter the

336  Chapter 37  The trave ng sa esperson prob em


INDEX(D stances,F16,F17) formu a n ce G17 and copy t to the G18 G26 range In G17, the formu a
computes the d stance between the first and second c ty sted, the second and th rd c ty, and so on
Now you can compute the target ce (tota  d stance trave ed) n ce G27 w th the SUM(G16 G26)
formu a

At th s po nt, you’re ready to nvoke the Evo ut onary So ver M n m ze ce G27, c ck Add
Constraint, and se ect the F16 F26 range Se ect Dif for All Different Th s ensures that the So ver
a ways keeps the chang ng ce s n the se ected range, assum ng the va ues 1, 2, up to 11 Each va ue
w occur exact y once The So ver Parameters d a og box s shown n F gure 37-2 Before runn ng
So ver, ncrease the mutat on rate to 5

FIGURE 37-2  The So ver s set up for a trave ng sa esperson prob em.

The m n mum poss b e d stance to trave s 8,995 m es To see the order n wh ch the c t es are
v s ted, beg n n the row w th a 1 (correspond ng to W e’s home, Boston) and fo ow the c t es n
the sted sequence The c t es are v s ted n the fo ow ng order Boston–NY–P ttsburgh–Ch cago–
Denver–Seatt e–San Franc sco–Los Ange es–Phoen x–Da as–M am –Boston Many other sequences
for v s t ng the c t es a so y e d the m n mum tota trave d stance of 8,995 m es

The trave ng sa esperson prob em  Chapter 37   337


Problems
1. A sma job shop needs to schedu e s x jobs The due date and days needed to comp ete each
job are g ven n the fo ow ng tab e In what order shou d the jobs be schedu ed to m n m ze
the tota days the jobs are ate?

Job Processing time Due date (measured from today)


1 9 32
2 7 29
3 8 22
4 18 21
5 9 37
6 6 28

2. The Nbam es x sx fi e conta ns the d stance between a NBA arenas Suppose you ve n New
York and want to v s t each arena once and return to New York In what order shou d you v s t
the c t es to m n m ze tota d stance trave ed?

3. Suppose now that you ve n At anta and are dr v ng 29 genera managers on th s tr p to NBA
arenas Each genera manager wants to return to h s home Each t me you v s t an arena, you
drop off a genera manager at h s home arena In what order shou d you drop off the genera
managers to m n m ze the tota d stance trave ed by the genera managers?

4. In the W y Lowman prob em, suppose you must v s t New York mmed ate y after Denver
What s the so ut on to the prob em?

338  Chapter 37  The trave ng sa esperson prob em


CHAPTER 38

Importing data from a text file or


document

Question answered in this chapter:


■ How can I mport data from a text fi e nto Exce so that I can ana yze t?

Jeff Sagar n, the creator of the USA Today basketba and footba rat ngs, and I have deve oped a sys-
tem to rate NBA p ayers that severa NBA teams have used, nc ud ng the Da as Maver cks and New
York Kn cks Every day dur ng the season, Jeff’s FORTRAN program produces a mu t tude of nforma-
t on, nc ud ng rat ngs for each Da as Maver ck neup dur ng each game Jeff’s program produces
th s nformat on n the form of a text fi e In th s chapter, you see how you can mport a text fi e nto
M crosoft Exce to use t for data ana ys s

Answer to this chapter’s question


Th s sect on prov des the answer to the quest on that s sted at the beg nn ng of the chapter

How can I import data from a text file into Excel so that I can analyze it?

You w ke y often rece ve data n a M crosoft Word document or n a text ( txt) fi e that you need to
mport nto Exce for ana ys s To mport a Word document nto Exce , you shou d first save t as a text
fi e You can then use the Text Import W zard to mport the fi e W th the Text Import W zard, you can
break data n a text fi e nto co umns by us ng one of the fo ow ng approaches

■ If you choose the fixed-w dth opt on, Exce guesses where the data shou d be broken nto
co umns You can eas y mod fy the Exce assumpt ons

■ If you choose the de m ted opt on, you p ck de meter characters (common cho ces are a
comma, a space, or a p us s gn), and Exce breaks the data nto co umns wherever t encoun-
ters the character(s) you choose

As an examp e, the L neupsch38 docx fi e (a samp e of the data s shown n the fo ow ng b ock)
conta ns the ength of t me each neup p ayed for Da as n severa games dur ng the 2002–2003 sea-
son The fi e a so conta ns the rat ng of the neup For examp e, the first two nes te you that aga nst
Sacramento, the neup of Be , F n ey, LaFrentz, Nash, and Now tzk were on the court together for

339

9 05 m nutes and that the neup p ayed at a eve of 19 79 po nts (per 48 m nutes), worse than an
average NBA neup

Bell Finley LaFrentz Nash Nowitzki  - 19.79   695# 9.05m SAC DAL* Finley Nash
Nowitzki Van Exel Williams  - 11.63   695# 8.86m SAC DAL* Finley LaFrentz Nash Nowitzki
Van Exel  102.98 695# 4.44m SAC DAL* Bradley  Finley Nash Nowitzki Van Exel  - 44.26  
695# 4.38m SAC DAL* Bradley  Nash Nowitzki Van Exel Williams  9.71 695# 3.05m SAC DAL*
Bell Finley LaFrentz Nowitzki Van Exel - 121.50   695# 2.73m SAC DAL* Bell LaFrentz
Nowitzki Van Exel Williams 39.35 695# 2.70m SAC DAL* Bradley  Finley Nowitzki Van Exel
Williams 86.87 695# 2.45m SAC DAL* Bradley  Nash Van Exel Williams Rigaudeau - 54.55  
695# 2.32m SAC DAL*

You’d ke to mport th s neup nformat on nto Exce so that, for each neup, the fo ow ng nfor-
mat on wou d be sted n d fferent co umns

■ Each p ayer’s name

■ M nutes p ayed by the neup

■ Rat ng of the neup

The p ayer named Van Exe (fu name N ck Van Exe ) ra ses a prob em If you choose the de m ted
opt on and use a space character to break the data nto co umns, Van Exe w occupy two co umns
For neups that nc ude Van Exe , the numer ca data w be ocated n a d fferent co umn than the
co umn n wh ch the data s ocated for neups that don’t nc ude Van Exe To remedy th s prob em,
use the Rep ace command n Word to change each occurrence of Van Exe to Exe Now, when Exce
breaks up the data where a space occurs, Van Exe w requ re on y one co umn The first few rows of
your data now ook ke the fo ow ng

Bell Finley LaFrentz Nash Nowitzki  - 19.79  695# 9.05m SAC DAL* Finley Nash
Nowitzki Exel Williams  - 11.63  695# 8.86m SAC DAL* Finley LaFrentz Nash Nowitzki
Exel  102.98  69 5# 4.44m SAC DAL* Bradley  Finley Nash Nowitzki Exel  - 44.26  695#
4.38m SAC DAL* Bradley  Nash Nowitzki Exel Williams  9.71  69 5# 3.05m SAC DAL* Bell
Finley LaFrentz Nowitzki Exel - 121.50  695# 2.73m SAC DAL* Bell LaFrentz Nowitzki
Exel Williams 39.35  69 5# 2.70m SAC DAL* Bradley  Finley Nowitzki Exel Williams
86.87  69 5# 2.45m SAC DAL* Bradley  Nash Exel Williams Rigaudeau - 54.55  695# 2.32m
SAC DAL*

Of course, your approach wou d fa f another p ayer had the ast name Exe If that were the case,
you cou d rep ace Van Exe w th Exe 1

The tr ck to mport ng data from a Word or text fi e nto Exce s to use the Exce Text Import
W zard As ment oned ear er, you first need to save the Word fi e (L neupsch38 docx n th s examp e)
as a text fi e To do th s, open the fi e n Word, c ck the File tab, c ck Save As, and then se ect Plain
Text n the Save As Type st In the File Conversion d a og box, se ect Windows (Default) and then
c ck OK Your fi e shou d now be saved w th the L neupsch38 txt name C ose the Word document

In Exce , open the L neupsch38 txt fi e To see the text fi es n the Open w ndow, you need to
change the fi e type drop-down st ( ocated to the r ght of the F e name box) to Text Files When the
fi e opens, you see step 1 of the Text Import W zard, wh ch s shown n F gure 38-1

340  Chapter 38  mport ng data from a text fi e or document


FIGURE 38-1  Th s figure shows step 1 of the Text mport W zard.

C ear y, n th s case, you want to se ect Delimited and break the data at each space However,
s­ uppose you choose Fixed Width Then step 2 of the Text Import W zard appears, shown n
F gure 38-2 As you can see, you can create, move, or de ete a break po nt For many data mport
operat ons, chang ng co umn breaks can be a h t-or-m ss adventure

If you se ect De m ted n step 1, you see the second step of the Text Import W zard that’s shown
n F gure 38-3 Tab s se ected by defau t, and keep ng Tab se ected s recommended because many
Exce add- ns do not work proper y f Tab s c eared Se ect Space as the de m ter Se ect ng Treat
Consecutive Delimiters As One ensures that consecut ve spaces resu t n on y a s ng e co umn break

mport ng data from a text fi e or document  Chapter 38   341


FIGURE 38-2  Step 2 of the Text mport W zard appears after se ect ng F xed W dth.

FIGURE 38-3  Th s figure shows step 2 of the Text mport W zard after se ect ng De m ted.

342  Chapter 38  mport ng data from a text fi e or document


When you c ck Next, you’re sent to the th rd step n the w zard, wh ch s shown n F gure 38-4
You can configure the co umn data format for a se ected co umn By se ect ng General as the format,
you d rect Exce to treat numer ca data as numbers and other va ues as text

FIGURE 38-4  Th s figure shows step 3 of the w zard, n wh ch you can se ect a format to app y to the data you re
mport ng.

When you c ck Finish, the w zard mports the data nto Exce , as shown n F gure 38-5

FIGURE 38-5  Here s the Exce fi e w th neup nformat on.

mport ng data from a text fi e or document  Chapter 38   343


Each p ayer s sted n a separate co umn (co umns A–E); co umn F conta ns the rat ng of each
neup, co umn G conta ns the game number, co umn H conta ns the m nutes p ayed by each neup,
and co umns I and J st the two teams p ay ng n the game Of course, f you want, you cou d g oba y
rep ace Exe w th Van Exe , so the p ayer’s proper name was restored to the data

After sav ng the fi e as an Exce workbook ( x sx), you can use a the ana yt c capab t es of Exce
to ana yze the performance of Da as’s neups For examp e, you cou d ca cu ate the average perfor-
mance of the team when D rk Now tzk s on or off the court

Problems
1. The K ngs neups docx fi e conta ns performance rat ngs for some of the Sacramento K ngs
neups Import th s data nto Exce

2. In the examp e d scussed n the chapter, the t me each neup p ayed (co umn H) ends w th an
m Mod fy the fi e so that the t me p ayed by each neup s an actua number

344  Chapter 38  mport ng data from a text fi e or document


CHAPTER 39

Importing data from the Internet

Question answered in this chapter:


■ How can I eas y down oad sports stat st cs nto Exce ?

We a know that the Wor d W de Web conta ns usefu data on just about everyth ng However, you
can’t rea y do any sort of ana ys s of th s data wh e t’s on the web You need to mport the data nto
M crosoft Exce , wh ch you can do very eas y, prov d ng the data s defined ns de an HTML tab e In
an Exce workbook, on the Data tab, n the Get External Data group, c ck From Web When the
New Web Query d a og box appears, paste the URL of the webpage nto t and then c ck Go The
webpage appears n prev ew, and you can se ect the HTML tab e you want to mport The answer to
th s chapter’s quest on shows you how to mp ement th s s mp e procedure

Answer to this chapter’s question


Th s sect on prov des the answer to the quest on that s sted at the beg nn ng of the chapter

How can I easily download sports statistics into Excel?

The http://www.pro-football-reference.com/players/M/MannPe00/gamelog/ URL eads you to a game-


by-game og of Peyton Mann ng’s NFL stat st cs A subset of th s data mported nto Exce s shown n
F gure 39-1 Your work for th s examp e s n fi e Peyton x sx

To mport the data nto Exce , copy the URL and then open a b ank worksheet Now c ck the Data
tab on the r bbon and, n the Get External Data group, c ck From Web When the New Web Query
d a og box appears, press Ctr +V to paste the URL nto the address box and then c ck Go The New
Web Query d a og box d sp ays the data shown n F gure 39-2 (If you rece ve scr pt errors, c ck No to
d sm ss the warn ngs and stop runn ng scr pts It w not affect the mport process )

345

FIGURE 39-1  Th s figure shows Peyton Mann ng s game by game quarterback (QB) stat st cs.

FIGURE 39-2  Here s the New Web Query d a og box after choos ng a URL.

C ck the arrow that po nts to the data you want to down oad (choose to mport just Mann ng’s
regu ar season stat st cs) and Import (Each arrow represents an HTML tab e w th n the webpage )
In th s case, you wou d c ck the arrow above Rk The arrow changes to a check mark After c ck ng
Import, you see the Import Data d a og box, n wh ch you nd cate to Exce where you want to p ace
the data Choose ce B2 of the current worksheet for th s examp e After c ck ng OK, the ana ysts’ rat-
ngs are mported nto the worksheet (See F gure 39-1 ) Note that the numbers and abe s are beaut -
fu y separated nto d fferent ce s If you r ght-c ck w th n the data and se ect Refresh, Exce goes out

346  Chapter 39  mport ng data from the nternet


to the web and pu s the most recent data Therefore, f you c ck Refresh every Tuesday dur ng the
NFL season, Mann ng’s atest game stats w be added to your worksheet

You can eas y set your query to be refreshed or updated n any fash on you want Just r ght-c ck
anywhere n the query resu ts, se ect Data Range Properties, and change the Refresh Control set-
t ngs As shown n F gure 39-3, the query was spec fied to be automat ca y refreshed whenever the
fi e s opened

FIGURE 39-3  Refresh sett ngs for the web query.

To ed t th s query, r ght-c ck anywhere w th n the query output and se ect Edit Query By c ck ng
the Options button shown n the upper-r ght of F gure 39-2, you can contro the formatt ng of your
query resu ts

mport ng data from the nternet  Chapter 39   347


If you are us ng Internet Exp orer, you can a so create a web query from an HTML tab e by r ght-
c ck ng ns de the tab e and se ect ng Export To Microsoft Excel The data s automat ca y mported
nto a new workbook start ng n ce A1

Note  If you have Office 2013 Pro Plus or higher, you can download Microsoft Power Query
for Excel from http://office.microsoft.com/en-us/excel/download-microsoft-power-query-for
-excel-FX104018616.aspx. Power Query provides many superb tools for downloading data
from the web and makes it easy to manipulate the downloaded data. For example, you can
control the columns of data selected for download and filter rows.

Problems
1. From Basketba -Reference com, down oad the career stat st cs of your favor te p ayer nto
Exce

2. From Fangraphs com, down oad the career stat st cs of your favor te p ayer nto Exce

3. From Pro-footba -reference com (seasons page), down oad the 2012 game resu ts nto Exce

4. F nd the top moneymak ng mov es of a t me and down oad the r revenues nto Exce

5. From NFL com, down oad 2012 rush ng stat st cs

348  Chapter 39  mport ng data from the nternet


CHAPTER 40

Validating data

Questions answered in this chapter:


■ I’m enter ng scores from profess ona basketba games nto Exce I know that a team scores
from 50 to 200 po nts per game I once entered 1,000 po nts nstead of 100 po nts, wh ch
messed up my ana ys s Is there a way Exce can prevent me from mak ng th s type of error?

■ I’m enter ng the date and amount of my bus ness expenses for a new year Ear y n the year,
I often enter the prev ous year n the Date fie d by m stake Can I set up Exce to prevent me
from mak ng th s type of error?

■ I’m enter ng a ong st of numbers Can Exce warn me f I enter a nonnumer c va ue?

■ My ass stant needs to enter state abbrev at ons when she enters dozens and dozens of sa es
transact ons Can we set up a st of state abbrev at ons to m n m ze the chance that she’
enter an ncorrect abbrev at on?

A ot of our work often nvo ves m nd-numb ng data entry When you’re enter ng a ot of nforma-
t on n M crosoft Exce , t’s easy to make an error The data va dat on feature n Exce 2013 can great y
essen the chances that you’ comm t a cost y error To set up data va dat on, you beg n by se ect ng
the ce range that you want to app y data va dat on to Choose Data Validation on the Data tab
and then spec fy the cr ter a (as you’ see n th s chapter’s examp es) that Exce uses to flag any nva d
data that’s entered

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

I’m entering scores from professional basketball games into Excel. I know that a team scores
from 50 to 200 points per game. I once entered 1,000 points instead of 100 points, which
messed up my analysis. Is there a way Excel can prevent me from making this type of error?

Suppose that you’ enter the number of po nts scored by the home team n ce s A2 A11, and, you’
enter the number of po nts scored by the v s t ng team n ce s B2 B11 (You’ find the work to so ve
th s prob em n the Nbadv x sx fi e ) You want to ensure that each va ue entered n the A2 B11 range
s a who e number from 50 through 200

349

Beg n by se ect ng the A2 B11 range and then choose Data Validation on the Data tab Se ect the
Settings tab, se ect Whole Number from the Allow st, and then fi n the Data Validation d a og
box as shown n F gure 40-1

FIGURE 40-1  Use the Sett ngs tab n the Data Va dat on d a og box to set up data va dat on cr ter a.

The Exce defau t response to nva d data (ca ed an error alert) s a message stat ng, “The va ue
entered s not va d A user has restr cted va ues that can be entered nto the ce ” You can use the
Error Alert tab n the Data Validation d a og box (see F gure 40-2) to change the nature of the error
a ert, nc ud ng the con, the t t e for the message box, and the text of the message tse f

On the Input Message tab, you can create a prompt or a ert that nforms a user about the type of
data that can be safe y entered The message s d sp ayed as a too t p n the se ected ce For examp e,
you can enter an error a ert that states, “P ease enter a who e number between 50 and 200 ” After
typ ng a number that v o ates that cr ter on, say 34, n ce E5, you wou d then see the message shown
n F gure 40-3

350  Chapter 40  Va dat ng data


FIGURE 40-2  Th s figure shows Error A ert tab opt ons n the Data Va dat on d a og box.

FIGURE 40-3  Error a ert for the basketba data va dat on examp e.

I’m entering the date and amount of my business expenses for a new year. Early in the year,
I often enter the previous year in the date field by mistake. Can I set up Excel to prevent me
from making this type of error?

Suppose t s ear y n 2013, and you are enter ng the date n the A2 A20 ce range (See the
­Datedv­­x sx fi e ) Se ect the A2 A20 range and then choose Data Validation on the Data tab F n
the Settings tab of the Data Validation d a og box as shown n F gure 40-4 Then you w not be
a owed to enter any date ear er than 1/1/2013

Va dat ng data  Chapter 40   351


FIGURE 40-4  Use sett ngs such as these to ensure the va d ty of dates you enter.

If you enter a date n th s range that occurs ear er than January 1, 2013, you’ be warned about
the error For examp e, enter ng 1/15/2012 n ce A3 br ngs up the error a ert you define

I’m entering a long list of numbers. Can Excel warn me if I enter a nonnumeric value?

To un eash the fu power of data va dat on, you can use the Custom sett ngs When you se ect
Custom n the Allow st on the Settings tab of the Data Validation d a og box (see F gure 40-5),
you use a formu a to define va d data A formu a you enter for data va dat on works the same as a
formu a used for cond t ona formatt ng, wh ch s descr bed n Chapter 23, “Cond t ona formatt ng ”
You enter a formu a that s true f and on y f the content of the first ce n the se ected range s va d
When you c ck OK n the Data Validation d a og box, the formu a s cop ed to the va dat on formu a
of the rema n ng ce s n the range When you enter a va ue n a ce n the se ected range, Exce d s-
p ays an error a ert f the formu a you entered returns Fa se

To ustrate the use of the Custom sett ng, suppose that you want to ensure that each entry n the
B2 B20 ce range s a number (See the Numberdv x sx fi e ) The key to so v ng th s prob em s us ng
the Exce ISNUMBER funct on The ISNUMBER funct on returns True f the funct on refers to a ce that
conta ns numer c data The funct on returns Fa se f the funct on refers to a ce that conta ns a non-
numer c va ue To ensure that enter ng a nonnumer c entry n B2 B20 w create an error, proceed as
fo ows

W th the cursor n ce B2, se ect the B2 B20 ce range C ck the Data tab, c ck Data Validation n
the Data Tools group, and then fi n the Settings tab of the Data Validation d a og box as shown
n F gure 40-5

352  Chapter 40  Va dat ng data


FIGURE 40-5  Use the ISNUMBER funct on to ensure that the data n a range s numer c.

After c ck ng OK, you’ rece ve an error prompt f you try to enter any nonnumer c va ue n
B2 B20 For examp e, f you type John n ce B3, you rece ve an error a ert

If you c ck Data Va dat on wh e work ng n ce B3, the formu a shown n F gure 40-5 s d sp ayed
as =ISNUMBER(B3) Th s demonstrates that the formu a entered n ce B2 s cop ed n the correct
fash on Enter ng John n ce B3 causes =ISNUMBER(B3) to return Fa se, so you rece ve the error a ert

My assistant needs to enter state abbreviations when she enters dozens and dozens of sales
transactions. Can we set up a list of state abbreviations to minimize the chance that she’ll
enter an incorrect abbreviation?

The key to th s data va dat on prob em s to use the L st va dat on cr ter a Beg n by enter ng a st of
state abbrev at ons See the Statedv x sx fi e In th s examp e, use the I6 I55 range and name the range
abbrev Next, se ect the range n wh ch you’ enter state abbrev at ons (The examp e uses D5 D156 )
After c ck ng Data Validation on the Data tab, fi n the Data Validation d a og box as shown n
F gure 40-6

Now, whenever you se ect a ce n the D5 D156 range, c ck ng the drop-down arrow d sp ays a st
of state abbrev at ons, as shown n F gure 40-7 On y abbrev at ons that appear on the st are va d
va ues n th s range If you do not use the drop-down st and nstead type a state abbrev at on, you’
rece ve an error message f you enter an ncorrect abbrev at on (such as ALK for A aska)

Va dat ng data  Chapter 40   353


FIGURE 40-6  The Data Va dat on d a og box can be used to define a st of va d va ues.

FIGURE 40-7  Th s figure shows a drop down st of state abbrev at ons.

354  Chapter 40  Va dat ng data


Remarks
Fo ow ng s some more nformat on you w find usefu as you exp ore the ab t es of Exce to he p
you so ve prob ems and va date data

■ If you press F5, c ck Special n the Go To d a og box, and then se ect Data Validation, Exce
se ects a ce s w th data va dat on sett ngs You can a so use the Go To Special d a og box to
se ect a ce s conta n ng data va dat on

■ In vers ons of Exce pr or to Exce 2010, f you wanted to use a data va dat on drop-down st
based on a data source st n a d fferent worksheet, you needed to name the st (as th s chap-
ter’s examp e was) for the drop-down st to work S nce Exce 2010, th s m tat on has been
removed

■ If you use the dynam c-range techn que descr bed n Chapter 21, “The OFFSET funct on,”
changes you make (add ng or de et ng tems) to the data source st are automat ca y
reflected n the drop-down st (See Prob em 10 n th s chapter ) A so, f you name the data
source st as an Exce tab e (see Chapter 25, “Tab es”), changes n the data source are reflected
n the drop-down st as ong as you po nt to the st range and do not try to type the tab e
name

■ Suppose you want to use a drop-down st to se ect a company you se candy bars to You
want another drop-down st that you can use to se ect the st of candy bars you se at the
se ected store The prob em s that the same set of candy bars m ght not be so d at each store
How do you create such a nested (often referred to as a cascad ng se ect on) st se ect on?
Suppose the stores are Target and CVS; suppose you ass gn a range name of Target to the st
of candy bars so d at Target and a range name of CVS to the st of candy bars so d at CVS If
the drop-down st for store se ect on s n, for examp e, A20, you cou d create the appropr ate
drop-down st n ce B20 by c ck ng Data Validation and fi ng n the =INDIRECT(A20) for-
mu a for the st se ected As d scussed n Chapter 22, “The INDIRECT funct on,” f A20 conta ns
CVS, the st w key off the CVS range that conta ns a candy bars so d at CVS, and so on See
Prob em 11 n th s chapter

■ To c ear data va dat on from a range, se ect the range, choose Data Validation on the Data
tab, and then se ect Clear All

■ If you have a ong st, you probab y want to nvoke the Exce AutoComp ete feature If you
start the range for your drop-down st n the ce be ow the end of the st (no b ank ce s
a owed), AutoComp ete w work See the Fru t st x sx fi e

■ You can a so use data va dat on to set up cr ter a based on the ength of text n a ce (see
Prob em 4 n th s chapter) or the t me of day (see Prob em 15, a so n th s chapter)

Va dat ng data  Chapter 40   355


Problems
1. You are enter ng nonnegat ve who e numbers n the C1 C20 ce range Enter a data va dat on
sett ng that ensures that each entry s a nonnegat ve who e number

2. You are enter ng the dates of transact ons n the C1 C15 ce range that occurred dur ng Ju y
2004 Enter a data va dat on sett ng that ensures that each date entered occurs n Ju y 2004

3. W th the L st opt on n the group of data va dat on sett ngs, you can generate an error
message f a va ue that s not nc uded n a st s entered n the ce range you’re va dat ng
Suppose you’re enter ng emp oyee first names n the A1 A10 ce range The on y emp oyees
of the company are Jen, Greg, V v an, Jon, and John Use the L st opt on to ensure that no one
m sspe s a first name

4. W th the Text Length opt on n the group of data va dat on sett ngs, you can generate an
error a ert when the number of characters n a ce does not match the number you define
Use Text Length to ensure that each ce n the C1 C10 range w conta n at most five charac-
ters ( nc ud ng b anks)

5. You are enter ng emp oyee names n the A1 A10 ce range Use data va dat on to ensure
that no emp oyee’s name s entered more than tw ce (H nt Use the Custom sett ng and the
COUNTIF funct on )

6. You are enter ng product ID codes n the A1 A15 ce range Product ID codes must a ways end
w th the characters xyz Use data va dat on to ensure that each product ID code entered ends
w th xyz (H nt Use the Custom sett ng and the RIGHT funct on )

7. Suppose you want every entry n the B2 B15 ce range to conta n text and not a numer ca
va ue Use data va dat on to ensure that enter ng a numer ca va ue returns an error (H nt Use
the ISTEXT funct on )

8. Set up a data va dat on procedure that ensures that a numbers typed n co umn E w con-
ta n exact y two dec ma p aces (H nt Use the LEN and FIND funct ons )

9. The Lat tude x sx fi e conta ns a formu a to compute the d stance between two c t es, us ng
the r at tude and ong tude The fi e a so conta ns the at tude and ong tude of var ous US c t-
es Set up a drop-down st so that when you se ect a c ty n ce P2 and another c ty n ce Q2,
the d stance between the c t es s computed n Q10

10. Ensure that f new c t es are added to the st of c t es n Prob em 9, the drop-down st w
nc ude the new c t es

356  Chapter 40  Va dat ng data


11. The Candybardata x sx fi e conta ns a st of stores where you se candy bars The worksheet
a so conta ns the types of candy bars you se at each store and the pr ce charged for each
candy bar Set up your worksheet so that users can enter or se ect both the store and a candy
bar from a drop-down st and have the pr ce show up n D19

• Enab e users to se ect a store from the drop-down st n B19


• Set up a drop-down st n C13 to et users choose a type of candy bar from a st conta n-
ng on y those candy bars so d at a se ected store (H nt Use the INDIRECT funct on when
defin ng the st )

• If you change the store n B19, C19 m ght temporar y not st a candy bar so d at the new y
se ected store Ensure that n C19, your worksheet says Make Se ect on Above f th s s the
case For examp e, f B19 says CVS and C13 says Gumba s, C19 shou d say Make Se ect on
Above

12. You have a $100,000 expense budget In co umn A, you w enter expenses as they are
ncurred Set up a data va dat on cr ter on that ensures that the tota expenses sted n co -
umn E do not exceed your budget

13. Set up a data va dat on cr ter on that ensures that a co umn of numbers s entered n
descend ng order

14. Set up data va dat on cr ter a that ensure that a person can on y enter dates that are on
Monday through Fr day (H nt The WEEKDAY funct on returns a 1 for Sunday, a 2 for Monday,
and so on )

15. Set up data va dat on cr ter a that ensure that the t me entered n the A1 A20 ce range w
be a morn ng t me

Va dat ng data  Chapter 40   357


CHAPTER 41

Summarizing data by using


histograms

Questions answered in this chapter:


■ Peop e often say that a p cture s worth a thousand words Can I use Exce to create a p cture
(ca ed a h stogram) that summar zes the va ues n a data set?

■ What are some common shapes of h stograms?

■ What can I earn by compar ng h stograms from d fferent data sets?

The ab ty to summar ze a arge data set s mportant The three too s used most often to summar ze
data n M crosoft Exce are histograms, descriptive statistics, and PivotTables Th s chapter d scusses the
use of h stograms for summar z ng data It covers descr pt ve stat st cs n Chapter 42, “Summar z ng
data by us ng descr pt ve stat st cs,” and P votTab es n Chapter 43, “Us ng P votTab es and s cers to
descr be data ”

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

People often say that a picture is worth a thousand words. Can I use Excel to create a picture
(called a histogram) that summarizes the values in a data set?

A h stogram s a common y used too to summar ze data Essent a y, a h stogram te s you how many
observat ons (another term for data points) fa n var ous ranges of va ues For examp e, a h stogram
created from month y C sco stock returns m ght show how many month y returns C sco had from
0 percent through 10 percent, 11 percent through 20 percent, and so on The ranges n wh ch you
group data are referred to as bin ranges

Look at how to construct and nterpret h stograms that summar ze the va ues of month y returns
for C sco and GM stock n years 1990–2000 You’ find th s data (and returns for other stocks) n the
Stock x sx fi e F gure 41-1 shows a subset of the data ( n the Stockpr ces worksheet) Dur ng March
1990, for examp e, C sco stock ncreased n va ue by 1 1 percent

359

FIGURE 41-1  Th s figure shows month y stock returns.

When construct ng h stograms w th Exce , you can et Exce define the b n ranges, or you can
define the b n ranges yourse f If Exce defines the b n ranges, you cou d end up w th we rd- ook ng
b n ranges, such as –12 53 percent to 4 52 percent For th s reason, you m ght prefer to define the
ranges yourse f

A good way to start defin ng b n ranges for a h stogram (you can th nk of defin ng b n ranges as
sett ng boundar es) s to d v de the range of va ues (between the sma est and argest) nto 8 to 15
equa y spaced categor es A the month y returns for C sco are from –30 percent through 40 percent,
so choose b n range boundar es of –30 percent, –20 percent, –10 percent, 0 percent, and so on up to
40 percent

To create b n ranges, enter CSCO, 4, 3, 2, … , – 2, – 3 (the boundar es of the b n ranges) n ce s


H54 H62 Next, on the Data tab on the r bbon, n the Analysis group, c ck Data Analysis to open
the Data Analysis d a og box; t sts the funct ons of the Ana ys s Too Pak, wh ch conta ns many of
the stat st ca capab t es n Exce

360  Chapter 41  Summar z ng data by us ng h stograms


Note  If the Data Analysis command doesn’t appear on the Data tab, click the File tab,
choose Options, and then select Add-Ins. In the Manage box, click Excel Add-Ins and
then click Go. In the Add-Ins dialog box, select Analysis ToolPak (the first choice, not
Analysis ToolPak VBA) and then click OK. Now you can access the Analysis ToolPak func-
tions by clicking Data Analysis in the Analysis group on the Data tab.

By c ck ng Histogram n the Data Analysis d a og box, you open the Histogram d a og box (w th
a nputs b ank) shown n F gure 41-2

FIGURE 41-2  Th s s the H stogram d a og box for the C sco h stogram.

Here’s how to fi n the d a og box as t’s shown n F gure 41-2

■ Se ect the nput range (F51 F181) (To se ect the F51 F181 range, you can se ect ce F51 and
then press Ctr +Sh ft+down arrow Th s takes you to the bottom of the co umn ) Th s range
nc udes a the data you want to use to create the h stogram Inc ude the CSCO abe from ce
F51 because when you do not nc ude a abe n the first row, the x-ax s of the h stogram s
often abe ed w th a number, wh ch can be confus ng

■ The b n range (H54 H62) nc udes the boundar es of the b n ranges Exce creates b ns of
–30 percent through –20 percent, –20 percent through –10 percent, and so on up to 30–40
percent

■ Se ect Labels because the first rows of both the b n range and the nput range conta n abe s

Summar z ng data by us ng h stograms  Chapter 41   361


■ Choose to create the h stogram n a new worksheet (name t histo)

■ Se ect Chart Output, or Exce w not create a h stogram

C ck OK n the Histogram d a og box The C sco h stogram w ook ke the one shown n
F gure 41-3

FIGURE 41-3  Th s C sco h stogram was created by us ng an Exce Analysis ToolPak funct on.

When you create the h stogram, you’ see gaps between the bars To remove these gaps, r ght-
c ck any bar on the graph and choose Format Data Series In the Format Data Series pane, drag
Gap Width to 0% You m ght a so see that a abe does not appear for each bar If a the abe s do
not appear, se ect the graph and drag any hand e that has two arrows to w den the graph You can
a so reduce the font s ze to make a abe appear To reduce the font s ze, r ght-c ck the graph ax s and
then r ght-c ck Font Change the font s ze to 5 You can a so change the t t e of the chart by se ect-
ng the text and enter ng the t t e you want After you make some of these changes, the h stogram
appears as t’s shown n F gure 41-4

FIGURE 41-4  You can change the format of d fferent e ements n the chart.

362  Chapter 41  Summar z ng data by us ng h stograms


Not ce that C sco returns are most ke y between 0 and 10 percent per month, and the he ght of
the bars drops off as the graph moves away from the ta est bar When you create the h stogram, you
a so obta n the b n-range frequency summary shown n F gure 41-5

FIGURE 41-5  These are C sco b n range frequenc es.

From the b n-range frequenc es, you can earn, for examp e, that for two months, C sco’s return
was greater than –30 percent and ess than or equa to –20 percent; for 13 months, the month y
return was greater than –20 percent and ess than or equa to –10 percent

What are some common shapes of histograms?

For most data sets, a h stogram created from the data w be c ass fied as one of the fo ow ng

■ Symmetr c

■ Skewed r ght (pos t ve y skewed)

■ Skewed eft (negat ve y skewed)

■ Mu t p e peaks

The fo ow ng st ooks at each type n more deta See the Skewexamp es x sx fi e

■ Symmetric distribution  A h stogram s symmetr c f t has a s ng e peak and ooks approx -


mate y the same to the eft of the peak as to the r ght of the peak Test scores (such as IQ
tests) are often symmetr c For examp e, the h stograms of IQs (see ce W42) m ght ook ke
F gure 41-6 Not ce that the he ght of the bars one bar away from the peak bar are approx -
mate y the same, the he ght of the bars two bars away from the peak bar are approx mate y
the same, and so on The bar abe ed 105 represents a peop e w th an IQ greater than 95 and
ess than or equa to 105, the bar abe ed 65 represents a peop e hav ng an IQ ess than or
equa to 65, and so on A so note that C sco month y returns are approx mate y symmetr c

Summar z ng data by us ng h stograms  Chapter 41   363


FIGURE 41-6  Th s s a symmetr c h stogram.

■ Skewed right (positively skewed)  A h stogram s skewed r ght (pos t ve y skewed) f t has
a s ng e peak and the va ues of the data set extend much farther to the r ght of the peak than
to the eft of the peak Many econom c data sets (such as fam y or nd v dua ncome) exh b t
a pos t ve skew F gure 41-7 (see ce T24) shows an examp e of a pos t ve y skewed h stogram
created from a samp e of fam y ncomes

FIGURE 41-7  A pos t ve y skewed h stogram was created from data about fam y ncome.

■ Skewed left (negatively skewed)  A h stogram s skewed eft (negat ve y skewed) f t has
a s ng e peak and the va ues of the data set extend much farther to the eft of the peak than
to the r ght of the peak Days from concept on to b rth are negat ve y skewed An examp e
s shown n ce Q7 of F gure 41-8 The he ght of each bar represents the number of women
whose t me from concept on to b rth fe n the g ven b n range For examp e, two women
gave b rth fewer than 180 days after concept on

364  Chapter 41  Summar z ng data by us ng h stograms


FIGURE 41-8  Th s s a negat ve y skewed h stogram of data p ott ng days from concept on to b rth.

■ Multiple peaks  When a h stogram exh b ts mu t p e peaks, t usua y means that data from
two or more popu at ons are be ng graphed together For examp e, suppose the d ameter of
e evator ra s produced by two mach nes y e ds the h stogram shown n F gure 41-9 See ce
Q11 of the Tw npeaks x sx fi e

FIGURE 41-9  Th s s a mu t p e peak h stogram.

In th s h stogram, the data c usters nto two groups In a ke hood, each group of data corre-
sponds to the e evator ra s produced by one of the mach nes If you assume that the d ameter
you want for an e evator ra s 55 nches, you can conc ude that one mach ne s produc ng
e evator ra s that are too narrow, whereas the other mach ne s produc ng e evator ra s that
are too w de You shou d fo ow up w th your nterpretat on of th s h stogram by construct ng
a h stogram chart ng the e evator ra s produced by each mach ne Th s examp e shows why
h stograms are a powerfu too n qua ty contro

Summar z ng data by us ng h stograms  Chapter 41   365


What can I learn by comparing histograms from different data sets?

Ana ysts are often asked to compare d fferent data sets For examp e, you m ght be asked how the
month y returns on GM and C sco stock d ffer To answer a quest on such as th s, you can construct a
h stogram for GM by us ng the same b n ranges as for C sco and then p ace one h stogram above the
other, as shown n F gure 41-10 See the H stograms worksheet n the Stock x sx fi e

FIGURE 41-10  Th s figure shows the use of h stograms that nc ude the same b n ranges to compare d fferent
data sets.

By compar ng these two h stograms, you can draw two mportant conc us ons

■ Typ ca y, C sco performed better than GM You know th s because the h ghest bar for C sco s
one bar to the r ght of the h ghest bar for GM A so, the C sco bars extend farther to the r ght
than the GM bars

■ C sco had more var ab ty, or spread about the mean, than GM Note that GM’s peak bar con-
ta ns 59 months, whereas C sco’s peak bar conta ns on y 41 months Th s shows that for C sco,
more of the returns are outs de the b n that represents the most ke y C sco return C sco
returns are more spread out than GM returns

In Chapter 42, you ook at more deta s about the d fferences between the month y returns on
C sco and GM

366  Chapter 41  Summar z ng data by us ng h stograms


Problems
1. Use the data n Stock x sx to construct h stograms for month y returns for GE and Inte

2. Use the data n H stor ca nvest2009 x sx to create h stograms for annua returns on stocks and
bonds Then compare the annua returns on these stocks and bonds

3. You are g ven ( n the Dem ng x sx fi e) the measured d ameter ( n nches) for 500 rods pro-
duced by Rodco, as reported by the product on foreman A rod s cons dered acceptab e f
t s at east 1 nch n d ameter In the past, the d ameter of the rods produced by Rodco has
fo owed a symmetr c h stogram

• Construct a h stogram of these measurements


• Comment on any unusua aspects of the h stogram
Can you guess what m ght have caused any unusua aspects of the h stogram? (H nt  One of
qua ty-guru Edwards Dem ng’s 14 po nts s to “Dr ve out fear ”)

4. The Unemp oyment x sx fi e conta ns month y US unemp oyment rates Create a h stogram
Are unemp oyment rates symmetr c or skewed?

5. The Teams x sx fi e conta ns runs scored by Major League Baseba teams dur ng a season
Create a h stogram Are runs scored symmetr c or skewed?

6. The NFLpo nts x sx fi e conta ns po nts scored by NFL teams dur ng a season Create a h sto-
gram Are po nts scored symmetr c or skewed?

Summar z ng data by us ng h stograms  Chapter 41   367


CHAPTER 42

Summarizing data by using


descriptive statistics

Questions answered in this chapter:


■ What defines a typ ca va ue for a data set?

■ How can I measure how much a data set spreads from ts typ ca va ue?

■ Together, what do the mean and standard dev at on of a data set te me about the data?

■ How can I use descr pt ve stat st cs to compare data sets?

■ For a g ven data po nt, can I eas y find ts percent e rank ng w th n the data set? For examp e,
how can I find the n net eth percent e of a data set?

■ How can I eas y find the second argest or second sma est number n a data set?

■ How can I rank numbers n a data set?

■ What s the tr mmed mean of a data set?

■ When I se ect a range of ce s, s there an easy way to get a var ety of stat st cs that descr be
the data n those ce s?

■ Why do financ a ana ysts often use the geometr c mean to summar ze the average return on
a stock?

Chapter 41, “Summar z ng data by us ng h stograms,” showed how you can descr be data sets by
us ng h stograms In th s chapter, you see how to descr be a data set by us ng part cu ar character st cs
of the data such as the mean, med an, standard dev at on, and var ance—measures that M crosoft
Exce 2013 groups as descriptive statistics You can obta n the descr pt ve stat st cs for a set of data
by c ck ng Data Analysis n the Analysis group on the Data tab and then se ect ng Descriptive
Statistics After you enter the re evant data and c ck OK, a the descr pt ve stat st cs of your data are
d sp ayed If you do not see Data Analysis on the Data tab, nsta the Data Analysis add- n by fo -
ow ng the nstruct ons g ven n Chapter 41

369

Answers to this chapter’s questions
Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

What defines a typical value for a data set?

To ustrate the use of descr pt ve stat st cs, return to the C sco and GM month y stock return data
n the Stock x sx fi e To create a set of descr pt ve stat st cs for th s data, c ck Data Analysis on the
Analysis tab and then se ect Descriptive Statistics F n the Descriptive Statistics d a og box as
shown n F gure 42-1

FIGURE 42-1  Th s figure shows the Descr pt ve Stat st cs d a og box.

The nput range s the month y C sco and GM returns, ocated n the E51 F181 range ( nc ud ng the
abe s n row 51) The rema nder of the Descr pt ve Stat st cs d a og box has been fi ed n as shown n
F gure 42-1 for the fo ow ng reasons

■ Co umns was se ected n the Grouped By opt ons because each data set s sted n a d fferent
co umn

■ Labe s In F rst Row was se ected because the first row of the data range conta ns abe s and
not data

370  Chapter 42  Summar z ng data by us ng descr pt ve stat st cs


■ Ce I53 of the current worksheet was se ected as the first ce n the output range

■ Summary Stat st cs was se ected to ensure that the most common y used descr pt ve stat st cs
measures for both GM and C sco month y returns were d sp ayed

When you c ck OK, Exce ca cu ates the descr pt ve stat st cs, as shown n F gure 42-2

FIGURE 42-2  Th s figure shows the descr pt ve stat st cs resu ts for C sco and GM stocks.

Now, nterpret the descr pt ve stat st cs that define a typ ca va ue (or a centra ocat on) for C sco’s
month y stock returns The Descr pt ve Stat st cs output conta ns three measures of centra ocat on
mean (or average), med an, and mode

■ Mean The mean of a data set s wr tten as x and s s mp y the average of a observat ons n
the samp e If the data va ues were x 1, x 2, … ,xn the fo ow ng equat on ca cu ates the mean

1

i n

x= xi
n i 1

Here, n equa s the number of observat ons n the samp e, and xi s the ith observat on n the
samp e You find that C sco’s mean month y return s 5 6 percent per month

It s a ways true that the sum of the dev at ons of a va ues from the mean equa s 0 Thus,
you can th nk of a data set’s mean as a ba anc ng po nt for the data Of course, w thout us ng
the Descr pt ve Stat st cs opt on, you can obta n a samp e’s mean n Exce by app y ng the
AVERAGE funct on to the appropr ate ce range

Summar z ng data by us ng descr pt ve stat st cs  Chapter 42   371


■ Median The med an of a samp e s the m dd e observat on when the data s sted from
sma est to argest If a samp e conta ns an odd number of observat ons, the med an s the
observat on that has as many observat ons be ow t as above t Thus, for a samp e of n ne,
the med an wou d be the fifth sma est (or fifth argest) observat on When a samp e nc udes
an even number of observat ons, you can s mp y average the two m dd e observat ons
Essent a y, the med an s the fift eth percent e of the data For examp e, the med an month y
return on C sco s 5 percent You cou d a so obta n th s nformat on by us ng the MEDIAN
funct on

■ Mode The mode s the most frequent y occurr ng va ue n the samp e If no va ue occurs


more than once, the mode does not ex st For GM, no month y return occurred more than
once for years 1990–2000, so the mode does not ex st For C sco, the mode was approx mate y
5 14 percent In vers ons of Exce pr or to Exce 2010, you cou d a so use the MODE funct on to
compute the mode If no data va ue occurred more than once, the MODE funct on returned
#NA

The prob em s that a data set can have more than one mode, and the MODE funct on s mp y
returned the first mode t found For th s reason, Exce 2010 ntroduced two funct ons MODE.
SNGL and MODE.MULT (See the fi e Modefunct ons x sx )

MODE.SNGL performs exact y as the MODE funct on performed n ear er Exce vers ons
Ear er vers ons of Exce , however, do not recogn ze the MODE.SNGL funct on

MODE.MULT s an array funct on You’ earn more about array funct ons n Chapter 87, “Array
funct ons and formu as ” To use the MODE.MULT funct on (or any other array funct on) you
must first se ect the range of ce s where the funct on w return va ues Next, enter the func-
t on or formu a F na y, do not just press Enter; you must ho d down the Ctr key fo owed by
the Sh ft key and then press Enter The prob em w th the MODE.MULT funct on s that you do
not know n advance how many modes a data set has, so you do not know the correct s ze of
the range that you need to se ect

The Modefunct ons x sx fi e (see F gure 42-3) shows the use of a three funct ons nvo v ng
modes

372  Chapter 42  Summar z ng data by us ng descr pt ve stat st cs


FIGURE 42-3  Th s figure shows examp es of Exce MODE funct ons.

The mode s rare y used as a measure of centra ocat on It s nterest ng to note, however,
that for a symmetr c data set, the mean, med an, and mode are equa

A natura quest on s whether the mean or med an s a better measure of centra ocat on
Essent a y, the mean s the best measure of centra ocat on f the data set does not exh b t an
excess ve skew Otherw se, you shou d use the med an as the measure of centra ocat on If a
data set s h gh y skewed, extreme va ues d stort the mean In th s case, the med an s a better
measure of a typ ca data set va ue For examp e, the US government reports med an fam y
ncome nstead of mean fam y ncome because fam y ncome s h gh y pos t ve y skewed

The skewness measure the Descr pt ve Stat st cs output reports nd cates whether a data set s
h gh y skewed

• A skew greater than +1 nd cates a h gh degree of pos t ve skew


• A skew ess than –1 nd cates a h gh degree of negat ve skew
• A skew between –1 and +1, nc us ve, nd cates a re at ve y symmetr c data set
Thus, month y returns of GM and C sco exh b t a s ght degree of pos t ve skewness Because
the skewness measure for each data set s ess than +1, the mean s a better measure of a
typ ca return than the med an You can a so use the SKEW funct on to compute the skew of a
data set

Summar z ng data by us ng descr pt ve stat st cs  Chapter 42   373


■ Kurtosis  Kurtos s, wh ch sounds ke a d sease, s not a very mportant measure Kurtos s near
0 means a data set exh b ts peakedness c ose to the norma (or standard be -shaped) curve
(The norma curve s d scussed n Chapter 69, “The norma random var ab e ”) Pos t ve kurto-
s s means that a data set s more peaked than a norma random var ab e, whereas negat ve
kurtos s means that data s ess peaked than a norma random var ab e GM month y returns
are more peaked than a norma curve, whereas C sco month y returns are ess peaked than a
norma curve

How can I measure how much a data set spreads from its typical value?

Cons der two nvestments that each y e d an average of 20 percent per year Before dec d ng wh ch
nvestment you prefer, you’d ke to know about the spread, or r sk ness, of the nvestment The most
mportant measures of the spread (or d spers on) of a data set from ts mean are samp e var ance,
samp e standard dev at on, and range

■ Sample variance and sample standard deviation  The samp e var ance s2 s defined by the
fo ow ng formu a
i n

s = 21
n–1
∑ (x –x) i
2

i 1

You can th nk of the samp e var ance as the average squared dev at on of the data from ts
mean Intu t ve y, t seems that you shou d d v de by n to compute a true average squared
dev at on, but for techn ca reasons, you need to d v de by n – 1

D v d ng the sum of the squared dev at ons by n – 1 ensures that the samp e var ance s an
unb ased measure of the true var ance of the popu at on from wh ch the samp ed data s
drawn

The samp e standard dev at on s s just the square root of s2

Here s an examp e of these computat ons for the three numbers 1, 3, and 5
1
s2 [(1 3 )2 + ( 3 3 )2 + ( 5 3 )2 ] 4
3 1

You find that

s 4 2
In the stock examp e, the samp e standard dev at on of month y returns for C sco s 12 2 per-
cent w th a samp e var ance of 0 015%2 Natura y, %2 s hard to nterpret, so you usua y ook
at the samp e standard dev at on For GM, the samp e standard dev at on s 8 97 percent

374  Chapter 42  Summar z ng data by us ng descr pt ve stat st cs


In prev ous vers ons of Exce , the samp e var ance of a data set was computed w th the VAR
funct on, and the samp e standard dev at on was computed w th the STDEV funct on You
can st use these funct ons n Exce 2010, but Exce 2010 has added the equ va ent func-
t ons, VAR.S and STDEV.S (The S stands for sample ) The new funct ons, VAR.P and STDEV.P,
compute the popu at on var ance and popu at on standard dev at on To compute a popu a-
t on var ance or standard dev at on, s mp y rep ace n – 1 n the denom nator of the defin t on
of s2 by n

■ Range The range of a data set s the argest number n the data set m nus the sma est num-
ber Here, the range n the month y C sco returns s equa to 54 percent, and the range for GM
month y returns s 52 percent

Together, what do the mean and standard deviation of a data set tell me about the data?

Assum ng that a h stogram can be descr bed by a symmetr c h stogram, the ru e of thumb says the
fo ow ng

■ Approx mate y 68 percent of a observat ons are between x – s and x + s

■ Approx mate y 95 percent of a observat ons are between x – 2s and x + 2s

■ Approx mate y 99 7 percent of a observat ons are between x – 3s and x + 3s

In Chapter 69, you w see that the 68 percent, 95 percent and 99 7 percent are der ved from the
Gauss an, or norma random var ab e

For examp e, you wou d expect that approx mate y 95 percent of a C sco month y returns are
from –19 percent through 30 percent, as shown here

Mean – 2s .056 – 2 × (.122) –19% and Mean + 2s .056 + 2 × (.122) 30%

Any observat on more than two standard dev at ons away from the mean s ca ed an outlier For
the C sco data, 9 of 130 observat ons (or rough y 7 percent of a returns) are out ers In genera , the
ru e of thumb s ess accurate for h gh y skewed data sets but s usua y very accurate for re at ve y
symmetr c data sets, even f the data does not come from a norma popu at on

Many va uab e ns ghts can be obta ned by find ng causes of out ers Compan es shou d try to
ensure that the causes of good out ers occur more frequent y and the causes of bad out ers occur
ess frequent y

Using conditional formatting to highlight outliers


You’ find that t s often usefu to h gh ght a out ers n a data set An examp e s shown n
F gure 42-4 (See the Stockpr ces worksheet n the Stock x sx fi e )

Summar z ng data by us ng descr pt ve stat st cs  Chapter 42   375


FIGURE 42-4  Out ers for C sco are h gh ghted w th cond t ona formatt ng.

For examp e, to h gh ght the out ers for the C sco data, you first compute the ower cutoff for
an out er (mean – 2s) n ce J69 and the upper cutoff for an out er (mean + 2s) n ce J70 Next,
se ect the ent re range of C sco returns (ce s F52 F181) Then, at the first ce n the (F52) range, se ect
Conditional Formatting on the Home tab and se ect New Rule In the Edit Formatting Rule d a og
box, se ect Use A Formula To Determine Which Cells To Format and then fi n the rest of the
d a og box as shown n F gure 42-5

Th s cond t on ensures that f ce F52 s more than 2s above or be ow the mean month y C sco
return, the format you se ect (a red font co or n th s case) w be app ed to ce F52 Th s formatt ng
cond t on s automat ca y cop ed to the se ected range, and a out ers show up n red

376  Chapter 42  Summar z ng data by us ng descr pt ve stat st cs


FIGURE 42-5  Th s figure shows the cond t ona formatt ng ru es to se ect out ers, as shown n the Ed t Formatt ng
Ru e d a og box.

How can I use descriptive statistics to compare data sets?

You can use descr pt ve stat st cs to summar ze the d fferences between data sets, for examp e,
between C sco and GM month y returns Look ng at the shape and the measures and spread of a typ -
ca va ue, you can conc ude the fo ow ng

■ Typ ca y ( ook ng at e ther the mean or the med an), C sco month y returns are h gher than
GM

■ C sco month y returns are more var ab e ( ook ng at standard dev at on, var ance, and range)
than month y GM returns

■ Both C sco and GM month y returns exh b t s ght y pos t ve skews GM month y returns are
more peaked than a norma curve, whereas C sco month y returns are ess peaked than a
norma curve

For a given data point, can I easily find its percentile ranking within the data set? For example,
how can I find the ninetieth percentile of a data set?

Before Exce 2010, the PERCENTILE and PERCENTRANK funct ons were usefu when you wanted to
determ ne an observat on’s re at ve pos t on n a data set Four new re ated funct ons were added n
Exce 2010 PERCENTILE.INC, PERCENTILE.EXC, PERCENTRANK.INC, and PERCENTRANK.EXC The

Summar z ng data by us ng descr pt ve stat st cs  Chapter 42   377


PERCENTILE.INC and PERCENTRANK.INC funct ons g ve resu ts dent ca to the o d PERCENTILE and
PERCENTRANK funct ons Note that prev ous vers ons of Exce do not recogn ze these new funct ons
Examp es of how a these funct ons work are n the Percent e x sx fi e, shown n F gure 42-6

FIGURE 42-6  Th s figure shows examp es of PERCENTILE and PERCENTRANK funct ons. 

The PERCENTILE, PERCENTILE.INC, and PERCENTILE.EXC funct ons return the percent e of a
data set that you spec fy The syntax of these funct ons s of the PERCENTILE INC(data,k) form, wh ch
returns the kth percent e of the nformat on n the ce range spec fied by data

Cons der a data set cons st ng of n p eces of data The o d PERCENTILE and the new PERCENTILE.
INC funct ons returned the pth percent e (0<p<1) as the 1 + (n – 1)p ranked tem n the data set
For examp e, n H13, the PERCENTILE INC(C4 C18,F13) formu a computes the n net eth percent e of
the data n C4 C18 as 1 + (15 – 1) 9, wh ch equa s the 13 6 ranked tem That s, assum ng the data s
sorted n ascend ng order, Exce computes a number 60 percent of the way between the th rteenth
data po nt (130) and the fourteenth data po nt (140) Th s y e ds 136

378  Chapter 42  Summar z ng data by us ng descr pt ve stat st cs


The PERCENTILE.EXC funct on computes the kth percent e as the (n + 1)p ranked tem n the data
set PERCENTILE.EXC computes the n net eth percent e of the data as (15 + 1)( 9), wh ch s the 14 4
ranked tem That s, the n net eth percent e (assum ng aga n data s sorted n ascend ng order) s
computed to be 40 percent of the way between the fourteenth data po nt (140) and the fifteenth
data po nt (300) Th s y e ds ( 60)(140) + ( 40)(300) = 204 You can see that the two funct ons return
drast ca y d fferent answers If you cons der the data to have been drawn by samp ng from a arge
set of data, you m ght assume that g ven the data you’ve seen, there s much more than a 10 percent
chance that a p ece of data wou d be more than 136 After a , two of the 15 data po nts are more
than 130, so t does not seem reasonab e to say that the n net eth percent e of the data s on y 136
Therefore, say ng the n net eth percent e s 204 seems more reasonab e Us ng the .EXC funct on
nstead of the .INC funct on s strong y recommended Note that the .EXC funct on does not compute
a percent e for 0 and 1 The .EXC stands for the fact that the PERCENTILE.EXC funct on exc udes the
zero and one hundredth percent es

The PERCENTRANK, PERCENTRANK.INC, and PERCENTRANK.EXC funct ons return the rank ng of
an observat on re at ve to a va ues n a data set The syntax of the PERCENTRANK.EXC funct on, for
examp e, s PERCENTRANK EXC(data,value) The PERCENTRANK and PERCENTRANK.INC funct ons
both ca cu ate the percent e rank of the kth sma est number n the data set as (k – 1)/(n-1) Thus, as
shown n ce E4, the PERCENTILE or PERCENTILE.INC funct on y e ds a rank of 0 for 10 because k = 1
for th s data po nt The PERCENTRANK.EXC funct on computes the rank of the kth sma est data po nt
as k/(n + 1) In ce D4, the PERCENTRANK.EXC funct on returns a rank of 1/16 = 0625 A percent e
rank ng of 6 25 percent seems more rea st c than a rank ng of 0 percent because there s tt e reason
to th nk that a va ue of 10 s the sma est data po nt n a arger data set from wh ch th s data was
samp ed

Note The PERCENTILE and PERCENTRANK functions are easily confused. To simplify,


PERCENTILE yields a value of the data, whereas PERCENTRANK yields a percentage.

How can I easily find the second largest or second smallest number in a data set?

The =LARGE(range,k) formu a returns the kth argest number n a ce range The =SMALL(range,k)
formu a returns the kth sma est number n a ce range For examp e, n the Tr mmean x sx fi e, n ce
F1, the =LARGE(C4 C62,2) formu a returns the second argest number n the C4 C62 (99) ce range,
whereas n ce F2, the =SMALL(C4 C62,2) formu a returns the second sma est number n the C4 C62
(80) ce range (See F gure 42-7 )

Summar z ng data by us ng descr pt ve stat st cs  Chapter 42   379


FIGURE 42-7  Th s figure shows examp es of the LARGE and SMALL funct ons, the RANK and RANK.AVG funct ons,
and tr mmed mean.

How can I rank numbers in a data set?

In prev ous vers ons of Exce , you used the RANK funct on to rank numbers n a data set The syn-
tax of the RANK funct on s RANK(number,array,0) Exce 2010 ntroduced a funct on, RANK.EQ, that
returns resu ts dent ca to the RANK funct on Th s formu a y e ds the rank of a number n a g ven
array, where the argest number n the array s ass gned rank 1, the second argest number s rank 2,
and so on The RANK(number,array,1) or RANK EQ(number,array,1) syntax resu ts n ass gn ng a rank
of 1 to the sma est number n the array, a rank of 2 to the second sma est number, and so on In the
Tr mmean x sx fi e (see F gure 42-7), copy ng the RANK EQ(C4,$C$4,$C$62,0) formu a from ce D4
to D5 D62 returns the rank of each test score For examp e, the score of 100 n ce C7 s the h ghest
score, whereas the scores of 98 n ce s C21 and C22 t ed for th rd h ghest Note that the RANK func-
t on returned a 3 for both scores of 98

The Exce RANK.AVG funct on has the same syntax as the other RANK funct ons, but n the case of
t es, RANK.AVG returns the average rank for a t ed data po nts For examp e, because the two scores
of 98 ranked th rd and fourth, RANK.AVG returns 3 5 for each The average ranks were generated by
copy ng the RANK AVG(C4,$C$4 $C$62,0) formu a from E4 to E5 E62

What is the trimmed mean of a data set?

Extreme skewness n a data set can d stort the mean of the data set In these s tuat ons, peop e usua y
use med an as a measure of the data set’s typ ca va ue The med an, however, s unaffected by many
changes n the data For examp e, compare the fo ow ng two data sets

Set 1: –5, –3, 0, 1, 3, 5, 7, 9, 11, 13, 15

380  Chapter 42  Summar z ng data by us ng descr pt ve stat st cs


Set 2: –20, –18, –15, –10, –8, 5, 6, 7, 8, 9, 10

These data sets have the same med an (5), but the second data set shou d have a ower typ -
ca va ue than the first The Exce TRIMMEAN funct on s ess d storted by extreme va ues than
the AVERAGE funct on, but t s more nfluenced by extreme va ues than the med an The
=TRIMMEAN(range,percent) formu a computes the mean of a data set after de et ng the data
po nts at the top percent d v ded by 2 and bottom percent d v ded by 2 Before Exce determ nes
the number of data po nts to remove, t rounds down the number of exc uded po nts to the nearest
mu t p e of 2 For examp e, app y ng the TRIMMEAN funct on w th percent=10% converts the mean
after de et ng the top 5 percent and bottom 5 percent of the data In ce F3 of the Tr mmean x sx
fi e, the =TRIMMEAN(C4 C62, 10) formu a computes the mean of the scores n C4 C62 after de et ng
the two h ghest and two owest scores Four observat ons are de eted because 0 1*59 = 5 9 rounds
down to four (The resu t s 90 04 ) In ce F4, the =TRIMMEAN(C4 C62, 05) formu a computes (90 02)
the mean of the scores n C4 C62 after de et ng the top and bottom scores Two observat ons are
removed because 0 05*59 = 2 95 rounds down to two (See F gure 42-7 )

When I select a range of cells, is there an easy way to get a variety of statistics that describes
the data in those cells?

To see the so ut on to th s quest on, se ect the C4 C36 ce range n the Tr mmean x sx fi e In the
ower-r ght corner of your screen, the Exce status bar d sp ays a cornucop a of stat st cs descr b ng
the numbers n the se ected ce range (See F gure 42-8 ) For examp e, for the C4 C36 ce range, the
mean s 90 39, there are 33 numbers, the sma est va ue s 80, and the argest va ue s 100 If you r ght-
c ck the status bar, you can change the d sp ayed set of stat st cs

FIGURE 42-8  Th s figure shows the stat st cs on the status bar.

Why do financial analysts often use the geometric mean to summarize the average return on
a stock?

The Geommean x sx fi e conta ns the annua returns of two fict t ous stocks (See F gure 42-9 )

Ce C9 nd cates that the average annua return on Stock 1 s 5 percent, and the average annua
return on Stock 2 s 10 percent Th s wou d seem to nd cate that Stock 2 s a better nvestment If
you th nk about t, however, what w probab y happen w th Stock 2 s that one year you w ose
50 percent and the next ga n 70 percent Th s means that every two years, $1 00 becomes 1(1 7)( 5)
=  85 Because Stock 1 never oses money, you know that t s c ear y the better nvestment Us ng
the geometr c mean as a measure of average annua return he ps to conc ude correct y that Stock 1
s the better nvestment The geometr c mean of n numbers s s mp y the nth root of the product of
the numbers For examp e, the geometr c mean of 1 and 4 s the square root of 4 (2), whereas the
geometr c mean of 1, 2, and 4 s the cube root of 8 (a so 2) To use the geometr c mean to ca cu ate
an average annua return on an nvestment, you add 1 to each annua return and take the geometr c
mean of the resu t ng numbers Then subtract 1 from th s resu t to obta n an est mate of the stock’s
average annua return

Summar z ng data by us ng descr pt ve stat st cs  Chapter 42   381


FIGURE 42-9  Th s figure shows the geometr c mean.

The =GEOMMEAN(range) formu a finds the geometr c mean of numbers n a range So, to est -
mate the average annua return on each stock, you proceed as fo ows

1. Compute 1 + each annua return by copy ng the =1+C5 formu a from C12 to C12 D15

2. Copy the =GEOMEAN(C12 C15)–1 formu a from C16 to D16

The annua average return on Stock 1 s est mated to be 5 percent, and the annua average return
on Stock 2 s –7 8 percent Note that f Stock 2 y e ds the mean return of –7 8 percent dur ng two con-
secut ve years, $1 becomes 1(1 – 078)2 = 85, wh ch agrees w th common sense

Problems
1. Use the data n the Stock x sx fi e to generate descr pt ve stat st cs for Inte and GE stock

2. Use your answer to Prob em 1 to compare the month y returns on Inte and GE stock

3. C ty Power & L ght produces vo tage-regu at ng equ pment n New York and sh ps the equ p-
ment to Ch cago A vo tage regu ator s cons dered acceptab e f t can ho d a vo tage of 25 to
75 vo ts The vo tage he d by each un t s measured n New York before each un t s sh pped
The vo tage s measured aga n when the un t arr ves n Ch cago A samp e of vo tage measure-
ments from each c ty s g ven n the C typower x sx fi e

382  Chapter 42  Summar z ng data by us ng descr pt ve stat st cs


• Us ng descr pt ve stat st cs, comment on what you have earned about the vo tage un ts
ho d before and after sh pment

• What percentage of un ts s acceptab e before and after sh pp ng?


• Do you have any suggest ons about how to mprove the qua ty of C ty Power & L ght’s
regu ators?

• Ten percent of a New York regu ators have a vo tage exceed ng what va ue?

• F ve percent of a New York regu ators have a vo tage ess than or equa to what va ue?

4. In the Decade ncome x sx fi e, you are g ven a samp e of ncomes ( n thousands of 1980 do -
ars) for a set of fam es samp ed n 1980 and 1990 Assume that these fam es are representa-
t ve of the who e Un ted States Repub cans c a m that the country was better off n 1990 than
n 1980 because average ncome ncreased Do you agree?

5. Use descr pt ve stat st cs to compare the annua returns on stocks, T-b s, and corporate
bonds Use the data conta ned n the H stor ca nvest x sx fi e

6. In 1970 and 1971, e g b ty for the US armed serv ces draft was determ ned on the bas s of a
draft ottery number The number was determ ned by b rth date A tota of 366 ba s, one for
each poss b e b rth date, were p aced n a conta ner and shaken The first ba se ected was
g ven the number 1 n the ottery, the second ba the number 2, and so on Men whose b rth-
days corresponded to the owest numbers were drafted first The Draft ottery x sx fi e conta ns
the actua resu ts of the 1970 and 1971 draw ngs For examp e, n the 1970 draw ng, January
1 rece ved the number 305 Use descr pt ve stat st cs to demonstrate that the 1970 draft ot-
tery was not random and the 1971 ottery was random (H nt Use the AVERAGE and MEDIAN
funct ons to compute the mean and med an ottery number for each month )

7. The Jordan x sx fi e g ves the start ng sa ar es (hypothet ca ) of a 1984 geography graduates


from the Un vers ty of North Caro na (UNC) What s your best est mate of a typ ca start ng
sa ary for a geography major? In rea ty, the major at UNC hav ng the h ghest average start-
ng sa ary n 1984 was geography because the great basketba p ayer M chae Jordan was a
geography major!

8. Use the LARGE or SMALL funct on to sort the annua stock returns n the H stor ca nvest x sx
fi e What advantage does th s method of sort ng have over c ck ng the Sort button?

9. Compare the mean, med an, and tr mmed mean (tr mm ng 10 percent of the data) of the
annua returns on stocks, T-b s, and corporate bonds g ven n the H stor ca nvest x sx fi e

10. Use the geometr c mean to est mate the mean annua return on stocks, bonds, and T-b s n
the H stor ca nvest x sx fi e

11. The Dow x sx fi e conta ns month y returns on the 30 Dow stocks dur ng the past 20 years Use
th s data to determ ne the three stocks w th the argest mean month y returns

12. Us ng the Dow x sx data aga n, determ ne the three stocks w th the most r sk or var ab ty

Summar z ng data by us ng descr pt ve stat st cs  Chapter 42   383


13. Us ng the Dow x sx data, determ ne the three stocks w th the h ghest skew

14. Us ng the Dow x sx data, how do the tr mmed-mean returns (tr m off 10 percent of the
returns) d ffer from the overa mean returns?

15. The Incomedata x sx fi e conta ns ncomes of a representat ve samp e of Amer cans n years
1975, 1985, 1995, and 2005 Descr be how US persona ncome has changed over th s t me
per od

16. The Co tsdata x sx fi e conta ns yards ga ned by the 2006 Ind anapo s Co ts on each rush ng
and pass ng p ay Descr be how the outcomes of rush ng p ays and pass ng p ays d ffer

384  Chapter 42  Summar z ng data by us ng descr pt ve stat st cs


CHAPTER 43

Using PivotTables and slicers to


describe data

Questions answered in this chapter:


■ What s a P votTab e?

■ How can I use a P votTab e to summar ze grocery sa es at severa grocery stores?

■ What P votTab e ayouts are ava ab e n Exce 2013?

■ Why s a P votTab e ca ed a P votTab e?

■ How can I eas y change the format n a P votTab e?

■ How can I co apse and expand fie ds?

■ How can I sort and fi ter P votTab e fie ds?

■ How can I summar ze a P votTab e by us ng a P votChart?

■ How can I use the Report F ter sect on of the P votTab e?

■ How do P votTab e s cers work?

■ How can I add b ank rows or h de subtota s n a P votTab e?

■ How can I app y cond t ona formatt ng to a P votTab e?

■ How can I update my ca cu at ons when I add new data?

■ I work for a sma trave agency for wh ch I need to mass-ma a trave brochure My funds are
m ted, so I want to ma the brochure to peop e who spend the most money on trave From
nformat on n a random samp e of 925 peop e, I know the gender, the age, and the amount
these peop e spent on trave ast year How can I use th s data to determ ne how gender and
age nfluence a person’s trave expend tures? What can I conc ude about the type of person to
whom I shou d ma the brochure?

385

■ I’m do ng market research about stat on wagons I need to determ ne what factors nfluence
the ke hood that a fam y w purchase a stat on wagon From nformat on n a arge samp e
of fam es, I know the fam y s ze ( arge or sma ) and the fam y ncome (h gh or ow) How can
I determ ne how fam y s ze and ncome nfluence the ke hood that a fam y w purchase a
stat on wagon?

■ I work for a manufacturer that se s m croch ps g oba y I’m g ven month y actua and pre-
d cted sa es for Canada, France, and the Un ted States for Ch p 1, Ch p 2, and Ch p 3 I’m a so
g ven the var ance, or d fference, between actua and budgeted revenues For each month and
each comb nat on of country and product, I’d ke to d sp ay the fo ow ng data actua rev-
enue, budgeted revenue, actua var ance, actua revenue as a percentage of annua revenue,
and var ance as a percentage of budgeted revenue How can I d sp ay th s nformat on?

■ What s a ca cu ated fie d?

■ How can I use a report fi ter or s cer?

■ How can I group tems n a P votTab e?

■ What s a ca cu ated tem?

■ What s “dr ng down”?

■ I often have to use spec fic data n a P votTab e to determ ne profit, such as the Apr sa es n
France of Ch p 1 Unfortunate y, th s data moves around when new fie ds are added to my
P votTab e Does Exce have a funct on that enab es me a ways to extract Apr ’s Ch p 1 sa es n
France from the P votTab e?

■ How can I use the New Exce 2013 T me ne feature to summar ze data dur ng d fferent t me
per ods?

■ How can I use a P votTab e to summar ze tota sa es to date dur ng a year?

■ How can I use a P votTab e to summar ze sa es th s month compared to the same month a
year ear er?

■ How can I create a P votTab e based on data n severa ocat ons?

■ How can I create a P votTab e based on an a ready created P votTab e?

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

What is a PivotTable?

In numerous bus ness s tuat ons, you need to ana yze, or s ce and d ce, your data to ga n mportant
ns ghts Imag ne that you se d fferent grocery products n d fferent stores at d fferent po nts n t me
You m ght have hundreds of thousands of data po nts to track P votTab es enab e you to summar ze

386  Chapter 43  Us ng P votTab es and s cers to descr be data


your data qu ck y n a most any way mag nab e For examp e, for your grocery store data, you cou d
use a P votTab e to determ ne the fo ow ng qu ck y

■ Amount spent per year n each store on each product

■ Tota spend ng at each store

■ Tota spend ng for each year

In a trave agency, as another examp e, you m ght s ce data so that you can determ ne whether
the average amount spent on trave s nfluenced by age or gender or by both factors In ana yz ng
automob e purchases, you’d ke to compare the fract on of arge fam es that buy a stat on wagon
to the fract on of sma fam es that purchase a stat on wagon For a m croch p manufacturer, you’d
ke to determ ne tota Ch p 1 sa es n France, for examp e, dur ng Apr , and so on A P votTab e s an
ncred b y powerfu too that you can use to s ce and d ce data The eas est way to understand how a
P votTab e works s to wa k through some carefu y constructed examp es, so get started! Beg n w th
an ntroductory examp e and then exp ore many advanced P votTab e features through subsequent
examp es

How can I use a PivotTable to summarize grocery sales at several grocery stores?

The Data worksheet n the Grocer espt x sx fi e conta ns more than 900 rows of sa es data (See
F gure 43-1 ) Each row conta ns the number of un ts so d and revenue of a product at a store as we
as the month and year of the sa e The product group (fru t, m k, cerea , or ce cream) s a so nc uded
You wou d ke to see a breakdown of sa es dur ng each year of each product group and product at
each store You wou d a so ke to be ab e to show th s breakdown dur ng any subset of months n a
g ven year (for examp e, what the sa es were from January through June)

Us ng P votTab es and s cers to descr be data  Chapter 43   387


FIGURE 43-1  Th s s the data for the grocery P votTab e examp e.

Before creat ng a P votTab e, you must have head ngs n the first row of your data Not ce that the
grocery data conta ns head ngs (Year, Month, Store, Group, Product, Un ts, and Revenue) n row 2
P ace your cursor anywhere n the data and then c ck PivotTable n the Tables group on the Insert
tab Exce opens the Create PivotTable d a og box, shown n F gure 43-2, and makes an assumpt on
about your data range (In th s case, Exce correct y guessed that the data range was A1 G923 ) By
se ect ng Use An External Data Source, you can a so refer to a database as a source for a P votTab e
Data Model, new n Exce 2013, s d scussed n Chapter 44, “The Data Mode ”

388  Chapter 43  Us ng P votTab es and s cers to descr be data


FIGURE 43-2  Th s s the Create P votTab e d a og box.

After you c ck OK, you see the PivotTable Fields st shown n F gure 43-3

Us ng P votTab es and s cers to descr be data  Chapter 43   389


FIGURE 43-3  Th s s the P votTab e F e ds st.

You fi n the P votTab e F e d st by dragg ng P votTab e head ngs, or fields, nto the boxes, or
zones Th s step s cr t ca to ensur ng that the P votTab e summar zes and d sp ays the data n the
manner you want The four zones are as fo ows

■ Row Labels  F e ds dragged here are sted on the eft s de of the tab e n the order n wh ch
they are added to the box For examp e, you can drag the Year, Group, Product, and Store
fie ds, n that order, to the Row Labels box Th s causes Exce to summar ze data first by year,
then for each product group w th n a g ven year, then by product w th n each group, and,
fina y, each product by store At any t me, you can drag a fie d to a d fferent zone or reorder
the fie ds w th n a zone by dragg ng a fie d up or down n a zone or by c ck ng the arrow to
the r ght of the fie d abe

■ Column Labels  F e ds dragged here have the r va ues sted across the top row of the
P votTab e To start out th s examp e, you have no fie ds n the Co umn Labe s zone

390  Chapter 43  Us ng P votTab es and s cers to descr be data


■ Values  F e ds dragged here are summar zed mathemat ca y n the tab e Un ts and Revenue
( n that order) have been dragged to th s zone Exce tr es to guess what k nd of ca cu at on
you want to perform on a fie d In th s examp e, Exce guesses that Revenue and Un ts shou d
be summed, wh ch happens to be correct If you want to change the method of ca cu at on for
a data fie d to an average, a count, or someth ng e se, c ck the data fie d and choose Value
Field Settings An examp e of how to use the Va ue F e d Sett ngs command s g ven ater n
the chapter If you se ect a numer c fie d from the fie d st, the fie d s automat ca y added to
the Va ues zone and aggregated by us ng Sum If you se ect a nonnumer c fie d from the fie d
st, the fie d s automat ca y p aced n the Rows zone

■ Report Filter  Beg nn ng n Exce 2007, Report Filter s the new name for the o d Page F e d
area For fie ds dragged to the Report F ter area, you can eas y p ck any subset of the fie d
va ues so that the P votTab e shows ca cu at ons based on y on that subset In th s examp e,
Month was dragged to the Report F ter area You can eas y se ect any subset of months, for
examp e January to June, and the ca cu at ons are based on on y those months

The comp eted P votTab e F e ds s shown n F gure 43-4 The resu t ng P votTab e s shown n
F gure 43-5 and n the A Row F e ds worksheet of the Grocer espt x sx workbook In row 5, you can
see that 243,228 un ts were so d for $728,218 68 n 2005

Tip  Here is some advice about navigating between worksheets:


■ Control+PageUp key sequence moves you back one worksheet.
■ Control+PageDn key sequence moves you forward one worksheet.
■ Right-clicking either of the arrows to the left of the first worksheet name brings up a
list of worksheet names from which you can move to any worksheet in the workbook.

Note  To see the field list, you need to be in a field in the PivotTable. If you do not see the
field list, right-click any cell in the PivotTable and select Show Field List.

Us ng P votTab es and s cers to descr be data  Chapter 43   391


FIGURE 43-4  Th s s the comp eted P votTab e F e ds st.

392  Chapter 43  Us ng P votTab es and s cers to descr be data


FIGURE 43-5  Th s s the grocery P votTab e n compact form.

What PivotTable layouts are available?

The P votTab e ayout shown n F gure 43-5 s ca ed the compact form In the compact form, the row
fie ds are shown one on top of another To change the ayout, first p ace your cursor anywhere w th n
the tab e On the Design tab, n the Layout Group, c ck Report Layout and choose one of the fo -
ow ng Show In Compact Form (see F gure 43-5), Show In Outline Form (see F gure 43-6 and the
Out ne Form worksheet), or Show In Tabular Form (F gure 43-7 and the Tabu ar Form worksheet)

Us ng P votTab es and s cers to descr be data  Chapter 43   393


FIGURE 43-6  Th s s the out ne form.

FIGURE 43-7  Th s s the tabu ar form.

394  Chapter 43  Us ng P votTab es and s cers to descr be data


Why is a PivotTable called a PivotTable?

You can eas y p vot fie ds from a row to a co umn and v ce versa to create a d fferent ayout For
examp e, by dragg ng the Year fie d to the Column Labels box, you create the P votTab e ayout
shown n F gure 43-8 (See the Years Co umn worksheet )

FIGURE 43-8  The Years fie d s p voted to the co umn fie d.

How can I easily change the format in a PivotTable?

If you want to change the format of an ent re co umn fie d, doub e-c ck the co umn head ng and c ck
Number Format n the Value Field Settings d a og box App y the format you want For examp e, n
the Formatted $s worksheet, the Revenue fie d s formatted as currency by doub e-c ck ng the Sum
Of Revenue head ng and app y ng a currency format You can a so change the format of a va ue fie d
by c ck ng the arrow to the r ght of the Value fie d n PivotTable Fields Se ect Value Field Settings
fo owed by Number Format, and then you can reformat the co umn as you want t

From any ce n a P votTab e, you can se ect the Design tab on the r bbon to revea many
P votTab e sty es

How can I collapse and expand fields?

Expand ng and co aps ng fie ds (a feature ntroduced n Exce 2007) s a great advantage n
P votTab es In F gure 43-5, you see m nus (–) s gns by each year, group, and product C ck ng the
m nus s gn co apses a fie d and changes the s gn to a p us (+) s gn C ck ng the p us s gn expands the
fie d For examp e, f you c ck the m nus s gn by cerea n any ce n co umn A, you find that n each
year, cerea s contracted to one row, and the var ous cerea stores are no onger sted See F gure
43-9 and the Cerea co apse worksheet C ck ng the p us s gn n ce A6 br ngs back the deta ed or
expanded v ew st ng sa es for each nd v dua cerea

Us ng P votTab es and s cers to descr be data  Chapter 43   395


FIGURE 43-9  The cerea tem s co apsed.

You can a so expand or contract an ent re fie d Go to any row conta n ng a member of that fie d
and se ect PivotTable Tools Analyze on the r bbon In the Active Field group, c ck e ther the green
Expand Field button ( abe ed w th a p us s gn) or the red Contract Field button ( abe ed w th a
m nus s gn) (See F gure 43-10 )

FIGURE 43-10  Th s shows the Expand F e d and Co apse F e d button.

For examp e, suppose you s mp y want to see on y the sa es by product group for each year
P ck any ce conta n ng a group’s name (for examp e, A6), se ect PivotTable Tools Options on the
r bbon, and c ck the Collapse Field button You see the resu t shown n F gure 43-11 (the Groups
Co apsed worksheet) Se ect ng the Expand Field button br ngs you back to the or g na v ew

396  Chapter 43  Us ng P votTab es and s cers to descr be data


FIGURE 43-11  The Group fie d s co apsed.

How can I sort and filter PivotTable fields?

In F gure 43-5, the products are sted a phabet ca y w th n each group For examp e, Cheer os s the
first type of cerea sted If you want the products to be sted n reverse a phabet ca order, s mp y
move the cursor to any ce conta n ng a product (for examp e, A7 conta n ng Cheer os n the A Row
F e ds worksheet) and c ck the drop-down arrow to the r ght of Row Labels n A5 You see the st
of fi ter ng opt ons shown n F gure 43-12 Se ect ng Sort Z To A as shown n F gure 43-12 wou d st
Spec a K first for Cerea , who e m k first for M k, p ums for Fru t, and so on

In t a y, your P votTab e d sp ays resu ts first from 2005, then 2006, and then 2007 If you want to
see the data for 2007 first, move the cursor to any ce conta n ng a year (for examp e, A5) and choose
Sort Largest To Smallest from the ava ab e opt ons

At the bottom of the fi ter ng opt ons d a og box, you can a so se ect any subset of products to be
d sp ayed You m ght want to c ear Se ect A first and then se ect the products you want to show

Us ng P votTab es and s cers to descr be data  Chapter 43   397


FIGURE 43-12  These are the P votTab e fi ter ng opt ons for the Product fie d.

For another examp e of fi ter ng, ook at the Data worksheet n the Ptcustomers x sx fi e, shown n
F gure 43-13 The worksheet data conta ns the customer number, the amount pa d, and the quarter of
the year n wh ch payment was rece ved for each customer transact on After dragg ng Customer to
the Row Labels box, Quarter to the Column Labels box, and Paid to the Values box, the P votTab e
shown n F gure 43-14 s d sp ayed (See the Ptab e worksheet n the Pcustomers x sx fi e )

398  Chapter 43  Us ng P votTab es and s cers to descr be data


FIGURE 43-13  The Customer P votTab e data.

Us ng P votTab es and s cers to descr be data  Chapter 43   399


FIGURE 43-14  Th s s the Customer P votTab e.

Natura y, you m ght ke to show a st of just your top 10 customers To obta n th s ayout, c ck
the Row Labels arrow and se ect Value Filters Choose Top 10 Items to obta n the ayout shown n
F gure 43-15 (See the Top 10 cus worksheet ) Of course, by se ect ng Clear Filter, you can return to
the or g na ayout

400  Chapter 43  Us ng P votTab es and s cers to descr be data


FIGURE 43-15  Th s figure shows Top 10 customers.

Suppose you s mp y want to see the top customers that generate 50 percent of your revenue
Se ect the Row Labels fi ter ng con, se ect Value Filters and Top 10, and fi n the d a og box as
shown n F gure 43-16

FIGURE 43-16  Configure the Top 10 F ter d a og box to show customers generat ng 50 percent of revenue.

The resu t ng P votTab e s n the Top Ha f worksheet and shown n F gure 43-17 As you can see,
the top 14 customers generate a tt e more than ha f of the revenue

Us ng P votTab es and s cers to descr be data  Chapter 43   401


FIGURE 43-17  The top customers generate ha f of the revenues.

Now suppose you want to sort your customers by Quarter 1 revenue (See the Sorted q1 work-
sheet ) R ght-c ck anywhere n the Quarter 1 co umn, po nt to Sort, and then c ck Sort Largest To
Smallest The resu t ng P votTab e s shown n F gure 43-18 Note that Customer 13 pa d the most n
Quarter 1, Customer 2 pa d the second most, and so on

402  Chapter 43  Us ng P votTab es and s cers to descr be data


FIGURE 43-18  Customers are sorted on Quarter 1 revenue.

How can I summarize a PivotTable by using a PivotChart?

Exce makes t easy to summar ze P votTab es v sua y by us ng P votCharts The key to ay ng out the
data the way you want t n a P votChart s to sort data and co apse or expand fie ds In the grocery
examp e, suppose you want to summar ze the trend over t me of each food group’s un t sa es (See
the Chart 2 worksheet n the Grocer espt x sx fi e ) You shou d move the Year fie d to the Row area
and de ete Revenue from the Values area You a so need to co apse the ent re Group fie d n the
Row Labels zone and move Groups to the Column area Now you are ready to create a P votChart
C ck anywhere ns de the tab e and se ect PivotChart from the Analyze tab Now p ck the chart type
you want to create The fourth Line Graph opt on, wh ch d sp ays the chart shown n F gure 43-19, has
been chosen here The chart shows that m k sa es were h ghest n 2005 and owest n 2006

Us ng P votTab es and s cers to descr be data  Chapter 43   403


FIGURE 43-19  Th s s the P votChart for the un t group sa es trend.

How can I use the Report Filter section of the PivotTable?

Reca that Months was p aced n the Report F ter sect on of the tab e To see how to use a report
fi ter, suppose that you want to summar ze sa es for the months of January to June By c ck ng the
Filter con n ce B2 of the F rst 6 months worksheet, you can se ect January–June Th s resu ts n the
P votTab e shown n F gure 43-20, wh ch summar zes the number of un ts so d by product, group, and
year for the months of January to June

404  Chapter 43  Us ng P votTab es and s cers to descr be data


FIGURE 43-20  A P votTab e summar z ng January to June sa es.

How do PivotTable slicers work?

The prob em w th a report fi ter s that a v ewer of the P votTab e shown n F gure 43-20 cannot eas y
see that the tab e summar zes January to June sa es The Exce s cer feature ( ntroduced n Exce 2010)
neat y so ves th s prob em To create a s cer for any of the co umns of data used to generate your
P votTab e, p ace your cursor anywhere n the P votTab e and then c ck Slicer on the r bbon’s Insert
tab In the S cers worksheet of the Grocer espt x sx fi e, S cer was se ected from the Insert menu The
Month and Product fie ds were se ected to create s cers for Month and Product Us ng a g ven s cer,
you can se ect any subset of poss b e va ues to be used n creat ng your tab e In the Month s cer, the
months January through June were se ected (one at a t me wh e ho d ng down the Ctr key) Noth ng
was done to the Product s cer, so the data s based on January to June sa es The s cers are shown n
F gure 43-21

You can a so add a s cer for a fie d by r ght-c ck ng the fie d n the PivotTable Fields pane and
se ect ng Add As Slicer

Us ng P votTab es and s cers to descr be data  Chapter 43   405


FIGURE 43-21  Here s an examp e of s cers for the Month and Product fie ds.

If you se ect a s cer, on the Slicer Tools Options r bbon tab, you see formatt ng opt ons that
enab e you to change ts appearance For examp e, you can change the he ght and w dth as we as
the number of co umns n the s cer You can a so eas y res ze a s cer by dragg ng ts s des or corners

How can I add blank rows or hide subtotals in a PivotTable?

If you want to add a b ank row between each grouped tem, se ect PivotTable Tools Design on
the r bbon, c ck Blank Rows, and then c ck Insert Blank Line After Each Item If you want to
h de subtota s or grand tota s, se ect PivotTable Tools Design and then se ect Subtotals or Grand
Totals After add ng b ank rows and h d ng a tota s, you can obta n the tab e n the B ank rows no
tota s worksheet of the Grocerypt x sx workbook, shown n F gure 43-22 After r ght-c ck ng n any
P votTab e ce , you can se ect PivotTable Options to open the PivotTable Options d a og box

406  Chapter 43  Us ng P votTab es and s cers to descr be data


FIGURE 43-22  Here s the grocery P votTab e w thout tota s.

How can I apply conditional formatting to a PivotTable?

Suppose you want to app y data bars to the Un ts co umn n the grocery P votTab e One prob em
you’ encounter s that subtota s and grand tota s w have arge data bars and make the other data
bars sma er than they shou d be It’s better to have the data bars app y to a product sa es, not the
subtota s and grand tota s (See the Cond form worksheet of workbook Grocer espt x sx ) To app y
the data bars to on y the un t sa es by product, beg n by p ac ng the cursor n any ce conta n ng
un t sa es for a product (for examp e, choco ate m k n B8) On the Home tab, c ck Conditional
Formatting fo owed by Data Bars and then choose More Rules You see the New Formatting Rule
d a og box shown n F gure 43-23

Us ng P votTab es and s cers to descr be data  Chapter 43   407


FIGURE 43-23  Th s s the New Formatt ng Ru e d a og box for us ng cond t ona formatt ng w th P votTab es.

By se ect ng All Cells Showing “Sum of Units” Values For “Product” and se ect ng the
$B$8 $B$227 range, you can ensure that data bars app y on y to ce s st ng un t sa es for products, as
you can see n the Cond form worksheet and F gure 43-24

408  Chapter 43  Us ng P votTab es and s cers to descr be data


FIGURE 43-24  Th s figure shows data bars for a P votTab e.

How can I update my calculations when I add new data?

If the data n your or g na set of rows changes, you can update your P votTab e to nc ude the data
changes by r ght-c ck ng the tab e and se ect ng Refresh You can a so se ect Refresh from the
Analyze tab

If you want data you add to be automat ca y nc uded n your P votTab e ca cu at ons when you
refresh t, you shou d define your or g na data set as a tab e by se ect ng t w th Ctr +T (See Chapter
25, “Tab es,” for more nformat on )

If you want to change the range of data used to create a P votTab e, you can a ways se ect Change
Data Source on the Analyze tab You can a so move the tab e to a d fferent ocat on by se ect ng
Move PivotTable

Us ng P votTab es and s cers to descr be data  Chapter 43   409


I work for a small travel agency for which I need to mass-mail a travel brochure. My funds are
limited, so I want to mail the brochure to people who spend the most money on travel. From
information in a random sample of 925 people, I know the gender, the age, and the amount
these people spent on travel last year. How can I use this data to determine how gender and
age influence a person’s travel expenditures? What can I conclude about the type of person to
whom I should mail the brochure?

To understand th s data, you need to break t down as fo ows

■ Average amount spent on trave by gender

■ Average amount spent on trave for each age group

■ Average amount spent on trave by gender for each age group

The data s nc uded on the Data worksheet n the Trave data x sx fi e, and a samp e s shown n
F gure 43-25 For examp e, the first person s a 44-year-o d ma e who spent $997 on trave

FIGURE 43-25  Th s s trave agency data show ng age, gender, and amount spent on trave .

F rst, get a breakdown of spend ng by gender Beg n by se ect ng Insert PivotTable Exce extracts
the A2 D927 range After c ck ng OK, put the cursor n the tab e so that the fie d st appears Next,

410  Chapter 43  Us ng P votTab es and s cers to descr be data


drag the Gender co umn to the Row Labels zone and drag Amount Spent On Travel to the Values
zone Th s resu ts n the P votTab e shown n F gure 43-26

You can te from the head ng, Sum Of Amount Spent On Trave , that you are summar z ng the
tota amount spent on trave , but you actua y want the average amount spent on trave by men
and women To ca cu ate these quant t es, doub e-c ck Sum Of Amount Spent On Travel from the
P votTab e (not the fie d st!) and then se ect Average from the Value Field Settings d a og box,
shown n F gure 43-27

FIGURE 43-26  Th s P votTab e summar zes the tota trave expend tures by gender.

FIGURE 43-27  You can se ect a d fferent summary funct on n the Va ue F e d Sett ngs d a og box.

Us ng P votTab es and s cers to descr be data  Chapter 43   411


You now see the resu ts, shown n F gure 43-28

FIGURE 43-28  Here are the average trave expend tures by gender.

On average, peop e spend $908 13 on trave Women spend an average of $901 16, whereas men
spend $914 99 Th s P votTab e nd cates that gender has tt e nfluence on the propens ty to trave By
c ck ng the Row Labels arrow, you can fi ter to show just ma e or fema e resu ts

Now you want to see how age nfluences trave spend ng Sw tch Gender to the Columns zone
of the P votTab e by dragg ng Gender from the Row Labels zone to the Column Labels zone To
break down spend ng by age, drag Age to the Row area The P votTab e now appears as t’s shown n
F gure 43-29

FIGURE 43-29  Th s P votTab e shows the average trave expend tures by age and gender.

412  Chapter 43  Us ng P votTab es and s cers to descr be data


Age seems to have tt e effect on trave expend tures In fact, th s P votTab e s pretty use ess
n ts present state You need to group data by age to see any trends To group the resu ts by age,
r ght-c ck anywhere n the Age co umn and choose Group In the Grouping d a og box (shown n
F gure 43-30), you can des gnate the nterva by wh ch to define an age group By us ng 10-year ncre-
ments, you obta n the P votTab e shown n F gure 43-31

On average, 25–34-year-o ds spend $935 84 on trave , 55–64-year-o ds spend $903 57 on trave ,


and so on Th s nformat on s more usefu , but t st nd cates that peop e of a ages tend to spend
about the same amount on trave Th s v ew of the data does not he p determ ne whom you shou d
ma your brochure to

FIGURE 43-30  Use the Group And Show Deta command to group deta ed records.

F na y, get a breakdown of average trave spend ng by age for men and women separate y A
you have to do s drag Gender to the Column Labels zone of the fie d st, resu t ng n the P votTab e
shown n F gure 43-31 (See the F na Tab e worksheet )

FIGURE 43-31  Th s s the age and gender breakdown of trave spend ng.

Now you’re cook ng! You can see that as age ncreases, women spend more on trave and men
spend ess Now you know who shou d get the brochure o der women and younger men As a stu-
dent once sa d, “That wou d be some k nd of cru se!”

Us ng P votTab es and s cers to descr be data  Chapter 43   413


A graph prov des a n ce summary of th s ana ys s Move the cursor ns de the P votTab e and, from
the Analyze tab on the r bbon, se ect PivotChart A menu of recommended charts appears The first
cho ce (Clustered Column) has been se ected The resu t s the chart shown n F gure 43-32 If you
want to ed t the chart further, se ect PivotChart Tools Then, for examp e, f you choose Layout, you
can add t t es to the chart and ax s and make other changes

FIGURE 43-32  Th s s a P votChart for the age and gender trave expend ture breakdown.

Each age group spends approx mate y the same on trave , but as age ncreases, women spend
more than men (If you want to use a d fferent type of chart, you can change the chart type by r ght-
c ck ng the P votChart and then choos ng Chart Type )

Not ce that the bars show ng expend tures by ma es decrease w th age, and the bars represent ng
the amount spent by women ncrease w th age You can see why the P votTab es that showed on y
gender and age data fa ed to unmask th s pattern Because ha f your samp e popu at on s men and
ha f s women, you found that the average amount spent by peop e does not depend on the r age
(Not ce that the average he ght of the two bars for each age s approx mate y the same ) You a so
found that the average amount spent by men and women was approx mate y the same You can see
th s because, averaged over a ages, the b ue and red bars have approx mate y equa he ghts S c ng
and d c ng the data s mu taneous y across age and gender does a much better job of show ng you the
rea nformat on

Note that by c ck ng the drop-down arrow assoc ated w th A, you cou d fi ter the graph on Age,
and by c ck ng the drop-down arrow assoc ated w th Gen, you cou d fi ter the graph based on
Gender

I’m doing market research about station wagons. I need to determine what factors influence
the likelihood that a family will purchase a station wagon. From information in a large sample

414  Chapter 43  Us ng P votTab es and s cers to descr be data


of families, I know the family size (large or small) and the family income (high or low). How
can I determine how family size and income influence the likelihood that a family will pur-
chase a station wagon?

In the Stat on x sx fi e, you can find the fo ow ng nformat on

■ Is the fam y s ze arge or sma ?

■ Is the fam y’s ncome h gh or ow?

■ D d the fam y buy a stat on wagon? Yes or No

A samp e of the data s shown n F gure 43-33 (see the Data worksheet) For examp e, the first fam-
y sted s a sma , h gh- ncome fam y that d d not buy a stat on wagon

FIGURE 43-33  Th s s data co ected about ncome, fam y s ze, and the purchase of a stat on wagon.

You want to determ ne how fam y s ze and ncome nfluence the ke hood that a fam y w pur-
chase a stat on wagon The tr ck s to ook at how ncome affects purchases for each fam y s ze and
how fam y s ze affects purchases for each ncome eve

To beg n, choose Insert Pivot Table and then se ect the data (the B2 D345 ce range) Us ng
PivotTable Fields, drag Family Size to the Row Labels area, Station Wagon to the Column Labels

Us ng P votTab es and s cers to descr be data  Chapter 43   415


area, and any of the three fie ds to the Values area The resu t s the P votTab e shown n F gure 43-34
(See the 1st Tab e worksheet ) Not ce that Exce has chosen to summar ze the data appropr ate y by
count ng the number of observat ons n each category For examp e, 34 h gh-sa ary, arge fam es d d
not buy a stat on wagon, whereas 100 h gh-sa ary, arge fam es d d buy one

FIGURE 43-34  Th s s a summary of stat on wagon ownersh p by fam y s ze and sa ary.

You wou d ke to know for each row n the P votTab e the percentage of fam es that purchased a
stat on wagon To d sp ay the data n th s format, r ght-c ck any va ue ce n the P votTab e data and
then choose Value Field Settings, wh ch opens the Value Field Settings d a og box In the d a og
box, c ck Show Values As and then se ect % Of Row n the Show Data As st You now obta n the
P votTab e shown n F gure 43-35 (See the 1st Percent Breakdown worksheet )

FIGURE 43-35  Th s s the percentage breakdown of stat on wagon ownersh p by ncome for arge and sma
fam es.

416  Chapter 43  Us ng P votTab es and s cers to descr be data


From F gure 43-35, you earn that for both arge and sma fam es, ncome has tt e effect on
whether the fam y purchases a stat on wagon Now you need to determ ne how fam y s ze affects
the propens ty to buy a stat on wagon for h gh- ncome and ow- ncome fam es To do th s, move
Salary above Family Size n the Row Labels zone, resu t ng n the P votTab e shown n F gure 43-36
(See the F na Percent Breakdown worksheet )

FIGURE 43-36  Th s s the breakdown of stat on wagon ownersh p by fam y s ze for h gh and ow sa ar es.

From th s tab e, you earn that for h gh- ncome fam es, a arge fam y s much more ke y to buy a
stat on wagon than a sma fam y S m ar y, for ow- ncome fam es, a arge fam y s a so more ke y
to purchase a wagon than a sma fam y The bottom ne s that fam y s ze has a much greater effect
on the ke hood that a fam y w purchase a stat on wagon than ncome

I work for a manufacturer that sells microchips globally. I’m given monthly actual and pre-
dicted sales for Canada, France, and the United States for Chip 1, Chip 2, and Chip 3. I’m also
given the variance, or difference, between actual and budgeted revenues. For each month
and each combination of country and product, I’d like to display the following data: actual
revenue, budgeted revenue, actual variance, actual revenue as a percentage of annual rev-
enue, and variance as a percentage of budgeted revenue. How can I display this information?

In th s scenar o, you are a finance manager for a m croch p manufacturer You se your products n
d fferent countr es and reg ons and at d fferent t mes P votTab es can he p you summar ze your data
n a format that’s eas y understood

The Ptab eexamp e x sx fi e nc udes month y actua and pred cted sa es dur ng 1997 of Ch p 1,
Ch p 2, and Ch p 3 n Canada, France, and the Un ted States The fi e a so conta ns the var ance, or
d fference, between actua revenues and budgeted revenues A samp e of the data s shown n F gure
43-37 (See the Data worksheet ) For examp e, n the Un ted States n January, sa es of Ch p 1 tota ed
$4,000, a though sa es of $5,454 were pred cted Th s y e ded a var ance of –$1,454

Us ng P votTab es and s cers to descr be data  Chapter 43   417


FIGURE 43-37  Ch p data from d fferent countr es for d fferent months shows actua , budget, and
var ance revenues.

For each month and each comb nat on of country and product, you wou d ke to d sp ay the fo -
ow ng data

■ Actua revenue

■ Budgeted revenue

■ Actua var ance

■ Actua revenue as a percentage of annua revenue

■ Var ance as a percentage of budgeted revenue

To beg n, se ect a ce w th n the range of data you’re work ng w th (remember that the first row
must nc ude head ngs) and then choose Insert PivotTable Exce automat ca y determ nes that your
data s n the A1 F208 range

If you drag Month to the Rows zone, Country to the Columns zone, and Revenue to the Values
area, for examp e, you obta n the tota revenue each month by country A fie d you add to the Filters
zone (Product, for examp e) enab es you to fi ter your P votTab e by us ng va ues n that fie d By add-
ng Product to the Filters zone, you can v ew sa es of on y Ch p 1 by month for each country G ven

418  Chapter 43  Us ng P votTab es and s cers to descr be data


that you want to be ab e to show data for any comb nat on of country and product, you shou d add
Month to the Rows zone of the P votTab e and both Country and Product to the Filters zone Next,
drag Var, Revenue, and Budget to the Values zone You have now created the P votTab e that s
shown n F gure 43-38 (See the 1st Tab e worksheet )

FIGURE 43-38  Th s s a month y summary of revenue, budget, and var ance.

For examp e, n January, tota revenue was $87,534, and tota budgeted sa es were $91,831, so
actua sa es fe $4,297 short of the forecast

You want to determ ne the percentage of revenue earned dur ng each month Aga n, drag
Revenue from the fie d st to the Values area of the P votTab e R ght-c ck n th s va ue co umn and
then choose Value Field Settings In the Value Field Settings d a og box, c ck Show Values As In
the Show Values As st, se ect % Of Column and rename th s fie d as Sum Of Revenue2, as shown
n F gure 43-39

You now obta n the P votTab e shown n F gure 43-40 (See the 2nd Tab e worksheet ) January sa es
prov ded 8 53 percent of revenue Tota revenue for the year was $1,026,278

Us ng P votTab es and s cers to descr be data  Chapter 43   419


FIGURE 43-39  Create each month s percentage of annua revenue.

FIGURE 43-40  Th s s the month y revenue breakdown.

420  Chapter 43  Us ng P votTab es and s cers to descr be data


Instead of us ng Va ue F e ds Sett ngs to change the d sp ay of a data fie d, you may change the
way a Va ues fie d s d sp ayed by r ght-c ck ng a va ue ce and se ect ng Show Values As

What is a calculated field?

Now you want to determ ne for each month the var ance as a percentage of tota sa es To do th s,
you can create a calculated field Se ect a ce anywhere w th n the data area of the P votTab e and
then choose Fields Items and Sets from the Analyze tab Choose Calculated Field to open the
Insert Calculated Field d a og box As shown n F gure 43-41, enter a name for your fie d and then
enter your formu a The formu a for th s examp e s =Var/Budget You can enter the formu a yourse f
or use the st of fie ds and the Insert Field button to add a fie d to the formu a After c ck ng Add
and then OK, you see the P votTab e shown n F gure 43-42 (See the Ca c F e d worksheet of the
Ptab eexamp e x sx fi e )

FIGURE 43-41  Create a ca cu ated fie d.

Us ng P votTab es and s cers to descr be data  Chapter 43   421


FIGURE 43-42  Th s shows the P votTab e w th ca cu ated fie d for var ance percentage.

Thus, n January, sa es were 4 7 percent ower than budgeted By open ng the Insert Calculated
Field d a og box aga n, you can mod fy or de ete a ca cu ated fie d

How can I use a report filter or slicer?

To see sa es of Ch p 2 n France, for examp e, you can se ect the appropr ate va ues from the Product
and Country fie ds n the Filters zone W th Ch p 2 and France se ected, you wou d see the P votTab e
shown n F gure 43-43 F gure 43-44 shows how to create the same tab e w th s cers (see the S cers
worksheet)

FIGURE 43-43  Th s figure shows sa es of Ch p 2 n France.

In the S cers worksheet, S cers was used to create the same tab e You can c ck n the P votTab e
and se ect Slicers from the Insert tab Create the s cers shown n F gure 43-44 by se ect ng the
Product and Country fie ds Se ect ng Ch p 2 from the Product s cer and France from the Country

422  Chapter 43  Us ng P votTab es and s cers to descr be data


s cer y e ds the re evant computat ons for a transact ons nvo v ng Ch p 2 n France As was prev -
ous y ment oned, you can a so create a s cer by r ght-c ck ng the fie d n the Fields st

FIGURE 43-44  Th s figure shows sa es of Ch p 2 n France w th s cers.

How can I group items in a PivotTable?

Often, you want to group head ngs n a P votTab e For examp e, you m ght want to comb ne sa es for
January to March To create a group, se ect the tems you want to group, r ght-c ck the se ect on, and
then choose Group And Show Detail, Group After chang ng the name Group 1 to Jan-March and
de et ng Month from the Row Labels sect on of the PivotTable d a og box, you obta n the P votTab e
shown n F gure 43-45

Us ng P votTab es and s cers to descr be data  Chapter 43   423


FIGURE 43-45  Group ng tems for January, February, and March.

Remarks about grouping


Fo ow ng are some further ns ghts about us ng group ng n Exce

■ You can d sband a group by se ect ng Group And Show Detail and then Ungroup

■ You can group nonadjacent se ect ons by ho d ng down the Ctr key wh e you se ect nonadja-
cent rows or co umns

■ W th numer ca va ues or dates n a row fie d, you can group by number or dates n arb -
trary nterva s For examp e, you can create groups for age ranges and then find the average
ncome for a 25–34-year-o ds

What is a calculated item?

A ca cu ated tem works just ke a ca cu ated fie d except that you are creat ng one row rather than a
co umn To create a ca cu ated tem, you shou d se ect an tem n the row area of the P votTab e, not
an tem n the body of the P votTab e Then, on the Analyze tab, se ect Fields Items and Sets, fo -
owed by Calculated Item

To ustrate how to create a Ca cu ated Item, ook at the Ca cu ated tem x sx fi e In the worksheet
data (see F gure 43-46), you have sa es of d fferent car brands You wou d ke to summar ze tota sa es
by the company’s country (Japan, Germany, or Un ted States)

424  Chapter 43  Us ng P votTab es and s cers to descr be data


FIGURE 43-46  Th s s the data for creat ng a ca cu ated fie d.

To beg n, create a P votTab e st ng tota sa es by country (see worksheet PT1) Drag Brand to the
Rows zone and Sales to the Values zone You now obta n the P votTab e shown n F gure 43-47

FIGURE 43-47  The P votTab e s summar z ng sa es by brand.

Us ng P votTab es and s cers to descr be data  Chapter 43   425


Before creat ng a ca cu ated tem, t s a good dea to h de the Grand Tota by se ect ng Grand
Totals from the Design Tab and se ect ng Off for Rows and Columns Otherw se, after you create
the ca cu ated tem, the Grand Tota s w doub e-count each car

To create a ca cu ated tem for Japan, put your cursor anywhere n the Row Labels Column of the
P votTab e and then se ect Fields Items and Sets from the Analyze tab After se ect ng Calculated
Item, fi n the d a og box as shown n F gure 43-48 and se ect OK

FIGURE 43-48  Create a ca cu ated tem for Japan.

Th s d a og box creates a ca cu ated tem for Japan by add ng together Honda and N ssan sa es
In a s m ar fash on, you can create ca cu ated fie ds that summar ze sa es n Germany and the Un ted
States The resu t ng P votTab e s n worksheet Ca c Item and s shown n F gure 43-49

If you want to de ete a ca cu ated tem or ca cu ated fie d, se ect Calculated Item or Calculated
Field from Fields Items and Sets From the Name sect on of the d a og box, se ect the fie d or tem
you w sh to de ete and se ect Delete

426  Chapter 43  Us ng P votTab es and s cers to descr be data


FIGURE 43-49  Th s s a st of ca cu ated tems.

If you des re, you may h de the nd v dua brand sa es by fi ter ng on the row abe s and se ect ng
just Japan, Germany, and Un ted States

See prob em 11 n the “Prob ems” sect on of th s chapter for an examp e of creat ng a ca cu ated
tem In the ch p manufactur ng P votTab e examp e, you cou d not create a ca cu ated tem because
you had mu t p e cop es of the Revenue fie d

What is “drilling down”?

“Dr ng down” s doub e-c ck ng a ce n a P votTab e to d sp ay a the deta ed data that’s summa-
r zed n that fie d For examp e, doub e-c ck ng any March entry n the m croch p scenar o d sp ays the
data that’s re ated to March sa es

I often have to use specific data in a PivotTable to determine profit, such as the April sales
in France of Chip 1. Unfortunately, this data moves around when new fields are added to my
PivotTable. Does Excel have a function that enables me always to extract April’s Chip 1 sales in
France from the PivotTable?

Yes, there s such a funct on The GETPIVOTDATA funct on fi s the b Suppose that you want to
extract sa es of Ch p 1 n France dur ng Apr from the P votTab e conta ned n the Data worksheet n
the Getp votdata x sx fi e (See F gure 43-50 ) Enter ng the GETPIVOTDATA(A4,”Apr France Ch p 1
Sum of Revenue”) formu a n ce E2 y e ds the correct va ue ($37,600) even f add t ona products,
countr es, and months are added to the P votTab e ater You can a so determ ne the resu t ng revenue
by po nt ng to the ce conta n ng Ch p 1 Apr sa es n France (ce D26)

The first argument for th s funct on s n the ce n the upper- eft corner of the P votTab e (ce A4)
You enc ose the P votTab e head ngs n quotat on marks (separated by spaces) that define the entry
you want The ast entry must spec fy the data fie d, but other head ngs can be sted n any order

Us ng P votTab es and s cers to descr be data  Chapter 43   427


Thus, the formu a here means “For the P votTab e whose upper- eft corner s n ce A4, find the Sum
of Revenue for Ch p 1 n France dur ng Apr ” Th s formu a returns the correct answer even f the sa es
data for Ch p 1 n France n Apr moves to a d fferent ocat on n the P votTab e

FIGURE 43-50  Use the GETPIVOTDATA funct on to ocate Apr Ch p 1 Sa es n France.

If you want s mp y to return tota revenue ($1,026,278), you can enter the GETPIVOTDATA(A4,”Sum
of Revenue”) formu a (see ce F2)

To see the true power of the GETPIVOTDATA funct on, suppose you want to summar ze sa es of
each product by country for each month of the year n a n ce tab e as shown n F gure 43-51

FIGURE 43-51 Use GETPIVOTDATA to extract Apr sa es of each product n each country.

428  Chapter 43  Us ng P votTab es and s cers to descr be data


To beg n, create a drop-down box enab ng you to enter the month of the year n ce J9 Enter
the countr es n I13 I15 and the products n J12 L12 In ce J13, copy your prev ous GETPIVOTDATA
formu a from E2 and ed t t to become =IFERROR(GETPIVOTDATA(“Sum of Revenue”,$A$4,”Month”,$
J$9,”Product”,J$12,”Country”,$I13),0) Copy ng th s formu a from J13 to J13 L15 pu s the sa es of each
product dur ng Apr from the P votTab e As you copy across, the product pu s changes, and as you
copy down, the country pu s changes In each ce , the chosen month s pu ed from ce J9 The use of
the IFERROR funct on ensures that f no sa es of a product occurred n a country dur ng the se ected
month, you return a 0 nstead of an error message Imag ne how usefu th s tr ck wou d be f you so d
1000 products n 200 countr es and reg ons!

Often, the GETPIVOTDATA funct on s a nu sance In these cases, you can turn off the opt on to
use t Suppose you want to refer to data n ce s B5 B11 from a P votTab e e sewhere n your work-
book You wou d probab y use the =B5 formu a and copy t to the B6 B11 range Hopefu y, th s
wou d extract B6, B7, , B11 to the ce s you want Unfortunate y, f the GETPIVOTDATA opt on s
act ve, you get a bunch of GETPIVOTDATA funct ons that refer to the same ce If you want to turn off
GETPIVOTDATA, c ck the File tab and then c ck Options Se ect Formulas and, under Working With
Formulas, c ear the GetPivotData Function For PivotTable References check box Th s ensures
that c ck ng ns de a P votTab e y e ds a formu a ke =B5 rather than a GETPIVOTDATA funct on You
can a so turn off GetP votData n a part cu ar P votTab e by se ect ng PivotTable from the Analyze
tab Se ect Options and, from the drop-down st, c ear Generate GetPivotData

F na y, note that you can a so comb ne the MATCH and OFFSET funct ons (exp a ned n Chapter 4,
“MATCH funct on,” and Chapter 21, “The OFFSET funct on,” respect ve y) to extract var ous P votTab e
entr es

How can I use the new Excel 2013 Timeline feature to summarize data during different time
periods?

Exce 2013 ntroduces a wonderfu new feature, T me ne, that enab es you to fi ter your P votTab e
eas y based on t me per ods Assum ng that your data has a co umn conta n ng actua dates, you
can se ect any subset of consecut ve ca endar years, quarters, months, or days n your data, and the
T me ne feature ensures that a P votTab e ca cu at ons nc ude on y spreadsheet rows from the
se ected per od

To ustrate the use of the T me ne feature, ook at the Makeupt me ne x sx workbook In the
worksheet data, the fo ow ng nformat on s sted for 1900 makeup transact ons Sa esperson,
Product, Date, Un ts, and Revenue In the worksheet P vot Tab e, you see a P votTab e that summa-
r zes sa es of each product by each sa esperson After c ck ng anywhere n the P votTab e, c ck the
Insert tab on the r bbon and se ect Timeline from the Filters group You see the t me ne shown n
F gure 43-52

Us ng P votTab es and s cers to descr be data  Chapter 43   429


FIGURE 43-52  Th s s the t me ne for Makeup data.

By us ng the Sh ft key, you can se ect adjacent quarters that can be used to summar ze sa es For
examp e, the T me ne worksheet (see F gure 43-53) summar zes sa es dur ng 2004 and the first two
quarters of 2005 C ck ng the funne restores a P votTab e based on a data

FIGURE 43-53  Th s t me ne summar zes sa es for 2004 and first two quarters of 2005.

430  Chapter 43  Us ng P votTab es and s cers to descr be data


How I can use a PivotTable to summarize total sales to date during a year?

Us ng Value Field Settings makes t easy to summar ze tota sa es to date dur ng a year To ustrate
th s, ook at the MonthtoMonth x sx fi e The Data worksheet conta ns the Month, Year, and Amount
for a number of sa es transact ons To beg n, n the Year to Date worksheet, summar ze month y sa es
for each year by dragg ng Month to the Rows area, Year to the Columns area, and Revenues to the
Values area Th s y e ds the P votTab e shown n F gure 43-54

FIGURE 43-54  Th s s a summary of sa es by month and year.

Th s figure shows a sa es summary broken down by month and year From anywhere n the
P votTab e, r ght-c ck and se ect Value Field Settings and Show Values As and choose Running
Total In Se ect Month The resu t ng P votTab e, shown n F gure 43-55 (see worksheet Year to Date),
shows the sa es for each month for the g ven year through that month For examp e, sa es through
February 2010 were $58,449 You may a so create the runn ng tota s by r ght-c ck ng any va ues ce
and choos ng Show Values As

Us ng P votTab es and s cers to descr be data  Chapter 43   431


FIGURE 43-55  Here are year to date sa es tota s.

How can I use a PivotTable to summarize sales this month compared to the same month a
year earlier?

Aga n, you w use the data n the Month to Month workbook In the Prev ous Year worksheet, cre-
ate a P votTab e by dragg ng Month to the Row area, Year to the Column area, and Sales to the
Values area After r ght-c ck ng anywhere n the P votTab e and se ect ng Value Field Settings,
fi ng n the d a og box as shown n F gure 43-56 creates the P votTab e shown n F gure 43-57 Here
you see how sa es dur ng each month compare to the same month n the prev ous year For examp e,
January 2010 sa es ncreased 704 15 percent over January 2009 sa es Aga n, you can a so change the
d sp ay of sa es from actua sa es to compar ng a month to the same month dur ng the prev ous year
by r ght-c ck ng a va ues ce and se ect ng Show Values As

432  Chapter 43  Us ng P votTab es and s cers to descr be data


FIGURE 43-56  These are the sett ngs needed to compare a month to the same month n the prev ous year.

FIGURE 43-57  Compar son of sa es to the same month dur ng the prev ous year.

Us ng P votTab es and s cers to descr be data  Chapter 43   433


How can I create a PivotTable based on data in several locations?

Often, the data needed to create a P votTab e can e n d fferent worksheets or d fferent workbooks
The key to creat ng a P votTab e from data n d fferent ocat ons s to press ALT+D+P and open the
c ass c PivotTable And PivotChart Wizard, shown n F gure 43-58

FIGURE 43-58  Th s s the c ass c P votTab e and P votChart W zard open ng page.

To ustrate how to create a P votTab e based on data n d fferent ranges, open the East and West
fi es and, through View Arrange Tiled, d sp ay them s de by s de as shown n F gure 43-59 Th s data
represents January, February, and March sa es n the East and West You want to produce a P votTab e
that summar zes tota sa es of each product dur ng each month

434  Chapter 43  Us ng P votTab es and s cers to descr be data


FIGURE 43-59  Two fi es w be summar zed w th a P votTab e.

To beg n, press ALT+D+P and se ect Multiple Consolidation Ranges, as shown n F gure 43-58
After se ect ng Next, se ect Create A Single Page Field For Me and, from Step 2b of the PivotTable
and PivotChart Wizard, se ect, as shown n F gure 43-60, the East sa es data and c ck Add to add t
to the range of data that w be used to create your P votTab e

FIGURE 43-60  Add the East data.

C ear the East data from the Range port on of the page; se ect the West data and add th s data
to the All Ranges sect on After c ck ng Next, you can dec de whether to p ace the fina P votTab e
n a new worksheet or the current worksheet A new worksheet has been chosen here After se ect ng
Finish, you obta n the P votTab e (see F gure 43-61) n the PT worksheet of West x sx workbook

Us ng P votTab es and s cers to descr be data  Chapter 43   435


FIGURE 43-61  Th s P votTab e s summar z ng East and West sa es.

You find, for examp e, that tota sa es of Product A n February were 1317 You can fi ter on the
products by se ect ng the drop-down arrow n ce A4 and fi ter on the months by us ng the drop-
down arrow n ce B3 The drop-down arrow n ce B1 enab es you to fi ter the P votTab e so on y
East or West sa es data s used Refresh updates the P votTab e based on data changes S cers and
t me nes do not work w th a P votTab e created from Multiple Ranges

If you do not ke the ALT+D+P comb nat on, you can add the PivotTable And PivotChart Wizard
to the Quick Access too bar by se ect ng File, Options, Quick Access Toolbar, and Commands Not
on the Ribbon and then se ect ng PivotTable and PivotChart Wizard

To create a P votTab e from mu t p e ranges, the head ngs ( n th s case, January, February, and
March) n each range must be dent ca Chapter 44 d scusses a new feature n Exce 2013, the Data
Mode , wh ch enab es you to create P votTab es even when a head ng from one source range occurs
n none of the other source ranges

How can I create a PivotTable based on an already created PivotTable?

Often, you want to create a P votTab e based on an a ready created P votTab e Th s enab es you to
v ew severa P votTab es based on the same data For examp e, a summary of makeup sa es w th each
sa esperson’s name sted go ng down and product sted go ng across was created n the T ­ me ne ­x sx
workbook (as shown n F gure 43-52) Suppose you a so want to create a P votTab e w th product
sted go ng down and sa esperson go ng across W th the cursor n the P votTab e worksheet of work-
book Makeupt me ne x s, press ALT+D+P to open the PivotTable And PivotChart Wizard Choose
Another PivotTable or PivotChart Report Choose the P votTab e from wh ch you w sh to bu d
your new tab e The or g na P votTab e has been chosen P votTab e10 Now the F e d st appears, and
you can create a new P votTab e w thout d sturb ng your o d tab e Product has been put n the Row
area, Name n the Co umn area, and Do ars n the Va ues area Th s creates the P votTab e shown n
F gure 43-62

436  Chapter 43  Us ng P votTab es and s cers to descr be data


FIGURE 43-62  Here s a P votTab e based on another P votTab e.

Problems
1. Contoso, Ltd produces m croch ps F ve types of defects ( abe ed 1–5) have been known to
occur Ch ps are manufactured by two operators (A and B), us ng four mach nes (1–4) You
are g ven data about a samp e of defect ve ch ps, nc ud ng the type of defect, the operator,
mach ne number, and day of the week the defect occurred Use th s data to chart a course of
act on that wou d ead, as qu ck y as poss b e, to mproved product qua ty You shou d use
a P votTab e to strat fy the defects w th respect to type of defect, day of the week, mach ne
used, and operator work ng You m ght even want to break down the data by mach ne, opera-
tor, and so on Assume that each operator and mach ne made an equa number of products
You’ find th s data n the Contoso x sx fi e

2. You own a fast-food restaurant and have done some market research n an attempt to under-
stand your customers better For a random samp e of customers, you are g ven the ncome,
gender, and number of days per week that res dents go out for fast food Use th s nformat on
to determ ne how gender and ncome nfluence the frequency w th wh ch a person goes out
to eat fast food The data s n the McDona ds x sx fi e

3. Students at the Schoo of F ne Art app y to study e ther Eng sh or Sc ence You have been
ass gned to determ ne whether the Schoo of F ne Art d scr m nates aga nst women n adm t-
t ng students to the schoo of the r cho ce You are g ven the fo ow ng data on the Schoo of
F ne Art’s students

• Fema e or ma e
• Major app ed for Eng sh (Eng) or Sc ence (Sc )

• Adm t? Yes or No
Assum ng that women are as qua fied for each major as men are, does th s data nd cate that
the co ege d scr m nates aga nst women? Be sure you use a ava ab e nformat on The data s
n the F nearts x sx fi e

4. You have been ass gned to eva uate the qua ty of care g ven to heart attack pat ents at
Emergency Room (ER) and Ch cago Hope (CH) For the past month, you are g ven the fo ow-
ng pat ent data

Us ng P votTab es and s cers to descr be data  Chapter 43   437


• Hosp ta (ER or CH)
• R sk category (h gh or ow) H gh-r sk peop e are ess ke y to surv ve than ow-r sk peop e

• Pat ent outcome ( ve or d e)


Use th s data to determ ne wh ch hosp ta s do ng a better job of car ng for heart attack
pat ents H nt Use a the data The data s n the Hosp ta x sx fi e

5. You are g ven the month y eve of the Dow Jones Index for years 1947 to 1992 Does th s
data nd cate any unusua seasona patterns n stock returns? H nt You can extract the month
(January, February, and so on) by us ng the TEXT(A4,”mmm”) formu a cop ed to any co umn
The data s n the Dow x sx fi e

6. The Makeupdb x sx fi e conta ns nformat on about the sa es of makeup products For each
transact on, you are g ven the fo ow ng nformat on

• Name of sa esperson
• Date of sa e
• Product so d
• Un ts so d
• Transact on revenue
Create a P votTab e to comp e the fo ow ng nformat on

• The number of sa es transact ons for each sa esperson


• For each sa esperson, the tota revenue by product
• Us ng your answer to the prev ous quest on, create a funct on that a ways y e ds Jen’s p-
st ck sa es

• Tota revenue generated by each sa esperson broken down by ocat on

• Tota revenue by sa esperson and year (H nt You need to group the data by year )

7. For years 1985 to 1992, you are g ven month y nterest rates on bonds that pay money
one year after the day they’re bought It’s often suggested that nterest rates are more
vo at e—tend to change more—when nterest rates are h gh Does the data n the Intratevo -
vo at ty x sx fi e support th s statement? (H nt P votTab es can d sp ay standard dev at ons )

8. For the grocery examp e, prepare a chart that summar zes the trend over t me of the sa es at
each store

9. For the grocery examp e, create a ca cu ate fie d that computes an average per un t pr ce
rece ved for each product

10. For the grocery examp e, create a P votChart that summar zes the sa es of each product at
each store for years 2005 and 2006

438  Chapter 43  Us ng P votTab es and s cers to descr be data


11. For the data n the Ca c temdata x sx fi e, create ca cu ated tems that summar ze sa es of des-
sert (cakes + pudd ngs) and fru ts (app es + grapes)

12. In the ch p P votTab e examp e, create a P votTab e that summar zes month y sa es of Ch ps 1
and 3 n France and the Un ted States

13. In the customer P votTab e examp e, show the top 15 customers n one tab e and the bottom
5 customers n another tab e

14. The Ptab epartsdata x sx fi e conta ns sa es of var ous parts Each part code beg ns w th e ther
Part (for computer part) or Comp (for computer) Create a P votTab e that shows on y sa es of
Parts (H nt Use a abe s fi ter )

15. For the data n prob em 14, summar ze the tota sa es of parts and computers

16. The C garettedata x sx fi e conta ns the age of a samp e of Amer cans, whether they smoke
c garettes or c gars, and whether they d ed dur ng the current year What can you conc ude
from th s data?

17. The Co egedata x sx fi e te s you the fo ow ng nformat on about students who app ed to
graduate schoo at Ke ey Un vers ty gender, des red major, whether accepted or rejected If
you construct the appropr ate P votTab e, you w find fewer women are accepted than men
are Do you th nk Ke ey d scr m nates aga nst women?

18. The Ana yzeSurveydata x sx fi e conta ns answers on a 1–7 sca e to var ous quest ons on a
teach ng eva uat on survey Create a P votChart that charts the fract on of the t me each va ue
1–7 occurs for each quest on F ter the chart to show the breakdown for any set of three ques-
t ons you choose

19. Us ng the data n the MonthtoMonth x sx fi e, create a P votTab e that shows how each
month’s sa es d ffers from the prev ous month for the year 2010

Us ng P votTab es and s cers to descr be data  Chapter 43   439


CHAPTER 44

The Data Model

Questions answered in this chapter:


■ What s the Data Mode feature and why do I need to earn about t?

■ How can I add data to the Data Mode ?

■ How can I create re at onsh ps w th n the Data Mode ?

■ How can I use the Data Mode to create P votTab es?

■ How does the Qu ck Exp ore opt on work?

■ How can I add new data to a Data Mode ?

■ How can I remove data from the Data Mode ?

■ How can I use the Data Mode to create a new P votTab e?

■ How can I ed t or de ete re at onsh ps?

■ How does the DISTINCT COUNT funct on work?

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

What is the Data Model feature and why do I need to learn about it?

The Data Mode feature s new n Exce 2013 (It was an add- n n Exce 2010 ) The Data Mode
prov des an easy way to oad data beyond the ord nary capab t es of Exce 2013 (1,048,576 rows of
data) and use th s data to create P votTab es The Data Mode a so enab es you to comb ne data that
comes from sources outs de of Exce ( nc ud ng Access and SQL Server) w th data from Exce F na y,
an understand ng of the Data Mode w make t eas er for you to grasp the amaz ng capab t es of
PowerP vot (see Chapter 45, “PowerP vot”), wh ch s ava ab e f you have access to Exce 2013 Pro P us
or Office 365

In Chapter 43, “Us ng P votTab es and s cers to descr be data,” you earned how to use the Exce
P votTab e feature to summar ze data You saw how to create P votTab es based on data n d sparate
ocat ons, but th s approach requ red the data n each ocat on to have the same co umn head ngs

441

Th s s often not the case For examp e, the Datamode temp x sx workbook conta ns two worksheets
The Reps worksheet (shown on the eft n F gure 44-1) conta ns a st of sa espeop e ID numbers
and the state where they se your products The Sa es worksheet (shown on the r ght n F gure
44-1) shows un t sa es generated by each emp oyee Natura y, you wou d ke to use a P votTab e to
summar ze sa es by state The prob em s that the data n the Sa es worksheet does not know each
sa esperson’s state You cou d add a co umn by us ng VLOOKUP formu as to nsert the states n the
Sa es worksheet If you had severa hundred thousand rows of data, however, these VLOOKUPs wou d
great y s ow down your spreadsheet performance The Exce Data Mode enab es you to work around
the VLOOKUPs by eas y creat ng a re at onsh p that te s Exce the state for each sa esperson w thout
the need of s ow VLOOKUPs

Data must be nc uded n the Data Mode to create amaz ng graph cs w th Power V ew (See
Chapter 46, “Power V ew,” for a d scuss on of Power V ew ) F na y, f you want to mash up data from
d fferent sources such as databases, the web, text fi es, and Exce spreadsheets, you want to use
PowerP vot (d scussed n Chapter 45) When you understand the Data Mode , PowerP vot becomes
much eas er to understand Power V ew and PowerP vot are on y ava ab e f you have the Pro P us or
Office 365 ed t on of Exce 2013, but the Data Mode s nc uded n a ed t ons of Exce 2013

FIGURE 44-1  Th s s the data used n the Data Mode examp e.

How can I add data to the Data Model?

Before add ng any data to the Data Mode , you shou d make the data a tab e (see Chapter 25,
“Tab es”) F rst, se ect the data, nc ud ng co umn headers, n the Reps worksheet and use Ctr +T to
make the data a tab e From Tab e Too s, name the tab e Reps Then, as shown n F gure 44-2, se ect
PivotTable from the Insert tab and se ect the Add This Data To The Data Model check box Th s
ensures that the data n the Reps worksheet s nc uded n the Data Mode In a s m ar fash on, se ect
the data n the Sa es worksheet and name the tab e Sales Add the Sa es tab e to the Data Mode

442  Chapter 44  The Data Mode


FIGURE 44-2  Add data to the Data Mode .

How can I create relationships within the Data Model?

If you want to summar ze sa es by state, you have a prob em At present, there s no way for Exce
to know each sa esperson’s state Somehow, you need to create a re at onsh p that enab es Exce to
determ ne the state for each row of data n the Sa es tab e After add ng the Sa es tab e to the Data
Mode , you can create the needed re at onsh p by se ect ng Relationships from the Data tab After
c ck ng Relationships, se ect ng New opens the Create Relationship d a og box shown n F gure
44-3 The Pr mary Co umn must be the co umn of data that nvo ves a one-to-one re at onsh p that
can be mapped nto the Fore gn Co umn Because the Reps tab e has a state for each sa es rep n your
examp e, the Pr mary Co umn must be the ID co umn n the Reps tab e Make the Fore gn Co umn
the ID co umn from the Sa es tab e These sett ngs are shown n F gure 44-3 Now f you try to create
a P votTab e that summar zes sa es by state, you w be fine because, for each ID number n the Sa es
tab e, Exce w know to pu the correct state from the Reps tab e

The Data Mode   Chapter 44   443


FIGURE 44-3  Create a re at onsh p between the tab es.

How can I use the Data Model to create PivotTables?

After add ng the Sales tab e to the Data Mode , you see PivotTable Fields After se ect ng All, you
see a tab es added to the Data Mode , as shown n F gure 44-4

FIGURE 44-4  Th s s the fie d st for the Data Mode examp e.

444  Chapter 44  The Data Mode


After c ck ng the tr ang es to the eft of the Reps and Sa es tab es, you see a co umns from the
Reps and Sa es tab es To create a P votTab e that computes tota sa es n each state, drag States to
the Rows zone and Sales to the Values zone, as shown n F gure 44-5 You obta n the P votTab e
shown n F gure 44-6

FIGURE 44-5  Th s s the creat on of the P votTab e to determ ne sa es n each state.

For examp e, 10,846 un ts were so d n A aska; 24,147 un ts were so d n Georg a, and so on

If you had tr ed to create the P votTab e before creat ng the re at onsh p shown n F gure 44-3,
Exce wou d have had no way to figure out the state for each row of the Sa es tab e Exce wou d have
therefore prompted you to create the needed re at onsh p

The Data Mode   Chapter 44   445


FIGURE 44-6  Th s figure shows the un t sa es n each state.

How does the Quick Explore option work?

If you c ck the tota sa es for any state (A aska here) you see the Qu ck Exp ore Icon shown n F gure
44-7 C ck ng the drop-down arrow to the r ght of the con opens the box shown n F gure 44-8
Qu ck Exp ore suggests dr ng down by ID C ck ng Drill To ID shows the sa es for a sa espeop e
assoc ated w th A aska sa es (see F gure 44-9)

FIGURE 44-7  Th s s what the Qu ck Exp ore con ooks ke.

446  Chapter 44  The Data Mode


FIGURE 44-8  Qu ck Exp ore suggests dr ng down to Sa esperson D.

FIGURE 44-9  Th s figure shows A aska sa espeop e and sa es.

How can I add new data to a Data Model?

If you want to add a new set of data to the Data Mode , make the data a tab e and se ect Insert
PivotTable You can se ect Add This Data To Data Model and, f you se ect All ( nstead of Act ve),
you can now use the new data n your P votTab e

You may a so add a new y created Exce Tab e to a Data Mode by c ck ng the Data tab on the r b-
bon and se ect ng Connections The Workbook Connections d a og box opens After se ect ng Add,
the Existing Connections d a og box opens After choos ng Tables, you can add your new tab e to
the Data Mode

If add ng new data means add ng new rows to tab es a ready nc uded n the Data Mode , se ect
Refresh from the Workbook Connections d a og box after se ect ng Connections from the Data
tab to ensure that your P votTab es w update to nc ude the new data

The Data Mode   Chapter 44   447


How can I remove data from a Data Model?

To remove data from a Data Mode , c ck the Data tab on the r bbon and then se ect Connections
As shown n F gure 44-10, you can se ect a Tab e (Reps s se ected) and choose Remove to remove the
tab e from the Data Mode

How can I use the Data Model to create a new PivotTable?

To use ex st ng data to create a new P votTab e, proceed as fo ows

1. Open the Create PivotTable d a og box by se ect ng PivotTable from the Insert tab

2. Se ect Use An External Data Source and then se ect Choose Connection

3. From the Existing Connections tab, se ect Tables and then choose Tables In Workbook
Data Model You see the d a og box shown n F gure 44-11

4. If you now se ect Open, you are returned to the Create PivotTable d a og box, and you can
now create a P votTab e

FIGURE 44-10  The Workbook Connect ons d a og box s set to remove the Reps tab e from the Data Mode .

448  Chapter 44  The Data Mode


FIGURE 44-11  Sa es and Reps tab es are now ava ab e for a P votTab e.

How can I edit or delete relationships?

To ed t or de ete re at onsh ps, se ect Relationships from the Data too s group on the Data tab Th s
opens the Manage Relationships d a og box shown n F gure 44-12 From th s d a og box, you can
ed t or de ete re at onsh ps or create new re at onsh ps

The Data Mode   Chapter 44   449


FIGURE 44-12  Th s s the Manage Re at onsh ps d a og box.

How does the DISTINCT COUNT function work?

In the DISTINCTCOUNTemp x sx fi e, you are g ven (as shown n F gure 44-13) a st of ath etes (1–100)
and sa ary payments rece ved Because many ath etes rece ved more than one payment, they occur
more than once on the st You are a so g ven the sport each ath ete p ays Suppose you want to
determ ne how many ath etes p ayed each sport F rst, make the data n E3 F466 a tab e named
Money and the data n the K6 L106 range a tab e named Activity; add each tab e to the Data Mode
Create a re at onsh p w th the pr mary key as Person n the Act v ty tab e and the fore gn key as
Person n the Money tab e Create a P votTab e (see the Count of Person worksheet) by dragg ng
Sport to the Row zone and dragg ng Person from the Money tab e to the Values zone Th s y e ds
the P votTab e shown n F gure 44-14 Because there are on y 100 ath etes, you see that each person
s counted mu t p e t mes To fix th s prob em, r ght-c ck any va ue ce n the P votTab e and choose
Value Field Settings If you scro to the bottom, you find, as shown n F gure 44-15, that the ast
(but not east!) cho ce s D st nct Count Th s cho ce ensures that each ath ete s counted on y once
and y e ds the P votTab e shown n F gure 44-16 and worksheet D st nct Count Th s P votTab e shows
exact y how many ath etes p ay each sport!

450  Chapter 44  The Data Mode


FIGURE 44-13  Th s s the data for the D ST NCT COUNT examp e.

FIGURE 44-14  Th s P votTab e counts each ath ete mu t p e t mes.

The Data Mode   Chapter 44   451


FIGURE 44-15  Choose D st nct Count to obta n a un que st of the number of ath etes p ay ng each sport.

FIGURE 44-16  Th s s the d st nct count of how many ath etes p ay each sport.

452  Chapter 44  The Data Mode


Problems
TheFaberu x sx fi e conta ns sa ar es, trave expenses, Facu ty ID, Department code, and Facu ty code
for a bus ness schoo facu ty Use th s data to answer the fo ow ng quest ons (No VLOOKUPS
a owed!)

1. Use the Data Mode to create a P votTab e that g ves average sa ary broken down by
department

2. Use the Data Mode to create a P votTab e that g ves average sa ary broken down by type of
facu ty member and department

3. Use the Data Mode to create a P votTab e that g ves average trave expenses by departments

The Data Mode   Chapter 44   453


CHAPTER 45

PowerPivot

Questions answered in this chapter:


■ How can I oad data nto PowerP vot?

■ How can I use PowerP vot to create a P votTab e?

■ How can I use s cers w th PowerP vot?

■ What are DAX funct ons?

M crosoft PowerP vot was first ntroduced as a down oadab e add- n for Exce 2010 If you have
Exce  2013 Pro P us or Office 365, PowerP vot for Exce s ava ab e to you PowerP vot for M crosoft
Exce 2013 s an add- n that enab es you to

■ Store and query arge vo umes of data (th nk hundreds of m ons of rows) effic ent y that you
can comb ne from mu t p e data sources and mu t p e data formats For examp e, some of your
data m ght come from a M crosoft Access database, some from a text fi e, some from severa
Exce fi es, and some from ve data mported from a webs te

■ Create ca cu ated co umns (beyond fie d defin t ons) For examp e, f each row of your source
data conta ned revenue and costs, you cou d create a ca cu ated co umn to compute Profit =
Revenue – Costs PowerP vot conta ns many DAX (Data Express on Language) funct ons that
fac tate the creat on of ca cu ated co umns

■ Create ca cu ated fie ds that aggregate data from d fferent rows For examp e, a ca cu ated
fie d cou d compute tota profit as the sum of profit from each transact on

■ Create KPIs (Key Performance Ind cators) that make t easy for an organ zat on to track per-
formance aga nst targets For examp e, a PowerP vot KPI cou d be used to determ ne for each
year and sa esperson how h s actua sa es compared to h s sa es quota

■ PowerP vot can be used as a data source for workbook reports (P votTab es, Charts, CUBE
funct ons, Power V ew, and so on) Power V ew s covered n Chapter 46, “Power V ew ”

■ PowerP vot reports can be pub shed to M crosoft SharePo nt to a ow automat c data refresh,
fac tate shar ng, and enab e IT mon tor ng When pub shed, t can be used as a data source
for other ana yt c and report ng exper ences (such as pub sh ng to SharePo nt, a dep oyment
process)

455

Th s chapter ntroduces PowerP vot For a more comp ete exp anat on of how PowerP vot works,
read Microsoft PowerPivot for Excel 2013: Give Your Data Meaning (M crosoft Press 2013) by Marco
Russo and A berto Ferrar

To enab e the PowerP vot add- n, se ect File from the r bbon Se ect Options fo owed by
Add-ins At the bottom of the Add-ins d a og box, se ect COM Add-ins and then c ck GO From
COM ­Add-ins, se ect Microsoft Office PowerPivot For Excel 2013 and c ck OK You now see a
PowerP vot tab on the r bbon

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

How can I load data into PowerPivot?

After you enab e PowerP vot, you see a PowerP vot tab on the r bbon C ck the PowerPivot tab and
c ck the Manage button to d sp ay the opt ons shown n F gure 45-1 After choos ng Home, you see
the Home tab shown n F gure 45-2

FIGURE 45-1  Th s figure shows the PowerP vot opt ons.

FIGURE 45-2  Th s figure shows the PowerP vot w ndow Home r bbon tab.

456  Chapter 45  PowerP vot


On the Home tab, you can mport data from mu t p e data sources and formats, for examp e

■ If you se ect From Database, PowerP vot oads data from an Access or SQL Server database

■ If you se ect From Report, PowerP vot oads data from a SQL Server Report ng Serv ces
report

■ If you se ect From Data Feeds, you can read data from a webs te that has an OData feed

■ For more nformat on on ODATA feeds, see http://mdn.microsoft.com/en-us/magazine


/ff714561.aspx

■ Choose Other Sources to oad data from a supported data sources, nc ud ng Exce fi es, text
fi es, and many other types of databases such as Orac e and Teradata

■ After mak ng Exce data nto a tab e, you can se ect Paste to nk the data to PowerP vot

To ustrate how to down oad data from mu t p e sources nto PowerP vot, use the Storesa es
txt text fi e, n wh ch s sted sa es transact ons from 20 stores A subset of the data s shown n
F gure 45-3

You can see that for each transact on, you are g ven the store number, the product so d, sa e date,
un ts so d, and revenue You want to summar ze th s data by state, but the state for each store s sted
n a d fferent fi e, States x sx The ocat on of each store s shown n F gure 45-4

FIGURE 45-3  Th s figure shows the sa es data to be oaded nto PowerP vot.

PowerP vot  Chapter 45   457


FIGURE 45-4  Th s figure shows the ocat on of each store by state.

You want to create a P votTab e that enab es you to s ce and d ce your data so that you can v ew
how you performed se ng each product n each state To beg n, c ck the PowerPivot tab and then
c ck Manage to open the PowerPivot w ndow See the Home tab shown n F gure 45-2 Because
you want to mport a text fi e, se ect From Text ( t s the ast cho ce) from From Other Sources
As shown n F gure 45-5, you can then browse to the Storesa es txt fi e You do not need to enter
anyth ng n the Fr end y connect on name sect on of the d a og box, but the PowerPivot Text File
name s chosen here Because the first row of data conta ns co umn headers, se ect Use First Row As
Column Headers In the Column Separator st, se ect Tab because the data fie ds n the text fi e s
tab de m ted C ck Finish and then Close to comp ete the process of mport ng the text fi e’s data
nto PowerP vot

458  Chapter 45  PowerP vot


FIGURE 45-5  Set up a text fi e mport for PowerP vot.

F gure 45-6 shows the resu t after the text data s mported nto PowerP vot A subset of the data
s shown At the bottom, you can see a tab nd cat ng that the source of the data s Storesa es txt The
tab s the tab e name, and you cou d have created a name dur ng the mport process

PowerP vot  Chapter 45   459


FIGURE 45-6  Th s s a subset of the data mported from Storesa es.txt.

Next, you want to mport the States x sx fi e so that you can re ate to the sa es data To mport
States x sx, return to Exce by c ck ng the Switch To Workbook Excel con n the upper- eft corner
(second con w th an X) of the PowerP vot r bbon Open the States x sx fi e and make the data a tab e
Copy the data you need Se ect Paste on the Home tab n PowerP vot (see F gure 45-2) The Paste
Preview d a og box shown n F gure 45-7 opens

460  Chapter 45  PowerP vot


FIGURE 45-7  Th s s the Paste Prev ew d a og box.

Se ect Use First Row As Column Headers and change the tab e name to States After c ck ng
OK, the data from States x sx s mported nto PowerP vot, as shown n F gure 45-8 Note that at the
bottom of the w ndow, a tab appears for each tab e that can be used to create reports

PowerP vot  Chapter 45   461


FIGURE 45-8  Data from two sources are now mported nto PowerP vot.

A ternat ve y, the data n the States x sx fi e cou d have been mported nto Exce by se ect ng
Excel File from From Other Sources and then brows ng to the States x sx fi e and se ect ng the
worksheet(s) you want to mport

Reca that you want to ana yze sa es n d fferent states The prob em s that, at present, PowerP vot
does not know that the st ng of store ocat ons from States x sx corresponds to the stores sted n
the text fi e To remedy th s prob em, you must create a re at onsh p between the two data sources
To create th s re at onsh p, you can c ck the Design r bbon tab n the PowerP vot w ndow (see
F gure 45-2), choose Create Relationship, and proceed as shown n Chapter 44, “The Data Mode ” It
s much eas er, however, to c ck Diagram View from the Home tab and define the needed re at on-
sh p by dragg ng (as shown n F gure 45-9) one co umn on top of another from the many-s de to the
one-s de

462  Chapter 45  PowerP vot


FIGURE 45-9  The re at onsh p d agram enab es you to nk stores between data sources.

To return to the data v ew, c ck the Data View con shown n F gure 45-2

How can I use PowerPivot to create a PivotTable?

Now you’re ready to use PowerP vot to summar ze your company’s sa es data through a P votTab e
For a d scuss on of other report types that PowerP vot supports, refer aga n to Ferrar and Russo
(2013) Se ect the Home tab n the PowerPivot w ndow and then se ect PivotTable The Create
PivotTable d a og box opens and prompts you to choose a new worksheet or a ocat on n the
current worksheet Choose a new worksheet The PowerPivot Fields d a og box opens, shown n
F gure 45-10

PowerP vot  Chapter 45   463


FIGURE 45-10  Th s figure shows the PowerP vot F e ds d a og box.

By c ck ng the tr ang es to the eft of the States and Storesa es tab es, you have access to a
co umns (now referred to as fie ds) of mported data The goa s to get a breakdown by state and
product of tota revenue and un ts so d To summar ze revenue and un ts so d, drag the Revenue and
Units fie ds to the Values zone Drag State to the Rows zone and Product to the Columns zone to
arrange PivotTable Fields as shown n F gure 45-11 Note that the fie ds used n the P votTab e are
se ected

464  Chapter 45  PowerP vot


FIGURE 45-11  Th s figure shows the ass gnment of fie ds to create a P votTab e report.

The port on of the P votTab e nvo v ng CDs, DVDs, and food s shown n F gure 45-12 As you can
see, 3,881 DVDs were so d n I no s (ILL) for a tota revenue of $2,295 76

FIGURE 45-12  Th s figure shows P votTab e break ng down product sa es by state.

PowerP vot  Chapter 45   465


How can I use slicers with PowerPivot?

In Chapter 43, “Us ng P votTab es and s cers to descr be data,” you earned how to use s cers to revea
deta s and d fferent perspect ves n your P votTab e ana yses Here, you create s cers that summa-
r ze the data for any subset of products and stores To do th s, you can r ght-c ck anywhere n your
P votTab e and se ect Slicers After choos ng Stores and Products, you see the resu t ng s cers shown
n F gure 45-13 (See the P votw ths cers x sx fi e ) From Slicer Tools, you can mod fy the appearance
of the s cers For examp e, you can mod fy the Stores s cer to have four co umns As descr bed n
Chapter 43, you can ho d down the Ctr key as you c ck to mu t se ect products, stores, or both A so,
the Sh ft key can be used to se ect any cont guous range from a s cer The P votTab e shown n F gure
45-13 g ves the tota revenue and un ts so d of books and food n Stores 7 through 11 Because Stores
7 through 11 are a n I no s or M ch gan, these are the on y states shown n the resu t ng P votTab e

FIGURE 45-13  Th s figure shows Product and Store s cers.

What are DAX functions?

Reca from Chapter 43 that you can generate new formu as n a P votTab e by us ng ca cu ated tems
or ca cu ated fie ds After your data s mported nto PowerP vot, you can use DAX formu a anguage
to create new ca cu ated co umns that make the data mode much more mean ngfu

Note  A full discussion of DAX is beyond the scope of this chapter. Microsoft PowerPivot for
Excel 2013: Give Your Data Meaning includes an excellent and complete discussion of the
DAX language.

466  Chapter 45  PowerP vot


To ustrate some DAX formu as, see how to create ca cu ated co umns to a ow ana ys s of year,
month, and day of the month To beg n, c ck the Storessales tab n the PowerP vot w ndow and
se ect the first b ank co umn C ck ng the fx button be ow the PowerPivot r bbon d sp ays a st
of DAX funct ons Many of these (such as YEAR, MONTH, and DAY) are based on Exce funct ons
Se ect ng the Date & Time category d sp ays the st of DAX funct ons shown n F gure 45-14 The
DAX anguage nc udes many other powerfu funct ons For examp e, the DISTINCT funct on can
return a tab e of d st nct va ues found n a co umn

FIGURE 45-14  Th s s a st ng of DAX funct ons.

To p ace the year, month, and day of the month for each transact on n a separate co umn, move to
the first ce of the first b ank co umn and type =YEAR(st Then you are prompted w th the co umns
from the Data Mode tab es that you can pass nto the YEAR funct on Se ect the Date co umn and
comp ete the =YEAR(storesa es[Date]) formu a The co umn s now popu ated w th the year of each
sa es transact on By r ght-c ck ng the co umn head ng, you can rename the co umn as Year In the
next co umn, compute the month of the year by enter ng the =MONTH(storesa es[Date]) formu a In
the next co umn, compute the day of the month w th the =DAY(storesa es[Date]) formu a By r ght-
c ck ng each co umn head ng, you can rename these co umns as Month and Day Of Month The
tab e w th the ca cu ated co umns s shown n F gure 45-15

PowerP vot  Chapter 45   467


FIGURE 45-15  Year, Month, and Day Of Month ca cu ated co umns are created w th DAX formu as.

Now you can create a var ety of nformat ve P votTab es For examp e, you can summar ze sa es n
each state by year (See Prob em 1 )

Problems
1. Summar ze tota sa es n each state by year

2. Summar ze tota revenue by store and create a s cer for stores

468  Chapter 45  PowerP vot


CHAPTER 46

Power View

Questions answered in this chapter:


■ How can I prepare data for Power V ew?

■ What k nd of charts can I create w th Power V ew?

■ How can I fi ter Power V ew charts?

■ How can I d sp ay sa es data by state or country?

■ How can I turn a t me ser es scatter chart nto an an mated exper ence?

■ How can I use Mu t p es to create many charts eas y?

If you have M crosoft Exce 2013 Pro P us or Office 365, Power V ew for Exce s ava ab e to you In th s
chapter, you earn the bas cs of how Power V ew can be used to create amaz ng charts and graph cs
Bas ca y, Power V ew creates a new sheet n your workbook that acts ke a b ank canvas on wh ch you
can create severa charts You can map sa es onto a US or wor d map and even turn a scatter chart of
US cr mes nto an exper ence that an mates the evo ut on of US cr mes over t me

To enab e the Power V ew add- n, se ect File from the r bbon At the bottom of the Add-ins d a og
box, se ect COM Add-ins and then c ck GO From COM Add-ins, se ect Microsoft Office Power
View For Excel 2013 and c ck OK If you c ck Insert on the r bbon, you see the Power V ew con
shown n F gure 46-1 On the Insert tab, c ck Power View n the Reports group (see F gure 46-1)
when you want to add a new Power V ew sheet If you have not a ready nsta ed and enab ed the
S ver ght add- n on your PC, you are prompted to do so It s a free down oad

FIGURE 46-1  Th s s a v ew of the r bbon after se ect ng nsert, nc ud ng the Power V ew con.

469

Answers to this chapter’s questions
Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

How can I prepare data for Power View?

To ready Exce data as the source data for a Power V ew report, se ect the data and nsert a new
Power V ew sheet Exce automat ca y adds the se ected range to the workbook data mode (see
Chapter 44, “The Data Mode ”) F gure 46-2 shows sa es data for an ced tea company (see fi e
Teasa es x sx) that w be used throughout th s chapter Each row g ves the year, state, product so d,
and un ts so d t s recommended to make a Exce data used as the source for Power V ew reports
nto Exce Tab es (see Chapter 25, “Tab es”) Th s ensures that new data s automat ca y nc uded n
Power V ew reports

If you se ect Get External Data from the Data tab on the r bbon, you can a so use externa data-
bases, text fi es, and webs tes as the source data for Power V ew reports

To get ready to create charts from th s data, se ect Power View from the Insert tab

FIGURE 46-2  Tea sa es data are used to ustrate Power V ew.

470  Chapter 46  Power V ew


You w see that a b ank Power V ew sheet s added to the workbook (see F gure 46-3), and Power
V ew F e ds (based on the Teasa es tab e) appears at the r ght of the report canvas C ck ng the tr -
ang e to the eft of Teasa es expands the tab e to d sp ay a fie ds n the Teasa es tab e

FIGURE 46-3  Th s s a b ank Power V ew sheet.

Suppose you want to create charts based on the year, un ts so d, and product so d After se ect ng
Year and Units (as shown n F gure 46-4), these fie ds appear n the Field zone C ck ng the drop-
down arrow to the r ght of Year changes the method of ca cu at on for Year to Do Not Summar ze
Otherw se, a rows hav ng the same year w be summed to obta n the entry n the Year co umn
After typ ng n a t t e (Tea Sales), you now have a report (see F gure 46-5) cons st ng of a s ng e tab e
that sts tota un ts so d for each year Now the tab e can be transformed nto other data v sua za-
t ons, nc ud ng charts

Power V ew  Chapter 46   471


FIGURE 46-4  Here are Year and Un ts added to the F e ds zone.

472  Chapter 46  Power V ew


FIGURE 46-5  Th s s the Year and Un ts tab e.

What kind of charts can I create with Power View?

If you c ck the Design tab, you see on the eft s de of the r bbon the Power V ew arsena of data v su-
a zat ons shown n F gure 46-6 Under Other Charts, you see L ne, Scatter, and P e charts The Map
opt on s exp a ned ater n th s chapter

FIGURE 46-6  These are the ava ab e Power V ew charts.

Beg n by exp or ng a Stacked Co umn chart to d sp ay tota un ts so d for each year Ensure that the
tab e s n focus (se ect t) and then, on the Design tab, se ect Stacked Column You may res ze the
chart by dragg ng the s des or corners of the chart, y e d ng the chart n F gure 46-7 and sheet Power
V ew 1 of Teasa escharts x sx

Add another chart to your canvas! Suppose you want to create a ne chart that shows un ts so d
each year of each product C ck a b ank port on of the canvas and then, n Power View Fields, se ect
Year, Units, and Products to create a tab e cons st ng of these three fie ds Use the Design tab to
transform the tab e nto the ne chart Th s resu ts n the charts shown n F gure 46-8

Power V ew  Chapter 46   473


FIGURE 46-7  Th s s a chart show ng tea sa es by year.

FIGURE 46-8  Th s figure shows two charts of Tea Sa es data.

How can I filter Power View charts?

In Chapter 43 through Chapter 45, you earned how to use s cers to fi ter P votTab es, the Data Mode ,
and PowerP vot mode s You now earn four ways to fi ter n Power V ew

■ F ters

■ S cers

■ F ter ng by Chart

■ T es

474  Chapter 46  Power V ew


If you hover ns de a chart or tab e, n the top-r ght corner, you see the F ter (a funne ) and
­ op-Out (or Pop-In) cons (the con w th the arrow to the r ght of the F ter con) C ck ng the P
P ­ op-Out
con makes the chart or tab e expand to fi the canvas C ck ng the con aga n makes the chart or
tab e pop n to revert t to ts or g na s ze

Hover ns de the chart n the Power V ew 2 worksheet of the Teasa es1 x sx fi e and c ck the F ter
con On the r ght of the screen (see F gure 46-10), fi ter the chart to show on y sa es through 2012

FIGURE 46-9  The F ter and Pop Out cons appear n the upper r ght port on of the tab e or chart.

FIGURE 46-10  Sa es are fi tered through 2012.

Power V ew  Chapter 46   475


A wonderfu feature of Power V ew s the fact that one chart can be used to fi ter a charts on a
Power V ew worksheet In the Power V ew 1 worksheet of the Teasa esfi terbycharts x sx workbook,
se ect 2008, 2010, and 2012 on the Units chart As shown n F gure 46-11, the Product chart s a so
fi tered to show on y sa es n 2008, 2010, and 2012 Se ect ng 2015 n the Units By Year chart restores
the unfi tered charts

FIGURE 46-11  Se ect ng 2008, 2010, and 2012 on Un ts By Year fi ters other charts.

You can a so fi ter a Power V ew Chart w th a s cer A s cer s created by first defin ng a s ng e co -
umn tab e and then transform ng t nto a s cer It then enab es nteract ve fi ter ng ns de the report
canvas, and that v sua y descr bes the fi ter se ect on the report uses In the PowerV ew 1 worksheet
of the Teasa ess cer x sx workbook (see F gure 46-12), use a s cer to fi ter annua un t sa es by product
to show on y B ack Tea and Peach Tea sa es To beg n, se ect a b ank area and create a new tab e con-
s st ng of the Product fie d You see a st of products On the Design tab, c ck Slicer To mu t se ect,
press the Ctr key to se ect B ack Tea and Peach Tea As shown n F gure 46-12, the s cer causes the
chart to show sa es resu ts for on y b ack and peach teas To c ear the fi ter, hover w th n the s cer and
c ck the Eraser con ocated n the top-r ght corner

476  Chapter 46  Power V ew


FIGURE 46-12  The s cer shows on y B ack Tea and Peach Tea sa es.

F na y, you can use T es to fi ter on one tem of a fie d at a t me In the Power V ew 1 worksheet
of the Teasa est es x sx workbook, create a t e that enab es you to zero n on each state To beg n,
create a tab e show ng years, states, and un ts Create a ne chart that shows sa es n each state dur ng
each year Th s chart s too busy, so add a t e on states by c ck ng the arrow to the r ght of States n
Power View Fields and se ect ng Add As Tile By The chart fi tered on the Ca forn a t e s shown n
F gure 46-13

Power V ew  Chapter 46   477


FIGURE 46-13  The t e s used to show annua Ca forn a sa es.

Any chart that s w th n the b ue nes s fi tered by the t e You can add add t ona v sua zat ons
w th n th s reg on to have them fi ter by the t e se ect on a so

How can I display sales data by state or country?

In the Teasa esmap x sx workbook, you want to v sua ze tota sa es by state on a US map To beg n,
create a tab e cons st ng of States and Un ts, as shown n F gure 46-14

478  Chapter 46  Power V ew


FIGURE 46-14  Th s figure shows sa es by state that w feed nto a map summary.

On the Design tab, transform the tab e to Map Power V ew uses B ng Maps to draw maps and
geocode text ocat ons, and th s requ res Internet connect v ty You are prompted to a ow th s con-
nect v ty the first t me access s requ red for the workbook sess on After you a ow access, you see the
amaz ng sa es summary shown n F gure 46-15 For each state, there s a bubb e whose s ze represents
the state’s sa es You can hover your cursor over a bubb e to revea stat st cs for the state

Power V ew  Chapter 46   479


FIGURE 46-15  Th s figure shows un t sa es summar zed by state.

How can I turn a time series scatter chart into an animated experience?

In 2006, German stat st c an Hans Ros ng gave a TED Ta k (http://www.bing.com/videos/search?q=


Ted+talk+animated+movie+data&mid=B8B186BF6A38B76D6F39B8B186BF6A38B76D6F39&view=
detail&FORM=VIRE2) n wh ch he used amaz ng graph cs to summar ze the evo ut on of wor d eco-
nom c deve opment Now Power V ew empowers you to create s m ar y amaz ng an mated v sua za-
t ons to d sp ay the evo ut on of three quant tat ve var ab es

To ustrate the process w th US cr mes between 1960 and 2009, use the Cr medata x sx fi e, wh ch
conta ns stat st cs on v o ent cr mes, property cr mes, and murders dur ng each of these years You
want to create an an mated v sua zat on show ng how these quant t es change over t me To beg n,
make the data a tab e and se ect Scatter from the other chart opt ons F n the fie d areas as shown
n F gure 46-16

■ P ac ng V o ent n the X Value zone ensures that v o ent cr mes are represented by the X ax s
va ue

■ P ac ng Property n the Y Value zone ensures that property cr mes are represented by the Y
ax s va ue

■ P ac ng murder n the Size zone ensures that murders are represented by the s ze of a bubb e

■ P ac ng Year n the Details zone ensures that one po nt s d sp ayed for each year

480  Chapter 46  Power V ew


■ The opt ona Color zone has been eft b ank If t s fi ed n, the co or fie d s used to catego-
r ze each po nt by co or

■ The key s to define Year as the P ay Ax s fie d Th s resu ts n the add t on of a P ay button and
T me ax s at the bottom of the chart C ck ng the Play button an mates the chart through the
years You can use the T me ax s to beg n your an mat on dur ng any year

FIGURE 46-16  These are the sett ngs you use to create the Cr me data mov e.

F gure 46-17 shows the fina chart Warn ng These charts are add ct ve!

If you p ay out the an mat on shown n F gure 46-17, you see cr mes ncrease for a wh e and then
(thankfu y) dec ne There s great debate about whether the pr mary cause of th s cr me dec ne s
mprovement n po cy strateg es or s mp y demograph cs (Young ma es comm t most cr mes, and the
number of young ma es eventua y drops )

Power V ew  Chapter 46   481


FIGURE 46-17  Th s s an an mated summary of cr me data.

How can I use Multiples to create many charts easily?

Suppose you want to summar ze annua sa es of each product n a separate chart The Power
V ew Mu t p es feature makes th s a snap To see how, ook at the Power V ew 1 sheet n the
Teasa esmu t p es x sx fi e Beg n w th the summary of Un t Sa es shown n F gure 46-7 and then s mp y
drag Product to e ther the Vert ca or Hor zonta Mu t p es zones Vert ca Mu t p es was chosen here
and obta ned the fo ow ng set of charts for each product The Layout tab enab es you to change the
appearance of these charts

482  Chapter 46  Power V ew


FIGURE 46-18  Here are product charts created w th Mu t p es.

Problems
The Ce phonedata x sx fi e conta ns the popu at on and number of ce phones for the 20 countr es
hav ng the most ce phones Use th s data n Prob ems 1 through 5

1. Create a co umn chart that summar zes ce phones by country

2. Create a scatter chart that p ots ce phones versus popu at on

3. Set up a s cer to fi ter a c ustered co umn graph of ce phones by country

4. Set up a t e to fi ter a co umn chart that summar zes ce phones by country

5. Summar ze the popu at on data on a map

6. The Returns x sx fi e conta ns annua returns on US stocks, T-b s, and bonds for the 1928–
2012 per od Create an an mat on to show the evo ut on of nvestment returns over t me

Power V ew  Chapter 46   483


CHAP TER 47

Sparklines

Questions answered in this chapter:


■ How can you graph ca y summar ze da y customer counts for each of a bank’s branches n a
s ng e ce ?

■ How can you mod fy spark nes?

■ How can you summar ze an NFL team’s sequence of w ns or osses n a s ng e ce ?

■ Do spark nes automat ca y update when new data s nc uded?

Spark nes are exc t ng graph cs that can summar ze a row or co umn of data n a s ng e ce The term
sparkline was first used by Edward Tufte, a famous expert on the v sua presentat on of data and ts
ana ys s He descr bed spark nes as “data- ntense, des gn-s mp e, word-s zed graph cs ” M crosoft
Exce 2013 makes t easy to create amaz ng graph cs that res de n a s ng e ce

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

How can you graphically summarize daily customer counts for each of a bank’s branches in a
single cell?

The Spark nes x sx fi e conta ns da y customer counts at severa branches of a New York state bank
See F gure 47-1

Say that you want to summar ze the week y customer counts by graph ng the da y counts for
each branch n a s ng e ce Se ect the range where you want your spark nes to go (I8 I14 s chosen)
and then, from the Insert r bbon tab, se ect Line from the Sparklines group, wh ch s shown n
F gure 47-2

485

FIGURE 47-1  Th s figure shows data for spark nes.

FIGURE 47-2  These are the Spark nes cho ces.

F n the fo ow ng d a og box w th the data on wh ch the spark nes are based (D8 H14) See
F gure 47-3

FIGURE 47-3  Create ne spark nes.

You now see a ne graph (F gure 47-4) that summar zes the customer traffic for each branch You
can see th s n the L ne Spark ne worksheet n the Spark nes x sx fi e

486  Chapter 47  Spark nes


FIGURE 47-4  L ne spark nes are summar z ng branch traffic.

You can see that for each branch, Monday and Fr day are c ear y the bus est days

How can you modify sparklines?

If you c ck n any ce conta n ng a spark ne, the Sparkline Tools Design tab opens After se ect ng
the Design tab, you can make many changes to your spark nes For examp e, as shown n F gure 47-5,
you can se ect the h gh and ow po nts to be marked

The resu t ng spark nes are shown n F gure 47-6 See the H gh Low worksheet n the Spark nes
x sx fi e

FIGURE 47-5  Se ect h gh and ow po nts to mark on spark nes.

FIGURE 47-6  H gh and ow po nts are marked on spark nes.

Spark nes  Chapter 47   487


These spark nes make t c ear that Fr day s the bus est day for each branch, and Tuesday or
Wednesday s the east busy day

From the Design tab, you can make the fo ow ng changes to your spark nes

■ Change the type of spark ne ( ne, co umn, or w n/ oss) Co umn and w n/ oss spark nes are
d scussed ater n the chapter

■ Use the Edit Data command to change the data used to create the spark nes You can a so
change the defau t sett ng so that h dden data s nc uded n your spark nes

■ Se ect any comb nat on of the h gh po nt, ow po nt, negat ve po nts, first po nt, or ast po nt
to be marked

■ Change the sty e or co or assoc ated w th the spark nes and spark ne markers

■ By se ect ng Axis, you can change the way the axes are set for each spark ne For examp e,
you can make the x-ax s or y-ax s sca e the same for each spark ne The defau t s to base the
sca e for each ax s on the data for the nd v dua spark ne Th s s the sca ng used n F gure
47-4 Custom enab es you to p ck an upper and ower m t for each ax s

■ When data po nts occur at rregu ar y spaced dates, you can se ect Data Axis from Axis so
that the graphed po nts are separated by an amount of space proport ona to the d fferences
n dates F gure 47-7 shows company sa es at rregu ar y spaced dates (See the Date Ax s
worksheet n the Spark nes x sx fi e ) In ce F12, the spark ne s graphed as though the dates
are spaced at regu ar nterva s After c ck ng Axis and choos ng the C10 C13 range to use as
the data ax s, the spark ne n ce F10 reflects the rregu ar date spac ng

FIGURE 47-7  Here are spark nes w th a date ax s.

You can a so change ne spark nes to co umn spark nes by c ck ng any spark ne and then se ect-
ng Column from the Sparklines Tools Design tab See F gure 47-8 and the Co umn Spark ne work-
sheet n the Spark nes x sx fi e

488  Chapter 47  Spark nes


FIGURE 47-8  Th s s a co umn spark ne graph.

How can you summarize an NFL team’s sequence of wins or losses in a single cell?

The Nflw ns osses x sx fi e conta ns the game-by-game performance for each NFL team dur ng the
2009 regu ar season A subset of th s data s shown n F gure 47-9 (See the W n Loss worksheet )

FIGURE 47-9  Spark nes summar ze w ns and osses for NFL teams.

Spark nes  Chapter 47   489


A 1 (one) denotes a w n and a –1 a oss Each w n/ oss spark ne treats any pos t ve number as an up
b ock and any negat ve number as a down b ock Any 0s are graphed as a gap To create the w n­/­oss
spark nes, se ect the range where the spark nes shou d be p aced (ce range C8 C39) and then se ect
Win/Loss from the Sparklines group on the Insert menu Choose the E8 T39 data range The spar-
k nes make the 2009 NFL season come a ve You can see the amaz ng starts of the Ind anapo s Co ts
and the New Or eans Sa nts You can see that the Tennessee T tans started poor y and then p ayed
much better The New York G ants started we and then h t a rough patch W n/ oss spark nes are
great for track ng an organ zat on’s progress toward meet ng quotas or goa s See Prob em 4 at the
end of th s chapter

Do Sparklines automatically update when new data is included?

If you want your spark nes to update automat ca y to nc ude new data, make the data a tab e (see
Chapter 25, “Tab es”) or convert the data to a dynam c range (see Chapter 21, “The OFFSET funct on ”)

Problems
1. For the bank branch data, make your ne spark nes use the same sca e for each branch

2. The Dow x sx data conta ns the va ues of the Dow Jones Index for January 2 through August
10, 2010 Create a ne spark ne to show the ups and downs of the market

3. Use w n/ oss spark nes to capture the market’s ups and downs Aga n, use the Dow x sx fi e

4. The Goa s x sx fi e shows the percentage by wh ch bank branches met or fa ed to meet the r
goa s each month Summar ze th s data w th w n/ oss spark nes

490  Chapter 47  Spark nes


CHAPTER 48

Summarizing data with database


statistical functions

Questions answered in this chapter:


■ Joo as s a sma makeup company that tracks each sa es transact on n a M crosoft Exce  2013
worksheet Often, t wants to answer quest ons such as

• How many do ars’ worth of p g oss d d Jen se ?


• What was the average number of pst ck un ts so d each t me Jen made a sa e n the East
reg on?

• What was the tota do ar amount of a makeup so d by Em ee or n the East reg on?
• How many do ars’ worth of pst ck were so d by Co een or Zaret n the East reg on?
• How many pst ck transact ons were not n the East reg on?
• How many do ars’ worth of pst ck d d Jen se dur ng 2004?
• How many un ts of makeup were so d for a pr ce of at east $3 20?
• What s the tota do ar amount each sa esperson so d of each makeup product?
■ What he pfu tr cks can I use to set up cr ter a ranges?

■ I have a database that sts, for each sa es transact on, the revenue, the date so d, and the
product ID code G ven the date so d and the ID code for a transact on, s there an easy way to
extract the transact on’s revenue?

As you saw n Chapter 43, “Us ng P votTab es and s cers to descr be data,” Exce P votTab es are a
great too for summar z ng data Often, however, a P votTab e g ves you much more nformat on than
you need Database statistical functions make t easy to answer any report ng quest on w thout creat-
ng a P votTab e

You are a ready fam ar w th funct ons such as SUM, AVERAGE, COUNT, MAX, and MIN By prefix-
ng a D (wh ch stands for database) on these and other funct ons, you create database stat st ca func-
t ons However, what does the DSUM funct on do, for examp e, that the SUM funct on can’t? Whereas
the SUM funct on adds up every ce n a ce range, the DSUM funct on enab es you to spec fy (by
us ng cr ter a) a subset of rows to add together n a ce range For examp e, suppose you have a

491

sa es database for a sma makeup company that conta ns the fo ow ng nformat on about each sa es
transact on

■ Name of sa esperson

■ Transact on date

■ Product so d

■ Un ts so d

■ Do ars of revenue generated per transact on

■ Reg on of the country where the transact on took p ace

You can find th s data n the Makeupdb x sx fi e, wh ch s shown n F gure 48-1

FIGURE 48-1  Use th s data to descr be how to work w th database stat st ca funct ons.

By us ng the DSUM funct on w th appropr ate cr ter a, you cou d, for examp e, add up the revenue
generated on y by transact ons nvo v ng p g oss sa es n the East dur ng 2004 Essent a y, the cr ter a
you set up flags those rows you want to nc ude n the tota sum W th n these rows, the DSUM func-
t on acts ke the ord nary SUM funct on

492  Chapter 48  Summar z ng data w th database stat st ca funct ons


The syntax of the DSUM funct on s DSUM(database,fie d,cr ter a):

■ Database s the ce range that makes up the database The first row of the st conta ns abe s
for each co umn

■ Field s the co umn conta n ng the va ues you want the funct on to add You can define the
fie d by enc os ng the co umn abe n quotat on marks (For examp e, you wou d des gnate the
Dollars co umn by enter ng “Dollars” ) The fie d can a so be spec fied by us ng the pos t on of
the co umn n the database, measured from eft to r ght For examp e, the makeup transact on
database wou d use co umns H through M (The Transact ons co umn was not nc uded as part
of the database ) You cou d spec fy co umn H as field 1 and co umn M as field 6

■ A criterion refers to a ce range that spec fies the rows on wh ch the funct on shou d operate
The first row of a cr ter a range must nc ude one or more co umn abe s (The on y except on
to th s ru e s computed criteria, wh ch s d scussed n the ast two examp es n th s chapter ) As
the examp es ustrate, the key to creat ng a cr ter a range s to understand that mu t p e cr te-
r a n the same row are jo ned by AND, whereas cr ter a n d fferent rows are jo ned by OR

Now ook at some examp es (see F gure 48-2) that ustrate the power and versat ty of database
stat st ca funct ons

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

How many dollars’ worth of lip gloss did Jen sell?

In th s examp e, you want to app y DSUM to co umn 5 of the database Co umn 5 conta ns the do ar
vo ume for each transact on (The database s named Data, wh ch cons sts of the H4 M1895 range )
The cr ter a range n O4 P5 flags a rows n the database n wh ch Name equa s Jen and Product
equa s p g oss Thus, enter ng the DSUM(data,5,O4 P5) formu a n ce N5 (see F gure 48-2) ca -
cu ates the tota do ar amount of p g oss so d by Jen You cou d have a so entered the formu a
as DSUM(data,”Do ars”,O4 P5) Jen so d $5,461 61 worth of p g oss In ce N6, you can find the
same answer by us ng the SUMIFS funct on (see Chapter 20, “The SUMIF, AVERAGEIF, SUMIFS, and
AVERAGEIFS funct ons”) w th the =SUMIFS(Do ars,Name,”Jen”,Product,” p g oss”) formu a

Summar z ng data w th database stat st ca funct ons  Chapter 48   493


FIGURE 48-2  Here are database stat st ca funct ons at work.

What was the average number of lipstick units sold each time Jen had a sale in the East
region?

You can compute th s number by enter ng the DAVERAGE(data,4,O7 Q8) formu a n ce N8 Us ng 4


as the va ue for field spec fies the Un ts co umn, and the O7 Q8 cr ter a range flags a rows n the data-
base n wh ch Name equa s Jen, Product equa s pst ck, and Locat on equa s East Us ng DAVERAGE
ensures that you average the un ts so d for the flagged rows You can see that on average, Jen so d
42 25 un ts of pst ck n transact ons n the East reg on In ce N9, you can ca cu ate the same answer
by us ng the =AVERAGEIFS(Un ts,Name,”Jen”,Product,” pst ck”,Locat on,”east”) formu a

What was the total dollar amount of all makeup sold by Emilee or in the East region?

In ce N11, you can compute the tota do ars ($76,156 48) of sa es by Em ee or n the East by us ng
the DSUM(data,5,O10 P12) formu a The cr ter a n O10 P12 flags sa es n the East or by Em ee,
because cr ter a n d fferent rows are treated as an OR operat on The great programmers at M crosoft
have ensured that th s formu a does not doub e-count Em ee’s sa es n the East Here, you cannot use
SUMIFS to find the answer eas y

How many dollars’ worth of lipstick were sold by Colleen or Zaret in the East region?

The DSUM(data,5,O13 Q15) formu a n ce N14 computes the tota pst ck revenue generated
through Co een’s and Zaret’s sa es ($1,073 20) n the East Not ce that O14 Q14 spec fies cr ter a that

494  Chapter 48  Summar z ng data w th database stat st ca funct ons


se ect Co een’s pst ck sa es n the East, and O15 Q15 spec fies cr ter a that se ect Zaret’s pst ck sa es
n the East Remember that cr ter a n d fferent rows are jo ned by OR In ce N15, the answer to th s
quest on s ca cu ated w th the fo ow ng formu a

=SUMIFS(Dollars,Name,"Colleen",Product,"lipstick",Location,"east")
+SUMIFS(Dollars,Name,"Zaret",Product,"lipstick",Location,"east")

How many lipstick transactions were not in the East region?

In ce N17, you can compute the tota number of pst ck transact ons (164) outs de the East reg on
w th the DCOUNT(data,4,O16 P17) formu a You use DCOUNT n th s prob em because you want
to spec fy cr ter a by wh ch the funct on w count the number of rows nvo v ng pst ck sa es and
reg ons other than n the East Exce treats the <>East express on n the cr ter a range as “not East ” For
th s prob em, us ng SUMIFS wou d requ re you to have a SUMIFS funct on for each reg on

Because the COUNT funct on counts numbers, you need to refer to a co umn conta n ng numer ca
va ues Co umn 4, the Un ts co umn, conta ns numbers, so that co umn s des gnated n the formu a
The DCOUNT(data,3,O16 P17) formu a wou d return 0 because there are no numbers n the database’s
th rd co umn (wh ch s co umn J n the worksheet) Of course, the DCOUNTA(data,3,O16 P17) formu a
wou d return the correct answer because COUNTA counts text as we as numbers

How many dollars’ worth of lipstick did Jen sell during 2004?

The tr ck here s know ng how to flag on y sa es that occurred n 2004 By nc ud ng n one row of
your cr ter a range a reference to the Date fie d, us ng the >=1/1/2004 and <1/1/2005 express ons
captures on y the 2004 sa es Thus, enter ng the DSUM(data,5,O18 R19) formu a n ce N19 computes
the tota pst ck sa es by Jen ($1,690 79) after January 1, 2004, and before January 1, 2005 In ce N20,
the answer to th s prob em s ca cu ated w th the =SUMIFS(Do ars,Date,”>=1/1/2004”,Date,”<=12/31/2
004”,Product,” pst ck”,Name,”Jen”) formu a.

How many units of makeup were sold for a price of at least $3.20?

Th s examp e nvo ves computed criteria Bas ca y, computed cr ter a flags rows of the database on
the bas s of whether a computed cond t on s true or fa se for that row For th s quest on, you want to
flag each row that conta ns Do ars/Un ts>=$3 20 When sett ng up a computed cr ter on (see F gure
48-3), the abe n the first row above the computed cr ter a must not be a co umn abe For examp e,
you can’t use Name, Product, or another abe from row 4 of th s worksheet The computed cr ter on
s set up to be a formu a that returns True based on the first row of nformat on n the database Thus,
to spec fy rows n wh ch the average pr ce s greater than or equa to $3 20, you need to enter =(L5/
K5)>=3 2 n your cr ter on range be ow a head ng that s not a co umn abe If the first row of data
does not sat sfy th s cond t on, you w see FALSE n the worksheet, but Exce w st flag a rows
hav ng a un t pr ce that’s greater than or equa to $3 20 Enter ng the DSUM(data,4,O21 O22) formu a
n N22 computes the tota number of un ts of makeup so d (1,127) n orders for wh ch the un t pr ce
was greater than or equa to $3 20 Note that ce O22 conta ns the =(L5/K5)>=3 2 formu a

Summar z ng data w th database stat st ca funct ons  Chapter 48   495


FIGURE 48-3  Th s figure shows a computed cr ter on.

What is the total dollar amount each salesperson sold of each makeup product?

For th s prob em, you cou d use a DSUM funct on whose cr ter a range s based on both the Name
and Product co umns Us ng a data tab e, you can eas y oop through a poss b e comb nat ons of
Name and Product n the cr ter a range and compute the tota revenue for each Name and Product
comb nat on

Beg n by enter ng any name n ce X26 and any product n ce Y26 Enter the
DSUM(data,5,X25 Y26) formu a n ce Q25, wh ch computes tota sa es revenue for ( n th s case)
Betsy and eye ner Enter each sa esperson’s name n the Q26 Q33 ce range and each product n the
R25 V25 ce range Now se ect the data tab e range (Q25 V33) On the Data tab, n the Data Tools
group, c ck What-If Analysis and then c ck Data Table Choose ce X26 as the co umn nput ce
and Y26 as the row nput ce You then obta n the resu ts shown n F gure 48-4 Each entry n the data
tab e computes the revenue generated for a d fferent name and product comb nat on because the
data tab e causes the names to be p aced n ce X26 and the products to be p aced n ce Y26 For
examp e, Ash ey so d $3,245 45 worth of pst ck

FIGURE 48-4  Comb ne data tab es w th a DSUM funct on.

496  Chapter 48  Summar z ng data w th database stat st ca funct ons


Th s examp e shows how comb n ng data tab es w th database stat st ca funct ons can qu ck y
generate many stat st cs of nterest Note that you cou d a so have so ved th s prob em by copy ng the
=SUMIFS(Do ars,Name,$Q37,Product,R$36) formu a from ce R37 to R37 V45

What helpful tricks can I use to set up criteria ranges?

Here are some examp es of tt e tr cks that m ght he p you set up an appropr ate cr ter a range
Suppose the co umn abe n the first row of the cr ter a range refers to a co umn conta n ng text (for
examp e, co umn H)

■ *A e* w flag records conta n ng the text str ng A e n co umn H

■ A?X w flag a record f the record’s co umn H entry beg ns w th A and conta ns X as ts th rd
character (The second character can be anyth ng!)

■ <>*B* w flag a record f co umn H’s entry does not conta n any Bs

If a co umn (for examp e, co umn I) conta ns numer ca va ues,

■ >100 w flag a record f co umn I conta ns a va ue greater than 100

■ <>100 w flag a record f co umn I conta ns a va ue not equa to 100

■ >=1000 w flag a record f co umn I conta ns a va ue greater than or equa to 1,000

I have a database that lists, for each sales transaction, the revenue, the date sold, and the
product ID code. Given the date sold and the ID code for a transaction, is there an easy way to
capture the transaction’s revenue?

The Dget x sx fi e (see F gure 48-5) conta ns a database that sts revenues, dates, and product ID
codes for a ser es of sa es transact ons If you know the date and the product ID code for a transac-
t on, how can you find the transact on’s revenue? W th the DGET funct on, t’s s mp e The syntax
of the DGET funct on s DGET(database,fie d#,cr ter a) G ven a ce range for database and a va ue
for field# n the database (count ng co umns from eft to r ght across the range), the DGET func-
t on returns the entry n co umn field# from the database record sat sfy ng the cr ter a If no record
­sat sfies the cr ter a, the DGET funct on returns the #VALUE error message If more than one record
sat sfies the cr ter a, the DGET funct on returns the #NUM! error message

Suppose that you want to know the revenue for a transact on nvo v ng product ID code 62426
that occurred on 1/9/2006 Assum ng that there s on y one transact on nvo v ng th s product on the
g ven date, the DGET(B7 D28,1,G5 H6) formu a (entered n ce G9) y e ds the transact on’s revenue of
$169 Note that 1 was used for the field# argument because Revenue s sted n the first co umn of
the database (wh ch s conta ned n the B7 D28 ce range) The G5 H6 cr ter a range ensures that you
find a transact on nvo v ng product 62426 on 1/9/2006

Summar z ng data w th database stat st ca funct ons  Chapter 48   497


FIGURE 48-5  Th s figure shows the usage of the DGET funct on.

Problems
1. How many un ts of p g oss d d Zaret se dur ng 2004 and 2005?

2. Create a data tab e that conta ns each person’s tota revenue and un ts so d

3. How many un ts of p g oss d d Co een se outs de the West reg on?

4. Us ng the data n the Makeupdb x sx fi e, create a data tab e that shows the average per-un t
revenue generated by each person for sa es n wh ch the average per-un t pr ce exceeded
$3 30

5. Use the data n the Sa es x sx fi e to determ ne the fo ow ng

• Tota do ar sa es n the M dwest

• Tota do ars that Heather so d n the East

• Tota do ars that Heather so d or that were so d n the East

498  Chapter 48  Summar z ng data w th database stat st ca funct ons


• Tota do ars so d n the East by Heather or John
• Number of transact ons n the East reg on
• Number of transact ons w th greater than average sa es
• Tota sa es not n the M dwest
6. The Housepr cedata x sx fi e conta ns the fo ow ng nformat on for se ected homes

• Square footage
• Pr ce
• Number of bathrooms
• Number of bedrooms
Use th s nformat on to answer the fo ow ng quest ons

• What s the average pr ce of a homes hav ng a tota number of bathrooms and bedrooms
greater than or equa to s x?

• How many homes se for more than $300,000 and have a tota number of bedrooms and
bathrooms ess than or equa to five?

• How many homes have at east three bathrooms, but the tota number of bedrooms and
bathrooms s ess than or equa to s x?

• What s the h ghest pr ce of a home hav ng at most 3,000 square feet and a tota number
of bedrooms and bathrooms ess than or equa to s x? (H nt Use the DMAX funct on to
so ve th s prob em )

7. The Dec es x sx fi e conta ns the unpa d ba ance for 20 accounts Use DBASE funct ons to com-
pute the tota unpa d ba ances n each dec e

Summar z ng data w th database stat st ca funct ons  Chapter 48   499


CHAPTER 49

Filtering data and removing


duplicates

Questions answered in this chapter:


Joo as s a sma company that manufactures makeup Its managers track each sa es transact on n a
M crosoft Exce 2013 worksheet Somet mes they want to extract, or fi ter out, a subset of the r sa es
data For examp e, they m ght want to dent fy sa es transact ons that answer the fo ow ng quest ons

■ How can I dent fy a transact ons n wh ch Jen so d pst ck n the East reg on?

■ How can I dent fy a transact ons n wh ch C c or Co een so d pst ck or mascara n the East
or South reg on?

■ How can I copy a transact ons n wh ch C c or Co een so d pst ck or mascara n the East or
South reg on to a d fferent worksheet?

■ How can I c ear fi ters from a co umn or database?

■ How can I dent fy a transact ons that nvo ved sa es greater than $280 and greater than
90 un ts?

■ How can I dent fy a sa es occurr ng n 2005 or 2006?

■ How can I dent fy a transact ons n the ast three months of 2005 or the first three months
of 2006?

■ How can I dent fy a transact ons for wh ch the sa esperson’s first name starts w th C?

■ How can I dent fy a transact ons for wh ch the ce conta n ng the product name s co ored
n red?

■ How can I dent fy a transact ons n the top 30 revenue va ues n wh ch Ha agan or Jen was
the sa esperson?

■ How can I eas y obta n a comp ete st of sa espeop e?

■ How can I v ew every comb nat on of sa esperson, product, and ocat on that occurs n the
database?

501

■ If my data changes, how can I reapp y the same fi ter?

■ How can I extract a foundat on transact ons n the first s x months of 2005 for wh ch Em ee
or Jen was the sa esperson and the average per-un t pr ce was more than $3 20?

Exce 2013 has fi ter ng capab t es that make dent fy ng any subset of data a snap Exce a so
makes t easy to remove dup cate records from a st You’ find the work for th s chapter n the
Makeupfi ter x sx fi e For the 1,891 sa es transact ons sted n th s fi e (F gure 49-1 shows a subset of
the data), you have the fo ow ng nformat on

■ Transact on number

■ Name of the sa esperson

■ Date of the transact on

■ Product so d

■ Un ts so d

■ Do ar amount of the transact on

■ Transact on ocat on

FIGURE 49-1  Here s the makeup sa es data.

502  Chapter 49  F ter ng data and remov ng dup cates


In what fo ows, any rectangu ar range of ce s w th head ngs n the first row of each co umn s
referred to as a database Each co umn (C through I) of your database (ce range C4 I1894) s ca ed a
field Each row of the database that conta ns data s ca ed a record (Thus, the records n your data-
base are conta ned n the C4 I1894 ce range ) The first row of each fie d must conta n a fie d name
For examp e, the name of the fie d n co umn F s Product By us ng the Exce AutoF ter, you can query
the database us ng AND cr ter a to dent fy a subset of records Th s means that you can use quer es
of the “F nd a records where F e d 1 sat sfies certa n cond t ons, and F e d 2 sat sfies certa n cond -
t ons, and F e d 3 sat sfies certa n cond t ons” form Th s chapter’s examp es ustrate the capab t es
of the Exce AutoF ter

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

How can I identify all transactions in which Jen sold lipstick in the East region?

To beg n, p ace your cursor anywhere n the database and se ect Filter n the Sort & Filter group on
the Data tab on the r bbon As shown n F gure 49-2, each co umn of the database now has an arrow
n the head ng row (see the Data worksheet)

FIGURE 49-2  Th s figure shows the AutoF ter head ng arrows.

F ter ng data and remov ng dup cates  Chapter 49   503


After c ck ng the arrow for the Name co umn, you see the cho ces shown n F gure 49-3 You cou d
choose Text Filters, wh ch enab es you to fi ter based on character st cs of the person’s name (more
on th s ater) For now, you just want to work w th data for Jen, so first c ear the Select All check box,
se ect the check box for Jen, and then c ck OK You now see on y those records for wh ch Jen was
the sa esperson Next, at the Product co umn, se ect the lipstick check box At the Location co umn,
se ect the East check box You now see on y those transact ons for wh ch Jen so d pst ck n the East
reg on (See F gure 49-4 and the L pst ck Jen East worksheet ) Not ce that the arrow has changed to a
funne n the co umns n wh ch you set up fi ter ng cr ter a

FIGURE 49-3  These are the cho ces for fi ter ng the Name co umn.

504  Chapter 49  F ter ng data and remov ng dup cates


FIGURE 49-4  Jen se s pst ck n the East reg on.

How can I identify all transactions in which Cici or Colleen sold lipstick or mascara in the East
or South region?

You se ect C c and Co een from the Name co umn st, lipstick and mascara from the Product
co umn st, and East and South from the Location co umn st The records meet ng these fi ter ng
cr ter a are shown n F gure 49-5 (See the C c Co een L pst ck And Masc worksheet )

FIGURE 49-5  Here are the transact ons n wh ch C c or Co een so d pst ck or mascara n the East or South
reg on.

F ter ng data and remov ng dup cates  Chapter 49   505


How can I copy all transactions in which Cici or Colleen sold lipstick or mascara in the East or
South region to a different worksheet?

The tr ck here s first to press F5, c ck Special, and then se ect Visible Cells Only Now when you
copy your data, Exce nc udes on y the v s b e rows ( n th s case, the rows se ected by the fi ter ng cr -
ter a) Se ect a the fi tered ce s n the worksheet (C c , Co een, pst ck, and mascara) and paste them
nto a b ank worksheet You can create a b ank worksheet n your workbook by r ght-c ck ng any
worksheet tab, c ck ng Insert, se ect ng Worksheet, and then c ck ng OK The V s b e Ce s Cop ed
worksheet conta ns the records where C c or Co een so d pst ck or mascara n the East

How can I clear filters from a column or database?

C ck ng Filter on the Data tab removes a fi ters C ck ng the funne for any co umn for wh ch you
created a fi ter d sp ays an opt on to c ear the fi ter from that co umn

How can I identify all transactions that involved sales greater than $280 and greater than 90
units?

After c ck ng Filter on the Data tab, first c ck the Units co umn arrow to d sp ay the opt ons shown
n F gure 49-6

FIGURE 49-6  Th s figure shows fi ter ng opt ons for a numer ca co umn.

506  Chapter 49  F ter ng data and remov ng dup cates


You can se ect any subset of numer ca un t va ues (for examp e, a transact ons for wh ch sa es
were –10 or –8 un ts) Number F ters s chosen here to d sp ay the cho ces n F gure 49-7

FIGURE 49-7  Here are the Number F ters opt ons.

Most of the opt ons you see n the figure are se f-exp anatory Here, you choose Is Greater Than
and then fi n the d a og box as shown n F gure 49-8

FIGURE 49-8  Se ect a records where un ts so d s greater than 90.

Next, at the Dollars co umn, c ck to nc ude on y records where the do ar amount s greater than
$280 You obta n the records shown n F gure 49-9 (See the Sa es > 90 un ts do ars > $280 work-
sheet ) Note that a se ected records have both un ts greater than 90 and do ars greater than $280

F ter ng data and remov ng dup cates  Chapter 49   507


FIGURE 49-9  Th s shows the transact ons where more than 90 un ts were so d for a tota of more than $280.

How can I identify all sales occurring in 2005 or 2006?

After c ck ng Filter on the r bbon, c ck the arrow for the Date co umn to d sp ay the cho ces  n
F gure 49-10

508  Chapter 49  F ter ng data and remov ng dup cates


FIGURE 49-10  These are fi ter ng opt ons for the Date co umn.

After se ect ng 2005 and 2006, you see on y those records nvo v ng sa es n 2005 or 2006, as
shown n F gure 49-11 (See the Sa es In 2005 And 2006 worksheet )

F ter ng data and remov ng dup cates  Chapter 49   509


FIGURE 49-11  Th s figure shows sa es dur ng 2005 and 2006.

Note that you cou d a so have se ected Date Filters to d sp ay the opt ons shown n F gure 49-12

Most of these opt ons are se f-exp anatory as we Custom Filter enab es you to se ect any range
of dates as your fi ter ng cr ter a

510  Chapter 49  F ter ng data and remov ng dup cates


FIGURE 49-12  These are the Date fi ter ng opt ons.

How can I identify all transactions in the last three months of 2005 or the first three months
of 2006?

After c ck ng the arrow for the Date co umn, you see the st of years shown n F gure 49-10 C ck ng
the + s gn to the eft of the year d sp ays a st of months You can se ect October through December
of 2005 and then January through March of 2006 to show a sa es dur ng those months (See
F gure 49-13 and the F ter By Months worksheet )

F ter ng data and remov ng dup cates  Chapter 49   511


FIGURE 49-13  Th s figure shows a sa es from October 2005 through March 2006.

How can I identify all transactions for which the salesperson’s first name starts with C?

C ck the Name co umn arrow and choose Text Filters Se ect Begins With and, n the d a og box
shown n F gure 49-14, choose Begins With C

FIGURE 49-14  Th s s the Custom AutoF ter d a og box set up to se ect a records for wh ch the sa esperson s
name beg ns w th C.

512  Chapter 49  F ter ng data and remov ng dup cates


How can I identify all transactions for which the cell containing the product name is colored
in red?

C ck the Product co umn arrow and then choose Filter By Color You can now se ect the co or to use
as a fi ter As shown n F gure 49-15, on y the rows for wh ch the product s co ored n red are nc uded
here F gure 49-16 shows the resu t ng records (see the F ter By Co or worksheet)

FIGURE 49-15  Th s s the d a og box for fi ter ng by ce co or.

FIGURE 49-16  Here are a the records where the product ce co or s red.

How can I identify all transactions in the top 30 of all revenue values for which Hallagan or
Jen was the salesperson?

After c ck ng Filter on the r bbon, you c ck the Name co umn arrow and then se ect the check boxes
for Hallagan and Jen C ck the arrow for the Dollar co umn and choose Number Filters From the
Number Filters st, se ect Top 10 and then fi n the d a og box as shown n F gure 49-17 You have

F ter ng data and remov ng dup cates  Chapter 49   513


now fi tered a records n the top 30 revenue va ues n wh ch Jen or Ha agan s the sa esperson See
the resu ts n F gure 49-18 (and the Top 30 $s W th Ha agan Or Jen worksheet) Note that on y five of
the top 30 sa es had Ha agan or Jen as the sa esperson You can a so se ect Top 5 percent, Bottom
20 percent, and so on for any numer ca co umn

FIGURE 49-17  Th s s the d a og box n wh ch to se ect the top 30 records by do ar va ue.

FIGURE 49-18  These are the top 30 records by do ar va ue for wh ch Jen or Ha agan was the sa esperson.

How can I easily obtain a complete list of salespeople?

Here, you want a st of a the sa espeop e w thout anybody’s name repeated Beg n by se ect ng
Remove Duplicates on the Data tab on the r bbon to d sp ay the Remove Duplicates d a og box
shown n F gure 49-19 After choos ng Unselect All, se ect on y the Name check box and then c ck
OK Th s sett ng fi ters the data for on y the first record nvo v ng each sa esperson’s name See the
resu ts n F gure 49-20 and n the Name Dup cates Removed worksheet

Important  Because selecting Remove Duplicates removes some of your data, I recommend
making a copy of your data before selecting Remove Duplicates.

514  Chapter 49  F ter ng data and remov ng dup cates


FIGURE 49-19  Th s s the Remove Dup cates d a og box w th the Name co umn se ected.

FIGURE 49-20  Th s figure shows the st of sa espersons names.

How can I view every combination of salesperson, product, and location that occurs in the
database?

Here aga n, you need to c ck Remove Duplicates on the Data tab to beg n F n the Remove
Duplicates d a og box as shown n F gure 49-21

F gure 49-22 sts the first record for each comb nat on of person, product, and ocat on occurr ng
n the database (See the Un que Name Product Locat on worksheet ) One hundred e ghty un que
comb nat ons occurred Note that the twent eth record was om tted because t nc uded Zaret se ng
p g oss n the M dwest, and the fifth record had a ready p cked up th s comb nat on

F ter ng data and remov ng dup cates  Chapter 49   515


FIGURE 49-21  F nd un que sa esperson, product, and ocat on comb nat ons.

FIGURE 49-22  Th s s a st of un que sa esperson, product, and ocat on comb nat ons.

516  Chapter 49  F ter ng data and remov ng dup cates


If my data changes, how can I reapply the same filter?

R ght-c ck any ce n your fi tered resu ts, po nt to Filter, and then c ck Reapply Any changes to your
data are reflected n the fi tered data

How can I extract all foundation transactions in the first six months of 2005 for which Emilee
or Jen was the salesperson and the average per-unit price was more than $3.20?

The AutoF ter feature (even w th Custom) s m ted to AND quer es across co umns Th s means, for
examp e, that you cannot find a transact ons for pst ck sa es by Jen dur ng 2005 or foundat on
sa es by Zaret dur ng 2004 To perform more-comp ex quer es such as th s one, you need to use the
Advanced F ter feature To use Advanced F ter, you set up a cr ter a range that spec fies the records
you want to extract (Th s process s descr bed n deta n Chapter 48, “Summar z ng data w th data-
base stat st ca funct ons ”) After spec fy ng the cr ter a range, you te Exce whether you want the
records extracted to the current ocat on or to a d fferent ocat on To dent fy a foundat on transac-
t ons n the first s x months of 2005 for wh ch Em ee or Jen was the sa esperson and for wh ch the
average per-un t pr ce was more than $3 20, you can use the cr ter a range shown n the O4 S6 range
n F gure 49-23 (See the Jen + Em ee worksheet n the Advancedfi ter x sx fi e )

FIGURE 49-23  Set up a cr ter a range to use w th an advanced fi ter.

In ce s R5 and R6, enter the =(L5/K5)>3 2 formu a Reca from Chapter 48 that th s formu a creates
computed cr ter a that flag each row n wh ch the per-un t pr ce s more than $3 20 A so, remember
that your head ng for a computed cr ter on must not be a fie d name Pr ce was used here as the fie d
head ng The cr ter a n O5 S5 flag a records n wh ch Jen s the sa esperson, the date s between
1/1/2005 and 6/30/2005, the product so d s foundat on, and the per-un t pr ce s more than $3 20
The cr ter a n O6 S6 flag a records n wh ch Em ee s the sa esperson, the date s between 1/1/2005
and 6/30/2005, the product so d s foundat on, and the per-un t pr ce s more than $3 20 The O4 S6
cr ter a range flags exact y the records you want Remember that cr ter a n d fferent rows are jo ned
by OR

You can now se ect any ce w th n the database range and se ect Advanced n the Sort & Filter
group on the Data tab F n the d a og box as shown n F gure 49-24

F ter ng data and remov ng dup cates  Chapter 49   517


FIGURE 49-24  These are the Advanced F ter d a og box sett ngs.

W th these sett ngs, you are te ng Exce to extract a records n the database (the G4 M1895 ce
range) that sat sfy the cr ter a spec fied n O4 S6 These records shou d be cop ed to a range whose
upper- eft corner s ce O14 The records extracted are shown n the O14 U18 ce range On y the four
records shown n F gure 49-25 meet the defined cr ter a (See the Jen + Em ee worksheet aga n )

FIGURE 49-25  Here are the Advanced F ter resu ts.

If you se ect Unique Records Only n the Advanced Filter d a og box, no dup cate records are
returned For examp e, f Jen had another foundat on transact on n the East reg on on 3/19/2005 for
one un t for $4 88, on y one of those transact ons wou d be extracted

Problems
1. F nd a transact ons n wh ch Ha agan so d eye ner n the West reg on

2. F nd a transact ons that rank n the top 5 percent w th regard to un ts so d

3. F nd the top 20 revenue-generat ng transact ons that nvo ve foundat on sa es

4. F nd a transact ons nvo v ng sa es of at east 60 un ts dur ng 2004 for wh ch the per-un t


pr ce was a max mum of $3 10

518  Chapter 49  F ter ng data and remov ng dup cates


5. F nd a foundat on transact ons dur ng the first three months of 2004 for wh ch the per-un t
pr ce was arger than the average pr ce rece ved for foundat on dur ng the ent re per od

6. F nd a transact ons n wh ch Zaret or Betsy so d e ther pst ck or foundat on

7. F nd a un que comb nat ons of product and sa esperson’s name

8. F nd a the top 30 sa es (by un ts) occurr ng n 2005 that nvo ved p g oss or mascara

9. F nd a sa es by Jen between August 10 and September 15, 2005

10. F nd a sa es of pst ck so d by Co een for wh ch the number of un ts so d s h gher than the


average number of un ts n a pst ck transact on

11. F nd a un que comb nat ons of name, product, and ocat on occurr ng dur ng the first three
months of 2006

12. F nd a records n wh ch the product ce s co ored ye ow

F ter ng data and remov ng dup cates  Chapter 49   519


CHAPTER 50

Consolidating data

Question answered in this chapter:


■ My company se s products n severa reg ons of the Un ted States Each reg on keeps records
of the number of un ts of each product so d dur ng the months of January, February, and
March Is there an easy way to create a master workbook that a ways comb nes each reg on’s
sa es and g ves a ta y of the tota amount of each product so d n the Un ted States dur ng
each month?

A bus ness ana yst often rece ves worksheets that ta y the same nformat on (such as month y product
sa es) from d fferent affi ates or reg ons To determ ne the company’s overa profitab ty, the ana yst
usua y needs to comb ne or conso date th s nformat on n a s ng e M crosoft Exce workbook
P votTab es bu t from mu t p e conso dat on ranges can be used to accomp sh th s goa , but the
tt e-known Conso date command (on the Data tab on the r bbon) s another way to accomp sh th s
goa W th Conso date, you can ensure that changes n the nd v dua worksheets are automat ca y
reflected n the conso dated worksheet

Answer to this chapter’s question


Th s sect on prov des the answer to the quest on that s sted at the beg nn ng of the chapter

My company sells products in several regions of the United States. Each region keeps records
of the number of units of each product sold during the months of January, February, and
March. Is there an easy way to create a master workbook that always combines each region’s
sales and gives a tally of the total amount of each product sold in the United States during
each month?

The East x sx fi e (shown n F gure 50-1) d sp ays month y un t sa es of Products A–H n the eastern
Un ted States dur ng January, February, and March S m ar y, the West x sx fi e (shown n F gure 50-2)
d sp ays month y un t sa es of Products A–H n the western Un ted States from January through
March Your need s to create a conso dated worksheet that tabu ates each product’s tota sa es by
month

521

FIGURE 50-1  Here are East reg on sa es from January through March.

FIGURE 50-2  Here are the West reg on sa es from January through March.

Before you use the Conso date command, t’s he pfu to see both worksheets together on the
screen To do th s, open both workbooks, c ck Arrange All n the Window group on the View tab
and se ect Tiled Your screen shou d ook ke F gure 50-3

522  Chapter 50  Conso dat ng data


FIGURE 50-3  East and West sa es are arranged on the same screen.

Now open a b ank worksheet n a new workbook and then c ck Arrange All and Tiled aga n In
the b ank worksheet, c ck Consolidate n the Data Tools group on the Data tab, and you see the
Consolidate d a og box, shown n F gure 50-4

FIGURE 50-4  Th s s the Conso date d a og box.

To conso date the data from the East and West reg ons n your new, b ank worksheet, enter the
ranges you want to conso date n the Reference box of the Consolidate d a og box, c ck ng Add

Conso dat ng data  Chapter 50   523


after se ect ng each range By se ect ng the Top Row and Left Column check boxes n the Use
Labels In area, you ensure that Exce conso dates the se ected ranges by ook ng at abe s n the top
row and eft co umn of each range Create Links To Source Data enab es changes n the se ected
ranges to be reflected n the conso dated worksheet Se ect Sum n the Function box because you
want Exce to add up the tota sa es of each product by month Se ect ng Count, for nstance, wou d
count the number of transact ons for each product dur ng each month; se ect ng Max wou d com-
pute the argest sa es transact on for each product dur ng each month The Consolidate d a og box
shou d be fi ed out as shown n F gure 50-5

After c ck ng OK, the new worksheet ooks ke the one shown n F gure 50-6 (See fi e
Eastandwestconso dated x sx ) You can see, for examp e, that 1,317 un ts of Product A were so d n
February, 597 un ts of Product F were so d n January, and so on

FIGURE 50-5  Th s s the comp eted Conso date d a og box.

FIGURE 50-6  Here s the tota sa es data after conso dat on.

524  Chapter 50  Conso dat ng data


Now, n ce C2 of East x sx, change the February Product A sa es from 263 to 363 Not ce that
n the conso dated worksheet, the entry for February Product A sa es has a so ncreased by 100
(from 1,317 to 1,417) Th s change occurs because Create Links To Source Data was se ected n the
Consolidate d a og box (By the way, f you c ck the 2 r ght be ow the workbook name n the con-
so dated worksheet, you see how Exce grouped the data to perform the conso dat on ) The resu t
s conta ned n the Eastandwestconso dated x sx fi e Of course, you cou d a so summar ze data from
d fferent worksheets by us ng P votTab es w th Mu t p e Conso dat on Ranges (see Chapter 43, “Us ng
P votTab es and s cers to descr be data”)

If you frequent y down oad new data to your source workbooks ( n th s case, East x sx and
­ est­­x sx), t’s a good dea to name the ranges, nc ud ng your data as a tab e Then new data s
W
automat ca y nc uded n the conso dat on You m ght a so choose to se ect some b ank rows be ow
the current data set When you popu ate the b ank rows w th new data, Exce p cks up the new data
when t performs the conso dat on A th rd cho ce s to make each data range a dynam c range (See
Chapter 21, “The OFFSET funct on,” for more nformat on )

Problems
The fo ow ng prob ems refer to the data n the Jancon x sx and Febcon x sx fi es Each fi e conta ns the
un t sa es, do ar revenues, and product so d for each transact on dur ng the month

1. Create a conso dated worksheet that g ves the tota un t sa es and do ar revenue for each
product by reg on

2. Create a conso dated worksheet that g ves the argest first-quarter transact on for each prod-
uct by reg on from the standpo nt of revenue and un ts so d

Conso dat ng data  Chapter 50   525


CHAPTER 51

Creating subtotals

Questions answered in this chapter:


■ Is there an easy way to set up a worksheet to ca cu ate tota revenue and un ts so d by reg on?

■ Can I a so obta n a breakdown by sa esperson of sa es n each reg on?

Joo as s a sma company that manufactures makeup For each transact on, t tracks the name of the
sa esperson, the ocat on of the transact on, the product so d, the un ts so d, and the revenue The
managers want answers to quest ons such as those that are the focus of th s chapter

P votTab es can be used to s ce and d ce data n M crosoft Exce Often, however, you’d ke an
eas er way to summar ze a st or a database w th n a st In a sa es database, for examp e, you m ght
want to create a summary of sa es revenue by reg on, a summary of sa es revenue by product, and
a summary of sa es revenue by sa esperson If you sort a st by the co umn n wh ch spec fic data s
sted, the Subtota command enab es you to create a subtota n a st on the bas s of the va ues n the
co umn For examp e, f you sort the makeup database by ocat on, you can ca cu ate tota revenue
and un ts so d for each reg on and p ace the tota s just be ow the ast row for that reg on As another
examp e, after sort ng the database by product, you can use the Subtota command to ca cu ate tota
revenue and un ts so d for each product and d sp ay the tota s be ow the row n wh ch the product
changes Unfortunate y, f you have made a range of ce s an Exce tab e (see Chapter 25, “Tab es”),
you cannot use that tab e to create subtota s

In the next sect on, you see how easy t s to use Subtota s to summar ze Exce data

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

Is there an easy way to set up a worksheet to calculate total revenue and units sold by region?

The data for th s quest on s n the Makeupsubtota s x sx fi e In F gure 51-1, you can see a subset of
the data as t appears after sort ng the st by the Locat on co umn

To ca cu ate revenue and un ts so d by reg on, p ace the cursor anywhere n the database and then
c ck Subtotal n the Outline group on the Data tab In the Subtotal d a og box, fi n the va ues as
shown n F gure 51-2

527

By se ect ng Location from the At Each Change In st, you ensure that subtota s are created at
each po nt n wh ch the va ue n the Location co umn changes Th s corresponds to the d fferent
reg ons Se ect ng Sum from the Use Function d a og box te s Exce to create tota s for each reg on
based on any set of co umns By se ect ng Units and Dollars n the Add Subtotal To area, you
nd cate that subtota s shou d be created for these co umns Replace Current Subtotals causes Exce
to remove any prev ous y computed subtota s Because you haven’t created any subtota s, t doesn’t
matter whether th s opt on s se ected for th s examp e If Page Break Between Groups s se ected,
Exce nserts a page break after each subtota Se ect ng the Summary Below Data check box causes
Exce to p ace subtota s be ow the data If th s opt on s not se ected, the subtota s are created above
the data used for the computat on C ck ng Remove All removes subtota s from the st

FIGURE 51-1  After sort ng a st by the va ues n a spec fic co umn, you can eas y create subtota s for that data.

A samp e of the Subtota s resu ts s shown n F gure 51-3 You can see that 18,818 un ts were so d n
the East reg on, earn ng revenue of $57,372 09

528  Chapter 51  Creat ng subtota s


FIGURE 51-2  Th s s the Subtota d a og box.

FIGURE 51-3  These are the subtota s for the East reg on.

Creat ng subtota s  Chapter 51   529


Not ce that n the eft corner of the w ndow (see F gure 51-3), be ow the Name box, buttons w th
the numbers 1, 2, and 3 appear C ck ng the argest number ( n th s case, 3) y e ds the data and sub-
tota s If you c ck the 2 button, you see just the subtota s by reg on, as shown n F gure 51-4 C ck ng
the 1 button y e ds the Grand Tota , as shown n F gure 51-5 In short, c ck ng a ower number reduces
the eve of deta shown

FIGURE 51-4  When you create subtota s, Exce adds buttons that you can c ck to d sp ay on y subtota s or both
subtota s and deta s.

FIGURE 51-5  D sp ay the overa tota w thout any deta .

Can I also obtain a breakdown by salesperson of sales in each region?

If you want to, you can nest subtota s In other words, you can obta n a breakdown of sa es by each
sa esperson n each reg on, or you can even get a breakdown of how much each sa esperson so d of
each product n each reg on (See the Nestedsubtota s x sx fi e ) To demonstrate the creat on of nested
subtota s, create a breakdown of sa es by each sa esperson n each reg on

To beg n, you must sort your data first by Location and then by Name Th s g ves a breakdown for
each sa esperson of un ts so d and revenue w th n each reg on If you sort first by Name and then by
Location, you wou d get a breakdown of un ts so d and revenue for each sa esperson by reg on After
sort ng the data, you proceed as before and create the subtota s by reg on C ck Subtotal aga n and
fi n the d a og box as shown n F gure 51-6

You now want a breakdown by Name C ear ng the Replace Current Subtotals check box ensures
that you w not rep ace your reg ona breakdown You can now see the breakdown of sa es by each
sa esperson n each reg on as shown n F gure 51-7

530  Chapter 51  Creat ng subtota s


FIGURE 51-6  Create nested subtota s.

FIGURE 51-7  Here s an examp e of nested subtota s.

Creat ng subtota s  Chapter 51   531


Problems
You can find the data for th s chapter’s prob ems n the Makeupsubtota s x sx fi e Use the Subtota
command for the fo ow ng computat ons

1. F nd the un ts so d and revenue for each sa esperson

2. F nd the number of sa es transact ons for each product

3. F nd the argest transact on ( n terms of revenue) for each product

4. F nd the average do ar amount per transact on by reg on

5. D sp ay a breakdown of un ts so d and revenue for each sa esperson that shows the resu ts for
each product by reg on

532  Chapter 51  Creat ng subtota s


CHAPTER 52

Charting tricks

Questions answered in this chapter:


■ How can I create comb nat on charts?

■ How can I create a secondary ax s?

■ How can I hand e m ss ng data?

■ How can I hand e the appearance of h dden data?

■ How can I use p ctures to add b ng to my co umn graphs?

■ I charted annua sa es data n a co umn graph, and the years do not show up as co umn abe s
What d d I do wrong?

■ How can I nc ude data abe s and data tab es n my charts?

■ How can I use Exce 2013 to p ace data abe s on a chart based on the contents of ce s?

■ How can I track sa es force performance over t me?

■ How can I create a band chart to check whether nventory s w th n acceptab e eve s?

■ How can I store a chart as a temp ate?

■ How can I use a thermometer chart to portray progress aga nst a target?

■ How can I create dynam c chart abe s?

■ How can I use check boxes to contro wh ch ser es are charted?

■ How can I use a st box to choose the ser es to be charted?

■ How can I create a Gantt chart?

■ How can I create a chart based on sorted data?

■ How can I create a h stogram that automat ca y updates when I nc ude new data?

■ How can I add cond t ona co ors to a chart?

■ How can I use waterfa charts to track progress toward a sa es target or break down compo-
nents of sa es pr ce?

533

■ How can I use the GETPIVOTDATA funct on and the Exce Tab e feature to create dynam c
dashboards?

■ How can I create a Pareto chart?

■ How can I nsert a vert ca ne n a chart to separate pre-merger and post-merger


performance?

■ How can I use a radar chart to portray how basketba team members d ffer n strength, speed,
and jump ng ab ty?

■ I know I can use a scatter p ot to d sp ay how two var ab es change How can I use a bubb e
chart to summar ze the var at on of three var ab es?

An o d Ch nese proverb says a p cture s worth a thousand words Exce can create many amaz ng
charts, and th s chapter shows you many examp es of chart ng t ps and tr cks Be aware that chart ng
n Exce 2013 has changed a ot from prev ous vers ons

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

How can I create combination charts?

The Comb nat onstemp x sx fi e conta ns Actua and Target sa es for January through Ju y You wou d
ke to create a chart that shows each month’s actua and target sa es F rst, se ect the F5 H12 range
and, from the Insert tab, se ect Column Charts and choose the first 2D (c ustered) co umn chart,
shown n F gure 52-1 Us ng two co umns makes t d fficu t to see the contrast between the actua
and target sa es, so use a comb nat on chart n wh ch one ser es s charted as a ne and the other as a
co umn To create th s chart, r ght-c ck on e ther ser es and se ect Change Chart Type After choos-
ng Combo (a new cho ce n Exce 2013) choose the first cho ce as shown n F gure 52-2 Th s y e ds
the comb nat on chart shown n F gure 52-3

534  Chapter 52  Chart ng tr cks


FIGURE 52-1  Th s s a co umn chart for actua and sa es target.

FIGURE 52-2  Se ect a Combo chart.

Chart ng tr cks  Chapter 52   535


FIGURE 52-3  Th s s a comb nat on chart.

How can I create a secondary axis?

When chart ng two quant t es of d ffer ng magn tude, a secondary ax s s often needed to make
sense of the chart To ustrate the dea, F gure 52-6 (see the Secondaryax s x sx fi e) shows month y
revenues and un ts so d If you show th s data on a s ng e Y-ax s, month y revenues wou d be hard y
v s b e To remedy th s prob em, beg n by se ect ng the (D7 F16) range that you want charted From
the Insert tab, se ect the Combo Chart con shown n F gure 52-4

FIGURE 52-4  Th s s the Combo Chart con.

From the drop-down arrow, se ect Create Custom Combo Chart and fi n the d a og box as
shown n F gure 52-5

The resu t ng chart summar zes Revenue on a secondary ax s (the r ght-s de vert ca ax s) w th a
ne chart The resu t ng chart n 52-6 shows c ear y that month y revenues and un ts so d change n a
v rtua y ockstep fash on

536  Chapter 52  Chart ng tr cks


FIGURE 52-5  Create a combo chart w th a secondary ax s.

FIGURE 52-6  A secondary ax s s used to summar ze revenue.

Chart ng tr cks  Chapter 52   537


How can I handle missing data?

Often, some rows of a spreadsheet have m ss ng data Exce g ves you three ways to chart
m ss ng data

■ Show the data as zeroes

■ Show the data as b anks (gaps)

■ Rep ace a m ss ng data po nt by a ne jo n ng adjacent data po nts

To ustrate how th ngs work, the M ss ngdata x sx fi e conta ns hour y temperatures, but severa
va ues are m ss ng After p ott ng the data as a ne chart, r ght-c ck the data and choose Select Data
Th s opens the d a og box shown n F gure 52-7

FIGURE 52-7  Th s figure shows the H dden And Empty Ce Sett ngs d a og box.

After se ect ng Connect Data Points With Line, you obta n the graph shown n F gure 52-8
Choose the Line Graph w th dots and nes so you can p ck out the m ss ng data because m ss ng data
po nts have no markers

538  Chapter 52  Chart ng tr cks


FIGURE 52-8  M ss ng data are rep aced by nes.

How can I handle the appearance of hidden data?

Often, we p ot data such as da y sa es and fi ter the data n the spreadsheet In th s s tuat on, Exce
g ves you a cho ce e ther to cont nue show ng a the data n the chart or just show the fi tered data
The H dden x sx fi e conta ns da y sa es of a product for a year If you graph the data as a ne chart,
you see the chart shown n F gure 52-9 If you r ght-c ck the data and se ect Show Data In Hidden
Rows And Columns, shown n F gure 52-7, even f you fi ter the data, a data po nts w st be d s-
p ayed n the chart For examp e, as shown n F gure 52-10, the data s fi tered to show on y December
sa es, but the chart st shows a da y sa es for the ent re year If you d d not se ect Show Data In
Hidden Rows And Columns, on y December sa es wou d be v s b e n the chart

Chart ng tr cks  Chapter 52   539


FIGURE 52-9  Th s s a chart show ng da y product sa es.

FIGURE 52-10  Data s fi tered, but the chart s not.

How can I use pictures to add bling to my column graphs?

Usua y, the magn tude of product sa es are summar zed w th bor ng co umns or bars n wh ch the
he ght of the co umn or w dth of the bar s proport ona to the product sa es Wou dn’t t be more fun
to summar ze product sa es w th a p cture of your product, sca ed proport ona y to actua sa es? To
ustrate the dea, check out the P cturegraph x sx fi e and the chart shown n F gure 52-11

In th s examp e, you assume that your company se s soda, so you w sh to summar ze month y sa es
w th a soda bott e whose s ze reflects the magn tude of month y sa es To beg n, se ect the C5 D8

540  Chapter 52  Chart ng tr cks


range and, from the Insert tab, se ect the first 2D co umn chart opt on (C ustered Co umn) Then
r ght-c ck any co umn and hover over Format Data Series Se ect Fill and then Picture, and you
see the w ndow shown n F gure 52-12 After se ect ng soda and press ng Enter, you are presented
w th many p ctures of soda After se ect ng the des red soda bott e and c ck ng Insert, the p cture
s nserted n the graph as shown n F gure 52-11, w th the he ght of the soda bott e proport ona to
actua sa es

FIGURE 52-11  Soda sa es are summar zed w th a soda bott e.

FIGURE 52-12  Th s s the nsert P ctures d a og box.

Chart ng tr cks  Chapter 52   541


I charted annual sales data in a column graph, and the years do not show up as column labels.
What did I do wrong?

The Category abe x sx fi e conta ns annua product sa es for years 2007 through 2010 When you cre-
ate a co umn graph w th D5 E9 as the chart data source, the chart fa s to show the year on the x-ax s
because Exce th nks you want the year charted as a ser es If you om t the Year category abe n the
upper- eft corner of the source range and use the D20 E24 range as the range for the chart, your
chart shows the year on the x-ax s, as des red

FIGURE 52-13  Om tt ng a category abe he ps the co umn graph the chart correct y.

How can I include data labels and data tables in my charts?

Often, you want to nsert data abe s next to your co umns or bars or perhaps show a tab e be ow
your chart To ustrate th s process, ook at the Labe sandtab es x sx fi e (A so see F gure 52-1 ) In th s
fi e, you are g ven sa es dur ng the current month of four product categor es To beg n, summar ze
th s data n a co umn graph and p ace a abe conta n ng the product name and actua sa es above
the co umn After creat ng a co umn graph n the usua fash on, se ect the co umn ser es and c ck the
+ s gn to the r ght of the chart Se ect Data Labels and More Options and choose Label Options.
Now fi n the Labe opt ons as shown n F gure 52-14

542  Chapter 52  Chart ng tr cks


FIGURE 52-14  These sett ngs are needed to show sa es and ser es name on a separate ne.

You now see the chart shown n F gure 52-15, wh ch shows the category names and va ues for each
co umn on separate nes

FIGURE 52-15  Category names and sa es are nc uded n the chart.

Chart ng tr cks  Chapter 52   543


You now see how to p ace a data tab e summar z ng sa es be ow the chart S mp y se ect the cat-
egory ax s and c ck the + s gn to the r ght of the chart After c ck ng Data Tables, you see the data
tab e shown n F gure 52-16

FIGURE 52-16  Sa es are summar zed w th a data tab e.

If you want to see more Data Tab e opt ons, se ect the tr ang e to the r ght of Data Tab e

How can I use Excel 2013 to place data labels on a chart based on the contents of cells?

Exce 2013 now makes t poss b e to p ace data abe s from ce s d rect y on charts To ustrate the
dea, exam ne the Labe sfromce s x sx fi e shown n F gure 52-17

FIGURE 52-17  Th s s a scatterp ot w th abe s from ce s.

544  Chapter 52  Chart ng tr cks


To beg n creat ng th s graph, se ect the H5 I10 ce range and choose the first Scatter Plot cho ce
from the Insert tab (Scatter P ot s the con w th dots next to the p e chart ) Th s creates the scatter
p ot n F gure 52-17 w thout the c ty abe s To create the c ty abe s, se ect the chart From the Design
tab, se ect Add Chart Element, choose Data Labels and then More Data Label Options Se ect the
first-cho ce Value from Cells and c ear Y Value Now you can se ect the G6 G10 ce range to nsert
the c ty abe s n the chart as shown n F gure 52-17

How can I track sales force performance over time?

The Sa estracker x sx fi e sts month y sa es by your outstand ng sa es force from January through May
(see F gure 52-18)

FIGURE 52-18  Here s the month y sa es data.

You want to use cons (up, down, or flat arrow) to track dur ng each month whether a sa esper-
son’s rank ng has mproved, dec ned, or stayed the same You cou d use Exce con sets (descr bed
n Chapter 23, “Cond t ona formatt ng”), but then you wou d have to nsert a set of cons for each
month, wh ch s a ted ous task A more effic ent (a though not as aesthet ca y p eas ng) way to cre-
ate these cons s to enter an h when you want an up arrow, enter an i when you want a down arrow,
and enter a g when you want a flat arrow Then f you change the font to W ngd ngs 3, you have the

Chart ng tr cks  Chapter 52   545


des red arrows because the etters of the a phabet correspond n W ngd ngs 3 to the symbo s shown
n F gure 52-19

FIGURE 52-19  Th s s the correspondence between etters and W ngd ngs 3 symbo s.

To create the cons shown n F gure 52-20, proceed as fo ows

■ Copy ng the RANK(E6,E$6 E0,0) formu a from J6 to J6 N20 computes each person’s sa es rank
dur ng each month

■ Copy ng the IF(K6<J6,”h”,IF(K6>J6,” ”,”g”)) formu a from O6 to O7 R20 creates an h f the per-
son’s rank has mproved, an i f the person’s rank has dec ned, and a g f the sa esperson’s rank
has stayed the same

■ After chang ng the font n the O6 R20 range to W ngd ngs 3, you see the cons shown n
F gure 52-20

The advantage of th s approach s that you can use IF statements to custom ze the cond t ons eas-
y that define the cons

546  Chapter 52  Chart ng tr cks


FIGURE 52-20  These are the cons that track change n sa esperson performance.

How can I create a band chart to check whether inventory is within acceptable levels?

Often, you need to track a quant ty ( nventory, cash on hand, number of acc dents) and want to track
whether the quant ty s rema n ng between h stor ca upper and ower m ts A band chart prov des
a usefu too to mon tor how a process changes over t me F gure 52-21 shows an examp e of a band
chart (See the Bandchart x sx fi e )

FIGURE 52-21  A band chart summar zes nventory eve s.

Chart ng tr cks  Chapter 52   547


To create the band chart, proceed as fo ows

1. You entered your ower m t on nventory (5) n B2 and your upper m t (25) on nventory
n B3

2. In row 5, you enter the ower m t for each month by copy ng the =$B$2 formu a from B5
to C5 G5

3. Copy ng the =$B$3-$B$2 formu a from B6 to C6 G6 computes the upper m t– ower m t


Labe th s row Upper L m t because th s row w be used to generate the ne represent ng
your upper nventory m t of 25 un ts

4. Se ect the B5 G7 range and se ect a Stacked area chart (the second 2D area opt on)

5. Se ect the Value ser es, r ght-c ck Chart Change Type, and choose the first ne-chart opt on

6. Add a secondary ax s to the Values ser es and then de ete t

7. R ght-c ck the Lower Limit ser es and se ect Fill From the Fill menu, se ect No Fill

Your band chart shows that you are hav ng great d fficu ty ma nta n ng nventory eve s between
the des red ower and upper m ts

How can I store a chart as a template?

You just created a beaut fu band chart You m ght th nk that each t me you want to create a band
chart, you need to repeat the prev ous y descr bed steps Th s s not the case You can save the band
(or any other chart) as a temp ate and pu up the chart sett ngs whenever you des re To ustrate the
dea, open the Bandchart x sx fi e, r ght-c ck the chart, se ect Save As Template, and g ve the chart
any name you want (Band was chosen here ) Now suppose you want a band chart just for the months
of January to March Se ect the data A4 D7 range and, from the Insert tab, se ect the arrow n the
ower-r ght corner of the Chart group Se ect All Charts and Templates Browse to the des red chart
temp ate, c ck OK, and you are done!

How can I use a thermometer chart to portray progress against a target?

A thermometer chart shows actua va ues of a quant ty such as revenues stacked w th n a co umn that
shows a target va ue The resu t ng chart (shown n F gure 52-22) resemb es a thermometer, hence the
name

548  Chapter 52  Chart ng tr cks


FIGURE 52-22  Th s s a thermometer chart.

To create a thermometer chart, proceed as fo ows

1. Se ect the A1 H3 range and a Clustered Column 2D chart

2. Se ect the Revenue ser es and then r ght-c ck and se ect Format Data Series Add a second-
ary ax s and then de ete t

3. Se ect the Revenue ser es and aga n r ght-c ck and se ect Format Data Series Set Overlap
to 0% and Gap w dth to 48%

4. Se ect the Target ser es and aga n r ght-c ck and se ect Format Data Series Set Overlap to
0% and Gap w dth to 261%.

5. You now see the chart shown n F gure 52-22 You m ght have to adjust the gap w dths to
obta n a chart you ke Mak ng the Target gap w dth sma er, for examp e, makes the red bars
w der; mak ng the Revenue gap w dth arger makes the b ue bars narrower

How can I create dynamic chart labels?

You have probab y encountered workbooks w th charts n wh ch you change a worksheet nput,
and the chart abe s do not change Th s often causes confus on Now earn how to nk ser es abe s
and chart t t es to worksheet ce s To ustrate the dea (see workbook Dynam cLabe s x sx and
F gure 52-23), suppose you want to chart future GDP n the Un ted States and Ch na You want the

Chart ng tr cks  Chapter 52   549


chart t t e to conta n the year n wh ch Ch na’s GDP passes US GDP and the ser es abe to conta n the
annua growth rate for each nat on In C5 and C8, you can change the est mated growth rates from
the r current va ues of 3% for US GDP and 10% for Ch na GDP

FIGURE 52-23  Create dynam c abe s.

The key dea s to nk your chart t t e and abe s to ce s that change when the growth rates
change Proceed as fo ows

1. Copy ng the IF(D7>=D4,1,0) formu a from D10 to E10 R10 enters a 1 f Ch na GDP s at east as
b g as US GDP

2. In ce C14, determ ne the year n wh ch Ch na passes the Un ted States w th the


I­ FERROR(MATCH(1,D10 R10,0),”none”) formu a Note that f Ch na never passes the Un ted
States, th s formu a returns “none”

3. In ce C17, the =IF(C14=”none”,“US stays on top”,“Ch nese GDP to pass US GDP n


Year“&TEXT(C14,”0”)) formu a creates your des red chart t t e Note that f Ch na never passes
the Un ted States, your chart t t e w be US Stays on Top Otherw se, your chart t t e s nked
to C14, so the chart t t e w conta n the year n wh ch Ch na passes the Un ted States The “0”
n the TEXT funct on ensures that the year s formatted as an nteger

4. In ce C18, the “USA(“&TEXT(C5,”0 0%”)&“annua growth)” formu a creates the chart t t e for
the USA ser es The “0 0%” port on of the text funct on ensures that the growth rate s format-
ted as a percentage

5. In ce C19, the =”Ch na(“&TEXT(C8,”0 0%”)&“annua growth)” formu a creates the chart t t e for
the Ch na ser es

6. Now you are ready to create the chart w th dynam c abe s

550  Chapter 52  Chart ng tr cks


7. Press Ctr , se ect the noncont nuous C2 R2, C4 R4, C7 R7 range, and create a scatter chart
(th rd opt on)

8. Se ect Add Chart Element from the Design tab and se ect Centered Overlay Title In
the formu a bar, type an equa s (=) s gn, po nt to ce C17, and press Enter You now have a
dynam c chart abe

9. Se ect Series 1 (the USA GDP ser es) and r ght-c ck and choose Select Data C ck Edit and fi
n the Edit Series d a og box as fo ows

FIGURE 52-24  Create a dynam c USA ser es abe .

Th s nks the USA ser es abe to ce C18, wh ch conta ns the annua growth rate In a s m ar fash-
on, you nk the Ch na ser es abe to ce C19 You now have comp eted a chart w th dynam c abe s

How can I use check boxes to control which series are charted?

You m ght reca from Chapter 26, “Sp n buttons, scro bars, opt on buttons, check boxes, combo
boxes, and group st boxes,” that a check box can be used to togg e the contents of a ce between
TRUE and FALSE It turns out that f Exce sees an #N/A error n a ce , the ce w not generate a po nt
appear ng n the chart Therefore, f you do not want to chart a ser es, s mp y use an IF formu a to
make the charted ser es #N/A when the check box puts a Fa se n a ce

To beg n, use the methods descr bed n Chapter 26 to create two check boxes, one to contro the
2010 ser es and another to contro the 2011 ser es The 2010 check box contro s ce B1, and the 2011
check box contro s ce C1 The or g na data s n E6 L7 Copy ng the IF($B$1,F6,NA()) formu a from F10
to F11 L11 s mp y returns the or g na data for the year f the year’s check box s se ected or returns
#N/A f the year’s check box s c eared You now se ect the E9 L11 ce range as the source data for a
Line With Markers chart Now c ear ng a year’s check box h des a year’s data n the chart, and se ect-
ng the check box shows the year’s data n the chart

Chart ng tr cks  Chapter 52   551


FIGURE 52-25  Check boxes can contro the ser es appear ng n a chart.

How can I use a list box to choose the series to be charted?

Suppose your spreadsheet (see L stbox x sx) conta ns 2007–2011 sa es n the East, West, M dwest, and
South You want an easy way to contro wh ch ser es s charted A st box (see Chapter 26) prov des an
easy way to choose the ser es to be charted To beg n, on the Developer tab, from the Insert group,
se ect List Box (fifth con n the top row) from Form Controls When you see the po nter, r ght-c ck
and se ect Format Control Se ect $A$14:$A$17 as Input Range and Cell Link $H$2 Now, w th an
nte gent use of the INDEX funct on, you can use ce H2 to contro the charted ser es

Copy ng the INDEX($H$16 $K$21,G7,$H$2) formu a from I7 to I8 I10 retr eves the correct ser es For
examp e, n the st box shown n F gure 52-26, the East reg on was se ected Th s p aces a 1 n ce H2
Your INDEX funct on retr eves the first co umn (co umn H) of data as des red Now se ect the H7 Y11
range and create a scatter chart, and you see that when you c ck a reg on n the st box, the se ected
ser es s charted

552  Chapter 52  Chart ng tr cks


FIGURE 52-26  Use a st box to contro the charted ser es.

How can I create a Gantt chart?

Often, a project requ res a number of projects to be comp eted A Gantt chart portrays the t me each
project beg ns Shown n F gure 52-27 (see fi e Gantt x sx) s a Gantt chart for a project cons st ng of
five act v t es To create th s chart, proceed as fo ows

1. Se ect the F3 H8 ce range and create a Stacked 2D bar chart (second opt on)

2. R ght-c ck the Start ser es and, after se ect ng Fill, choose No Fill to h de the Start ser es

3. R ght-c ck the vert ca ax s and, after se ect ng Format Axis, se ect Categories In Reverse
Order to ensure that Task 1 s sted first nstead of ast

FIGURE 52-27  Th s s a Gantt chart.

Chart ng tr cks  Chapter 52   553


How can I create a chart based on sorted data?

Suppose you have sa es n a number of states (see F gure 52-28 and fi e Sortedgraphx x sx), and you
want the graph to st the states n descend ng order of sa es as shown n F gure 52-29 To create th s
chart, you need to reorgan ze the data n co umns J to L so the sa es data s sorted n descend ng
order To accomp sh th s goa , proceed as fo ows

1. Copy ng the RANK(F9,$F$9 $F$23,0) formu a from G9 to G10 G22 computes the rank of each
state’s sa es For examp e, NY ranks s xth Note, however, that KY, A a, and Ar have the same
eve of sa es To sort the states n descend ng order of sa es, you need to assoc ate a un que
rank w th each state

2. Copy ng the G9+COUNTIF($G$8 G8,G9) formu a from H9 to H10 H22 creates a un que rank for
each state by ncreas ng the rank of a state w th a t ed rank each t me a t ed rank occurs

3. Copy ng the INDEX(E$9 E$23,MATCH($J9,$H$9 $H$23,0),1) formu a from K9 to K9 L23 sorts


the States and Sa es based on descend ng sa es

4. Now creat ng a co umn graph based on K9 L23 y e ds the graph shown n F gure 52-29

FIGURE 52-28  Th s s sa es data for a sorted graph.

554  Chapter 52  Chart ng tr cks


FIGURE 52-29  Sa es are sorted n descend ng order.

How can I create a histogram that automatically updates when I include new data?

In Chapter 42, “Summar z ng data by us ng descr pt ve stat st cs,” you earned how to use the
Ana ys s Too pak to create a h stogram Unfortunate y, h stograms created w th the Ana ys s Too pak
w not update f ex st ng data s changed or f new data s added By us ng the Exce Tab e fea-
ture, you can eas y create h stograms that automat ca y adjust to changes n the source data The
Dynam ch stograms x sx fi e ustrates the dea (see F gure 52-30) Co umn E conta ns NBA p ayer sa a-
r es n m ons of do ars for the 2003–2004 season To beg n, se ect the E5 E446 range and make that
range a tab e Enter the b n ranges for your h stogram n the H7 H28 range Note that row 28 w ca -
cu ate the number of sa ar es that are arger than $20 m on Use the FREQUENCY funct on to count
how many sa ar es fa nto each b n range The FREQUENCY funct on (see Chapter 87, “Array formu as
and funct ons”) s an array funct on To use th s funct on, you need to se ect the range the funct on
popu ates ( n th s case, I7 I28) first, enter the funct on syntax, and then press Ctr +Sh ft+Enter After
se ect ng I7 I28, type n the =FREQUENCY(E6:E446,H7:H27) formu a and press Ctr +Sh ft+Enter Exce
now enters the number of p ayers (0) w th a sa ary ess than or equa to 0 n I7, n I8 the number of
sa ar es >0 and <=1 m on (124), , n I27 the number of p ayers w th sa ar es >19 and <=20 m on
(2), and n I28 the number of p ayers w th a sa ary >20 m on To create the dynam c h stogram, se ect
the H7 I28 ce range and create a co umn graph You now have a dynam c h stogram that automat -
ca y updates to account for changes n the source data To prove that the h stogram updates, add a
few sa ar es of $30 m on You now see a new sp ke occur on the r ght s de of the graph

Chart ng tr cks  Chapter 52   555


FIGURE 52-30  Th s s a dynam c h stogram.

How can I add conditional colors to a chart?

Suppose you are chart ng actua and targeted sa es for each month, and you want months that
perform at 90 percent of target or better n b ue, 75 percent of target or worse n green, and other
months n red The Cond co ors x sx fi e (F gure 52-31) shows how th s s done The tr ck to create th s
chart s to put the data for each co or n a d fferent row To beg n, p ace sa es you want co ored b ue
n row 19 by copy ng the =IF(F13/F14>F15,F13/F14,” “) formu a from F19 to G19 M19 Then, to p ace
the sa es you want co ored red n row 20, copy the =IF(AND(G13/G14>G16,G13/G14<=G15),G13/
G14,” “) formu a from F20 to G20 M20 F na y, p ace the sa es for months that shou d appear n green
n row 20 by copy ng the =IF(AND(G13/G14>G16,G13/G14<=G15),G13/G14,” “) formu a from F21 to
G21 M21 Now se ect the E18 M21 range and create a co umn chart If you want to change the co or
for any ser es, se ect the ser es and c ck the pa ntbrush to the r ght of the chart; se ect Color and
choose the co or of your cho ce

556  Chapter 52  Chart ng tr cks


FIGURE 52-31  B ue nd cates a good month, green a bad month, and red a so so month.

How can I use waterfall charts to track progress toward a sales target or break down compo-
nents of sales price?

Waterfa charts, or g na y deve oped by the McK nsey consu t ng firm, are often used to show prog-
ress toward a fina cash pos t on or a breakdown of a company’s tota revenue nto cost components
and profit The Waterfa charts x sx fi e conta ns severa examp es of waterfa charts In the A Pos t ve
worksheet (see F gure 52-32), you create a waterfa chart for a s tuat on n wh ch a cash flows are
pos t ve You want the chart to show the month y progress toward your cash flow goa of $3,270
After enter ng your cash flows n co umn C, you need to track your cumu at ve cash flow n co umn B
Copy ng the B2+C2 formu a from B3 to B4 B7 computes the cumu at ve cash flow through the end of
each month Next, se ect the A1 C7 ce range and create a stacked co umn chart Se ect ng the Base
ser es and choos ng No Fill y e ds the waterfa chart shown n F gure 52-32

FIGURE 52-32  n th s waterfa chart, a cash flows are pos t ve.

Chart ng tr cks  Chapter 52   557


F gure 52-33 (see worksheet Pos t ve and Negat ve) shows a waterfa chart when some cash flows
are negat ve

After enter ng the pos t ve cash flows n co umn C and negat ve cash flows n co umn D, compute
the tota cash flow through the end of each month by copy ng the E1+C2-D2 formu a from E2 to
E3 E7 Next, n co umn B, by copy ng the E1-D2 formu a from B2 to B3 B7, compute the cumu at ve
cash flow through ast month, adjusted by the current month’s negat ve cash flow After se ect ng
the A1 D7 range and creat ng a co umn chart, a you have to do s h de co umn B, and you have the
waterfa chart shown n F gure 52-33

FIGURE 52-33  Th s s a waterfa chart when some cash flows are pos t ve and some are negat ve.

By fo ow ng the method used n the Pos t ve and Negat ve worksheet, you can eas y break down
a company’s revenue nto ts cost components ( nc ud ng profit) See worksheet Profitab ty Waterfa
and F gure 52-34

FIGURE 52-34  Th s s a profitab ty waterfa chart.

558  Chapter 52  Chart ng tr cks


How can I use the GETPIVOTDATA function and the Excel Table feature to create dynamic
dashboards?

Often, you m ght down oad month y, quarter y, or week y sa es data and want to summar ze the sa es
data n charts that automat ca y update to nc ude new data Know edge of the Exce GETPIVOTDATA
funct on (see Chapter 43, “Us ng P votTab es and s cers to descr be data”) and Exce Tab e feature (see
Chapter 25, “Tab es”) make th s re at ve y stra ghtforward (see fi e Randy x sx) Suppose you down oad
week y sa es data for four product categor es, F trate, Tape, Command, and Abras ves, at four stores
Menards, Target, Lowe’s, and Home Depot Your goa s to set up a dashboard that enab es you to
chart week y sa es to data at a g ven store qu ck y and g ve you contro of wh ch product categor es
appear n the chart As shown n F gure 52-35, your data s down oaded n co umns D–G Make the
D4 G243 range a tab e Th s ensures that a P votTab e based on th s data automat ca y updates to
nc ude new data when you refresh the tab e

FIGURE 52-35  Here are sa es data for dynam c dashboards.

You now create a P votTab e by dragg ng Week to the Rows zone, Store and Category to the
Columns zone, and Revenues to the Values zone Th s P votTab e (shown n F gure 52-36) summa-
r zes week y sa es for each category n each store

Chart ng tr cks  Chapter 52   559


FIGURE 52-36  P votTab e s summar z ng category sa es by store.

Now you are ready to use the GETPIVOTDATA funct on to extract the data needed to create the
des red charts To beg n, create a drop-down box (see Chapter 40, “Va dat ng data”) n ce AG8 that
can be used to se ect a store Create check boxes (see Chapter 26) for each category that can be used
to contro the AH9 AK9 range These ce s contro wh ch categor es appear n your chart Copy the
IF(­AH$9=FALSE,NA(),IFERROR(GETPIVOTDATA(“Revenue”,$I$11,”WEEK”,$AG11,”Category”,AH$10,
”Store”,$AG$8),” “)) formu a from AG11 to the AG11 AK23 range If you se ect the check box for a
category, th s formu a extracts the week y sa es for the category; f the category s c eared, #N/A s
entered n the ce A so, f 0 sa es occurred, the IFERROR port on of the formu as ensures that sa es of
0 are entered Make the AG10 AK24 range a tab e so any charts based on th s range update automat -
ca y to nc ude new data F gure 52-37 shows how the source data for your chart appears f you want
to summar ze Abras ve, Safety, and Tape sa es at Lowe’s

560  Chapter 52  Chart ng tr cks


FIGURE 52-37  Th s s the source data for your chart.

Now for the payoff! Se ect the AG10 AK24 range and create a scatter p ot w th smooth nes The
fin shed chart s shown n F gure 52-38 Th s chart can show sa es at any store of any category comb -
nat on and update when new data s down oaded

Chart ng tr cks  Chapter 52   561


FIGURE 52-38  A dynam c dashboard summar zes sa es at Lowe s of Abras ves, Tape, and Safety.

How can I create a Pareto chart?

Compan es often summar ze prob ems reported by customers w th a Pareto chart A Pareto chart
shows a st of prob ems on the x-ax s and, on the y-ax s, the fract on of prob ems assoc ated w th
each prob em and the cumu at ve percentage of prob ems caused by the sted prob ems The
Pareto x sx fi e (see F gure 52-39) ustrates the dea To beg n, sort the prob ems so they are sted
n descend ng order based on the number of t mes the prob em was reported Copy ng the E5/
SUM($E$5 $E$10) formu a from F5 to F6 F10 computes the percentage of a prob ems for each type of
prob em For examp e, Set Up caused 31 percent of a prob ems Copy ng the SUM($F$5 F5) formu a
from G5 to G6 G10 computes the cumu at ve percentage of prob ems For examp e, the first three
sted prob ems caused 80 percent of a reported prob ems After se ect ng the D4 D10 range, ho d
down the Ctr key and se ect the F4 G10 range After se ect ng the combo chart sett ngs shown n
F gure 52-40, you have the des red Pareto chart

Often, Pareto charts can be used to d sp ay the 80/20 ru e Some man festat ons of the 80/20 ru e
are as fo ows

■ 20 percent of d fferent customer comp a nts cause 80 percent of reported prob ems

■ 20 percent of peop e have 80 percent of tota ncome

■ 20 percent of your products generate 80 percent of your profit

■ 20 percent of your sa espeop e generate 80 percent of your sa es

562  Chapter 52  Chart ng tr cks


FIGURE 52-39  Use a Pareto chart to summar ze customer comp a nts.

FIGURE 52-40  Here are chart sett ngs for a Pareto chart.

Chart ng tr cks  Chapter 52   563


How can I insert a vertical line in a chart to separate pre-merger and post-merger
performance?

Suppose (see fi e Vert ca ne x sx and F gure 52-41) your company was merged w th another company
on January 10, 2011, and you are chart ng da y sa es You m ght want to nsert a vert ca ne n your
graph to nd cate the date of the merger If you draw the vert ca ne w th the Exce Shapes feature,
and the chart s moved, the ne w be n the wrong p ace To remedy th s prob em, beg n by se ect-
ng the E10 F32 range; create a scatter chart w th nes (th rd opt on) In the B15 C16 range, enter the
date of the merger and the ower and upper m ts on the y coord nates for your vert ca ne (In th s
case, the ower m t = 0, and the upper m t = 120 ) Copy the B15 C16 range and r ght-c ck your
chart C ck ng the Paste con nserts the vert ca ne on the January 10 date

FIGURE 52-41  The vert ca ne nd cates that January 10, 2011 was the merger date.

How can I use a radar chart to portray how basketball team members differ in strength,
speed, and jumping ability?

The Radar x sx fi e (see F gure 52-42) summar zes four ath etes n the d mens ons of strength, speed,
and ag ty Se ect the C2 F6 range and, from the Insert tab, se ect the Radar chart con shown n
F gure 52-43 From the drop-down menu, se ect Radar Chart with Markers, and you w have the
radar chart shown n F gure 52-42 The center of the radar chart nd cates a score of 0, and the farther
a marker s from the center, the better the score The chart makes t easy to see, for examp e, that Max
scores poor y on a measures, and Chr st an scores we on a three measures

564  Chapter 52  Chart ng tr cks


FIGURE 52-42  Th s s a radar chart w th markers.

FIGURE 52-43  Th s s a radar chart con.

I know I can use a scatter plot to display how two variables change. How can I use a bubble
chart to summarize the variation of three variables?

Whereas a scatter p ot shows you how two var ab es vary, a bubb e chart enab es you to summa-
r ze three var ab es v sua y The Bubb e x sx fi e (see F gure 52-44) conta ns, for severa countr es,
the percentage var ance n sa es re at ve to budget, the annua growth n sa es, and each country’s
market s ze To summar ze th s data n a bubb e chart, se ect the D9 F14 range, c ck the drop-down
arrow by Scatter Plot from the Insert tab, and choose the first Bubble Chart opt on After add-
ng (as descr bed ear er n the chapter) a data abe for each bubb e based on the country (ce
range C10 C14) and p ac ng the abe s above each bubb e, you obta n the bubb e chart shown n
F gure 52-44 The areas of the bubb es are proport ona to the market s ze of each country For
examp e, the US bubb e conta ns 50 percent more area than the Ch na bubb e

Chart ng tr cks  Chapter 52   565


FIGURE 52-44  Th s s an area bubb e chart.

Problems
The Cakes x sx fi e conta ns the number of sa espeop e and revenue for a bakery for each month Use
th s data for prob ems 1 to 4

1. Create a comb nat on chart w th a secondary ax s to summar ze month y sa espeop e and


revenues

2. Graph month y revenue and nsert data abe s on the chart

3. Graph the number of sa espeop e and nsert a data tab e be ow the chart

4. P ot month y sa es by us ng a cake chart rather than a co umn chart

566  Chapter 52  Chart ng tr cks


The H ddenp vot x sx fi e conta ns sa es of candy between 2009 and 2017 Use th s data for prob-
ems 5 and 6

5. F ter the data so that on y 2013 sa es appear n the spreadsheet, but a data appears n the
chart

6. Summar ze each year’s sa es n a P votTab e and show the percentage mprovement n sa es


from year to year

7. By us ng the data n the Sa estracker x sx fi e, h gh ght the top two sa espeop e each month
w th an up arrow, the bottom two w th a down arrow, and the others w th a flat arrow

8. The Ind ana Un vers ty basketba team cons ders at east 50 deflect ons per game a good per-
formance and 30 or fewer deflect ons a poor performance In the past s x games, Ind ana had
25, 55, 45, 43, 59, and 39 deflect ons P ot th s data on a band chart

9. P ot the data of prob em 8 on a co umn chart n wh ch good defens ve games are h gh ghted
n green, bad games n red, and other games n orange

10. Dur ng ts first year of operat on, a firm’s revenue was $5 m on and expenses were $6 m on
For d fferent assumed growth rates n expenses and revenues, p ot 10 years of revenues and
expenses and ensure that the graph t t e shows the year that revenues first exceed expenses

The Cr medata x sx fi e conta ns annua v o ent cr mes, property cr mes, and murders n the Un ted
States Use th s data for prob ems 11 and 12

11. Create a graph show ng the number of cr mes each year Use check boxes to contro wh ch
ser es are p otted

12. To summar ze murders, create a h stogram that updates automat ca y when new data s
nc uded

13. The fo ow ng tab e conta ns the performance rev ews of five emp oyees Use a radar chart to
summar ze the performance rev ews

Completes tasks
Person Hardworking Collegial on time Punctual
Wayne 1 2 3 4
V v an 5 6 7 8
Greg 10 9.5 9 8.5
Jen 9 2 9 4
Wanda 1 1.5 2 2.5

Chart ng tr cks  Chapter 52   567


14. A project cons sts of five act v t es The start t me and durat on of each act v ty are g ven
Summar ze th s data n a Gantt chart

Activity Start time Duration


A 0 4
B 3 6
C 5 7
D 6 8
E 3 6

15. The profit, revenue, and cost breakdown for a year are g ven n the fo ow ng tab e Summar ze
th s data n a waterfa chart

Item Amount
Revenue $300,000
Profit $65,000
Labor Costs $100.000
Mater a Costs $80,000
Overhead Costs $55,000

16. The Paretodata x sx fi e conta ns product sa es at a hardware store Create a Pareto chart for
revenue by product Does the 80/20 ru e appear to ho d for th s data?

568  Chapter 52  Chart ng tr cks


Trendline n the Analysis group on the Chart Tools Layout tab, and then c ck More Trendline
Options (or r ght-c ck and se ect Add Trendline) You see the Format Trendline d a og box, wh ch s
shown n F gure 53-1

FIGURE 53-1  These are the Format Trend ne d a og box opt ons.

If your graph nd cates that a stra ght ne s a reasonab e fit to the po nts, choose Linear If the
graph nd cates that the dependent var ab e ncreases at an acce erat ng rate, Exponential (or per-
haps Power) probab y fits the re at onsh p If the graph shows that the dependent var ab e ncreases
at a decreas ng rate, or that the dependent var ab e decreases at a decreas ng rate, Power s probab y
the most re evant

Th s chapter focuses on the L near opt on Chapter 54 d scusses the Exponent a opt on, and
Chapter 55 covers the Power opt on Chapter 62, “Us ng mov ng averages to understand t me ser es,”
d scusses the mov ng average curve, and Chapter 85 “Pr c ng products by us ng subject ve demand,”
d scusses the po ynom a curve (The ogar thm c curve s of tt e va ue n th s d scuss on, so t s not
addressed )

570  Chapter 53  Est mat ng stra ght ne re at onsh ps


Answers to this chapter’s questions
Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

How can I determine the relationship between monthly production and monthly operating
costs?

The Costest mate x sx fi e, shown n F gure 53-2, conta ns data about the un ts produced and the
month y p ant operat ng cost for a 14-month per od You are nterested n pred ct ng month y operat-
ng costs from un ts produced, wh ch he ps the p ant manager determ ne the operat ng budget and
understand better the cost to produce refr gerators

FIGURE 53-2  Th s s the p ant operat ng data.

Beg n by creat ng an XY chart (or a scatter p ot) that d sp ays the ndependent var ab e (un ts
produced) on the x-ax s and the dependent var ab e (month y p ant cost) on the y-ax s The co umn of
data that you want to d sp ay on the x-ax s must be ocated to the eft of the co umn of data you want
to d sp ay on the y-ax s To create the graph, se ect the data n the C2 D16 range ( nc ud ng the abe s
n ce s C2 and D2) C ck Scatter n the Charts group on the Insert tab and se ect the first opt on
(Scatter With Only Markers) as the chart type You see the graph shown n F gure 53-3

Est mat ng stra ght ne re at onsh ps  Chapter 53   571


FIGURE 53-3  Here s a scatter p ot of operat ng cost versus un ts produced.

When you ook at the scatter p ot, t seems reasonab e that a stra ght ne (or near re at onsh p)
ex sts between un ts produced and month y operat ng costs You can see the stra ght ne that fits
the po nts best by add ng a trend ne to the chart C ck w th n the chart to se ect t and then c ck a
data po nt A the data po nts are d sp ayed n b ue, w th an X cover ng each po nt R ght-c ck and
then c ck Add Trendline In the Format Trendline d a og box, se ect Linear and then se ect the
Display Equation On Chart and the Display R-Squared Value On Chart check boxes, as shown n
F gure 53-4

FIGURE 53-4  Se ect trend ne opt ons.

572  Chapter 53  Est mat ng stra ght ne re at onsh ps


After c ck ng Close and add ng ax s abe s and a chart t t e, you see the resu ts shown n F gure
53-5 A t t e was added to the chart and abe s for the x-ax s and y-ax s by se ect ng Chart Tools and,
from the Design tab, se ect ng Add Chart Element

FIGURE 53-5  Th s s the comp eted trend ne.

If you want to add more dec ma po nts to the va ues n the equat on, you can se ect the trend ne
equat on and, after se ect ng Format from Chart Tools, choose Format Selection After se ect ng
Number, you can choose the number of dec ma p aces to be d sp ayed

How does Exce determ ne the best-fitt ng ne? It chooses the ne that m n m zes (over a nes
that cou d be drawn) the sum of the squared vert ca d stance from each po nt to the ne The vert ca
d stance from each po nt to the ne s ca ed an error, or residual The ne Exce creates s ca ed the
least-squares line You m n m ze the sum of squared errors rather than the sum of the errors because
n s mp y summ ng the errors, pos t ve and negat ve errors can cance each other out For examp e,
f you add errors, a po nt 100 un ts above the ne and a po nt 100 un ts be ow the ne cance each
other If you square errors, however, Exce uses the fact that your pred ct ons for each po nt are wrong
to find the best-fitt ng  ne

Thus, Exce ca cu ates the best-fitt ng stra ght ne for pred ct ng month y operat ng costs from
month y un ts produced as fo ows

(Monthly operating cost)=37,894.0956+64.2687(Units produced)

By copy ng the 64 2687*C3+37894 0956 formu a from ce E3 to the E4 E16 ce range, you com-
pute the pred cted cost for each observed data po nt For examp e, when 1,260 un ts are produced,
the pred cted cost s $123,118 (See F gure 53-2 )

You shou d not use a east-squares ne to pred ct va ues of an ndependent var ab e that e
outs de the range for wh ch you have data The ne n th s examp e shou d on y be used to pred ct

Est mat ng stra ght ne re at onsh ps  Chapter 53   573


month y p ant operat ng costs dur ng months n wh ch product on s between approx mate y 450 and
1,300 un ts

The ntercept of th s ne s $37,894 10, wh ch can be nterpreted as the monthly fixed cost
Therefore, even f the p ant does not produce any refr gerators dur ng a month, th s graph est mates
that the p ant w st ncur costs of $37,894 10 The s ope of th s ne (64 2687) nd cates that each
extra refr gerator produced ncreases month y costs by $64 27 Thus, the variable cost of produc ng a
refr gerator s est mated to be $64 27

The errors (or res dua s) for each data po nt were computed n ce s F3 F16 The error for each
data po nt was defined as the amount by wh ch the po nt var es from the east-squares ne For each
month, error equa s the observed cost m nus the pred cted cost Copy ng the D3-E3 formu a from F3
to F4 F16 computes the error for each data po nt A pos t ve error nd cates a po nt s above the east-
squares ne, and a negat ve error nd cates that the po nt s be ow the east-squares ne, The sum of
the errors was computed n ce F1 and y e ded –0 03 In rea ty, for any east-squares ne, the sum of
the errors shou d equa 0 (–0 03 was obta ned because the equat on was rounded to four dec ma
po nts ) The fact that errors sum to 0 mp es that the east-squares ne has the ntu t ve y sat sfy ng
property of sp tt ng the po nts n ha f

How accurately does this relationship explain the monthly variation in plant operating cost?

C ear y, each month, both the operat ng cost and the un ts produced vary A natura quest on s,
“What percentage of the month y var at on n operat ng costs s exp a ned by the month y var at on
n un ts produced?” The answer to th s quest on s the R2 va ue (0 69 shown n F gure 53-5) You can
state that the near re at onsh p exp a ns 69 percent of the var at on n month y operat ng costs Th s
mp es that 31 percent of the var at on n month y operat ng costs s exp a ned by other factors Us ng
multiple regression (see Chapters 57 through 59), you can try to determ ne other factors that nfluence
operat ng costs

Peop e a ways ask what a good R2 va ue s There s rea y no defin t ve answer to th s quest on
W th one ndependent var ab e, of course, a arger R2 va ue nd cates a better fit of the data than a
sma er R2 va ue A better measure of the accuracy of your pred ct ons s the standard error of the
regression, wh ch s descr bed n the next sect on

How accurate are my predictions likely to be?

When you fit a ne to po nts, you obta n a standard error of the regress on that measures the spread
of the po nts around the east-squares ne The standard error assoc ated w th a east-squares ne
can be computed w th the STEYX funct on The syntax of th s funct on s STEYX(yrange,xrange), where
yrange conta ns the va ues of the dependent var ab e, and xrange conta ns the va ues of the ndepen-
dent var ab e In ce K1, the standard error of the cost est mate ne n the Costest mate x sx fi e was
computed by us ng the STEYX(D3 D16,C3 C16) formu a The resu t s shown n F gure 53-6

Approx mate y 68 percent of the po nts shou d be w th n one standard error of regress on (SER)
of the east-squares ne, and about 95 percent of the po nts shou d be w th n two SER of the east-
squares ne These measures are rem n scent of the descr pt ve stat st cs ru e of thumb that was
descr bed n Chapter 42, “Summar z ng data by us ng descr pt ve stat st cs ” In th s examp e, the

574  Chapter 53  Est mat ng stra ght ne re at onsh ps


abso ute va ue of around 68 percent of the errors shou d be $13,772 or sma er, and the abso ute
va ue of around 95 percent of the errors shou d be $27,544 (or 2*13,772) or sma er By ook ng at
the errors n co umn F, you can see that 10 out of 14, or 71 percent, of the po nts are w th n one
SER of the east-squares ne, and a (100 percent) of the po nts are w th n two standard SER of the
east-squares ne Any po nt that s more than two SER from the east-squares ne s ca ed an outlier
Look ng for causes of out ers can often he p you mprove the operat on of your bus ness For exam-
p e, a month n wh ch actua operat ng costs are $30,000 h gher than ant c pated wou d be a cost
out er on the h gh s de If you cou d ascerta n the cause of th s h gh cost out er and prevent t from
recurr ng, you wou d c ear y mprove p ant effic ency S m ar y, cons der a month n wh ch actua costs
are $30,000 ess than expected If you cou d ascerta n the cause of th s ow cost out er and ensure
that t occurred more often, you wou d mprove p ant effic ency

FIGURE 53-6  Th s s the computat on of s ope, ntercept, R squared (RSQ) va ues, and standard error of regress on.

When estimating a straight-line relationship, which functions can I use to get the slope and
intercept of the line that best fits the data?

The Exce SLOPE(yrange,xrange) and INTERCEPT(yrange,xrange) funct ons return the s ope and
ntercept, respect ve y, of the east-squares ne Thus, enter ng the SLOPE(D3 D16,C3 C16) for-
mu a n ce I1 (see F gure 53-6) returns the s ope (64 27) of the east-squares ne Enter ng the
INTERCEPT(D3 D16,C3 C16) formu a n ce I2 returns the ntercept (37,894 1) of the east-squares ne
By the way, the RSQ(yrange,xrange) funct on returns the R2 va ue assoc ated w th a east-squares ne
So, enter ng the RSQ(D3 D16,C3 C16) formu a n ce I3 returns the R2 va ue of 0 6882 for the east-
squares ne

Problems
The De data x sx fi e conta ns month y returns for the Standard & Poor’s stock ndex and for De
stock The beta of a stock s defined as the s ope of the east-squares ne used to pred ct the month y
return for a stock from the month y return for the market

1. Est mate the beta of De

2. Interpret the mean ng of De ’s beta

3. If you be eve a recess on s com ng, wou d you rather nvest n a h gh-beta or a ow-beta
stock?

Est mat ng stra ght ne re at onsh ps  Chapter 53   575


4. Dur ng a month n wh ch the market goes up 5 percent, you are 95 percent sure that De ’s
stock pr ce w ncrease between wh ch range of va ues?

The Housedata x sx fi e g ves the square footage and sa es pr ces for severa houses n Be evue,
Wash ngton

5. You w bu d a 500-square-foot add t on to your house How much do you th nk your home
va ue w ncrease as a resu t?

6. What percentage of the var at on n home va ue s exp a ned by var at on n house s ze?

7. A 3,000-square-foot house s se ng for $500,000 Is th s pr ce out of ne w th typ ca rea


estate va ues n Be evue? What m ght cause th s d screpancy?

8. We know that 32 degrees Fahrenhe t s equ va ent to 0 degrees Ce s us and that 212 degrees
Fahrenhe t s equ va ent to 100 degrees Ce s us Use the trend curve to determ ne the re at on-
sh p between Fahrenhe t and Ce s us temperatures When you create your n t a chart, before
c ck ng F n sh, you must nd cate that data s n co umns and not rows because w th on y two
data po nts, Exce assumes d fferent var ab es are n d fferent rows

9. The Betadata x sx fi e conta ns the month y returns on the Standard & Poor’s ndex as we as
the month y returns on C nergy, De , Inte , M crosoft, Norte , and Pfizer Est mate the beta of
each stock

10. The E ect ondata x sx fi e conta ns, for severa e ect ons, the percentage of votes Repub cans
ga ned from vot ng mach nes (counted on e ect on day) and the percentage Repub cans
ga ned from absentee ba ots (counted after e ect on day) Suppose that dur ng an e ect on,
Repub cans obta ned 49 percent of the votes on e ect on day and 62 percent of the absentee
ba ot votes The Democrat c cand date cr ed “fraud ” What do you th nk?

11. The O dfa thfu x sx fi e g ves the durat on between erupt ons of the O d Fa thfu geyser and
the ength of the next erupt on Suppose t has been 4 m nutes s nce the ast erupt on You are
95 percent sure that the ength of the next erupt on s between and

12. The Da ydow x sx fi e g ves da y va ues for the Dow Jones ndex from 1996 to 2010 What s
the R squared va ue when you pred ct tomorrow’s Dow Jones ndex from today’s? Does th s
h gh R squared va ue mean that the market s easy to pred ct?

576  Chapter 53  Est mat ng stra ght ne re at onsh ps


CHAPTER 54

Modeling exponential growth

Question answered in this chapter:


■ How can I mode the growth of a company’s revenue over t me?

If you want to va ue a company, t’s mportant to have some dea about ts future revenues A though
the future m ght not be ke the past, you often beg n a va uat on ana ys s of a corporat on by study-
ng the company’s revenue growth dur ng the recent past Many ana ysts ke to fit a trend curve to
recent revenue growth To fit a trend curve, you p ot the year on the x-ax s (for examp e, the first year
of data s Year 1, the second year of data s Year 2, and so on), and on the y-ax s, you p ot the com-
pany’s revenue

Usua y, the re at onsh p between t me and revenue s not a stra ght ne Reca that a stra ght ne
a ways has the same s ope, wh ch mp es that when the ndependent var ab e ( n th s case, the year)
s ncreased by 1, the pred ct on for the dependent var ab e (revenue) ncreases by the same amount
For most compan es, revenue grows by a fa r y constant percentage each year If th s s the case, as
revenue ncreases, the annua ncrease n revenue a so ncreases After a , revenue growth of 10 per-
cent of $1 m on means revenue grows by $100,000 Revenue growth of 10 percent of $100 m on
means revenue grows by $10 m on Th s ana ys s mp es that a trend curve for forecast ng revenue
shou d grow more steep y and have an ncreas ng s ope The exponential function has the property
that as the ndependent var ab e ncreases by 1, the dependent var ab e ncreases by the same per-
centage Th s re at onsh p s exact y what you need to mode revenue growth

The equat on for the exponent a funct on s y = aebx Here, x s the va ue of the ndependent
var ab e ( n th s examp e, the year), whereas y s the va ue of the dependent var ab e ( n th s case,
annua revenue) The va ue e (approx mate y 2 7182) s the base of natura ogar thms If you se ect
Exponential from the Exce trend ne opt ons, Exce ca cu ates the va ues of a and b that best fit the
data Look at an examp e

Answer to this chapter’s question


Th s sect on prov des the answer to the quest on that s sted at the beg nn ng of the chapter

577

How can I model the growth of a company’s revenue over time?

The C scoexpo x sx fi e, shown n F gure 54-1, conta ns the revenues for C sco for years 1990 through
1999 A revenues are n m ons of do ars In 1990, for examp e, C sco’s revenues were $103 47
m on

FIGURE 54-1  Th s figure shows C sco s annua revenues for the years 1990 through 1999.

To fit an exponent a curve to th s data, beg n by se ect ng the A3 B13 ce range Next, on the
Insert tab, n the Charts group, c ck Scatter Se ect ng the first chart opt on (Scatter With Only
Markers) creates the chart shown n F gure 54-2

Because the s ope of a stra ght ne s constant, fitt ng a stra ght ne to th s data wou d be r d cu-
ous When a graph’s s ope s rap d y ncreas ng, as n th s examp e, an exponent a growth w usua y
prov de a good fit to the data

To obta n the exponent a curve that best fits th s data, r ght-c ck a data po nt (a the po nts turn
b ue) and then c ck Add Trendline In the Format Trendline d a og box, se ect Exponential n the
Trendline Options area and se ect the Display Equation On Chart and Display R-Squared Value
On Chart check boxes After you c ck Close, you see the trend curve shown n F gure 54-3

The est mate of C sco’s revenue n year x (remember that x = 1 s year 1990) s computed from the
fo ow ng formu a

Estimated Revenue=58.552664e.569367x

Compute est mated revenue n the C4 C13 ce range by copy ng the =58 552664*EXP(0 569367*A4)
formu a from C4 to C5 C13 For examp e, the est mate of C sco’s revenue n 1999 (year 10) s $17 389
b on

578  Chapter 54  Mode ng exponent a growth


FIGURE 54-2  Th s s a scatter p ot for the C sco trend curve.

FIGURE 54-3  Th s s the exponent a trend curve for C sco revenues.

Not ce that most of the data po nts are very c ose to the fitted exponent a curve Th s pattern
nd cates that exponent a growth does a good job of exp a n ng C sco’s revenue growth dur ng the
1990s The fact that the R2 va ue (0 98) s very c ose to 1 s a so cons stent w th the v sua ev dence of a
good fit

Mode ng exponent a growth  Chapter 54   579


Remember that whenever x ncreases by 1, the est mate from an exponent a curve ncreases by
the same percentage You can ver fy th s fact by comput ng the rat o of each year’s est mated revenue
to the prev ous year’s est mated revenue To compute th s rat o, copy the =C5/C4 formu a from D5
to D6 D13 You find that the est mate of C sco’s growth rate s 76 7 percent per year, wh ch s the best
est mate of C sco’s annua growth rate for years 1990 through 1999

Of course, to use th s est mated annua revenue growth rate n a va uat on ana ys s, you need to
ask yourse f whether t’s ke y that th s growth rate can be ma nta ned Be forewarned that exponen-
t a growth cannot cont nue forever For examp e, f you use the exponent a trend curve to forecast
revenues for 2005 (year 16), C sco’s 2005 pred cted revenues wou d be $530 b on If th s est mate
were rea zed, C sco’s revenues wou d have tr p ed the 2005 revenues of the wor d’s argest company
(Wa mart) Th s seems h gh y unrea st c The mora s that dur ng ts ear y years, the revenue growth
for a techno ogy company fo ows exponent a growth After a wh e, the growth rate s ows down If
Wa Street ana ysts had understood th s fact dur ng the ate 1990s, the Internet stock bubb e m ght
have been avo ded Note that dur ng 1999, C sco’s actua revenue fe we short of the trend curve’s
est mated revenue Th s fact m ght we have nd cated the start of the techno ogy s owdown, wh ch
began dur ng ate 2000

By the way, why must you use x = 1 nstead of x = 1990? If you used x = 1990, Exce wou d have to
jugg e numbers around the s ze of e1990 A number th s arge causes Exce a great dea of d fficu ty

Problems
The Exponent a data x sx fi e conta ns annua sa es revenue for Stap es, Wa mart, and Inte Use th s
data to work through the first five prob ems for th s chapter

1. For each company, fit an exponent a trend curve to ts sa es data

2. For wh ch company does exponent a growth have the best fit w th ts revenue growth?

3. For wh ch company does exponent a growth have the worst fit w th ts revenue growth?

4. For each company, est mate the annua percentage growth rate for revenues

5. For each company, use your trend curve to pred ct 2003 revenues

6. The Impa as x xs fi e conta ns the pr ces of 2009, 2008, 2007, and 2006 Impa as dur ng 2010
From th s data, what can you conc ude about how a new car oses ts va ue as t grows o der?

580  Chapter 54  Mode ng exponent a growth


CHAPTER 55

The power curve

Question answered in this chapter:


■ As my company produces more of a product, t earns how to make the product more effi-
c ent y Can I mode the re at onsh p between un ts produced and the t me needed to produce
a un t?

A power curve s ca cu ated w th the equat on y = axb In the equat on, a and b are constants Us ng a
trend curve, you can determ ne the va ues of a and b that make the power curve fit a scatter p ot d a-
gram best In most s tuat ons, a s greater than 0 When th s s the case, the s ope of the power curve
depends on the va ue of b, as fo ows

■ For b>1, y ncreases as x ncreases, and the s ope of the power curve ncreases as x ncreases

■ For 0<b<1, y ncreases as x ncreases, and the s ope of the power curve decreases as x
ncreases

■ For b = 1, the power curve s a stra ght ne

■ For b<0, y decreases as x ncreases, and the power curve flattens out as x ncreases

Here are examp es of d fferent re at onsh ps that can be mode ed by a power curve These exam-
p es are conta ned n the Powerexamp es x sx fi e

If you are try ng to pred ct tota product on cost as a funct on of un ts produced, you m ght find
a re at onsh p s m ar to that shown n F gure 55-1 Not ce that b equa s 2 As ment oned prev ous y,
w th th s va ue of b, the cost of product on ncreases w th the number of un ts produced The s ope
becomes steeper, wh ch nd cates that each add t ona un t costs more to produce Th s re at onsh p
m ght occur because ncreased product on requ res more overt me abor, wh ch costs more than
regu ar abor

581

FIGURE 55-1  Pred ct cost as a funct on of the number of un ts produced.

If you are try ng to pred ct sa es as a funct on of advert s ng expend tures, you m ght find a curve
s m ar to that shown n F gure 55-2

FIGURE 55-2  The p ot shows sa es as a funct on of advert s ng.

Here, b equa s 0 5, wh ch s between 0 and 1 When b has a va ue n th s range, sa es ncrease w th


ncreased advert s ng but at a decreas ng rate Thus, the power curve enab es you to mode the dea
of d m n sh ng return—that each add t ona do ar spent on advert s ng w prov de ess benefit

582  Chapter 55  The power curve


If you are try ng to pred ct the t me needed to produce the ast un t of a product based on the
number of un ts produced to date, you often find a scatter p ot s m ar to that shown n F gure 55-3

Here you find that b equa s –0 1 Because b s ess than 0, the t me needed to produce each un t
decreases, but the rate of decrease—that s, the rate of earn ng—s ows down Th s re at onsh p
means that dur ng the ear y stages of a product’s fe cyc e, huge sav ngs n abor t me occur As
you make more of a product, however, sav ngs n abor t me occur at a s ower rate The re at onsh p
between cumu at ve un ts produced and t me needed to produce the ast un t s ca ed the learning or
experience curve

FIGURE 55-3  P ot the t me needed to produce a un t based on cumu at ve product on.

A power curve has the fo ow ng propert es

■ Property 1 If x ncreases by 1 percent, y ncreases by approx mate y b percent

■ Property 2 Whenever x doub es, y ncreases by the same percentage

Suppose that demand for a product as a funct on of pr ce can be mode ed as 1000(Pr ce) –2
Property 1 then mp es that a 1 percent ncrease n pr ce w ower demand (regard ess of pr ce) by
2 percent In th s case, the exponent b (w thout the negat ve s gn) s ca ed the elasticity E ast c ty s
d scussed further n Chapter 83, “Est mat ng a demand curve ” W th th s background, take a ook at
how to fit a power curve to data

The power curve  Chapter 55   583


Answer to this chapter’s question
Th s sect on prov des the answer to the quest on that s sted at the beg nn ng of the chapter

As my company produces more of a product, it learns how to make the product more effi-
ciently. Can I model the relationship between units produced and the time needed to produce
a unit?

The Fax x sx fi e conta ns data about the number of fax mach nes produced and the un t cost ( n 1982
do ars) of produc ng the ast fax mach ne made dur ng each year In 1983, for examp e, 70,000 fax
mach nes were produced, and the cost of produc ng the ast fax mach ne was $3,416 The data s
shown n F gure 55-4

FIGURE 55-4  Th s s the data used to p ot the earn ng curve for produc ng fax mach nes.

Because a earn ng curve tr es to pred ct e ther cost or the t me needed to produce a un t from
data about cumu at ve product on, the cumu at ve number of fax mach nes produced by the end of
each year s ca cu ated n co umn C In ce C4, refer to ce B4 to show the number of fax mach nes
produced n 1982 By copy ng the SUM($B$4 B4) formu a from C5 to C6 C10, you can compute cumu-
at ve fax mach ne product on for the end of each year

You can now create a scatter p ot that shows cumu at ve un ts produced on the x-ax s and un t
cost on the y-ax s After creat ng the chart, you c ck one of the data po nts (the data po nts w be
d sp ayed n b ue) and then r ght-c ck and c ck Add Trendline In the Format Trendline d a og box,
se ect Power and then se ect the Display Equation On Chart and Display R-Squared Value On
Chart check boxes W th these sett ngs, you obta n the chart shown n F gure 55-5 The curve drawn
represents the power curve that fits the data best

584  Chapter 55  The power curve


FIGURE 55-5  Th s s the earn ng curve for produc ng fax mach nes.

The power curve pred cts the cost of produc ng a fax mach ne as fo ows

Cost of producing fax machine=65,259(cumulative units produced)-.2533

Not ce that most data po nts are near the fitted power curve and that the R2 va ue s near y 1, nd -
cat ng that the power curve fits the data we

By copy ng the 65259*C4^–0 2533 formu a from ce E4 to E5 E10, you compute the pred cted cost
for the ast fax mach ne produced dur ng each year (The carat symbo [^], wh ch s ocated over the 6
key, s used to ra se a number to a power )

If you est mated that 1,000,000 fax mach nes were produced n 1989, after comput ng the tota
1989 product on (2,744,000) n ce C11, you can copy the forecast equat on to ce E11 to pred ct that
the ast fax mach ne produced n 1989 cost $1,526 85

Remember that Property 2 of the power curve states that whenever x doub es, y ncreases by
the same percentage By enter ng tw ce cumu at ve 1988 product on n ce C12 and copy ng your
forecast formu a n E10 to ce E12, you’ find that doub ng cumu at ve un ts produced reduces the
pred cted cost to 83 8 percent of ts prev ous va ue (1,516 83/1,712 60) For th s reason, the current
earn ng curve s known as an 84-percent earn ng curve Each t me you doub e un ts produced, the
abor requ red to make a fax mach ne drops by 16 2 percent

If a curve becomes steeper, the exponent a curve m ght fit the data as we as the power curve
does A natura quest on s wh ch curve fits the data better? In most cases, th s quest on can be
answered s mp y by eyeba ng the curves and choos ng the one that ooks ke t’s a better fit More
prec se y, you cou d compute the sum of squared errors (SSE) for each curve (obta ned by add ng up
the square of the curve va ue m nus the actua va ue for each data po nt) and choose the curve w th
the sma er SSE

The power curve  Chapter 55   585


The earn ng curve was d scovered n 1936 at Wr ght-Patterson A r Force Base n Dayton, Oh o,
when t was found that whenever the cumu at ve number of a rp anes produced doub ed, the t me
requ red to make each a rp ane dropped by around 15 percent

W k ped a g ves the fo ow ng earn ng curve est mates for var ous ndustr es

■ Aerospace 85 percent

■ Sh pbu d ng 80–85 percent

■ Comp ex mach ne too s for new mode s 75–85 percent

■ Repet t ve e ectron cs manufactur ng 90–95 percent

■ Repet t ve mach n ng or punch-press operat ons 90–95 percent

■ Repet t ve e ectr ca operat ons 75–85 percent

■ Repet t ve we d ng operat ons 90 percent

■ Raw mater a s 93–96 percent

■ Purchased parts 85–88 percent

Problems
1. Use the fax mach ne data to mode the re at onsh p between cumu at ve fax mach nes pro-
duced and tota product on cost

2. Use the fax mach ne data to mode the re at onsh p between cumu at ve fax mach nes pro-
duced and average product on cost per mach ne

3. A market ng d rector est mates that tota sa es of a product as a funct on of pr ce w


be
as shown n the fo ow ng tab e Est mate the re at onsh p between pr ce and demand and
pred ct demand for a $46 pr ce A 1 percent ncrease n pr ce w reduce demand by what
percentage?

Price Demand
$30.00 300
$40.00 200
$50.00 110
$60.00 60

4. The brand manager for a new drug be eves that the annua sa es of the drug as a funct on of
the number of sa es ca s on doctors w be as shown n the fo ow ng tab e Est mate sa es of
the drug f 80,000 sa es ca s are made on doctors

586  Chapter 55  The power curve


CHAPTER 56

Using correlations to summarize


relationships

Question answered in this chapter:


■ How are month y stock returns for M crosoft, GE, Inte , GM, and C sco re ated?

Trend curves are a great he p n understand ng how two var ab es are re ated Often, however, you
need to understand how more than two var ab es are re ated Look ng at the corre at on between
any pa r of var ab es can prov de ns ghts nto how mu t p e var ab es move up and down n va ue
together

The corre at on (usua y denoted by r) between two var ab es (ca them x and y) s a un t-free
measure of the strength of the near re at onsh p between x and y The corre at on between any two
var ab es s a ways between –1 and +1 A though the exact formu a used to compute the corre a-
t on between two var ab es sn’t very mportant, be ng ab e to nterpret the corre at on between the
var ab es s

A corre at on near +1 means that x and y have a strong pos t ve near re at onsh p That s, when
x s arger than average, y tends to be arger than average, and when x s sma er than average, y a so
tends to be sma er than average When a stra ght ne s app ed to the data, there w be a stra ght
ne w th a pos t ve s ope that does a good job of fitt ng the po nts As an examp e, for the data shown
n F gure 56-1 (x = units produced and y = monthly production cost), x and y have a corre at on of
+0 9 (See the Corre at onexamp es x sx fi e for F gures 56-1 through 56-3 )

589

FIGURE 56-1  Th s s a corre at on near +1, nd cat ng that two var ab es have a strong pos t ve near re at onsh p.

However, a corre at on near –1 means that there s a strong negat ve near re at onsh p between x
and y That s, when x s arger than average, y tends to be sma er than average, and when x s sma er
than average, y tends to be arger than average When a stra ght ne s app ed to the data, the ne
has a negat ve s ope that does a good job of fitt ng the po nts As an examp e, for the data shown n
F gure 56-2, x and y have a corre at on of –0 9

FIGURE 56-2  Th s s a corre at on near 1, nd cat ng that two var ab es have a strong negat ve near re at onsh p.

590  Chapter 56  Us ng corre at ons to summar ze re at onsh ps


A corre at on near 0 means that x and y have a weak near re at onsh p That s, know ng whether
x s arger or sma er than ts mean te s you tt e about whether y w be arger or sma er than ts
mean F gure 56-3 shows a graph of the dependence of un t sa es (y) on years of sa es exper ence (x)
Years of exper ence and un t sa es have a corre at on of 0 003 In th s data set, the average exper ence
s 10 years You can see that when a person has more than 10 years of sa es exper ence, h s sa es can
be e ther ow or h gh You can a so see that when a person has fewer than 10 years of sa es exper -
ence, sa es can be ow or h gh A though exper ence and sa es have tt e or no near re at onsh p,
there s a strong non near re at onsh p (see the fitted curve) between years of exper ence and sa es
Corre at on does not measure the strength of non near re at onsh ps

FIGURE 56-3  Th s s a corre at on of 0, nd cat ng a weak near re at onsh p between two var ab es.

Answer to this chapter’s question


Th s sect on prov des the answer to the quest on that s sted at the beg nn ng of the chapter

How are monthly stock returns for Microsoft, GE, Intel, GM, and Cisco related?

The Stockcorre x sx fi e (see F gure 56-4) shows month y stock returns for M crosoft, GE, Inte , GM,
and C sco dur ng the 1990s You can use corre at ons to understand how movements n these stocks
are re ated

To find the corre at ons between each pa r of stocks, c ck Data Analysis n the Analysis group
on the Data tab and then se ect Correlation You must nsta the Ana ys s Too Pak (as descr bed n
Chapter 41, “Summar z ng data by us ng h stograms,” and Chapter 42, “Summar z ng data by us ng
descr pt ve stat st cs”) before you can use th s feature C ck OK and then fi n the Correlation d a og
box as shown n F gure 56-5

Us ng corre at ons to summar ze re at onsh ps  Chapter 56   591


FIGURE 56-4  These are month y stock returns dur ng the 1990s.

FIGURE 56-5  Th s s the Corre at on d a og box.

The eas est way to enter the nput range s to se ect the upper- eft ce of the range (B51) and then
press Ctr +Sh ft+r ght arrow fo owed by Ctr +Sh ft+down arrow Se ect Labels In First Row f the first
row of the nput range conta ns abe s Enter ce H52 as the upper- eft ce of the output range After
c ck ng OK, you get the resu ts shown n F gure 56-6

592  Chapter 56  Us ng corre at ons to summar ze re at onsh ps


FIGURE 56-6  Here are the stock return corre at ons.

The corre at on between C sco and M crosoft s 0 513, for examp e, whereas the corre at on
between GM and M crosoft s 0 069 The ana ys s shows that returns on C sco, Inte , and M crosoft are
most c ose y t ed together Because the corre at on between each pa r of these stocks s around 0 5,
these stocks exh b t a moderate pos t ve re at onsh p In other words, f one stock does better than
average, t s ke y (but not certa n) that the other stocks w do better than average Because C sco,
Inte , and M crosoft stock returns are c ose y t ed to techno ogy spend ng, the r fa r y strong corre a-
t on s not surpr s ng You can a so see that the month y returns on M crosoft and GM are v rtua y
uncorre ated Th s re at onsh p nd cates that when M crosoft stock does better than average, you
rea y can’t te whether GM stock w do better or worse than average Aga n, th s trend s not sur-
pr s ng because GM s not rea y a h gh-tech company and s more suscept b e to the vagar es of the
bus ness cyc e

Filling in the correlation matrix


As you can see n th s examp e, Exce eft some entr es n the corre at on matr x b ank For exam-
p e, the corre at on between M crosoft and GE (wh ch s equa to the corre at on between GE and
M crosoft) s om tted If you want to fi n the ent re corre at on matr x, r ght-c ck the matr x and
then c ck Copy R ght-c ck a b ank port on of the worksheet and then c ck Paste Special In the
Paste Special d a og box, se ect Transpose Th s fl ps the data on ts s de Now r ght-c ck the fl pped
data and c ck Copy R ght-c ck the or g na corre at on matr x and c ck Paste Special aga n In the
Paste Special d a og box, se ect Skip Blanks and then c ck OK The transposed data s cop ed to the
or g na matr x, but past ng the data does not copy the b ank ce s from the transposed data The fu
corre at on matr x s shown n F gure 56-7

Us ng corre at ons to summar ze re at onsh ps  Chapter 56   593


FIGURE 56-7  Th s s the comp ete corre at on matr x.

Using the CORREL function


As an a ternat ve to us ng Correlation from the Analysis ToolPak, you can use the CORREL funct on
For examp e, enter ng the CORREL(E52 E181,F52 F181) formu a n ce I49 confirms that the corre at on
between month y returns on C sco (shown n co umn F) and GM (shown n co umn E) s 0 159

Relationship between correlation and R2


In Chapter 53, “Est mat ng stra ght- ne re at onsh ps,” you found an R2 va ue for un ts produced and
month y operat ng cost of 0 688 How s th s va ue re ated to the corre at on between un ts produced
and month y operat ng costs? The corre at on between two sets of data s s mp y

R2value

for the trend ne, where you choose the s gn for the square root to be the same as the s gn of the
s ope of the trend ne Thus, the corre at on between un ts produced and month y operat ng cost for
the data n Chapter 53 s

+ .688 = + .829

594  Chapter 56  Us ng corre at ons to summar ze re at onsh ps


Correlation and regression toward the mean
You have probab y heard the phrase, “regress on toward the mean ” Essent a y, th s statement means
that the pred cted va ue of a dependent var ab e w be n some sense c oser to ts average va ue than
the ndependent var ab e More prec se y, suppose you try to pred ct a dependent var ab e y from
an ndependent var ab e x If x s k standard dev at ons above average, your pred ct on for y w be
rk standard dev at ons above average (Here, r = correlation between x and y ) Because r s between
–1 and +1, th s means that y s fewer standard dev at ons away from the mean than x Th s s the rea
defin t on of “regress on toward the mean ” See Prob em 5 for an nterest ng app cat on of the con-
cept of regress on toward the mean

Problems
The data for the fo ow ng prob ems s n fi e Ch56data x sx

1. The Prob em 1 worksheet conta ns the number of cars parked each day both n the outdoor
ot and n the park ng garage near the Ind ana Un vers ty Ke ey Schoo of Bus ness F nd and
nterpret the corre at on between the number of cars parked n the outdoor ot and n the
park ng garage

2. The Prob em 2 worksheet conta ns da y sa es vo ume ( n do ars) of aser pr nters, pr nter car-
tr dges, and schoo supp es F nd and nterpret the corre at ons between these quant t es

3. The Prob em 3 worksheet conta ns annua returns on stocks, T-b s, and T-bonds F nd and
nterpret the corre at ons between the annua returns on these three c asses of nvestments

Here are two more prob ems

4. The Dow x sx fi e conta ns the month y returns between the 30 stocks compr s ng the Dow
Jones Index F nd the corre at ons between a stocks Then, for each stock, use cond t ona for-
matt ng to h gh ght the three stocks most corre ated w th that stock (Of course, you shou d
not h gh ght a stock as corre ated w th tse f )

5. NFL teams p ay 16 games dur ng the regu ar season Suppose the standard dev at on of the
number of games won by a teams s 2, and the corre at on between the number of games a
team w ns n two consecut ve seasons s 0 5 If a team goes 12 and 4 dur ng a season, what s
your best pred ct on for how many games that team w w n next season?

Us ng corre at ons to summar ze re at onsh ps  Chapter 56   595


CHAPTER 57

Introduction to multiple regression

Questions answered in this chapter:


■ Our factory manufactures three products How can I pred ct the cost of runn ng the factory
based on the number of un ts produced?

■ How accurate are my forecasts for pred ct ng month y cost based on un ts produced?

■ I know how to use the Data Ana ys s command to run a mu t p e regress on Is there a way to
run the regress on w thout us ng th s command and p ace the regress on’s resu ts n the same
worksheet as the data?

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

Our factory manufactures three products. How can I predict the cost of running the factory
based on the number of units produced?

Chapter 53 through Chapter 55 descr bed how to use the trend curve n M crosoft Exce 2013 to
pred ct one var ab e (ca ed y, or the dependent var ab e) from another var ab e (ca ed x, or the
independent var ab e) However, you often want to use more than one ndependent var ab e (ca ed
ndependent var ab es x1, x2, xn) to pred ct the va ue of a dependent var ab e In these cases, you
can use e ther the mu t p e regress on opt on n the Exce Data Ana ys s feature or the LINEST funct on
to est mate the re at onsh p you want

Mu t p e regress on assumes that the re at onsh p between y and x1, x2, xn has the fo ow ng
form

Y=Constant+B1x1+B2x2+...Bnxn

Exce ca cu ates the va ues of Constant, B1, B2, Bn to make the pred ct ons from th s equat on
as accurate ( n the sense of m n m z ng the sum of squared errors) as poss b e The fo ow ng examp e
ustrates how mu t p e regress on works

The Data worksheet n the Mrcostest x sx fi e (see F gure 57-1) conta ns the cost of runn ng a p ant
over 19 months as we as the number of un ts of Product A, Product B, and Product C produced dur-
ng each month

597

FIGURE 57-1  Th s s the data for pred ct ng month y operat ng costs.

You wou d ke to find the best forecast for month y operat ng cost that has the fo ow ng form
(wh ch s referred to as Form 1)

Monthly operating cost=Constant+B1*(Units A produced)+B2*(Units B produced)


+B3*(Units C produced)

The Exce Data Ana ys s feature can find the equat on for th s form that best fits your data
C ck Data Analysis n the Analysis group on the Data tab and then se ect Regression F n the
Regression d a og box as shown n F gure 57-2

Note  If you haven’t previously installed the Analysis ToolPak, click the File tab, click
Options, and then click Add-Ins. With Excel Add-ins selected in the Manage dialog box,
click Go, select the Analysis ToolPak check box, and then click OK.

598  Chapter 57  ntroduct on to mu t p e regress on


FIGURE 57-2  Th s s the Regress on d a og box.

■ Input Y Range (B3 B22 n th s examp e) conta ns the dependent var ab e or data ( nc ud ng the
Cost abe ) that you want to pred ct

■ Input X Range (C3 E22) conta ns the data or ndependent var ab es ( nc ud ng the A Made, B
Made, and C Made abe s) that you want to use n the pred ct on Exce has a m t of 15 nde-
pendent var ab es, wh ch must be n adjacent co umns

■ Because both the Input X and Input Y ranges nc ude abe s, se ect the Labels check box

■ The output was p aced n a new worksheet, t t ed Regress on

■ Se ect ng the Residuals check box causes Exce to st, for each observat on, the pred ct on
from Form 1 and the res dua , wh ch equa s the observed cost m nus the pred cted cost

After c ck ng OK n the Regression d a og box, you obta n the output shown n F gure 57-3 and
F gure 57-4 (See the Regress on worksheet )

ntroduct on to mu t p e regress on  Chapter 57   599


FIGURE 57-3  Here s the or g na mu t p e regress on output.

FIGURE 57-4  Here s the or g na mu t p e regress on res dua output.

What s the best pred ct on equat on? You’ find n the Coeffic ents co umn (co umn B of the
summary output) that the best equat on of Form 1 that can be used to pred ct month y cost s the
fo ow ng

Predicted monthly cost=35,102.90+2.07(AMade)+4.18(BMade)+4.79(CMade)

600  Chapter 57  ntroduct on to mu t p e regress on


A natura quest on s wh ch of your ndependent var ab es are usefu for pred ct ng month y cost?
After a , f you choose the number of games the Seatt e Mar ners won dur ng a one-month per od
as an ndependent var ab e, you wou d expect that th s var ab e wou d have tt e effect on pred ct-
ng month y operat ng cost When you run a regress on, each ndependent var ab e has a p-va ue
between 0 and 1 Any ndependent var ab e w th a p-va ue (see co umn E) of ess than or equa to 0 05
s cons dered usefu for pred ct ng the dependent var ab e Thus, the sma er the p-va ue, the h gher
the pred ct ve power of the ndependent var ab e Your three ndependent var ab es have p-va ues of
0 23 (for A Made), 0 025 (for B Made), and 0 017 (for C Made) These p-va ues can be nterpreted as
fo ows

■ When you use B Made and C Made to pred ct month y operat ng cost, you have a 77 percent
chance (1 – 0 23) that A Made adds pred ct ve power

■ When you use A Made and C Made to pred ct month y operat ng cost, there s a 97 5 percent
chance (1 – 0 025) that B Made adds pred ct ve power

■ When you use A Made and B Made to pred ct month y operat ng cost, there s a 98 3 percent
chance (1 – 0 017) that C Made adds pred ct ve power

Your p-va ues nd cate that A Made does not add much pred ct ve power to B Made and C Made,
wh ch means that f you know B Made and C Made, you can pred ct month y operat ng cost about as
we as you can f you nc ude A Made as an ndependent var ab e Therefore, you can opt to de ete A
Made as an ndependent var ab e and use just B Made and C Made for your pred ct on Copy the data
to the A Removed worksheet and de ete the A Made co umn (co umn C) Adjust the Input X range
to be C3 D22 In the NoA worksheet, you can see the regress on output shown n F gure 57-5 and
F gure 57-6

FIGURE 57-5  Mu t p e regress on output w th A Made data removed as an ndependent var ab e.

ntroduct on to mu t p e regress on  Chapter 57   601


FIGURE 57-6  Th s s res dua output ca cu ated when A Made data s removed as an ndependent var ab e.

You can see that B Made and C Made have very ow p-va ues (0 002 and 0 007, respect ve y) These
va ues nd cate that both these ndependent var ab es have usefu pred ct ve power By us ng the
new coeffic ents n co umn B, you can now pred ct month y operat ng cost by us ng the fo ow ng
equat on

Predicted monthly operating cost=35,475.3+5.32(BMade)+5.42(CMade)

How accurate are my forecasts for predicting monthly cost based on units produced?

In the regress on output n ce B5 of the NoA worksheet (see F gure 57-5), R2 equa s 0 61 An R2
va ue such as th s one means that together, B Made and C Made exp a n 61 percent of the var a-
t on n month y operat ng costs Not ce that n the or g na regress on, wh ch nc uded A Made as an
ndependent var ab e, R2 equa s 0 65 Th s nd cates that the add t on of A Made as an ndependent
var ab e exp a ns on y 4 percent more var at on n month y operat ng costs Hav ng such a m nor d f-
ference s cons stent w th the dec s on to de ete A Made as an ndependent var ab e

In the regress on output n ce B7 n the NoA worksheet, the standard error for the regress on w th
B Made and C Made as ndependent var ab es s 1,274 You wou d expect about 68 percent of your
mu t p e regress on forecasts to be accurate w th n one standard error and 95 percent to be accurate
w th n two standard errors Any forecast that d ffers from the actua va ue by more than two standard

602  Chapter 57  ntroduct on to mu t p e regress on


errors s cons dered an out er Thus, f your forecasted operat ng cost s n error by more than $2,548
(2*1274), you cons der that observat on to be an out er

In the Res dua port on of the output, shown ear er, n F gure 57-6, you are g ven for each observa-
t on the pred cted cost and the res dua , wh ch equa s the actua cost ess the pred cted cost For the
first observat on, for examp e, the pred cted cost s $43,381 10 The res dua of $1,057 95 nd cates that
the pred ct on of actua cost was too ow by $1,057 95

I know how to use the Data Analysis command to run a multiple regression. Is there a way to
run the regression without using this command and place the regression’s results in the same
worksheet as the data?

The Exce LINEST funct on can be used to nsert the resu ts of a regress on ana ys s d rect y nto a
workbook The LINEST funct on s an examp e of an array funct on (See Chapter 87, “Array formu as
and funct ons,” for further d scuss on of array funct ons and formu as ) For now, here s an ntroduc-
t on to array funct ons

■ Before enter ng an array funct on, you must a ways se ect the ce range n wh ch you want the
resu ts of the array funct on to be ocated

■ Instead of press ng Enter to perform the ca cu at on, you must press Ctr +Sh ft+Enter to com-
p ete the entry of an array funct on

■ After enter ng an array funct on, you see a cur y bracket n the formu a bar when you se ect a
ce n wh ch the array funct on’s resu ts are ocated Th s bracket nd cates that the resu ts n
the ce were computed w th an array funct on

■ You can’t mod fy data n any part of a range created by an array funct on

To use the LINEST funct on when there are m ndependent var ab es, beg n by se ect ng a b ank
ce range cons st ng of five rows and m + 1 co umns where you want LINEST to depos t the resu ts In
the A Removed worksheet, the F5 H9 range was used

The syntax of the LINEST funct on s LINEST(KnownYs,KnownXs,True,True) If the th rd argument s


changed to Fa se, Exce est mates the equat on w thout a constant term Chang ng the fourth argu-
ment to Fa se causes the LINEST funct on to om t many regress on computat ons and return on y the
mu t p e regress on equat on

W th the upper- eft ce of the target range se ected (F5 n th s examp e), se ect the range of the
s ze you want ( n th s case, the F5 H9 ce range) and then enter the =LINEST(B4 B22,C4 D22,True,
True) formu a Because LINEST s an array funct on at th s po nt, first ho d down Ctr +Sh ft and then
press Enter for the funct on to work correct y After us ng th s key comb nat on, you obta n the resu ts
shown n F gure 57-7 (See the A Removed worksheet )

ntroduct on to mu t p e regress on  Chapter 57   603


FIGURE 57-7  Use the LINEST funct on to ca cu ate a mu t p e regress on.

In row 5, you find the pred ct on equat on (coeffic ents read r ght to eft, start ng w th the nter-
cept) of Pred cted month y cost = 35,475 3 + 5 32(B Made) + 5 43(C Made) Row 6 conta ns standard
errors for each coeffic ent est mate, but these are not too re evant Ce F7 conta ns the R2 va ue of
0 61, and ce G7 conta ns the regress on standard error of 1,274 Rows 8 and 9 conta n nformat on
(F stat st c, degrees of freedom, sum of squares regress on, and sum of squares res dua ) that s ess
mportant

Note  Problems that you can work with to learn more about multiple regression are avail-
able at the end of Chapter 59, “Modeling nonlinearities and interactions.”

604  Chapter 57  ntroduct on to mu t p e regress on


CHAPTER 58

Incorporating qualitative factors


into multiple regression

Questions answered in this chapter:


■ How can I pred ct quarter y US auto sa es?

■ How can I pred ct US pres dent a e ect ons?

■ Is there an Exce funct on I can use to make forecasts eas y from a mu t p e regress on
equat on?

In the first examp e of mu t p e regress on n Chapter 57, “Introduct on to mu t p e regress on,” the
month y cost of p ant operat ons was forecasted by us ng the number of un ts of each product manu-
factured at the p ant Because you can quant fy exact y the amount of a product produced at a p ant,
you can refer to the un ts produced of Product A, Product B, and Product C as quantitative indepen-
dent variables In many s tuat ons, however, ndependent var ab es can’t be eas y quant fied In th s
chapter, you ook at ways to ncorporate qua tat ve factors such as seasona ty, gender, or the party of
a pres dent a cand date nto a mu t p e regress on ana ys s

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

How can I predict quarterly U.S. auto sales?

Suppose you want to pred ct quarter y US auto sa es to determ ne whether the quarter of the year
affects auto sa es Use the data n the Data worksheet n the Autotemp x sx fi e, shown n F gure 58-1
Sa es are sted n thousands of cars, and GNP s n b ons of do ars

605

FIGURE 58-1  Here s the auto sa es data.

You m ght be tempted to define an ndependent var ab e that equa s 1 dur ng the first quarter, 2
dur ng the second quarter, and so on Unfortunate y, th s approach wou d force the fourth quarter
to have four t mes the effect of the first quarter, wh ch m ght not be true The quarter of the year s a
qualitative independent variable To mode a qua tat ve ndependent var ab e, you create an ndepen-
dent var ab e ca ed a dummy variable for a but one of the qua tat ve var ab e’s poss b e va ues (It
s arb trary wh ch va ue you eave out In th s examp e, Quarter 4 was om tted ) The dummy var ab es
te you wh ch va ue of the qua tat ve var ab e occurs Thus, you have a dummy var ab e for Quarter 1,
Quarter 2, and Quarter 3 w th the fo ow ng propert es

■ Quarter 1 dummy var ab e equa s 1 f the quarter s Quarter 1 or 0 f otherw se

■ Quarter 2 dummy var ab e equa s 1 f the quarter s Quarter 2 or 0 f otherw se

■ Quarter 3 dummy var ab e equa s 1 f the quarter s Quarter 3 or 0 f otherw se

A Quarter 4 observat on w be dent fied by the fact that the dummy var ab es for Quarter 1
through Quarter 3 equa 0 You can see why you don’t need a dummy var ab e for Quarter 4 In fact,
f you nc ude a dummy var ab e for Quarter 4 as an ndependent var ab e n the regress on, M crosoft
Exce returns an error message, because f an exact near re at onsh p ex sts between any set of nde-
pendent var ab es, Exce must perform the mathemat ca equ va ent of d v d ng by 0 (an mposs b ty)

606  Chapter 58  ncorporat ng qua tat ve factors nto mu t p e regress on


when runn ng a mu t p e regress on In th s examp e, f you nc ude a Quarter 4 dummy var ab e, every
data po nt sat sfies the fo ow ng exact near re at onsh p

(Quarter 1 Dummy)+(Quarter 2 Dummy)+(Quarter 3 Dummy)+(Quarter 4 Dummy)=1

Note An exact linear relationship occurs if there exists constants c0, c1, . . . cN, such that
for each data point, c0 + c1x1 + c2x2 + . . . cNxN 0. Here, x1 through xN are the values of
the independent variables.

To create the dummy var ab e for Quarter 1, copy the IF(B12=1,1,0) formu a from G12 to G13 G42
Th s formu a p aces a 1 n co umn G whenever a quarter s the first quarter or a 0 n co umn G when-
ever the quarter s not the first quarter In a s m ar fash on, create dummy var ab es for Quarter 2 ( n
H12 H42) and Quarter 3 ( n I12 I42) You can see the resu ts of the formu as n F gure 58-2

FIGURE 58-2  Use dummy var ab es to track the quarter n wh ch a sa e occurs.

In add t on to seasona ty, you want to use macroeconom c var ab es such as gross nat ona
product (GNP, n b ons of 1986 do ars), nterest rates, and unemp oyment rates to pred ct car sa es
Suppose, for examp e, that you are try ng to est mate sa es for the second quarter of 1979 Because
va ues for GNP, nterest rate, and unemp oyment rate aren’t known at the beg nn ng of the second
quarter n 1979, you can’t use second quarter 1979 GNP, nterest rate, and unemp oyment rate to pre-
d ct Quarter 2 1979 auto sa es Instead, you use the va ues for GNP, nterest rate, and unemp oyment
rate lagged one quarter to forecast auto sa es By copy ng the =D11 formu a from J12 to J12 L42, you

ncorporat ng qua tat ve factors nto mu t p e regress on  Chapter 58   607
create the agged va ue for GNP, the first of your macroeconom c ndependent var ab es For examp e,
the J12 L12 range conta ns GNP, unemp oyment rate, and nterest rate for the first quarter of 1979

You can now run the mu t p e regress on by c ck ng Data Analysis on the Data tab and then
se ect ng Regression n the Data Analysis d a og box Use C11 C42 as the Input Y Range and G11 L42
as the Input X Range, se ect the Labels opt on (row 11 conta ns abe s), and se ect the Residuals
check box After c ck ng OK, you obta n the output, wh ch you can see n the Regress on worksheet
and n F gure 58-3, F gure 58-4, and F gure 58-5

FIGURE 58-3  Th s s the summary output and ANOVA tab e for auto sa es data.

In F gure 58-4, you can see that the equat on (equat on 1) used to pred ct quarter y auto sa es s as
fo ows

Predicted quarterly sales=3154.7+156.833Q1+379.784Q2+203.03 6Q3+.174(LAGGNP in billions)
–93.83(LAGUNEMP)–73.91(LAGINT)

A so n F gure 58-4, you see that each ndependent var ab e has a p-va ue ess than or equa to
0 15 You can conc ude that a ndependent var ab es have a s gn ficant effect on quarter y auto sa es
You nterpret a coeffic ents n a regress on equat on ceteris paribus (wh ch means that each coef-
fic ent g ves the effect of the ndependent var ab e after adjust ng for the effects of a other var ab es
n the regress on)

FIGURE 58-4  Th s s the coeffic ent nformat on for the auto sa es regress on.

608  Chapter 58  ncorporat ng qua tat ve factors nto mu t p e regress on


Here’s an nterpretat on of each coeffic ent

■ A $1 b on ncrease n ast quarter’s GNP ncreases quarter y car sa es by 174

■ An ncrease of 1 percent n ast quarter’s unemp oyment rate decreases quarter y car sa es by
93,832

■ An ncrease of 1 percent n ast quarter’s nterest rate decreases quarter y car sa es by 73,917

To nterpret the coeffic ents of the dummy var ab es, you must rea ze that they te you the effect
of seasona ty re at ve to the va ue eft out of the qua tat ve var ab es Therefore

■ In Quarter 1, car sa es exceed Quarter 4 car sa es by 156,833

■ In Quarter 2, car sa es exceed Quarter 4 car sa es by 379,784

■ In Quarter 3, car sa es exceed Quarter 4 car sa es by 203,036

You find that car sa es are h ghest dur ng the second quarter (Apr through June; tax refunds and
summer are com ng) and owest dur ng the th rd quarter (October through December; why buy a new
car when w nter sa t ng w ru n t?)

From the Summary output shown n F gure 58-3, you can earn the fo ow ng

■ The var at on n the ndependent var ab es (macroeconom c factors and seasona ty) exp a ns
78 percent of the var at on n the dependent var ab e (quarter y car sa es)

■ The standard error of regress on s 190,524 cars You can expect around 68 percent of your
forecasts to be accurate w th n 190,524 cars and about 95 percent of your forecasts to be
accurate w th n 381,048 cars (2*190,524)

■ Th rty-one observat ons are used to fit the regress on

The on y quant ty of nterest n the ANOVA tab e n F gure 58-3 s the s gn ficance (0 00000068)
Th s measure mp es that there are on y 6 8 chances n 10,000,000 that, taken together, a the nde-
pendent var ab es are use ess n forecast ng car sa es Thus, you can be qu te sure that the ndepen-
dent var ab es are usefu n pred ct ng quarter y auto sa es

F gure 58-5 shows, for each observat on, the pred cted sa es and res dua For examp e, for the
second quarter of 1979 (observat on 1), pred cted sa es from equat on 1 are 2,728 6, and the res dua
s 181,411 cars (2910 – 2728 6) Note that no res dua exceeds 381,000 n abso ute va ue, so you have
no out ers

ncorporat ng qua tat ve factors nto mu t p e regress on  Chapter 58   609
FIGURE 58-5  These are the res dua s for the auto sa es data.

How can I predict US presidential elections?

When asked wh ch factors dr ve pres dent a e ect ons, pres dent a adv sor James Carv e sa d, “It’s the
economy, stup d ” Ya e econom st Roy Fa r showed that Carv e was correct n th nk ng that the state
of the economy has a arge nfluence on the resu ts of pres dent a e ect ons Fa r’s dependent var ab e
(see the Data worksheet n the Prese ect12 x sx fi e, shown n F gure 58-6) for each e ect on (1916
through 2012) was the percentage of the two-party vote ( gnor ng votes rece ved by th rd-party
cand dates) that went to the ncumbent party He tr ed to pred ct the ncumbent party’s percentage
of the two-party vote by us ng ndependent var ab es such as

■ Party in power  In your data, 1 denotes when the Repub can party was n power, and 0
denotes when the Democrat c party was n power

■ Percentage growth in GNP during the first nine months of the election year

■ Absolute value of the inflation rate during the first nine months of the election
year  You use the abso ute va ue because e ther a pos t ve or a negat ve nflat on rate s bad

610  Chapter 58  ncorporat ng qua tat ve factors nto mu t p e regress on


■ Number of quarters during the last four years in which economic growth was
strong  Strong econom c growth s defined as growth at an annua eve of 3 2 percent or
more

■ Length of time an incumbent party has been in office  Fa r used 0 to denote one term n
office, 1 for two terms, 1 25 for three terms, 1 5 for four terms, and 1 75 for five terms or more
Th s defin t on mp es that each term after the first term n office has ess nfluence on the
e ect on resu ts than the first term n office

■ Elections during wartime  The e ect ons n 1920 (Wor d War I), 1944 (Wor d War II), and
1948 (Wor d War II was st underway n 1945) were defined as wart me e ect ons (E ect ons
he d dur ng the V etnam War were not cons dered to be wart me e ect ons ) Dur ng wart me
years, the var ab es re ated to quarters of good growth and nflat on were deemed rre evant
and were set to 0

■ The current president running for reelection  If th s s the case, th s var ab e s set to 1;
otherw se, th s var ab e s set to 0 In 1976, Gera d Ford was not cons dered a pres dent run-
n ng for ree ect on because he was not e ected e ther as pres dent or as v ce-pres dent

FIGURE 58-6  Th s s pres dent a e ect on data.

The data from e ect ons from 1916 through 2000 are now used to deve op a mu t p e regress on
equat on that can be used to forecast future pres dent a e ect ons The 2004, 2008, and 2012 e ec-
t ons have been saved as va dat on po nts When fitt ng a regress on to data, t’s a ways a good dea
to ho d back some of your data for use n va dat ng your regress on equat on Ho d ng back data
enab es you to determ ne whether your regress on equat on can do a good job of forecast ng data
t hasn’t seen Any forecast ng too that poor y forecasts data t hasn’t seen shou d not be used to
pred ct the future

ncorporat ng qua tat ve factors nto mu t p e regress on  Chapter 58   611
To run the regress on, c ck Data Analysis n the Analysis group on the Data tab and then se ect
the Regression too n the Data Analysis d a og box C7 C28 was used here as the Input Y Range and
E7 L28 as the Input X Range The Labels opt on (row 6 conta ns abe s) was se ected The output was
p aced n the Answer worksheet, wh ch you can see n F gure 58-7

FIGURE 58-7  Th s s the regress on output for pred ct ng pres dent a e ect ons.

In F gure 58-7, you can see that a ndependent var ab es ( f you round down the War coeffic ent to
0 10) have p-va ues ess than or equa to 0 10 and shou d a be used n pred ct ons From the coeffi-
c ents sect on n F gure 58-7, you can determ ne that the best equat on to pred ct e ect ons s g ven by
the fo ow ng (equat on 1)

Predicted presidential election percentage= 45.29 +0.69GROWTH – 0.71ABSINFL +0.86*QTRSGOODGROWTH


– 3.23TIMEINOFFICE + 5.83REPB + 4.75WAR + 4.04PRESRUNNING

The coeffic ents of the ndependent var ab es can be nterpreted as fo ows (after adjust ng for a
other ndependent var ab es)

■ A 1 percent ncrease n the annua GNP growth rate dur ng an e ect on year s worth
0 69 ­percent to the ncumbent party

■ A 1 percent dev at on from the dea (0 percent nflat on) costs the ncumbent party
0 71 ­percent of the vote

■ Every good quarter of growth dur ng an ncumbent’s term ncreases h s (maybe her someday
soon) vote by 0 86 percent

■ Re at ve to hav ng one term n office, the second term n office decreases the ncumbent’s vote
by 3 22 percent, and each ater term decreases the ncumbent’s vote by 0 25*(3 22percent) =
0 80 percent

■ A Repub can has a 5 83 percent edge over a Democrat

612  Chapter 58  ncorporat ng qua tat ve factors nto mu t p e regress on


■ The Un ted States at war adds 4 79 percent to the pred ct on for the ncumbent vote share

■ If the pres dent s runn ng, you shou d add 4 04 percent to your pred ct on for the ncumbent
vote share

FIGURE 58-8  These figures are res dua s from the pres dent a e ect on equat on.

From ce B5, you see that your regress on exp a ns 91 5 percent of the var at on n the ncumbent’s
vote share From the standard error of 2 46 percent, you earn that approx mate y 95 percent of your
forecasts shou d be accurate w th n 2*2 46 = 4 92% Because the marg n of error on pres dent a po s
the day of the e ect on s around 3 percent, t s amaz ng that your mode , wh ch does not account for
the qua ty of the cand dates, does so we ! Look at F gure 58-8; you see that the on y out er was the
1992 Bush–C nton e ect on, n wh ch C nton performed 5 68 percent better than expected Th s cou d
be attr buted to the fact that C nton was a great campa gner

Is there an Excel function I can use to make forecasts easily from a multiple regression
equation?

It’s ted ous to make forecasts by us ng an equat on such as equat on 1, but the Exce TREND funct on
makes t easy to generate forecasts from a mu t p e regress on You don’t even have to run a regres-
s on w th the Data Ana ys s command The syntax of the TREND funct on s TREND(Known y’s,Known
x’s,New x’s,Const) Th s funct on w run a regress on that attempts to pred ct Known y’s from Known
x’s The resu ts of th s regress on are then app ed to the New x’s data to generate pred ct ons based
on the fitted regress on equat on If Const = TRUE, the regress on ntercept s ca cu ated norma y,
whereas f Const= FALSE, the regress on equat on s fit w thout an ntercept

ncorporat ng qua tat ve factors nto mu t p e regress on  Chapter 58   613
The TREND funct on s an examp e of an array function A br ef ntroduct on to array funct ons
was prov ded n Chapter 57, “Introduct on to mu t p e regress on,” and a more comp ete d scuss on of
array funct ons s offered n Chapter 87, “Array formu as and funct ons ”

To ustrate the use of the TREND funct on, how to generate forecasts for the 1916 through 2012
e ect ons s descr bed by us ng data from on y the 1916 through 2000 e ect ons Beg n, as descr bed n
Chapter 57, by se ect ng the ce range ( n th s examp e, L17 L31) where you want your forecasts to go
W th the po nter n the first ce of th s range (ce L17), enter the =TREND(C7 C28,E7 K28,E7 K31,­TRUE)
formu a Next, as descr bed n Chapter 57, press Ctr +Sh ft+Enter You now see (see F gure 58-6) the
forecast for each e ect on, generated n ce s L7 L31 Note that n 2004, the ncumbent (Bush) per-
formed 4 6 percent worse than expected, and n 2008 and 2012, the cand dates of the party n power
(McCa n and Obama) performed 1 4 percent better than expected

Note  Problems that you can work through to learn more about multiple regression are
available at the end of Chapter 59, “Modeling nonlinearities and interactions.”

614  Chapter 58  ncorporat ng qua tat ve factors nto mu t p e regress on


CHAPTER 59

Modeling nonlinearities and


interactions

Questions answered in this chapter:


■ What does t mean when we say that an ndependent var ab e has a non near effect on a
dependent var ab e?

■ What does t mean when we say that the effects of two ndependent var ab es on a dependent
var ab e nteract?

■ How can I test for the presence of non near ty and nteract on n a regress on?

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

What does it mean when we say that an independent variable has a nonlinear effect on a
dependent variable?

An ndependent var ab e often nfluences a dependent var ab e through a non near re at onsh p For
examp e, f you try to pred ct product sa es by us ng an equat on such as Sa es = 500 – 10*Pr ce, pr ce
nfluences sa es near y Th s equat on nd cates that a un t ncrease n pr ce w (at any pr ce eve )
reduce sa es by 10 un ts If the re at onsh p between sa es and pr ce were governed by an equat on
such as Sa es = 500 + 4*Pr ce – 40*Pr ce2, pr ce and sa es wou d be re ated non near y As shown
n F gure 59-1, arger ncreases n pr ce resu t n arger decreases n demand (see the Non near ty
worksheet n the Interact ons x sx fi e) In short, f the change n the dependent var ab e caused by a
un t change n the ndependent var ab e s not constant, there s a non near re at onsh p between the
ndependent and dependent var ab es

615

FIGURE 59-1  Th s figure shows a non near re at onsh p between demand and pr ce.

What does it mean when we say that the effects of two independent variables on a dependent
variable interact?

If the effect of one ndependent var ab e on a dependent var ab e depends on the va ue of another
ndependent var ab e, you can say that the two ndependent var ab es exh b t interaction For exam-
p e, suppose you try to pred ct sa es by us ng pr ce and the amount spent on advert s ng If the effect
of chang ng the eve of advert s ng do ars s arge when the pr ce s sma and sma when the pr ce s
h gh, pr ce and advert s ng exh b t nteract on If the effect of chang ng the eve of advert s ng do ars
s the same for any pr ce eve , sa es and pr ce do not exh b t any nteract on

How can I test for the presence of nonlinearity and interaction in a regression?

To see whether an ndependent var ab e has a non near effect on a dependent var ab e, you s mp y
add an ndependent var ab e to the regress on that equa s the square of the ndependent var ab e If
the squared term has a ow p-va ue ( ess than 0 15), you have ev dence of a non near re at onsh p

To check whether two ndependent var ab es exh b t nteract on, add a term to the regress on that
equa s the product of the ndependent var ab es If the term has a ow p-va ue ( ess than 0 15), you
have ev dence of nteract on

To ustrate, try to determ ne how gender and exper ence nfluence sa ar es at a sma manufactur-
ng company For each emp oyee, you are g ven the fo ow ng set of data You can find the nforma-
t on n the Data worksheet n the Interact ons x sx fi e, shown n F gure 59-2

■ Annua sa ary ( n thousands of do ars)

■ Years of exper ence work ng n the manufactur ng bus ness

■ Gender (1 = fema e, 0 = ma e)
616  Chapter 59  Mode ng non near t es and nteract ons
Use th s data to pred ct sa ary (the dependent var ab e) based on years of exper ence and gen-
der To test whether years of exper ence has a non near effect on sa ary, add the term Exper ence
Squared by copy ng the B2^2 formu a from D2 to D3 D98 To test whether exper ence and gender
have a s gn ficant nteract on, add the term Exper ence*Gender by copy ng the B2*C2 formu a from
E2 to E3 E98 Run a regress on w th an Input Y Range of A1 A98 and an Input X Range of B1 E98 After
se ect ng Labels n the Regression d a og box and c ck ng OK, you shou d obta n the resu ts shown
n F gure 59-3

FIGURE 59-2  Th s s the data for pred ct ng sa ary based on gender and exper ence.

You can see that gender s ns gn ficant ( ts p-va ue s greater than 0 15) A other ndependent
var ab es are s gn ficant (mean ng they have a p-va ue ess than or equa to 0 15) You can de ete the
ns gn ficant gender var ab e as an ndependent var ab e To do th s, copy the data nto a new work-
sheet ca ed FinalRegression (R ght-c ck any worksheet tab, c ck Move Or Copy, and then se ect
the Create A Copy check box ) After de et ng the Gender co umn, you obta n the regress on resu ts
nc uded n the F na Regress on worksheet and shown n F gure 59-4

Mode ng non near t es and nteract ons  Chapter 59   617


FIGURE 59-3  These are regress on resu ts that test for non near ty and nteract on.

FIGURE 59-4  These are the regress on resu ts after de et ng the ns gn ficant gender var ab e.

A ndependent var ab es are now s gn ficant (have a p-va ue ess than or equa to 0 15) Therefore,
you can pred ct sa ary ( n thousands of do ars) by us ng the fo ow ng equat on (equat on 1)

Predicted salary=59.06+.78(EXP)-.033EXP2–2.07(EXP*GENDER)

The negat ve EXP2 term nd cates that each add t ona year of exper ence has ess mpact on sa ary,
wh ch means that exper ence has a non near effect on sa ary In fact, th s mode shows that after 13
years of exper ence, each add t ona year of exper ence actua y reduces sa ary

Remember that gender equa s 1 for a woman and 0 for a man After subst tut ng 1 for gender n
equat on 1, a woman’s sa ary can be pred cted as fo ows

Predicted salary=59.06+78EXP-.033EXP2 –2.07(EXP*1)=59.06-.033EXP2–1.29EXP

618  Chapter 59  Mode ng non near t es and nteract ons


For a man (subst tut ng gender = 0), the fo ow ng equat on can be used

Predicted salary=59.06+.78EXP-.033EXP2 –2.07(EXP*0)=59.06+.78EXP-.033EXP2

Thus, the nteract on between gender and exper ence shows that each add t ona year of exper -
ence benefits a woman an average of 0 78 – (–1 29) = $2,070 ess than a man Th s nd cates that
women are not be ng treated fa r y

Problems for Chapters 57 and 58


F zzy Drugs wants to opt m ze the y e d from an mportant chem ca process The company th nks the
number of pounds produced each t me the process s run depends on the s ze of the conta ner used,
the pressure, and the temperature The sc ent sts nvo ved be eve the effect of chang ng one var ab e
m ght depend on the va ues of other var ab es The s ze of the process conta ner must be between 1 3
and 1 5 cub c meters, pressure must be between 4 and 4 5 mm, and temperature must be between
22 and 30 degrees Ce s us The sc ent sts pat ent y set up exper ments at the ower and upper eve s of
the three contro var ab es and obta n the data shown n the F zzy x sx fi e

1. Determ ne the re at onsh p among y e d, s ze, temperature, and pressure

2. D scuss the nteract ons among pressure, s ze, and temperature

3. What sett ngs for temperature, s ze, and pressure wou d you recommend?

Here are add t ona mu t p e regress on prob ems

4. For 12 stra ght weeks, you have observed the sa es ( n number of cases) of canned tomatoes
at Mr D’s Supermarket (See the Grocery x sx fi e ) Each week, you keep track of the fo ow ng

• Was a promot ona not ce for canned tomatoes p aced n a shopp ng carts?
• Was a coupon for canned tomatoes g ven to each customer?
• Was a pr ce reduct on (none, 1, or 2 cents off) g ven?
Use th s data to determ ne how the preced ng factors nfluence sa es Pred ct sa es of canned
tomatoes dur ng a week n wh ch you use a shopp ng cart not ce, offer a coupon, and reduce
pr ce by 1 cent

5. The Countryreg on x sx fi e conta ns the fo ow ng data for severa underdeve oped countr es

• Infant morta ty rate


• Adu t teracy rate
• Percentage of students fin sh ng pr mary schoo
• Per cap ta GNP

Mode ng non near t es and nteract ons  Chapter 59   619


Use th s data to deve op an equat on that can be used to pred ct nfant morta ty Are there
any out ers n th s set of data? Interpret the coeffic ents n your equat on W th n what va ue
shou d 95 percent of your pred ct ons for nfant morta ty be accurate?

6. The Baseba 96 x sx fi e g ves runs scored, s ng es, doub es, tr p es, home runs, and bases sto en
for each Major League Baseba team dur ng the 1996 season Use th s data to determ ne the
effects of s ng es, doub es, and other act v t es on run product on

7. The Cardata x sx fi e prov des the fo ow ng nformat on for 392 car mode s

• Cy nders
• D sp acement
• Horsepower
• We ght
• Acce erat on
• M es per ga on (MPG)
Determ ne an equat on that can be used to pred ct MPG Why do you th nk a the ndepen-
dent var ab es are not s gn ficant?

8. The Pr ceads x sx fi e conta ns week y un t sa es of a product as we as the product pr ce and


advert s ng expend tures Exp a n how advert s ng and product pr ce nfluence un t sa es

9. The Teams x sx fi e conta ns runs scored; h t-by-p tcher; and wa ks, s ng es, doub es, tr p es,
and home runs for Major League Baseba teams dur ng the 2000–2006 seasons

• Use th s data to bu d a mode that pred cts how many runs a team w score based on the
team’s h tt ng stat st cs

• How accurate s th s mode for pred ct ng how many runs a team w score dur ng a
season?

• Suppose a team had a pos t ve res dua exceed ng three t mes the regress on’s standard
error What m ght cause such a resu t?

10. A h tter’s on-base percentage (OBP) s ca cu ated as h t-by-p tcher + wa ks + h ts/(at bats
+ h t-by-p tcher + wa ks + sacr fice fl es) A h tter’s s ugg ng percentage (SLG) s tota bases
(home runs gets cred t for four bases, tr p es get three, doub es two, and s ng es 1) d v ded by
at-bats The Opss ug x sx fi e conta ns h tt ng data for major eague teams dur ng the 2000–
2006 seasons

Use th s data to bu d a mode that can be used to pred ct runs scored by a team from a
team’s OBP and SLG

• Wou d you recommend that a team use th s mode or the mode from prob em 9 to pred ct
runs scored?

620  Chapter 59  Mode ng non near t es and nteract ons


• How cou d th s mode be used to eva uate nd v dua p ayers’ h tt ng ab t es?
• Why m ght you be skept ca f th s mode was used to eva uate the h tt ng ab ty of a tru y
great h tter such as A bert Pujo s of the St Lou s Card na s?

11. The NFL nfo x sx fi e conta ns the fo ow ng data for NFL teams dur ng the 2003–2006 seasons

• Marg n = Number of po nts by wh ch a team outscores ts opponent


• NYP/A = Yards ga ned pass ng per pass attempt
• YR/A = Yards ga ned per rush ng attempt
• DNYP/A = Yards ga ned pass ng by opponents per pass attempt
• DYR/A = Yards ga ned rush ng by opponents per attempt
• TO = Turnovers by team
• DTO = Turnovers by a team’s opponents
Does th s data nd cate that pass ng or rush ng effect veness has more mpact on team
success?

Around how many po nts does a turnover cost a team?

Many footba fans be eve you need a good rush ng attack to set up the pass ng game Does
th s data g ve any support to that v ew?

12. The Qb nfo x sx fi e sts the famous quarterback rat ngs for NFL quarterbacks dur ng the 2009
season The quarterback rat ng s based on the quarterback’s comp et on percentage, percent-
age of passes that resu t n a touchdown, yards per pass attempt, and percentage of passes
that are ntercepted

• Deve op a formu a to pred ct a quarterback’s rat ng based on h s season stat st cs


• How accurate are your pred ct ons?

Mode ng non near t es and nteract ons  Chapter 59   621


CHAPTER 60

Analysis of variance: one-way


ANOVA

Questions answered in this chapter:


■ The owner of my company, wh ch pub shes computer books, wants to know whether the
pos t on of our books n the computer book sect on of bookstores nfluences sa es More
spec fica y, does t rea y matter whether the books are p aced n the front, back, or m dd e of
the computer book sect on?

■ If I am determ n ng whether popu at ons have s gn ficant y d fferent means, why s the tech-
n que ca ed analysis of variance?

■ How can I use the resu ts of one-way ANOVA for forecast ng?

Data ana ysts often have data about severa groups of peop e or tems and want to determ ne
whether the data about the groups d ffers s gn ficant y Here are some examp es

■ Is there a s gn ficant d fference n the ength of t me that four doctors keep mothers n the
hosp ta after those pat ents g ve b rth?

■ Does the product on y e d for a new drug depend on whether the s ze of the conta ner n
wh ch the drug s produced s arge, sma , or med um?

■ Does the drop n b ood pressure atta ned after tak ng one of four drugs depend on the drug
taken?

When you’re try ng to determ ne whether the means n severa sets of data that depend on one
factor are s gn ficant y d fferent, one-way ana ys s of var ance, or ANOVA, s the correct too to use In
the preced ng examp es, the factors are the doctors, the conta ner s ze, and the drug, respect ve y In
ana yz ng the data, you can choose between two hypotheses

■ Null hypothesis, wh ch nd cates that the means of a groups are dent ca

■ Alternative hypothesis, wh ch nd cates a stat st ca y s gn ficant d fference between the groups’


means

To test these hypotheses n M crosoft Exce , you can use Anova S ng e Factor n the Data Ana ys s
d a og box If the p-va ue Exce computes s sma (usua y ess than or equa to 0 15), you can conc ude

623

that the a ternat ve hypothes s s true (the means are s gn ficant y d fferent) If the p-va ue s greater
than 0 15, the nu hypothes s s true (the popu at ons have dent ca means) Let’s ook at an examp e

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

The owner of my company, which publishes computer books, wants to know whether the
position of our books in the computer book section of bookstores influences sales. More
specifically, does it really matter whether the books are placed in the front, back, or middle of
the computer book section?

The pub sh ng company wants to know whether ts books se better when a d sp ay s set up n the
front, back, or m dd e of the computer book sect on Week y sa es ( n hundreds) were mon tored at
12 stores At five stores, the books were p aced n the front; at four stores, n the back; and at three
stores, n the m dd e Resu t ng sa es are conta ned n the S gn f worksheet n the Onewayanova x sx
fi e, wh ch s shown n F gure 60-1 Does the data nd cate that the ocat on of the books has a s gn fi-
cant effect on sa es?

FIGURE 60-1  Book sa es data.

You can assume that the 12 stores have s m ar sa es patterns and are approx mate y the same s ze
Th s assumpt on enab es you to use one-way ANOVA because you be eve that at most one factor (the
pos t on of the d sp ay n the computer book sect on) s affect ng sa es (If the stores were d fferent
s zes, you wou d need to ana yze the data w th two-way ANOVA, wh ch s d scussed n Chapter 61,
“Random zed b ocks and two-way ANOVA ”)

To ana yze the data, on the Data tab, c ck Data Analysis and then se ect Anova: Single Factor
F n the d a og box as shown n F gure 60-2

624  Chapter 60  Ana ys s of var ance: one way ANOVA


FIGURE 60-2  Anova: S ng e Factor d a og box.

Use the fo ow ng configurat ons

■ The data for your nput range, nc ud ng abe s, s n ce s B3 D8

■ Se ect Labels In First Row because the first row of the nput range conta ns abe s

■ Se ect Columns because the data s organ zed n co umns

■ Se ect C12 as the upper- eft ce of the output range

■ The se ected a pha va ue s not mportant You can use the defau t va ue

After c ck ng OK, you obta n the resu ts shown n F gure 60-3

FIGURE 60-3  One way ANOVA resu ts.

Ana ys s of var ance: one way ANOVA  Chapter 60   625


In ce s F16 F18, you see average sa es, depend ng on the ocat on of the d sp ay When the d sp ay
s at the front of the computer book sect on, average sa es are 900; when the d sp ay s at the back of
the sect on, sa es average 1,400; and when the d sp ay s n the m dd e, sa es average 1,100 Because
the p-va ue of 0 003 ( n ce H23) s ess than 0 15, you can conc ude that these means are s gn ficant y
d fferent

If I am determining whether populations have significantly different means, why is the tech-
nique called analysis of variance?

Suppose that the data n your book sa es study s the data shown n the worksheet named Ins g,
shown n F gure 60-4 (and n the Onewayanova x sx fi e) If you run a one-way ANOVA on th s data,
you obta n the resu ts shown n F gure 60-5

FIGURE 60-4  Book store data for wh ch the nu hypothes s s accepted.

Note that the mean sa es for each part of the store are exact y as before, yet the p-va ue of 66
nd cates that you shou d accept the nu hypothes s and conc ude that the pos t on of the d sp ay n
the computer book sect on doesn’t affect sa es The reason for th s strange resu t s that n the second
data set, you have much more var at on n sa es when the d sp ay s at each pos t on n the computer
book sect on In the first data set, for examp e, the var at on n sa es when the d sp ay s at the front
s between 700 and 1,100, whereas n the second data set, the var at on n sa es s between 200 and
2,000 The var at on of sa es w th n each store pos t on s measured by the sum of the squares of data
w th n a group Th s measure s shown n ce D24 n the first data set and n ce F24 n the second
In the first data set, the sum of squares of data w th n groups s on y 22, whereas n the second data
set, the sum of squares w th n groups s 574! Th s arge var at on w th n the data po nts at each store
pos t on masks the var at on between the groups (store pos t ons) themse ves and makes t mposs b e
to conc ude for the second data set that the d fference between sa es n d fferent store pos t ons s
s gn ficant

626  Chapter 60  Ana ys s of var ance: one way ANOVA


FIGURE 60-5  ANOVA resu ts accept ng the nu hypothes s.

How can I use the results of a one-way ANOVA for forecasting?

If there s a s gn ficant d fference between group means, the best forecast for each group s s mp y the
group’s mean Therefore, n the first data set, you pred ct the fo ow ng

■ Sa es when the d sp ay s at the front of the computer book sect on w be 900 books per
week

■ Sa es when the d sp ay s at the back w be 1,400 books per week

■ Sa es when the d sp ay s n the m dd e w be 1,100 books per week

If there s no s gn ficant d fference between the group means, your best forecast for each obser-
vat on s s mp y the overa mean Thus, n the second data set, you pred ct week y sa es of 1,117,
ndependent of where the books are p aced

You can a so est mate the accuracy of your forecasts The square root of the W th n Groups MS
(mean square) s the standard dev at on of the forecasts from a one-way ANOVA As shown n F gure
60-3, the standard dev at on of forecasts for the first data set s 1 56 (see the S gn f worksheet aga n)
By ru e of thumb, th s means that you wou d expect, for examp e

■ Dur ng 68 percent of a the weeks n wh ch books are p aced at the front of the computer
book sect on, sa es w be between 900 – 156 = 744 and 900 + 156 = 1,056 books

■ Dur ng 95 percent of a weeks n wh ch books are p aced at the front of the computer book
sect on, sa es w be between 900 – 2(156) = 588 books and 900 + 2(156) = 1,212 books

Ana ys s of var ance: one way ANOVA  Chapter 60   627


Problems
You can find the data for the fo ow ng prob ems n the Chapter60data x sx fi e

1. For pat ents of four card o og sts, you are g ven the number of days the pat ents stayed n the
hosp ta after open-heart surgery

• Is there ev dence that the doctors have d fferent d scharge po c es?


• You are 95 percent sure that a pat ent of Doctor 1 w stay n the hosp ta between what
range of days?

2. A drug can be produced by us ng a 400-degree, 300-degree, or 200-degree oven You


are g ven the pounds of the drug y e ded when var ous batches are baked at d fferent
temperatures

• Does temperature appear to nfluence the process y e d?


• What s the range of pounds of the product that you are 95 percent sure w be produced
w th a 200-degree oven?

• If you be eve that pressure w th n the conta ner a so nfluences process y e d, does th s
ana ys s rema n va d?

628  Chapter 60  Ana ys s of var ance: one way ANOVA


CHAPTER 61

Randomized blocks and two-way


ANOVA

Questions answered in this chapter:


■ I am try ng to ana yze the effect veness of my sa es force The prob em s that n add t on to
a sa es representat ve’s effect veness, the amount that a representat ve se s depends on the
d str ct to wh ch he s ass gned How can I ncorporate the d str ct ass gnments of my repre-
sentat ves nto my ana ys s?

■ Based on my know edge of sa es representat ves and d str cts, how can I forecast sa es? How
accurate are my sa es forecasts?

■ How can I determ ne whether vary ng the pr ce and the amount of advert s ng affects
the sa es of a v deo game? How can I determ ne whether pr ce and advert s ng nteract
s gn ficant y?

■ How can I nterpret the effects of pr ce and advert s ng on sa es when s gn ficant nteract on
between pr ce and advert s ng s absent?

In many sets of data, two factors can nfluence a dependent var ab e Here are some examp es

Factors Dependent variable


Sa es representat ve and d str ct ass gnment Sa es
Product pr ce and advert s ng expend ture Sa es
Temperature and pressure Product on y e d
Surgeon and brand of stent used Hea th of pat ent after open heart surgery

When two factors m ght nfluence a dependent var ab e, random zed b ocks or two-way ana ys s
of var ance (ANOVA) can be used to determ ne wh ch, f any, of the factors have a s gn ficant nflu-
ence on the dependent var ab e W th two-way ANOVA, you can a so determ ne whether two factors
exh b t a s gn ficant nteract on For examp e, suppose you are try ng to pred ct sa es by us ng product
pr ce and advert s ng budget Pr ce and advert s ng nteract s gn ficant y f the effect of advert s ng
depends on the product pr ce

In a random zed b ock mode , you observe each poss b e comb nat on of factors exact y once You
can’t test for nteract ons n a random zed b ock des gn In a two-way ANOVA mode , you observe

629

each comb nat on of factors the same number of t mes (ca t k) In th s case, k must be greater than
1 In a two-way ANOVA mode , you can eas y test for  nteract ons

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

I am trying to analyze the effectiveness of my sales force. The problem is that in addition to
a sales representative’s effectiveness, the amount that a representative sells depends on the
district to which she is assigned. How can I incorporate the district assignments of my repre-
sentatives into my analysis?

Suppose you want to determ ne how a sa es representat ve and the sa es d str ct to wh ch the repre-
sentat ve s ass gned nfluence product sa es To answer the quest on n th s examp e, you can have
each of four sa es reps spend a month se ng n each of five sa es d str cts The resu t ng sa es are
g ven n the Randomized Blocks worksheet n the Twowayanova x sx fi e and shown n F gure 61-1 For
examp e, Rep 1 so d 20 un ts dur ng the month she was ass gned to D str ct 4

FIGURE 61-1  Data for the random zed b ocks examp e.

Th s mode s ca ed a two-way ANOVA without replication because two factors (d str ct and sa es
representat ve) can nfluence sa es, and you have on y a s ng e nstance pa r ng each representat ve
w th each d str ct Th s mode s a so ca ed a randomized block des gn because you’d ke to random-
ze (chrono og ca y) the ass gnment of representat ves to d str cts In other words, you’d ke to ensure
that the month dur ng wh ch Rep 1 s ass gned to D str ct 1 s equa y ke y to be the first, second,
th rd, fourth, or fifth month Th s random zat on hopefu y essens the effect of t me (a representa-
t ve presumab y becomes better over t me) on your ana ys s; n a sense, you are b ock ng the effect of
d str cts when you try to compare sa es representat ves

To ana yze th s data n M crosoft Exce , c ck Data Analysis on the Data tab and then se ect
Anova: Two-Factor Without Replication F n the d a og box as shown n F gure 61-2

You can use the fo ow ng nformat on to set up th s ana ys s

■ The nput range data s n ce s C5 G10

■ Se ect Labels because the first row of the nput range conta ns abe s

■ Enter B12 as the upper- eft ce of the output range

630  Chapter 61  Random zed b ocks and two way ANOVA


■ The a pha va ue determ nes the number shown n the F Cr t co umn You w not need the
nformat on n the F Cr t co umn so, throughout th s chapter, you can use the defau t a pha
va ue of 0 05

FIGURE 61-2  Anova: Two Factor W thout Rep cat on d a og box for sett ng up a random zed b ocks mode .

The output you obta n s shown n F gure 61-3 (The resu ts n ce s G12 G24 were not created
by the Exce Data Ana ys s feature Formu as were entered n those ce s, as s exp a ned ater n
the chapter )

FIGURE 61-3  Random zed b ocks output.

To determ ne whether the row factor (d str cts) or co umn factor (sa es representat ves) has a
s gn ficant effect on sa es, just ook at the p-va ue If the p-va ue for a factor s ow ( ess than 15), the
factor has a s gn ficant effect on sa es The row p-va ue ( 0000974) and co umn p-va ue ( 024) are both
ess than 15, so both the d str ct and the representat ve have a s gn ficant effect on sa es

Random zed b ocks and two way ANOVA  Chapter 61   631
Based on my knowledge of sales representatives and districts, how can I forecast sales? How
accurate are my sales forecasts?

How shou d you pred ct product sa es? You can pred ct sa es dur ng a month by us ng equat on 1,
shown here

Predicted sales=Overall average+(Rep effect)+(District effect)

In th s equat on, Rep effect equa s 0 f the sa es rep factor s not s gn ficant If the sa es rep factor s
s gn ficant, Rep effect equa s the mean for the g ven rep m nus the overa average L kew se, District
effect equa s 0 f the d str ct factor s not s gn ficant If the d str ct factor s s gn ficant, District effect
equa s the mean for the g ven d str ct m nus the overa average

Compute the overa average (17 6) n ce G12 by us ng the AVERAGE(D6 G10) formu a The rep-
resentat ve and d str ct effects are computed by copy ng the E15–$G$12 formu a from ce G15 to
G16 G24 As an examp e, you can compute pred cted sa es by Rep 4 n D str ct 2 as 17 6 – 2 85 + 3 6 =
18 35 Th s va ue s computed n ce D38 (see F gure 61-4) w th the G12+G16+G24 formu a If the d s-
tr ct effect s s gn ficant and the sa es representat ve effect s not, pred cted sa es for Rep 4 n D str ct
2 wou d be 17 6 – 2 85 = 14 75

FIGURE 61-4  Forecast for sa es n D str ct 2 by Rep 4.

As n one-way ANOVA, the standard dev at on of the forecast errors s the square root of the mean
square error shown n ce E31 You can compute th s standard dev at on n ce E32 w th the SQRT(E31)
formu a Thus, you can be 95 percent sure that f Rep 4 s ass gned to D str ct 2, month y sa es w be
between 18 35 – 2(3 99) = 10 37 and 18 35 + 2(3 99) = 26 33 These m ts are computed n ce D39
and D40 w th the D38–2*E32 and D38+2*E32 formu as, respect ve y

How can I determine whether varying the price and the amount of advertising affects
the sales of a video game? How can I determine whether price and advertising interact
significantly?

When you have more than one observat on for each comb nat on of the row and co umn factors, you
have a two-factor ANOVA with rep cat on To perform th s sort of ana ys s, Exce requ res you to have
the same number of observat ons for each row-and-co umn comb nat on

In add t on to test ng for the s gn ficance of the row and co umn factors, you can a so test for
s gn ficant nteract on between them For examp e, f you want to understand how pr ce and adver-
t s ng affect sa es, an nteract on between pr ce and advert s ng wou d nd cate that the effect of an
advert s ng change wou d depend on the pr ce eve (or, equ va ent y, the effect of a pr ce change
wou d depend on the advert s ng eve ) A ack of nteract on between pr ce and advert s ng wou d
mean that the effect of a pr ce change wou d not depend on the eve of advert s ng

632  Chapter 61  Random zed b ocks and two way ANOVA


As an examp e of two-factor ANOVA w th rep cat on, suppose you want to determ ne how pr ce
and advert s ng eve affect the month y sa es of a v deo game In the Two Way ANOVA No Interact on
worksheet n the Twowayanova x sx fi e, you can find the data shown n F gure 61-5 Dur ng the
three months n wh ch advert s ng was ow and pr ce was med um, for examp e, 21, 20, and 16 un ts
were so d

FIGURE 61-5  V deo game sa es data; no nteract on.

Not ce that for each pr ce/advert s ng comb nat on, there are exact y three observat ons In ce D1,
the overa average (25 037) of a observat ons w th the AVERAGE(D4 F12) formu a s computed In
ce s G4, G7, and G10, the effect for each eve of advert s ng s computed For examp e, the effect of
hav ng a ow eve of advert s ng equa s the average for ow advert s ng m nus the overa average In
ce G4, the ow advert s ng effect of –5 59 w th the AVERAGE(D4 F6)–$D$1 formu a s computed In
a s m ar fash on, the effect of each pr ce eve by copy ng the AVERAGE(D4 D12)–$D$1 formu a from
D13 to E13 F13 s computed

To ana yze th s data, c ck Data Analysis on the Data tab, and then se ect Anova: Two-Factor
With Replication n the Data Analysis d a og box F n the d a og box as shown n F gure 61-6

FIGURE 61-6  Anova: Two Factor W th Rep cat on d a og box for runn ng a two factor ANOVA w th rep cat on.

Random zed b ocks and two way ANOVA  Chapter 61   633
You can use the fo ow ng nformat on to set up the ana ys s

■ The nput range data, nc ud ng abe s, s n C3 F12 In two-way ANOVA w th rep cat on, Exce
requ res a abe for each eve of the co umn effect n the first row of each co umn n the nput
range Thus, you can enter Low, Med um, and H gh n ce s D3 F3 to nd cate the poss b e
pr ce eve s Exce a so requ res a abe for each eve of the row effect n the first co umn of
the nput range These abe s must appear n the row that marks the beg nn ng of the data
for each eve Thus, you can p ace abe s correspond ng to ow, med um, and h gh eve s of
advert s ng n ce s C4, C7, and C10

■ In the Rows Per Samp e box, enter 3 because you have three rep cat ons for each comb nat on
of pr ce and advert s ng eve

■ The upper- eft ce of your output range s B14

The on y mportant port on of the output s the ANOVA tab e, wh ch s shown n F gure 61-7

FIGURE 61-7  Two way ANOVA w th rep cat on output; no nteract on.

As w th random zed b ocks, an effect ( nc ud ng nteract ons) s s gn ficant f t has a p-va ue that’s
ess than 15 Here, Samp e (th s s the row for advert s ng effect) and Pr ce (shown n the row abe ed
Co umns) are h gh y s gn ficant, and there s no s gn ficant nteract on (The nteract on p-va ue s
79!) Therefore, you can conc ude that pr ce and advert s ng nfluence sa es and that the effect of
advert s ng on sa es does not depend on the pr ce eve F gure 61-8 graphs average sa es for each
pr ce advert s ng comb nat on, and demonstrates the fact that pr ce and advert s ng do not exh b t a
s gn ficant nteract on (See the Graph No Interact on worksheet )

Not ce that as advert s ng ncreases, average sa es ncrease at rough y the same rate, whether the
pr ce eve s ow, med um, or h gh Bas ca y, you can recogn ze No Interact on by the fact that the
ser es for each pr ce eve are near y para e

634  Chapter 61  Random zed b ocks and two way ANOVA


FIGURE 61-8  No nteract on between pr ce and advert s ng n th s data set.

How can I interpret the effects of price and advertising on sales when significant interaction
between price and advertising is absent?

In the absence of a s gn ficant nteract on, you can forecast sa es n a two-factor ANOVA w th rep ca-
t on n the same way that you do n a two-factor ANOVA w thout rep cat on Here’s the equat on to
use (equat on 2)

Predicted sales=Overall average+[Row or advertising effect(if significant)]


+[Column or price effect(if significant)]

Th s ana ys s assumes that pr ce and advert s ng are the on y factors that affect sa es If sa es are
h gh y seasona , seasona ty wou d need to be ncorporated nto the ana ys s (Seasona ty s d s-
cussed n Chapter 63, “W nters’s method,” and Chapter 65, “Forecast ng n the presence of spec a
events ”) For examp e, when pr ce s h gh and advert s ng s med um, pred cted sa es are g ven by
25 037 + (–1 814) + (–8 704) = 14 52 (See ce E54 n F gure 61-9, wh ch shows the Two Way ANOVA
No Interact on worksheet aga n ) In F gure 61-5, shown ear er, you can see that the overa average s
equa to 25 037, the med um advert s ng effect equa s –1 814, and the h gh pr ce effect equa s –8 704

Random zed b ocks and two way ANOVA  Chapter 61   635
FIGURE 61-9  Forecasts for sa es w th h gh pr ce and med um advert s ng.

The standard dev at on of the forecast errors equa s the square root of your mean squared w th n
error

29.78 = 5.46

You can be 95 percent sure that the forecast s accurate w th n 10 92 un ts In other words, you are
95 percent sure that sa es dur ng a month w th h gh pr ce and med um advert s ng w be between
3 60 and 25 43 un ts

In the Two Way ANOVA w th Interact on worksheet, the data from the prev ous examp e was
changed to the data shown n F gure 61-10 After runn ng the ana ys s for a two-factor ANOVA w th
rep cat on, the resu ts shown n F gure 61-11 were obta ned

FIGURE 61-10  Sa es data w th nteract on between pr ce and advert s ng.

636  Chapter 61  Random zed b ocks and two way ANOVA


FIGURE 61-11  Output for the two factor ANOVA w th nteract on.

In th s data set, the p-va ue for nteract on s 001 When you see a ow p-va ue ( ess than 15) for
nteract on, you do not even check p-values for row and column factors You s mp y forecast sa es for
any pr ce and advert s ng comb nat on to equa the mean of the three observat ons nvo v ng that
pr ce and advert s ng comb nat on For examp e, the best forecast for sa es dur ng a month w th h gh
advert s ng and med um pr ce s

34 + 40 + 32 106
= = 35.555 units
4 3

The standard dev at on of forecast errors s aga n the square root of the mean square w th n

( 17.11 = 4.14)

Thus, you can be 95 percent sure that the sa es forecast s accurate w th n 8 26 un ts

F gure 61-12 ustrates why th s data exh b ts a s gn ficant nteract on between pr ce and advert s-
ng For a ow and med um pr ce, ncreased advert s ng ncreases average sa es, but f pr ce s h gh,
ncreased advert s ng has no effect on average sa es Th s exp a ns why you cannot use equat on 2 to
forecast sa es when a s gn ficant nteract on s present After a , how can you ta k about an advert s ng
effect when the effect of advert s ng depends on the pr ce?

The key th ng to not ce about th s graph s that the d fferent ser es are not para e Th s te s you
that at d fferent pr ce eve s, changes n advert s ng have d fferent effects on sa es

Random zed b ocks and two way ANOVA  Chapter 61   637
FIGURE 61-12  Pr ce and advert s ng exh b t a s gn ficant nteract on n th s set of data.

Problems
The data for the fo ow ng prob ems s n the Ch61 x sx fi e

1. You be eve that pressure (h gh, med um, or ow) and temperature (h gh, med um, or ow)
nfluence the y e d of a product on process G ven th s theory, determ ne the answers to the
fo ow ng prob ems

• Use the data n the Prob em 1 worksheet to determ ne how temperature and/or pressure
nfluence the y e d of the process

• W th h gh pressure and ow temperature, you’re 95 percent sure that process y e d w be


n what range?

2. You are try ng to determ ne how the part cu ar sa es representat ve and the number of sa es
ca s (one, three, or five) made to a doctor nfluence the amount ( n thousands of do ars) that
each doctor prescr bes of your drug Use the data n the Prob em 2 worksheet to determ ne
the answers to the fo ow ng prob ems

• How do the representat ve and number of sa es ca s nfluence sa es vo ume?


• If Rep 3 makes five sa es ca s to a doctor, you’re 95 percent sure she w generate prescr p-
t ons w th n what range of do ars?

638  Chapter 61  Random zed b ocks and two way ANOVA


3. Answer the quest ons n Prob em 2 by us ng the data n the Prob em 3 worksheet

4. The Coupondata x sx fi e conta ns nformat on on sa es of peanut butter for weeks when


a coupon was g ven out (or not) and advert s ng was done (or not) n the Sunday paper
Descr be how the coupon and advert s ng nfluence peanut butter sa es

Random zed b ocks and two way ANOVA  Chapter 61   639
CHAPTER 62

Using moving averages to


understand time series

Question answered in this chapter:


■ I’m try ng to ana yze the upward trend n quarter y revenues of Amazon com s nce 1996
Fourth quarter sa es n the Un ted States are usua y arger (because of Chr stmas) than sa es
dur ng the first quarter of the fo ow ng year Th s pattern obscures the upward trend n sa es
How can I show the upward trend n revenues graph ca y?

Answer to this chapter’s question


Th s sect on prov des the answer to the quest on that s sted at the beg nn ng of the chapter

T me ser es data s mp y d sp ays the same quant ty measured at d fferent po nts n t me For exam-
p e, the data n the Amazon com x sx fi e, a subset of wh ch s shown n F gure 62-1, d sp ays the t me
ser es for quarter y revenues n m ons of do ars for Amazon com The data covers the t me nterva
from the fourth quarter of 1995 through the th rd quarter of 2012

To graph th s t me ser es, se ect the C2 D70 range, wh ch conta ns the quarter number (the first
quarter s Quarter 1, and the ast s Quarter 69) and Amazon quarter y revenues ( n m ons of do ars)
Then choose Chart on the Insert tab and the second opt on under the Scatter chart type (Scatter
With Smooth Lines And Markers) The t me ser es p ot s shown n F gure 62-2

641

FIGURE 62-1  Quarter y revenues for Amazon.com sa es.

FIGURE 62-2  T me ser es p ot of quarter y Amazon.com revenues.

There s an upward trend n revenues, but the fact that fourth-quarter revenues dwarf revenues
dur ng the first three quarters of each year makes t hard to spot the trend Because there are four
quarters per year, t wou d be n ce to graph average revenues dur ng the ast four quarters Th s s
ca ed a four-period moving average Us ng a four-quarter mov ng average smooths out the seasona

642  Chapter 62  Us ng mov ng averages to understand t me ser es


nfluence because each average w conta n one data po nt for each quarter Such a graph s ca ed
a moving average graph because the p otted average moves over t me Mov ng average graphs a so
smooth out random var at on, wh ch he ps you get a better dea of what s go ng on w th your data

To create a mov ng average graph of quarter y revenues, you can mod fy the chart Se ect the
graph and then c ck a data po nt unt a the data po nts are d sp ayed n b ue R ght-c ck any po nt,
c ck Add Trendline, and then se ect Moving Average Set the per od equa to 4 M crosoft Exce
now creates the four-quarter mov ng average trend curve that’s shown n F gure 62-3 (See the
Amazon com x sx fi e )

For each quarter, Exce p ots the average of the current quarter and the ast three quarters Of
course, for a four-quarter mov ng average, the mov ng average curve starts w th the fourth data
po nt The mov ng average curve makes t c ear that Amazon com’s revenues had a steady upward
trend In fact, the s ope of the four-quarter mov ng average appears to be ncreas ng In a ke hood,
the s ope of th s mov ng average graph w eventua y eve off, resu t ng n a graph that ooks ke an
S curve The Exce Trend Curve feature cannot fit S curves, but the Exce 2013 So ver can be used to fit
S curves to data See Marketing Analytics by Wayne W nston (John W ey, n press) for an exp anat on
of how to fit S curves to data

FIGURE 62-3  Four quarter mov ng average trend curve.

Problem
1. The Ch62data x sx fi e conta ns quarter y revenues for GM, Ford, and GE Construct a four-
quarter mov ng average trend curve for each company’s revenues Descr be what you earn
from each trend curve

Us ng mov ng averages to understand t me ser es  Chapter 62   643


CHAPTER 63

Winters’s method

You often need to pred ct future va ues of a t me ser es, such as month y costs or month y product
revenues Th s s usua y d fficu t because the character st cs of any t me ser es are constant y chang-
ng Smooth ng or adapt ve methods are usua y best su ted for forecast ng future va ues of a t me
ser es Th s chapter descr bes the most powerfu smooth ng method Winters’s method To he p you
understand how W nters’s method works, I’ use t to forecast month y hous ng starts n the Un ted
States Hous ng starts are s mp y the number of new homes whose construct on beg ns dur ng a
month I’ beg n by descr b ng the three key character st cs of a t me ser es

Time series characteristics


The behav or of most t me ser es can be exp a ned by understand ng three character st cs base, trend,
and seasona ty

■ The base of a ser es descr bes the ser es’ current eve n the absence of any seasona ty For
examp e, suppose the base eve for US hous ng starts s 160,000 In th s case, you can be eve
that f the current month were an average month re at ve to other months of the year, 160,000
hous ng starts wou d occur

■ The trend of a t me ser es s the percentage ncrease per per od n the base Thus, a trend of
1 02 means that you est mate that hous ng starts are ncreas ng by 2 percent each month

■ The seasona ty (seasona ndex) for a per od te s you how far above or be ow a typ ca month
you can expect hous ng starts to be For examp e, f the December seasona ndex s 8, then
December hous ng starts are 20 percent be ow a typ ca month If the June seasona ndex s
1 3, then June hous ng starts are 30 percent h gher than a typ ca  month

Parameter definitions
After observ ng month t, you w have used a data observed through the end of month t to est mate
the fo ow ng quant t es of nterest

■ Lt = Leve of ser es

■ Tt = Trend of ser es

■ St = Seasona ndex for current month


645

The key to W nters’s method s the fo ow ng three equat ons, wh ch are used to update Lt, Tt,
and St In the fo ow ng formu as, alp, bet, and gam are ca ed smoothing parameters You choose the
va ues of these parameters to opt m ze forecasts In the fo ow ng formu as, c equa s the number of
per ods n a seasona cyc e (c = 12 months, for examp e) and x t equa s the observed va ue of the t me
ser es at t me t

■ Formu a 1 Lt = alp(x t /st–c) + (1 – a p)(Lt–1*Tt–1)

■ Formu a 2 Tt = bet(Lt /L –1) + (1 – bet)Tt–1

■ Formu a 3 St = gam(x t /Lt) + (1 – gam)st-c

Formu a 1 nd cates that the new base est mate s a we ghted average of the current observat on
(deseasona zed) and the ast per od’s base updated by the ast trend est mate Formu a 2 nd cates
that the new trend est mate s a we ghted average of the rat o of the current base to the ast per od’s
base (th s s a current est mate of trend) and the ast per od’s trend Formu a 3 nd cates that you
update your seasona ndex est mate as a we ghted average of the est mate of the seasona ndex
based on the current per od and the prev ous est mate Note that arger va ues of the smooth ng
parameters correspond to putt ng more we ght on the current observat on

You can define Ft,k as your forecast (F) after per od t for the per od t+k Th s resu ts n the formu a
Ft,k = Lt*(Tt)kst k–c (I refer to th s as formu a 4 )

Th s formu a first uses the current trend est mate to update the base k per ods forward Then the
resu t ng base est mate for per od t + k s adjusted by the appropr ate seasona ndex

Initializing Winters’s method


To start W nters’s method, you must have n t a est mates for the ser es base, trend, and seasona
ndexes In th s examp e, month y hous ng starts for years 1986 and 1987 were used to n t a ze
W nters’s method Smooth ng parameters were then chosen to opt m ze one-month-ahead forecasts
for years 1988 through 1996 See F gure 63-1 and the House2 x sx fi e Here are the steps that were
fo owed

646  Chapter 63  W nters s method


FIGURE 63-1  n t a zat on of W nters s method.

■ Step 1  Est mate, for examp e, the January seasona ndex as the average of January hous ng
starts for 1986 and 1987 d v ded by the average month y starts for 1986 and 1987 Therefore,
copy ng the =AVERAGE(B2,B14)/AVERAGE($B$2 $B$25) formu a from G14 to G15 G25 gener-
ates the est mates of seasona ndexes For examp e, the January est mate s 0 75, and the June
est mate s 1 17

■ Step 2  To est mate the average month y trend, d v de the twe fth root of the 1987 mean
starts by the 1986 mean starts Compute th s n ce J3 (and copy t to ce D25) w th the
=(J1/J2)^(1/12) formu a

■ Step 3  Go ng nto January 1987, est mate the base of the ser es as the deseasona zed
December 1987 va ue Th s was computed n C25 w th the =(B25/G25) formu a

Estimating the smoothing constants


Now you’re ready to est mate smooth ng constants In co umn C, you can update the ser es base; n
co umn D, the ser es trend; and n co umn G, the seasona ndexes In co umn E, compute the forecast
for next month and, n co umn F, compute the abso ute percentage error for each month F na y,
use the So ver to choose va ues for the smooth ng constants that m n m ze the sum of the abso ute
percentage errors Here’s the process

■ Step 1  In G11 I11, enter tr a va ues (between 0 and 1) for the smooth ng constants

■ Step 2  In C26 C119, compute the updated ser es eve w th formu a 1 by copy ng the
=a p*(B26/G14)+(1–a p)*(C25*D25) formu a from C26 to C27 C119

W nters s method  Chapter 63   647


■ Step 3  In D26 D119, use formu a 2 to update the ser es trend, copy ng the =bet*(C26
/C25)+(1–bet)*D25 formu a from D26 to D27 D119

■ Step 4  In G26 G119, use formu a 3 to update the seasona ndexes, copy ng the =gam*(B26
/C26)+(1–gam)*G14 formu a from G26 to G27 G119

■ Step 5  In E26 E119, use formu a 4 to compute the forecast for the current month by copy ng
the =(C25*D25)*G14 formu a from E26 to E27 E119

■ Step 6  In F26 F119, compute the abso ute percentage error for each month by copy ng the
=ABS(B26-E26)/B26 formu a from F26 to F27 F119

■ Step 7  Compute the average abso ute percentage error for years 1988 through 1996 n F21
w th the =AVERAGE(F26 F119) formu a

■ Step 8  Now use So ver to determ ne smooth ng parameter va ues that m n m ze the average
abso ute percentage error The So ver Parameters d a og box s shown n F gure 63-2

FIGURE 63-2  So ver Parameters d a og box for W nters s mode .

Smooth ng parameters (G11 I11) were used to m n m ze the average abso ute percentage error
(ce F21) The So ver ensures that you find the best comb nat on of smooth ng constants Smooth ng
constants must be between 0 and 1 Here, alp = 50, bet = 01, and gam = 27 m n m ze the average
abso ute percentage error You m ght find s ght y d fferent va ues for the smooth ng constants, but

648  Chapter 63  W nters s method


you shou d obta n a mean abso ute percentage error (MAPE) c ose to 7 3 percent In th s examp e,
many comb nat ons of the smooth ng constants g ve forecasts hav ng approx mate y the same MAPE
Your one-month-ahead forecasts are off by an average of 7 3 percent

Remarks
■ Instead of choos ng smooth ng parameters to opt m ze one-per od forecast errors, you cou d,
for examp e, choose to opt m ze the average abso ute percentage error ncurred n forecast ng
tota hous ng starts for the next s x months

■ If at the end of month t you want to forecast sa es for the next four quarters, you wou d s m-
p y add ft,1 + ft,2 + ft,3 + ft,4 If you want, you cou d choose smooth ng parameters to m n m ze
the abso ute percentage error ncurred n est mat ng sa es for the next year

Problems
A the data for the fo ow ng prob ems s n the Quarter y x sx fi e

1. Use W nters’s method to forecast one-quarter-ahead revenues for App e

2. Use W nters’s method to forecast one-quarter-ahead revenues for Amazon com

3. Use W nters’s method to forecast one-quarter-ahead revenues for Home Depot

4. Use W nters’s method to forecast tota revenues for the next two quarters for Home Depot

W nters s method  Chapter 63   649


CHAPTER 64

Ratio-to-moving-average forecast
method

Questions answered in this chapter:


■ What s the trend of a t me ser es?

■ How can I define seasona ndexes for a t me ser es?

■ Is there an easy way to ncorporate trend and seasona ty nto forecast ng future product
sa es?

Often, you need a s mp e, accurate method to pred ct future quarter y revenues of a corporat on or
future month y sa es of a product The ratio-to-moving-average method prov des an accurate, easy-
to-use forecast ng method for these s tuat ons

In the Rat oma x sx fi e, you are g ven data for sa es of a product dur ng 20 quarters (shown ater n
F gure 64-1 n rows 5 through 24), and you want to pred ct sa es dur ng the next four quarters (quar-
ters 21–24) Th s t me ser es has both trend and seasona ty

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

What is the trend of a time series?

A trend of 10 un ts per quarter means, for examp e, that sa es are ncreas ng by 10 un ts per quarter,
whereas a trend of –5 un ts per quarter means that sa es tend to decrease 5 un ts per quarter

How do I define seasonal indexes for a time series?

We know that Wa mart sees a arge ncrease n ts sa es dur ng the fourth quarter (because of the ho -
day season) If you do not recogn ze th s, you wou d have troub e com ng up w th good forecasts of
quarter y Wa mart revenues The concept of seasona ndexes he ps you understand a company’s sa es
pattern better The quarter y seasona ndexes for Wa mart revenues are as fo ows

■ Quarter 1 (January through March) 90

■ Quarter 2 (Apr through June) 98

651

■ Quarter 3 (Ju y through September) 96

■ Quarter 4 (October through December) 1 16

These ndexes mp y, for examp e, that sa es dur ng a fourth quarter are typ ca y 16 percent h gher
than sa es dur ng an average quarter Seasonal indexes must average out to 1

To see whether you understand seasona ndexes, try to answer the fo ow ng quest on Suppose
that dur ng Quarter 4 of 2013, Wa mart has sa es of $200 b on, and dur ng Quarter 1 of 2014,
Wa mart has sa es of $180 b on Are th ngs gett ng better or worse for Wa mart? The key dea here
s to deseasonalize sa es and express each quarter’s sa es n terms of an average quarter For examp e,
the Quarter 4 2013 sa es are equ va ent to se ng 200/1 16 = $172 4 b on n an average quarter,
and the Quarter 1 2014 sa es are equ va ent to se ng 180/ 9 = $200 b on n an average quarter
Thus, even though Wa mart’s actua sa es decreased 10 percent, sa es appear to be ncreas ng by
(200/172 4) – 1 = 16 percent per quarter Th s s mp e examp e shows how mportant t s to under-
stand your company’s or product’s seasona ndexes

Is there an easy way to incorporate trend and seasonality into forecasting future
product sales?

Now et’s turn to the s mp e rat o-to-mov ng-average forecast ng method Th s techn que enab es you
to est mate a t me ser es’ trend and seasona ndexes eas y and makes t easy to generate forecasts
of future va ues of the t me ser es The work done for th s quest on s shown n F gure 64-1 and the
Rat oma x sx fi e

FIGURE 64-1  Data for the rat o to mov ng average examp e.

652  Chapter 64  Rat o to mov ng average forecast method


You beg n by try ng to est mate the deseasona zed eve of the ser es dur ng each per od (us ng
centered mov ng averages) Then you can fit a trend ne to your deseasona zed est mates ( n co umn
G) Next, determ ne the seasona ndex for each quarter F na y, est mate the future eve of the
ser es by extrapo at ng the trend ne and then pred ct future sa es by reseasona z ng the trend ne
est mate

■ Calculating moving averages  To beg n, compute a four-quarter mov ng average (four


quarters e m nates seasona ty) for each quarter by averag ng the pr or quarter, the current
quarter, and the next two quarters To do th s, copy the AVERAGE(E5 E8) formu a from F6 to
F7 F22 For examp e, for Quarter 2, the mov ng average s 25*(24 + 44 + 61 + 79) = 52

■ Calculating centered moving averages  The mov ng average for Quarter 2 s centered at
Quarter 2 5, whereas the mov ng average for Quarter 3 s centered at Quarter 3 5 Averag ng
these two mov ng averages g ves a centered mov ng average, wh ch est mates the eve of the
process at the end of Quarter 3 Copy ng the AVERAGE(F6 F7) formu a from ce G7 g ves you
an est mate of the eve of the ser es dur ng each ser es—w thout seasona ty!

■ Fitting a trend line to the centered moving averages  You use the centered mov ng aver-
ages to fit a trend ne that can be used to est mate the future eve of the ser es

In F1, use the SLOPE(G7 G22,B7 B22) formu a to find the s ope of the trend ne and, n ce
F2, use the INTERCEPT(G7 G22,B7 B22) formu a to find the ntercept of the trend  ne You
can now est mate the eve of the ser es dur ng Quarter t to be 6 94t + 30 17 Copy ng the
Intercept+S ope*B23 formu a from G25 to G26 G28 computes the est mated eve of the ser es
from Quarter 21 onward

■ Computing the seasonal indexes  Reca that a seasona ndex of, say, 2 for a quarter means
sa es n that quarter are tw ce sa es dur ng an average quarter, and a seasona ndex of 5 for a
quarter means that sa es dur ng that quarter are ha f of an average quarter To determ ne the
seasona ndexes, beg n by ca cu at ng actual sales/centered moving average for each quarter
for wh ch you have sa es To do th s, copy the =E7/G7 formu a from ce H7 to H8 H22 You’
see, for examp e, that dur ng each first quarter, sa es were 77, 71, 90, and 89 percent of aver-
age, so you can est mate the seasona ndex for Quarter 1 as the average of these four num-
bers (82 percent) To ca cu ate the n t a seasona ndex est mates, copy the AVERAGEIF($D$7
$D$22,J3,$H$7 $H$22) formu a from ce K5 to K6 K8 Th s formu a averages the four est mates
you have for Quarter 1 seasona ty

Unfortunate y, the seasona ndexes do not average exact y to 1 To ensure that the fina sea-
sona ndexes average to 1, copy the K3/AVERAGE($K$3 $K$6) formu a from L3 to L4 L6

■ Forecasting sales during Quarters 21–24  To create the sa es forecast for each future quar-
ter, you s mp y mu t p y the trend ne est mate for the quarter’s eve (from co umn G) by the
appropr ate seasona ndex Copy ng the VLOOKUP(D25,season,3)*G25 formu a from ce G25
to G26 G28 computes the fina forecast for Quarters 21–24

Rat o to mov ng average forecast method  Chapter 64   653


If you th nk the trend of the ser es has changed recent y, you can est mate the ser es’ trend based
on more recent data For examp e, you cou d use the centered mov ng averages for Quarters 13–18 to
get a more recent trend est mate w th the SLOPE(G17 G22,B17 B22) formu a Th s y e ds an est mated
trend of 8 09 un ts per quarter If you want to forecast Quarter 22 sa es, for examp e, you wou d add
4(8 09) to the ast centered mov ng average you have (from Quarter 18) of 160 13 to est mate the
eve of the ser es n Quarter 22 Then mu t p y ng by the Quarter 2 seasona ndex of 933 y e ds a fina
forecast for Quarter 22 sa es of (160 13 + 4(8 09))*( 933) = 179 6 un ts

Problem
1. The Wa martdata x sx fi e conta ns quarter y revenues of Wa mart dur ng years 1994–2009
Use the rat o-to-mov ng-average method to forecast revenues for Quarters 3 and 4 n 2009
and Quarters 1 and 2 n 2010 Use Quarters 53–60 to create a trend est mate that you use n
your forecasts

654  Chapter 64  Rat o to mov ng average forecast method


CHAPTER 65

Forecasting in the presence of


special events

Questions answered in this chapter:


■ How can I determ ne whether spec fic factors nfluence customer traffic?

■ How can I eva uate forecast accuracy?

■ How can I check whether my forecast errors are random?

For a student project n the ear y 1990s (before d rect depos t!), a c ass and I attempted to forecast
the number of customers v s t ng the East and P aza Branch of the Ind ana Un vers ty (IU) Cred t Un on
each day Interv ews w th the branch manager made t c ear that the fo ow ng factors affected the
number of customers

■ Month of the year

■ Day of the week

■ Whether the day was a facu ty or staff payday

■ Whether the day before or the day after was a ho day

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

How can I determine whether specific factors influence customer traffic?

The data co ected s conta ned n the Or g na worksheet n the Cred tun on x sx fi e, shown n F gure
65-1 If you try to run a regress on on th s data by us ng dummy var ab es (as descr bed n Chapter
58, “Incorporat ng qua tat ve factors nto mu t p e regress on”), the dependent var ab e wou d be
the number of customers arr v ng each day (the data n co umn E) You wou d need 19 ndependent
var ab es

■ E even to account for the month (12 months m nus 1)

■ Four to account for the day of the week (5 bus ness days m nus 1)

655

■ Two to account for the types of paydays that occur each month

■ Two to account for whether a part cu ar day fo ows or precedes a ho day

M crosoft Exce 2013 a ows on y 15 ndependent var ab es, so t appears that you’re n troub e

FIGURE 65-1  Data used to pred ct cred t un on customer traffic.

When a regress on forecast ng mode requ res more than 15 ndependent var ab es, you can use
the Exce So ver to est mate the coeffic ents of the ndependent var ab es You can a so use Exce to
compute the R-squared va ues between forecasts and actua customer traffic and the standard dev a-
t on for the forecast errors To ana yze th s data (see F gure 65-2), a forecast ng equat on was created
by us ng a ookup tab e to ocate the day of the week, the month, and other factors Then So ver
was used to choose the coeffic ents for each eve of each factor that y e ds the m n mum sum of
squared errors (Each day’s error equa s actua customers m nus forecasted customers ) Here are the
part cu ars

Beg n by creat ng nd cator var ab es ( n co umns G through J) for whether the day s a staff pay-
day (SP), facu ty payday (FAC), before a ho day (BH), or after a ho day (AH) (See F gure 65-1 ) For
examp e, n ce s G4, H4, and J4, enter 1 to nd cate that January 2 was a staff payday, facu ty payday,
and after a ho day Ce I4 conta ns 0 to nd cate that January 2 was not before a ho day

The forecast s defined by a constant (wh ch he ps center the forecasts so that they w be more
accurate) and effects for each day of the week, each month, a staff payday, a facu ty payday, a day
occurr ng before a ho day, and a day occurr ng after a ho day Insert tr a va ues for a these parame-
ters (the So ver chang ng ce s) n the O4 O26 ce range, shown n F gure 65-2 So ver w then choose

656  Chapter 65  Forecast ng n the presence of spec a events


va ues that make the mode fit the data best For each day, the forecast of customer count w be
generated by the fo ow ng equat on

Predicted customer count=Constant+(Month effect)+(Day of week effect)


+(Staff payday effect, if any)+(Faculty payday effect, if any)+
(Before holiday effect, if any)+(After holiday effect, if any)

Us ng th s mode , you can compute a forecast for each day’s customer count by copy ng the fo -
ow ng formu a from K4 to K5 K257

$O$26+VLOOKUP(B4,$N$14:$O$25,2)+VLOOKUP(D4,$N$4:$O$8,2) +G4*$O$9+H4*$O$10+I4*$O$11+J4*$O$12

Ce O26 p cks up the constant term VLOOKUP(B4,$N$14 $O$25,2) p cks up the month coeffic ent
for the current month, and VLOOKUP(D4,$N$4 $O$8,2) p cks up the day of the week coeffic ent for
the current week G4*$O$9+H4*$O$10+I4*$O$11+J4*$O$12 p cks up the effects ( f any) when the
current day s coded as SP, FAC, BH, or AH

By copy ng the (E4-K4)^2 formu a from L4 to L5 L257, you can compute the squared error for each
day Then, n ce L2, compute the sum of squared errors w th the SUM(L4 L257) formu a

FIGURE 65-2  Chang ng ce s and customer forecasts.

In ce R4, average the day of the week chang ng ce s w th the AVERAGE(O4 O8) formu a, and n
ce R5, average the month chang ng ce s w th the AVERAGE(O14 O25) formu a Later, you can con-
stra n the average month and day of the week effects to equa 0, wh ch ensures that a month or day
of the week w th a pos t ve effect has a h gher than average customer count, and a month or day of
the week w th a negat ve effect has a ower than average customer count

You can use the So ver sett ngs shown n F gure 65-3 to choose the forecast parameters to m n -
m ze the sum of squared errors

Forecast ng n the presence of spec a events  Chapter 65   657


FIGURE 65-3  So ver Parameters d a og box for determ n ng forecast parameters.

The So ver mode changes the coeffic ents for the month, day of the week, BH, AH, SP, FAC, and
the constant to m n m ze the sum of square errors You can a so constra n the average day of the
week and month effect to equa 0 Use the So ver to obta n the resu ts shown n F gure 65-2 For
examp e, Fr day s the bus est day of the week, and June s the bus est month A staff payday ra ses the
forecast (a e se be ng equa — n the Lat n, ceter s par bus) by 397 customers

How can I evaluate forecast accuracy?

To eva uate the accuracy of the forecast, you compute the R-squared va ue between the forecasts and
the actua customer count n ce J1 The formu a you use s RSQ(E4 E257,K4 K257) Th s formu a com-
putes the percentage of the actua var at on n customer count that s exp a ned by the forecast ng
mode Here, the ndependent var ab es exp a n 77 percent of the da y var at on n customer count

You compute the error for each day n co umn M by copy ng the E4–K4 formu a from M4 to
M5 M257 A c ose approx mat on to the standard error of the forecast s g ven by the standard dev a-
t on of the errors Th s va ue s computed n ce M1 by us ng the STDEVS(M4 M257) formu a Thus,
approx mate y 68 percent of the forecasts shou d be accurate w th n 163 customers, 95 percent accu-
rate w th n 326 customers, and so on

658  Chapter 65  Forecast ng n the presence of spec a events


Try to spot any out ers Reca that an observat on s an out er f the abso ute va ue of a forecast
error exceeds two t mes the standard error of the regress on Se ect the M4 M257 range and then
c ck Conditional Formatting on the Home tab Next, se ect New Rule and, n the New Formatting
Rule d a og box, choose Use A Formula To Determine Which Cells To Format F n the ru e
descr pt on n the d a og box as shown n F gure 65-4 (For more nformat on about cond t ona for-
matt ng, see Chapter 23, “Cond t ona formatt ng ”)

FIGURE 65-4  Us ng cond t ona formatt ng to spot forecast out ers.

After you choose a format w th a red font, the cond t ona formatt ng sett ngs w d sp ay n
red any error that exceeds 2*(standard dev at on of errors) n abso ute error Look ng at the out ers,
you can see that the mode often under-forecasts the customer count for the first three days of the
month A so, dur ng the second week n March (spr ng break), the mode over-forecasts, and the day
before spr ng break, t great y under-forecasts

To remedy th s prob em, n the 1st Three Days worksheet, chang ng ce s were added for each of
the first three days of the month and for spr ng break and the day before spr ng break Tr a va ues
were added for these new effects n ce s O26 O30 By copy ng the fo ow ng formu a from K4 to
K5 K257

$O$25+VLOOKUP(B4,$N$13:$O$24,2)+VLOOKUP(D4,$N$4:$O$8,2)+G4*$O$9+H4*$O$10+I4*$O$11+J4*$O$12
+IF(C4=1,$O$26,IF(C4=2,$O$27,IF(C4=3,$O$28,0)))

the effects of the first three days of the month are nc uded (The term IF(C4=1,$O$26,
IF(C4=2,$O$27,IF(C4=3,$O$28,0))) p cks up the effect of the first three days of the month ) The spr ng
break coeffic ents were entered manua y n ce s K52 K57 For examp e, n ce K52, +O29 was added
to the formu a, and n ce s K53 K57, +O30 was added

After nc ud ng the new chang ng ce s n the So ver d a og box, you get the resu ts shown n F gure
65-5 Not ce that the first three days of the month great y ncrease customer count (probab y because

Forecast ng n the presence of spec a events  Chapter 65   659


of government support and Soc a Secur ty checks) and that spr ng break reduces customer count
F gure 65-5 a so shows the mprovement n the forecast ng accuracy The R squared va ue (RSQ) has
mproved to 87 percent, and the standard error s reduced to 122 customers

FIGURE 65-5  Forecast parameters and forecasts nc ud ng spr ng break and the first three days of the month.

By ook ng at the forecast errors for the week of 12/24 through 12/31 (see F gure 65-6), you can
see that the mode has great y over-forecasted the customer counts for the days n th s week It a so
under-forecasted customer counts for the week before Chr stmas Further exam nat on of the forecast
errors (often ca ed residuals) a so shows the fo ow ng

■ Thanksg v ng s d fferent from a norma ho day n that the cred t un on s far ess busy than
expected the day after Thanksg v ng

■ The day before Good Fr day s rea y busy because peop e eave town for Easter

■ Tax day (Apr 16) s a so bus er than expected

■ The week before Ind ana Un vers ty starts fa c asses ( ast week n August) was not busy, prob-
ab y because many staff and facu ty take a summer fl ng vacat on before the hect c onrush of
the fa semester

FIGURE 65-6  Errors for Chr stmas week.

660  Chapter 65  Forecast ng n the presence of spec a events


In the Chr stmas week worksheet, chang ng ce s were added to ncorporate the effects of these
factors After add ng the new parameters as chang ng ce s, run So ver aga n The resu ts you shou d
get are shown n F gure 65-7 The RSQ s up to 92 percent, and the standard error s down to 98 61
customers! Note that the post–Chr stmas week effect reduced da y customer count by 359, the day
before Thanksg v ng added 607 customers, the day after Thanksg v ng reduced customer count by
161, and so on

FIGURE 65-7  F na forecast parameters.

Not ce a so how the forecast ng mode s mproved by us ng out ers If your out ers have some-
th ng n common (such as be ng the first three days of the month), nc ude the common factor as an
ndependent var ab e, and your forecast ng error w drop

How can I check whether my forecast errors are random?

A good forecast ng method shou d create forecast errors or res dua s that are random By random
errors, I mean that your errors exh b t no d scern b e pattern If forecast errors are random, the s gn
of your errors shou d change (from p us to m nus or m nus to p us) approx mate y ha f the t me
Therefore, a common y used test to eva uate the randomness of forecast errors s to ook at the num-
ber of s gn changes n the errors If you have n observat ons, nonrandomness of the errors s nd cated
f you find e ther fewer than

n–1 –
n
2

Forecast ng n the presence of spec a events  Chapter 65   661


or more than

n–1 +
n
2
changes n s gn In the Chr stmas week worksheet, as shown n F gure 65-7, the number of s gn
changes was determ ned n the res dua s by copy ng the IF(M5*M4<0,1,0) formu a from ce P5 to
P6 P257 A s gn change n the res dua s occurs f and on y f the product of two consecut ve res dua s s
negat ve Therefore, th s formu a y e ds 1 whenever a change n the s gn of the res dua s occurs There
were 125 changes n s gn In ce P1

254 – 1 –
254 = 110.6
2

changes were computed n s gn as the cutoff for nonrandom res dua s Therefore, you have random
res dua s

A s m ar ana ys s was performed to pred ct da y customer counts for d nner at a major restaurant
cha n The spec a factors corresponded to ho days The study found that Super Sunday (the day of
the NFL’s Super Bow ) was the east busy day, and Va ent ne’s Day and Mother’s Day were the bus est
A so, Saturday was the bus est day of the week for d nner, and Fr day was the bus est day of the week
for unch

Problems
1. How can you use the techn ques out ned n th s chapter to pred ct the da y sa es of pens at
Stap es?

2. If you had severa years of data, how wou d you ncorporate a trend n the ana ys s?

662  Chapter 65  Forecast ng n the presence of spec a events


CHAPTER 66

An introduction to random
variables

Questions answered in this chapter:


■ What s a random var ab e?

■ What s a d screte random var ab e?

■ What s the mean, var ance, and standard dev at on of a random var ab e?

■ What s a cont nuous random var ab e?

■ What s a probab ty dens ty funct on?

■ What are ndependent random var ab es?

In today’s wor d, the on y th ng that’s certa n s that we face a great dea of uncerta nty In the next
n ne chapters, you find some powerfu techn ques you can use to ncorporate uncerta nty n bus -
ness mode s The key bu d ng b ock n mode ng uncerta nty s understand ng how to use random
var ab es

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

What is a random variable?

Any s tuat on whose outcome s uncerta n s ca ed an experiment The va ue of a random var ab e s


based on the (uncerta n) outcome of an exper ment For examp e, toss ng a pa r of d ce s an exper -
ment, and a random var ab e m ght be defined as the sum of the va ues shown on each d e In th s
case, the random var ab e cou d assume any of the va ues of 2, 3, and so on up to 12 As another
examp e, cons der the exper ment of se ng a new v deo game conso e, for wh ch a random var ab e
m ght be defined as the market share for th s new product

663

What is a discrete random variable?

A random var ab e s d screte f t can assume a fin te number of poss b e va ues Here are some
examp es of d screte random var ab es

■ Number of potent a compet tors for your product

■ Number of aces drawn n a five-card poker hand

■ Number of car acc dents you have (hopefu y zero!) n a year

■ Number of dots show ng on a d e

■ Number of free throws out of 12 that Phoen x Sun’s star Steve Nash makes dur ng a basketba
game

What is the mean, variance, and standard deviation of a random variable?

In Chapter 42, “Summar z ng data by us ng descr pt ve stat st cs,” the mean, var ance, and standard
dev at on for a data set was d scussed In essence, the mean of a random var ab e (often denoted by
µ) s the average va ue of the random var ab e you wou d expect f you performed an exper ment
many t mes The mean of a random var ab e s often referred to as the random var ab e’s expected
va ue The var ance of a random var ab e (often denoted by σ2) s the average va ue of the squared
dev at on from the mean of a random var ab e that you wou d expect f you performed an exper ment
many t mes The standard dev at on of a random var ab e (often denoted by σ) s s mp y the square
root of ts var ance As w th data sets, the mean of a random var ab e s a summary measure for a typ -
ca va ue of the random var ab e, whereas the var ance and standard dev at on measure the spread of
the random var ab e about ts mean

As an examp e of how to compute the mean, var ance, and standard dev at on of a random var -
ab e, suppose you be eve that the return on the stock market dur ng the next year s governed by the
fo ow ng probab t es

Probability Market return


.40 +20 percent
.30 0 percent
.30 20 percent

Hand ca cu at ons show the fo ow ng

µ = .40*(.20) + .30*(.00) + .30*(–.20) = .02 or 2 percent

σ2 = .4*(.20 – .02)2 + .30*(.0 – .02)2 + .30*(–.20 – .02)2 = .0276

Then σ = 166 or 16 6 percent

In the Meanvar ance x sx fi e (shown n F gure 66-1), these computat ons are ver fied

664  Chapter 66  An ntroduct on to random var ab es


FIGURE 66-1  Comput ng the mean, standard dev at on, and var ance of a random var ab e.

The mean of the market return was computed n ce C9 w th the SUMPRODUCT(B4 B6,C4 C6)
formu a Th s formu a mu t p es each va ue of the random var ab e by ts probab ty and sums up the
products

To compute the var ance of the market return, the squared dev at on of each va ue of the random
var ab e was determ ned from ts mean by copy ng the (B4–$C$9)^2 formu a from D4 to D5 D6 Then,
n ce C10, the var ance of the market return was computed as the average squared dev at on from
the mean w th the SUMPRODUCT(C4 C6,D4 D6) formu a F na y, the standard dev at on of the market
return was computed n ce C11 w th the SQRT(C10) formu a

What is a continuous random variable?

A cont nuous random var ab e s a random var ab e that can assume a very arge number or, to a
ntents and purposes, an nfin te number of va ues Here are some examp es of cont nuous random
var ab es

■ Pr ce of M crosoft stock one year from now

■ Market share for a new product

■ Market s ze for a new product

■ Cost of deve op ng a new product

■ Newborn baby’s we ght

■ Person’s IQ

■ D rk Now tzk ’s three-po nt shoot ng percentage dur ng next season

What is a probability density function?

A d screte random var ab e can be spec fied by a st of va ues and the probab ty of occurrence for
each va ue of the random var ab e Because a cont nuous random var ab e can assume an nfin te
number of va ues, you can’t st the probab ty of occurrence for each va ue of a cont nuous random
var ab e A cont nuous random var ab e s comp ete y descr bed by ts probability density function For
examp e, the probab ty dens ty funct on for a random y chosen person’s IQ s shown n F gure 66-2

An ntroduct on to random var ab es  Chapter 66   665


FIGURE 66-2  Probab ty dens ty funct on for Qs.

A probab ty dens ty funct on (pdf) has the fo ow ng propert es

■ The va ue of the pdf s a ways greater than or equa to 0

■ The area under the pdf equa s 1

■ The he ght of the dens ty funct on for a va ue x of a random var ab e s proport ona to the
ke hood that the random var ab e assumes a va ue near x For examp e, the he ght of the
dens ty for an IQ of 83 s rough y ha f the he ght of the dens ty for an IQ of 100 Th s te s you
that IQs near 83 are approx mate y ha f as ke y as IQs around 100 A so, because the dens ty
peaks at 100, IQs around 100 are most ke y

■ The probab ty that a cont nuous random var ab e assumes a range of va ues equa s the cor-
respond ng area under the dens ty funct on For examp e, the fract on of peop e hav ng IQs
from 80 through 100 s s mp y the area under the dens ty from 80 through 100

■ Note that a d screte random var ab e that assumes many va ues s often mode ed as a cont nu-
ous random var ab e (See Chapter 69, “The norma random var ab e ”) For examp e, a though
the number of ha f ga ons of m k so d n a s ng e day by a sma grocery store s d screte,
t proves more conven ent to mode th s d screte random var ab e as a cont nuous random
var ab e

What are independent random variables?

A set of random var ab es s ndependent f know edge of the va ue of any of ts subsets te s you
noth ng about the va ues of the other random var ab es For examp e, the number of games the
Ind ana Un vers ty footba team won dur ng a year s ndependent of the percentage return on
M crosoft dur ng the same year Know ng that Ind ana d d very we wou d not change your v ew of
how M crosoft stock d d dur ng the year

666  Chapter 66  An ntroduct on to random var ab es


However, the returns on M crosoft stock and Inte stock are not ndependent If you are to d that
M crosoft stock had a h gh return n one year, n a ke hood, computer sa es were h gh, wh ch te s
you that Inte probab y had a good year as we

Problems
1. Ident fy the fo ow ng random var ab es as d screte or cont nuous

• Number of games the Seatt e Seahawks w n next season


• Number that comes up when sp nn ng a rou ette whee
• Un t sa es of M crosoft Surface tab ets next year
• Length of t me that a ght bu b asts before t burns out
2. Compute the mean, var ance, and standard dev at on of the number of dots show ng when a
d e s tossed

3. Determ ne whether the fo ow ng random var ab es are ndependent

• Da y temperature and sa es at an ce cream store


• Su t and number of a card drawn from a deck of p ay ng cards
• Inflat on and return on the stock market
• Pr ce charged for and the number of un ts so d of a car mode
4. The current pr ce of a company’s stock s $20 The company s a takeover target If the take-
over s successfu , the company’s stock pr ce w ncrease to $30 If the takeover s unsuccess-
fu , the stock pr ce w drop to $12 Determ ne the range of va ues for the probab ty of a suc-
cessfu takeover that wou d make t worthwh e to purchase the stock today Assume your goa
s to max m ze your expected profit H nt Use the Goa Seek command, wh ch s d scussed n
deta n Chapter 17, “The Goa Seek command ”

5. When a rou ette whee s spun, the poss b e outcomes are 0, 00, 1, 2, , 36 If you bet on a
number com ng up, you w n $35 f your number comes up, and you ose $1 otherw se What
are the mean and standard dev at on of your w nn ngs on a s ng e p ay of the game?

An ntroduct on to random var ab es  Chapter 66   667


CHAPTER 67

The binomial, hypergeometric,


and negative binomial random
variables

Questions answered in this chapter:


■ What s a b nom a random var ab e?

■ How can I use the BINOM DIST funct on to compute b nom a probab t es?

■ If equa numbers of peop e prefer Coke to Peps and Peps to Coke and I ask 100 peop e
whether they prefer Coke to Peps , what s the probab ty that exact y 60 peop e prefer Coke
to Peps and the probab ty that between 40 and 60 peop e prefer Coke to Peps ?

■ Of a the e evator ra s my company produces, 3 percent are cons dered defect ve We are
about to sh p a batch of 10,000 e evator ra s to a customer To determ ne whether the batch s
acceptab e, the customer w random y choose a samp e of 100 ra s and check whether each
samp ed ra s defect ve If two or fewer samp ed ra s are defect ve, the customer w accept
the batch How can I determ ne the probab ty that the batch w be accepted?

■ A r nes do not ke fl ghts w th empty seats Suppose that, on average, 95 percent of a t cket
ho ders show up for a fl ght If the a r ne se s 105 t ckets for a 100-seat fl ght, what s the
probab ty that the fl ght w be overbooked?

■ The oca V age De knows that 1,000 customers come for unch each day On average, 20
percent order the spec a ty vegetar an sandw ch These sandw ches are premade How many
shou d the de make f t wants to have a 5 percent chance of runn ng out of vegetar an
sandw ches?

■ What s the hypergeometr c random var ab e?

■ What s the negat ve b nom a random var ab e?

669

Answers to this chapter’s questions
Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

What is a binomial random variable?

A binomial random variable s a d screte random var ab e used to ca cu ate probab t es when a three
of the fo ow ng app y

■ n ndependent tr a s occur

■ Each tr a resu ts n one of two outcomes success or fa ure

■ In each tr a , the probab ty of success (p) rema ns constant

In such a s tuat on, the b nom a random var ab e can be used to ca cu ate probab t es re ated to
the number of successes n a g ven number of tr a s We et x be the random var ab e denot ng the
number of successes occurr ng n n ndependent tr a s when the probab ty of success on each tr a s
p Here are some examp es n wh ch the b nom a random var ab e s re evant

■ Coke or Pepsi  Assume that equa numbers of peop e prefer Coke to Peps and Peps to
Coke You ask 100 peop e whether they prefer Coke to Peps You’re nterested n the prob-
ab ty that exact y 60 peop e prefer Coke to Peps and the probab ty that from 40 through
60 peop e prefer Coke to Peps In th s s tuat on, you have a b nom a random var ab e defined
by the fo ow ng

• Tr a survey nd v dua s
• Success prefer Coke
• p equa s 0 50
• n equa s 100
Let x equa the number of peop e samp ed who prefer Coke You want to determ ne the prob-
ab ty that x = 60 and 40 ≤ x ≤ 60

■ Elevator rails  Of a the e evator ra s you produce, 3 percent are cons dered defect ve
You are about to sh p a batch of 10,000 e evator ra s to a customer To determ ne whether
the batch s acceptab e, the customer w random y choose a samp e of 100 ra s and check
whether each samp ed ra s defect ve If two or fewer samp ed ra s are defect ve, the cus-
tomer w accept the batch You want to determ ne the probab ty that the batch w be
accepted

You have a b nom a random var ab e defined by the fo ow ng

• Tr a ook at a samp ed ra
• Success ra s defect ve

670  Chapter 67  The b nom a , hypergeometr c, and negat ve b nom a random var ab es
• p equa s 0 03
• n equa s 100
Let x equa the number of defect ve ra s n the samp e You want to find the probab ty that
x ≤ 2

■ Airline overbooking  A r nes don’t ke fl ghts w th empty seats Suppose that, on average,
95 percent of a t cket ho ders show up for a fl ght If the a r ne se s 105 t ckets for a 100-seat
fl ght, what s the probab ty that the fl ght w be overbooked?

You have a b nom a random var ab e defined by the fo ow ng

• Tr a nd v dua t cket ho ders


• Success t cket ho der shows up
• p equa s 0 95
• n equa s 105
Let x equa the number of t cket ho ders who show up Then you want to find the probab ty
that x ≥ 101

How can I use the BINOM.DIST function to compute binomial probabilities?

M crosoft Exce 2013 nc udes the BINOM.DIST funct on, wh ch you can use to compute b nom a
probab t es If you want to compute the probab ty of x or fewer successes for a b nom a random
var ab e hav ng n tr a s w th probab ty of success p, s mp y enter BINOM.DIST(x,n,p,1) If you want
to compute the probab ty of exact y x successes for a b nom a random var ab e hav ng n tr a s w th
probab ty of success of p, enter BINOM.DIST(x,n,p,0) Enter ng 1 as the ast argument of BINOM
.DIST y e ds a cumu at ve probab ty; enter ng 0 y e ds the probab ty mass funct on for any part cu ar
va ue (Note that a ast argument of True can be used nstead of a 1, and a ast argument of Fa se can
be used nstead of a 0 ) Previous versions of Excel will not recognize the BINOM.DIST function In prev -
ous vers ons of Exce , you can use the BINOMDIST funct on, wh ch has exact y the same syntax as the
BINOM.DIST funct on Let’s use the BINOM.DIST funct on to ca cu ate some probab t es of nterest
You’ find the data and ana ys s n the B nom a examp es x sx fi e, wh ch s shown n F gure 67-1

The b nom a , hypergeometr c, and negat ve b nom a random var ab es  Chapter 67   671
FIGURE 67-1  Us ng the b nom a random var ab e.

If equal numbers of people prefer Coke to Pepsi and Pepsi to Coke and I ask 100 people
whether they prefer Coke to Pepsi, what is the probability that exactly 60 people prefer Coke
to Pepsi and the probability that between 40 and 60 people prefer Coke to Pepsi?

You have n = 100 and p = 0 5 You seek the probab ty that x = 60 and the probab ty that 40 ≤ x
≤ 60, where x equa s the number of peop e who prefer Coke to Peps F rst, you find the probab ty
that x = 60 by enter ng the BINOM DIST(60,100,0 5,0) formu a Exce returns the va ue 0 011

To use the BINOM.DIST funct on to compute the probab ty that 40 ≤ x ≤ 60, you can note that
the probab ty that 40 ≤ x ≤ 60 equa s the probab ty that x ≤ 60 m nus the probab ty that x ≤ 39
Thus, you can obta n the probab ty that from 40 through 60 peop e prefer Coke by enter ng the
BINOM DIST(60,100,0 5,1)–BINOM DIST(39,100,0 5,1) formu a Exce returns the va ue 0 9648 So, f
Coke and Peps are equa y preferred, t s very un ke y that n a samp e of 100 peop e, Coke or Peps
wou d be more than 10 percent ahead If a samp e of 100 peop e shows Coke or Peps to be more
than 10 percent ahead, you shou d probab y doubt that Coke and Peps are equa y preferred

Of all the elevator rails my company produces, 3 percent are considered defective. We are
about to ship a batch of 10,000 elevator rails to a customer. To determine whether the batch
is acceptable, the customer will randomly choose a sample of 100 rails and check whether
each sampled rail is defective. If two or fewer sampled rails are defective, the customer will
accept the batch. How can I determine the probability that the batch will be accepted?

If you et x equa the number of defect ve ra s n a batch, you have a b nom a random var ab e w th
n = 100 and p = 0 03 You seek the probab ty that x ≤ 2 S mp y enter the BINOM DIST(2,100,0 03,1)

672  Chapter 67  The b nom a , hypergeometr c, and negat ve b nom a random var ab es
formu a n ce C8 Exce returns the va ue 0 42 Thus, the batch w be accepted 42 percent of the
t me

Rea y, your chance of success s not exact y 3 percent on each tr a For examp e, f the first 10 ra s
are defect ve, the chance the next ra s defect ve has dropped to 290/9,990; f the first 10 ra s are not
defect ve, the chance the next ra s defect ve s 300/9,990 Therefore, the probab ty of success on
the e eventh tr a s not ndependent of the probab ty of success on one of the first 10 tr a s Desp te
th s fact, the b nom a random var ab e can be used as an approx mat on when a samp e s drawn and
the samp e s ze s ess than 10 percent of the tota popu at on Here, the popu at on equa s 10,000,
and the samp e s ze s 100 Exact probab t es nvo v ng samp ng from a fin te popu at on can be
ca cu ated w th the hypergeometr c random var ab e, wh ch s d scussed ater n th s chapter

Airlines do not like flights with empty seats. Suppose that, on average, 95 percent of all ticket
holders show up for a flight. If the airline sells 105 tickets for a 100-seat flight, what is the
probability that the flight will be overbooked?

Let x equa the number of t cket ho ders who show up for the fl ght You have n = 105 and p = 0 95
You seek the probab ty that x ≥ 101 Note that the probab ty that x ≤ 101 equa s 1 m nus the
probab ty that x ≤ 100 So, to compute the probab ty that the fl ght s overbooked, you enter the
1–BINOM DIST(100,105,0 95,1) formu a n ce C10 Exce y e ds 0 392, wh ch means there s a 39 2
percent chance that the fl ght w be overbooked

The local Village Deli knows that 1,000 customers come for lunch each day. On average, 20
percent order the specialty vegetarian sandwich. These sandwiches are premade. How many
should the deli make if it wants to have a 5 percent chance of running out of vegetarian
sandwiches?

In Exce 2013, the BINOM.INV funct on, w th the BINOM INV(tr a s, probab ty of success, a pha)
syntax, determ nes the sma est number x for wh ch the probab ty of ess than or equa to x successes
s at east alpha In ear er vers ons of Exce , the CRITBINOM(tr a s, probab ty of success, a pha) func-
t on y e ded the same resu ts as BINOM.INV In th s examp e, tr a s equa s 1,000, probab ty of success
equa s 0 2, and alpha equa s 95 As shown n F gure 67-2, f the de orders 221 sandw ches, the prob-
ab ty that demand w be ess than or equa to 221 s at east 0 95 A so, the probab ty that 220 or
fewer sandw ches w be demanded s ess than 0 95

The b nom a , hypergeometr c, and negat ve b nom a random var ab es  Chapter 67   673
FIGURE 67-2  Examp e of BINOM.INV funct on.

What is the hypergeometric random variable?

The hypergeometric random variable governs a s tuat on such as the fo ow ng

■ An urn conta ns N ba s

■ Each ba s one of two types (ca ed success or fa ure)

■ There are s successes n the urn

■ A samp e of s ze n s drawn from the urn

Look at an examp e n the Hypergeom d st x sx fi e, wh ch s shown n F gure 67-3 The Exce 2013
HYPERGEOM DIST(x,n,s,N,0) formu a g ves the probab ty of x successes f n ba s are drawn from an
urn conta n ng N ba s, of wh ch s are marked as success The Exce 2013 HYPERGEOM DIST(x,n,s,N,1)
formu a g ves the probab ty of ess than or equa to x successes f n ba s are drawn from an urn con-
ta n ng N ba s, of wh ch s are marked as success (As w th the BINOM.DIST funct on, True can be used
to rep ace 1 and Fa se to rep ace 0 )

For examp e, suppose that 40 of the Fortune 500 compan es have a woman CEO The 500 CEOs are
ana ogous to the ba s n the urn (N = 500), and the 40 women are representat ve of the s successes n
the urn Then, copy ng the HYPERGEOM DIST(C8,Samp e s ze,Popu at on women,Popu at on s ze,0)
formu a from D8 to D9 D18 g ves the probab ty that a samp e of 10 Fortune 500 compan es w
have 0, 1, 2, , 10 women CEOs Here, Sample size equa s 10, Population women equa s 40, and
Population size equa s 500

F nd ng a woman CEO s a success In the samp e of 10, for examp e, there’s a probab ty of 0 431
that no women CEOs w be n the samp e By the way, you cou d have approx mated th s probab ty
w th the BINOM DIST(0,10,0 08,0) formu a, y e d ng 0 434, wh ch s very c ose to the true probab ty of
0 431 In ce F10, the probab ty that at most 2 of the 10 peop e n the samp e wou d be women was

674  Chapter 67  The b nom a , hypergeometr c, and negat ve b nom a random var ab es
computed w th the HYPGEOM DIST(2,Samp e S ze,Popu at on women,Popu at on s ze,TRUE) formu a
Thus, there s a 96 2 percent chance that at most two peop e n the samp e w be women Of course,
you cou d have obta ned th s answer by add ng the shaded ce s (D8 D10) together

FIGURE 67-3  Us ng the hypergeometr c random var ab e.

What is the negative binomial random variable?

The negative binomial random variable app es to the same s tuat on as the b nom a random var ab e,
but the negat ve b nom a random var ab e g ves the probab ty of f fa ures occurr ng before the sth
success Thus, =NEGBINOM DIST(f,s,p,0) g ves the probab ty that exact y f fa ures w occur before
the sth success when the probab ty of success s p for each tr a , and =NEGBINOM DIST(f,s,p,1) g ves
the probab ty that at most f fa ures w occur before the sth success when the probab ty of success
s p for each tr a For examp e, cons der a baseba team that w ns 40 percent of ts games (see the
Negb nom d st x sx fi e and F gure 67-4) Copy ng the =NEGBINOM DIST(D9,2,0 4,Fa se) formu a from
E9 to E34 g ves the probab ty of 0, 1, 2, , 25 osses occurr ng before the second w n Note here
that success equa s a game won For examp e, there s a 19 2 percent chance the team w ose exact y
one game before w nn ng two games In ce G10, the =NEGBINOM DIST(3,2,0 4,TRUE) formu a was
used to compute the chance that at most three osses w occur before your team w ns two games
(0 663) Of course, you cou d have obta ned th s answer by s mp y add ng up the shaded ce s (E9 E12)

The b nom a , hypergeometr c, and negat ve b nom a random var ab es  Chapter 67   675
FIGURE 67-4  Us ng the negat ve b nom a random var ab e.

Problems
1. Suppose that, on average, 4 percent of a CD dr ves rece ved by a computer company are
defect ve The company has adopted the fo ow ng po cy Samp e 50 CD dr ves n each sh p-
ment and accept the sh pment f none are defect ve Us ng th s nformat on, determ ne the
fo ow ng

• What fract on of sh pments w be accepted?


• If the po cy changes so that a sh pment s accepted f on y one CD dr ve n the samp e s
defect ve, what fract on of sh pments w be accepted?

• What s the probab ty that a samp e s ze of 50 w conta n at east 10 defect ve CD dr ves?

2. Us ng the a r ne overbook ng data

• Determ ne how the probab ty of overbook ng var es as the number of t ckets so d var es
from 100 through 115 H nt Use a one-way data tab e

• Show how the probab ty of overbook ng var es as the number of t ckets so d var es from
100 through 115, and the probab ty that a t cket ho der shows up var es from 80 percent
through 95 percent H nt Use a two-way data tab e

676  Chapter 67  The b nom a , hypergeometr c, and negat ve b nom a random var ab es
3. Suppose that dur ng each year, a g ven mutua fund has a 50 percent chance of beat ng the
Standard & Poor’s 500 Stock Index (S&P Index) In a group of 100 mutua funds, what s the
probab ty that at east 10 funds w beat the S&P Index dur ng at east 8 out of 10 years?

4. Profess ona basketba p ayer Steve Nash s a 90-percent fou shooter

• If he shoots 100 free throws, what s the probab ty that he w m ss more than 15 shots?
• How good a fou shooter wou d Steve Nash be f he had on y a 5 percent chance of mak ng
fewer than 90 free throws out of 100 attempts? H nt Use Goa Seek

5. When tested for extra sensory percept on (ESP), part c pants are asked to dent fy the shape
on a card from a 25-card deck The deck cons sts of five cards w th each of five shapes If a
person dent fies 12 cards correct y, what wou d you conc ude?

6. Suppose that n a group of 100 peop e, 20 have the flu and 80 do not If you random y se ect
30 peop e, what s the chance that at east 10 peop e have the flu?

7. A student s se ng magaz nes for a schoo fundra ser There s a 20 percent chance that a
g ven house w buy a magaz ne He needs to se five magaz nes Determ ne the probab ty
that he w need to v s t 5, 6, 7, , 100 houses to se five magaz nes

8. Use the BINOM.DIST funct on to ver fy that the BINOM.INV funct on y e ds the correct answer
to your V age De examp e

9. In the seventeenth century, French mathemat c ans P erre de Fermat and B a se Pasca were
nsp red to formu ate the theory of modern probab ty after try ng to so ve the Prob em of
the Po nts Here s a s mp e examp e Pasca and Fermat take turns toss ng co ns Fermat w ns
a po nt f a head s tossed, and Pasca w ns a po nt f a ta s tossed If Pasca s ahead 8–7 and
the first p ayer w th 10 po nts w ns, what s the chance that Pasca w w n?

The b nom a , hypergeometr c, and negat ve b nom a random var ab es  Chapter 67   677
CHAPTER 68

The Poisson and exponential


random variable

Questions answered in this chapter:


■ What s the Po sson random var ab e?

■ How can I compute probab t es for the Po sson random var ab e?

■ If the number of customers arr v ng at a bank s governed by a Po sson random var ab e, what
random var ab e governs the t me between arr va s?

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

What is the Poisson random variable?

The Poisson random variable s a d screte random var ab e that s usefu for descr b ng probab t es
for s tuat ons n wh ch events (such as customer arr va s at a bank or orders p aced for a product) have
a sma probab ty of occurr ng dur ng a short t me nterva More spec fica y, dur ng a short t me
nterva , denoted as t, e ther zero or one event w occur, and the probab ty of one event occurr ng
dur ng a short nterva of ength t s (for some λ) g ven by λt Here, λ s the mean number of occur-
rences per t me un t

S tuat ons n wh ch the Po sson random var ab e can be app ed nc ude the fo ow ng

■ Number of un ts of a product demanded dur ng a month

■ Number of deaths per year by horse k ck n the Pruss an army

■ Number of car acc dents you have dur ng a year

■ Number of cop es of The Seat of the Soul ordered today at Amazon com

■ Number of worker’s compensat on c a ms fi ed at a company th s month

■ Number of defects n 100 yards of str ng (Here, 1 yard of str ng p ays the ro e of t me )

679

How can I compute probabilities for the Poisson random variable?

You can use the M crosoft Exce 2013 POISSON.DIST funct on to compute probab t es nvo v ng the
Po sson random var ab e In ear er vers ons of Exce , the POISSON funct on y e ded POISSON prob-
ab t es Just remember that n a ength of t me t, the mean of a Po sson random var ab e s t The
syntax of the POISSON funct on s as fo ows

POISSON DIST(x,Lambda,True or 1) ca cu ates the probab ty that a Po sson random var ab e w th


a mean equa to Lambda s ess than or equa to x

POISSON DIST(x,Lambda,Fa se or 0) ca cu ates the probab ty that a Po sson random var ab e w th


a mean equa to Lambda s equa to x

Here are some examp es of how to compute probab t es for Po sson random var ab es You can
find these examp es n the Po sson x sx fi e, shown n F gure 68-1

FIGURE 68-1  Us ng the Po sson random var ab e.

Suppose that my consu t ng bus ness rece ves an average of 30 phone ca s per hour Dur ng a two-
hour per od, I want to determ ne the fo ow ng

■ The probab ty that exact y 60 ca s w be rece ved n the next two hours

■ The probab ty that the number of ca s rece ved n the next two hours w be fewer than or
equa to 60

■ The probab ty that from 50 through 100 ca s w be rece ved n the next two hours

Dur ng a two-hour per od, the mean number of ca s s 60 In ce C4, I find the probab ty (0 05)
that exact y 60 ca s w be rece ved n the next two hours by us ng the POISSON DIST(60,C2,Fa se)
formu a In ce C5, I find the probab ty (0 534) that at most 60 ca s w be rece ved n two hours w th
the POISSON DIST(60,C2,True) formu a In ce C6, I find the probab ty (0 916) that from 50 through
100 ca s w be rece ved n two hours w th the POISSON DIST(100,C2,True)–POISSON DIST(49,C2,True)
formu a

Note  You can always use 1 instead of True as an argument in any Excel function.

680  Chapter 68  The Po sson and exponent a random var ab e


If the number of customers arriving at a bank is governed by a Poisson random variable, what
random variable governs the time between arrivals?

The t me between arr va s can be any va ue, wh ch means that the t me between arr va s s a cont nu-
ous random var ab e If an average of arr va s occurs per t me un t, the t me between arr va s fo ows
an exponent a random var ab e hav ng the probab ty dens ty funct on (pdf) of f(t) = λ–λt Th s ran-
dom var ab e has a mean, or average, va ue equa to 1/λ For λ = 30, a graph of the exponent a pdf s
shown n F gure 68-2 You can find th s chart and the data for th s examp e n the Dens ty worksheet
n the Exponent a d st x sx fi e

FIGURE 68-2  Exponent a probab ty dens ty funct on.

Reca from Chapter 66, “An ntroduct on to random var ab es,” that for a cont nuous random var -
ab e, the he ght of the pdf for a number x reflects the ke hood that the random var ab e assumes
a va ue near x You can see n F gure 68-2 that extreme y short t mes between bank arr va s (for
examp e, ess than 0 05 hours) are very ke y, but that for onger t mes, the pdf drops off sharp y

Even though the average t me between arr va s s 1/30 = 0 033 hours, there’s a reasonab e
chance that the t me between arr va s w be as much as 0 20 hours The Exce 2013
EXPON DIST(x,1/mean,True or 1) formu a w g ve the probab ty that an exponent a random
­var ab e w th a g ven mean w assume a va ue ess than or equa to x Thus, the second argument
to the EXPON.DIST ­funct on s the rate per t me un t at wh ch events occur For examp e, to com-
pute the ­probab ty that the t me between arr va s s at east 5, 10, or 15 m nutes, you can copy
the 1–EXPON DIST(C5,$D$2,True or 1) formu a from ce D5 to D7 In ear er vers ons of Exce , the
EXPONDIST funct on y e ds the same resu ts as EXPON.DIST

Note that m nutes were first converted to hours (5 m nutes equa s 1/12 hour and so on) A so, the
mean t me between arr va s s 0 033 hours, so 1/Mean = 1/ 033 = 30 was entered n the formu a In
short, the arr va rate per t me un t was entered, as you can see n F gure 68-3

The Po sson and exponent a random var ab e  Chapter 68   681


FIGURE 68-3  Computat ons of exponent a probab t es.

Problems
1. Beer dr nkers order an average of 40 p tchers of beer per hour at N ck’s Pub n B oom ngton,
Ind ana

• What s the probab ty that at east 100 p tchers are ordered n a two-hour per od?

• What s the chance that the t me between ordered p tchers w be 30 seconds or ess?

2. Suppose that teenage dr vers have an average of 0 3 acc dents per year

• What s the probab ty that a teenager w have no more than one acc dent dur ng a year?

• What s the probab ty that the t me between acc dents w be s x months or ess?

3. I am next n ne at a fast-food restaurant n wh ch customers wa t n a s ng e ne, and the t me


to serve a customer fo ows an exponent a d str but on w th a mean of 3 m nutes What s the
chance that I w have to wa t at east 5 m nutes to be served?

4. S nce 1900, a fract on ( 00124) of a Major League Baseba games have resu ted n no-h tters
A team p ays 162 games n a season What s the chance that a team p tches two or more no-
h tters dur ng a season?

682  Chapter 68  The Po sson and exponent a random var ab e


CHAPTER 69

The normal random variable

Questions answered in this chapter:


■ What are the propert es of the norma random var ab e?

■ How can I use Exce to find probab t es for the norma random var ab e?

■ Can I use Exce to find percent es for norma random var ab es?

■ Why s the norma random var ab e appropr ate n many rea -wor d s tuat ons?

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

What are the properties of the normal random variable?

In Chapter 66, “An ntroduct on to random var ab es,” you earned that cont nuous random var ab es
can be used to mode quant t es such as the fo ow ng

■ Pr ce of M crosoft stock one year from now

■ Market share for a new product

■ Market s ze for a new product

■ Cost of deve op ng a new product

■ Newborn baby’s we ght

■ A person’s IQ

Remember that f a d screte random var ab e (such as sa es of B g Macs dur ng 2014) can assume
many poss b e va ues, you can approx mate the va ue by us ng a cont nuous random var ab e as we
As descr bed n Chapter 66, any cont nuous random var ab e X has a probab ty dens ty funct on
(pdf) The pdf for a cont nuous random var ab e s a nonnegat ve funct on w th the fo ow ng proper-
t es (a and b are arb trary numbers)

■ The area under the pdf s 1

■ The probab ty that X < a equa s the probab ty that X ≤ a Th s probab ty s represented by
the area under the pdf to the eft of a
683

■ The probab ty that X > b equa s the probab ty that X ≥ b Th s probab ty s shown n the
area under the pdf to the r ght of b

■ The probab ty that a < X < b equa s the probab ty that a ≤ X ≤ b Th s probab ty s the area
under the pdf between a and b

Thus, the area under a cont nuous random var ab e’s pdf represents probab ty A so, the arger
the va ue of the dens ty funct on at X, the more ke y the random var ab e w take on a va ue near
X For examp e, f the dens ty funct on of a random var ab e at 20 s tw ce the dens ty funct on of the
random var ab e at 5, then the random var ab e s tw ce as ke y to take on a va ue near 20 than a
va ue near 5

For a cont nuous random var ab e, the probab ty that X equa s any value w a ways equa 0 For
examp e, some peop e are from 5 99999 feet through 6 00001 feet ta , but no person can be exact y
6 feet ta Th s exp a ns why you can rep ace the ess-than s gn (<) w th the ess-than or equa -to s gn
(≤) n the probab ty statements

F gure 69-1 d sp ays the pdf for X = IQ of a random y chosen person The area under th s pdf s 1 If
you want to find the probab ty that a person’s IQ s ess than or equa to 90, you s mp y find the area
to the eft of 90 If you want to find the probab ty that a person’s IQ s from 95 through 120, you find
the area under the pdf from 95 through 120 If you want to find the probab ty that a person’s IQ s
more than 130, you find the area under the dens ty funct on to the r ght of 130 (See the IQ Dens ty
worksheet n the Norma examp es x sx fi e )

FIGURE 69-1  Q pdf.

Actua y, the dens ty p otted n F gure 69-1 s an examp e of the normal random variable The
norma random var ab e s spec fied by ts mean and standard dev at on IQs fo ow a norma random
var ab e w th µ = 100 and σ = 15 Th s s the pdf d sp ayed n F gure 69-1 The norma random var ab e
has the fo ow ng propert es

■ The most ke y va ue of a norma random var ab e s µ (as nd cated by the pdf peak ng at 100
n F gure 69-1)

684  Chapter 69  The norma random var ab e


■ As the va ue x of the random var ab e moves away from µ, the probab ty that the random
var ab e s near x sharp y decreases

■ The norma random var ab e s symmetr c about ts mean For examp e, IQs near 80 are as
ke y as IQs near 120

■ A norma random var ab e has 68 percent of ts probab ty w th n σ of ts mean, 95 percent


w th n 2σ of ts mean, and 99 7 percent w th n 3σ of ts mean These measures shou d rem nd
you of the ru e of thumb descr bed n Chapter 42, “Summar z ng data by us ng descr pt ve
stat st cs ” In fact, the ru e of thumb s based on the assumpt on that data s samp ed from a
normal distribution, wh ch exp a ns why the ru e of thumb does not work as we when the data
fa s to exh b t a symmetr c h stogram

For a arger σ, a norma random var ab e s more spread out about ts mean Th s pattern s us-
trated n F gures 69-2 and 69-3 (See the S gma of 5 and 15 worksheet n the Norma examp es x sx fi e )

FIGURE 69-2  Norma random var ab e pdf w th a mean equa to 60 and a standard dev at on equa to 5.

FIGURE 69-3  Norma random var ab e pdf w th a mean equa to 60 and a standard dev at on equa to 15.

The norma random var ab e  Chapter 69   685


How can I use Excel to find probabilities for the normal random variable?

Cons der a norma random var ab e X w th a mean µ and standard dev at on σ Suppose for any num-
ber x, you want to find the probab ty that X ≤ x, wh ch s ca ed the normal cumulative function To
use M crosoft Exce 2013 to find the probab ty that X ≤ x, enter the NORM DIST(x,µ,σ,1) formu a Of
course, the fourth argument of 1 cou d be rep aced by True

The argument 1 te s Exce to compute the norma cumu at ve If the ast argument of the funct on
s 0, Exce returns the actua va ue of the norma random var ab e pdf Exce 2013 stat st ca funct ons
(such as NORM.DIST) have been mod fied or redes gned comp ete y to prov de better accuracy than
the r counterparts (such as NORMDIST) n prev ous vers ons of Exce

You can use the NORM.DIST funct on to answer many quest ons concern ng norma probab t es
You can find examp es n the Norma worksheet n the Norma examp es x sx fi e, wh ch s shown n
F gure 69-4 and n the fo ow ng three scenar os

FIGURE 69-4  Ca cu at ng norma probab ty.

■ What fraction of people have an IQ of less than 90? Let X equa the IQ of a random y
chosen person Then you seek the probab ty that X < 90, wh ch s equa to the probab ty
that X ≤ 90 Therefore, you can enter the NORM DIST(90,100,15,1) formu a n ce C3 of the
Norma worksheet, and Exce returns 0 252 Thus, 25 2 percent of a peop e have an IQ ess
than 90

■ What fraction of all people have IQs from 95 through 120?  When find ng the probab -
ty that a ≤ X ≤ b, you use the (area under the norma dens ty funct on to the eft of b) – (area
under norma dens ty funct on to the eft of a) formu a Thus, you can find the probab ty that
a ≤ X ≤ b by enter ng the NORM DIST(b,µ,s,1)–NORM DIST(a,µ,s,1) formu a You can answer
the quest on about IQs from 95 through 120 by enter ng the NORMDIST(120,100,15,1)–
NORMDIST(95,100,15,1) formu a n ce C4 of the Norma worksheet Exce returns the prob-
ab ty 0 539, so 53 9 percent of a peop e have an IQ from 95 through 120

■ What fraction of all people have IQs of at least 130?  To find the probab ty that X ≥ b,
note that the probab ty that X ≥ b equa s 1 – probab ty X < b You can compute the prob-
ab ty that X ≥ b by enter ng the 1–NORM DIST(b,µ,σ,1) formu a You seek the probab ty
that X ≥ 130 Th s equa s 1 – probab ty X < 130 You enter the 1–NORM DIST(130,100,15,1)

686  Chapter 69  The norma random var ab e


formu a n ce C5 of the Norma worksheet Exce returns 0 023, so you know that 2 3 percent
of peop e have an IQ of at east 130

Can I use Excel to find percentiles for normal random variables?

Cons der a g ven norma random var ab e X w th mean and standard dev at on In many s tuat ons,
you want to answer quest ons such as the fo ow ng

■ A drug manufacturer be eves that next year’s demand for ts popu ar ant depressant w be
norma y d str buted, w th mean equa to 60 m on days of therapy (DOT) and s gma equa to
5 m on DOT How many un ts of the drug shou d be produced th s year f the company wants
to have on y a 1 percent chance of runn ng out of the drug?

■ Fam y ncome n B oom ngton, Ind ana, s norma y d str buted, w th mean equa to $30,000
and s gma equa to $8,000 The poorest 10 percent of a fam es n B oom ngton are e g b e
for federa a d What shou d the a d cutoff be?

In the first examp e, you want to determ ne the n nety-n nth percent e of demand for the ant de-
pressant That s, you seek the number x such that there s on y a 1 percent chance that demand w
exceed x and a 99 percent chance that demand w be ess than x In the second examp e, you want
the tenth percent e of fam y ncome n B oom ngton That s, you seek the number x such that there
s on y a 10 percent chance that fam y ncome w be ess than x and a 90 percent chance that fam y
ncome w exceed x

Suppose you want to find the pth percent e (expressed as a dec ma ) of a norma random var ab e
X w th a mean and a standard dev at on In Exce 2013, s mp y enter the NORM INV(p,µ,σ) formu a
Th s formu a returns a number x such that the probab ty that X ≤ x equa s the spec fied percen-
t e You now can so ve your examp es You’ find these exerc ses on the Norma worksheet n the
Norma examp es x sx fi e

For the drug manufactur ng examp e, et X equa annua demand for the drug You want a va ue x
such that the probab ty that X ≥ x equa s 0 01 or the probab ty that X < x equa s 0 99 Aga n, you
seek the n nety-n nth percent e of demand, wh ch you find ( n m ons) by enter ng the NORM
INV(0 99,60,5) formu a n ce C7 Exce returns 71 63, so the company must produce 71,630,000 DOT
Th s assumes, of course, that the company beg ns the year w th no supp y of the drug on hand If, for
examp e, t had a beg nn ng nventory of 10 m on DOT, t wou d need to produce 61,630,000 DOT
dur ng the current year

To determ ne the cutoff for federa a d, f X equa s the ncome of a B oom ngton fam y, you seek
a va ue of x such that the probab ty that X ≤ x equa s 0 10, or the tenth percent e of B oom ngton
fam y ncome You find th s va ue w th the NORM INV(0 10,30000,8000) formu a Exce returns
$19,747 59, so a d shou d be g ven to a fam es w th ncomes sma er than $19,749 59

Why is the normal random variable appropriate in many real-world situations?

A we -known mathemat ca resu t ca ed the central limit theorem nd cates that f you add together
many (usua y at east 30 s suffic ent) ndependent random var ab es, the r sum s norma y d str b-
uted Th s resu t ho ds true even f the nd v dua random var ab es are not norma y d str buted Many

The norma random var ab e  Chapter 69   687


quant t es (such as measurement errors) are created by add ng together many ndependent random
var ab es, wh ch exp a ns why the norma random var ab e occurs often n the rea wor d Here are
some other s tuat ons n wh ch you can use the centra m t theorem

■ The tota demand for p zzas dur ng a month at a supermarket s norma y d str buted even f
the da y demand for p zzas s not

■ The amount of money you w n f you p ay craps 1,000 t mes s norma y d str buted, even
though the amount of money you w n on each nd v dua p ay s not

Another mportant mathemat ca resu t shows how to find the mean, var ance, and standard dev a-
t ons of sums of ndependent random var ab es If you are add ng together ndependent random
var ab es X1, X2, , Xn where mean Xi = µi, and standard dev at on Xi = σi then the fo ow ng are true

1. Mean (X1 + X2 + Xn) = µ1 + µ2 + µn


2 2 2
2. Var ance (X1 + X2 + Xn) = s 1
+s 2
+ s n

3. Standard dev at on (X1 + X2 + Xn) = σ21 + σ22 + ...σ2n

Note that 1 s true even when the random var ab es are not ndependent By comb n ng 1 through
3 w th the centra m t theorem, you can so ve many comp ex probab ty prob ems, such as the fo -
ow ng Suppose da y demand for p zza s not norma y d str buted but has a mean of 45 and s gma of
10 What s the probab ty that at east 1,400 p zzas w be so d dur ng a month? Your p zza so ut on
s n the Centra L m t worksheet n the Norma examp es x sx fi e, wh ch s shown n F gure 69-5

FIGURE 69-5  Us ng the centra m t theorem.

Even though the da y demand for frozen p zzas s not norma y d str buted, you know from the
centra m t theorem that the 30-day demand for frozen p zzas s norma y d str buted G ven th s, the
preced ng 1 through 3 mp y the fo ow ng

■ From 1, the mean of a 30-day demand equa s 30(45) = 1,350

■ From 2, the var ance of a 30-day demand equa s 30(12)2 = 4,320

■ From 3, the standard dev at on of a 30-day demand equa s = 65 73

688  Chapter 69  The norma random var ab e


Thus, the 30-day demand for p zzas can be mode ed fo ow ng a norma random var ab e w th a
mean of 1,350 and a standard dev at on of 65 73 In ce D11, the probab ty that at east 1,400 p z-
zas are so d s computed as the probab ty that the norma approx mat on s at east 1,399 5
(note that a demand of 1,399 6, for examp e, wou d round up to 1,400) w th the 1–NORM
DIST(1399 5,D7,D9,TRUE) formu a You find the probab ty that demand n a 30-day per od for at
east 1,400 p zzas s 22 6 percent

The number of p zzas that you must stock to have on y a 1 percent chance of runn ng out of p zzas
s just the n nety-n nth percent e of the demand d str but on You determ ne the n nety-n nth percen-
t e of the demand d str but on (1,503) n ce D12 w th the NORM INV(0 99,D7,D9) formu a Therefore,
at the beg nn ng of a month, you shou d br ng your stock of p zzas up to 1,503 f you want to have
on y a 1 percent chance of runn ng out of p zzas

Problems
1. Suppose you can set the mean number of ounces of soda that s put nto a can The actua
number of ounces has a standard dev at on of 0 05 ounces

• If you set the mean at 12 03 ounces, and a soda can s acceptab e f t conta ns at east 12
ounces, what fract on of cans s acceptab e?

• What fract on of cans have ess than 12 1 ounces?


• What shou d you set the mean to f you want at most 1 percent of your cans to conta n at
most 12 ounces? H nt Use the Goa Seek command

2. Annua demand for a drug s norma y d str buted w th a mean of 40,000 un ts and a standard
dev at on of 10,000 un ts

• What s the probab ty that annua demand s from 35,000 through 49,000 un ts?
• If you want to have on y a 5 percent chance of runn ng out of the drug, at what eve
shou d you set annua product on?

3. The probab ty of w nn ng a game of craps s 0 493 If I p ay 10,000 games of craps and bet
the same amount on each game, what s the probab ty that I’m ahead? Beg n by determ n-
ng the mean and standard dev at on of the profit on one game of craps Then use the centra
m t theorem

4. Week y sa es of Vo vo’s Cross Country stat on wagons are norma y d str buted w th a mean of
1,000 and standard dev at on of 250

• What s the probab ty that, dur ng a week, from 400 through 1,100 stat on wagons are
so d?

• There s a 1 percent chance that fewer than what number of stat on wagons s so d dur ng
a week?

The norma random var ab e  Chapter 69   689


CHAPTER 70

Weibull and beta distributions:


modeling machine life and
duration of a project

Questions answered in this chapter:


■ How can I est mate the probab ty that a mach ne w work w thout fa ng for at east 20
hours?

■ How can I est mate the probab ty that hang ng drywa n a bu d ng w take more than 200
hours?

The Weibull random variable s a cont nuous random var ab e that s often used to mode the fet me
of a mach ne If you have data about how ong s m ar mach nes have asted n the past, you can est -
mate the two parameters (alpha and beta) that define a We bu random var ab e You can then use
the WEIBULL.DIST funct on n M crosoft Exce 2013 to determ ne probab t es of nterest such as an
est mate of how ong a mach ne w run w thout fa ng

The beta random variable s a cont nuous random var ab e that’s often used to mode the durat on
of an act v ty G ven est mates of the m n mum durat on, max mum durat on, mean durat on, and the
standard dev at on of the durat on, you can use the BETA.DIST funct on n Exce 2013 to determ ne
probab t es of nterest

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

How can I estimate the probability that a machine will work without failing for at least
20 hours?

Suppose you have observed the fet me of seven s m ar mach nes The data co ected about the
mach nes s conta ned n the We bu est x sx fi e, shown n F gure 70-1

691

FIGURE 70-1  Mach ne fet me data.

Re ab ty eng neers have found that the We bu random var ab e s usua y appropr ate for
mode ng mach ne fet mes The We bu random var ab e s spec fied by two parameters alpha and
beta Based on the data, you can determ ne (us ng the AVERAGE and STDEV.S funct ons n ce s B13
and B14) that, on average, a mach ne asts 18 68 hours, w th a standard dev at on of 7 40 hours By
copy ng these va ues to ce s G6 and G11 and runn ng the So ver w th the sett ngs shown n F gure
70-2, you can find est mates of a pha and beta that ensure that the We bu random var ab e w have
a mean and standard dev at on match ng the data In th s case, a pha equa s 2 725 and beta equa s
21 003, as you can see n F gure 70-3 Any va ue you enter for a pha and beta n ce s E2 and E3 for a
We bu random var ab e y e ds a mean (computed n ce E6) and standard dev at on (computed n ce
E11) The So ver mode var es a pha and beta unt the mean and standard dev at on of the We bu
d str but on equa the mean and standard dev at on of mach ne fet me computed from your data
The Mu t start opt on for the GRG Non near eng ne s recommended for th s The Mu t start eng ne
works best w th upper and ower bounds on the chang ng ce s A ower bound of 0 010 on a pha
and beta w a ways work An upper bound of 1,000 for a pha and beta was tr ed If the So ver makes
a pha or beta bump up aga nst your upper bound, you shou d re ax the bound

692  Chapter 70  We bu and beta d str but ons: mode ng mach ne fe and durat on of a project
FIGURE 70-2  So ver sett ngs for determ n ng parameters for a We bu random var ab e.

FIGURE 70-3  Est mates of a pha and beta for a We bu random var ab e.

We bu and beta d str but ons: mode ng mach ne fe and durat on of a project  Chapter 70   693
Here’s the syntax of the WEIBULL.DIST funct on

WEIBULL.DIST(x,alpha,beta,Cumulative)

When Cumulative equa s True, th s formu a resu ts n the probab ty that a We bu random var -
ab e w th parameters a pha and beta s ess than or equa to x Chang ng True to Fa se y e ds the
he ght of the We bu probab ty dens ty funct on (pdf) Remember from Chapter 66, “An ntroduc-
t on to random var ab es,” that the he ght of a pdf for any va ue x of a cont nuous random var -
ab e nd cates the ke hood that the random var ab e assumes a va ue near x Thus, f the We bu
dens ty for 20 hours were tw ce the We bu dens ty for 10 hours, you wou d know that a mach ne
s tw ce as ke y to work for 20 hours before fa ng than to work for 10 hours before fa ng Before
answer ng some quest ons nvo v ng probab t es of nterest, note that n pr or vers ons of Exce , the
WEIBULLDIST funct on y e ds the same resu ts as WEIBULL.DIST

■ What is the probability that a machine will last at least 20 hours?  Th s probab ty
(41 7 percent) s computed n ce G16 w th the 1–WEIBULL DIST(20,a pha,beta,1) formu a
Essent a y, th s formu a computes the area under the We bu pdf to the r ght of 20 hours by
subtract ng from 1 the area to the eft of 20 hours

■ What is the probability that a machine will last from 15 through 30 hours?  Th s prob-
ab ty (66 9 percent) s computed n ce G18 w th the WEIBULL DISTL(30,a pha,beta,TRUE)–
WEIBULL DIST(15,a pha,beta,TRUE) formu a Th s formu a finds the area under the We bu pdf
from 15 through 30 hours by comput ng the area to the eft of 30 hours m nus the area to the
eft of 15 hours After you subtract the probab ty of a mach ne work ng w thout fa ure for
ess than 15 hours from the probab ty of a mach ne work ng w thout fa ure for ess than or
equa to 30 hours, you are eft w th the probab ty that a mach ne w work w thout fa ure
from 15 through 30 hours

How can I estimate the probability that hanging drywall in a building will take more than
200 hours?

S nce the deve opment of the Po ar s m ss e n the 1950s, project managers have mode ed act v ty
durat ons w th the beta random var ab e To spec fy a beta random var ab e, you need to spec fy a
m n mum va ue, a max mum va ue, and two parameters (a pha and beta) The data n the Beta x sx fi e
(see F gure 70-4) can be used to est mate the parameters of a beta d str but on

Suppose that you be eve that the t me needed to hang drywa n a bu d ng s sure to be between
0 and 600 hours These are your m n mum and max mum va ues, entered n ce s C7 and C8 The
F8 F22 ce range conta ns the engths of t me needed to hang drywa n 15 bu d ngs of a s m ar
s ze In ce F5, the AVERAGE funct on was used to compute the mean t me (78 49 hours) needed to
hang drywa n these 15 bu d ngs In ce F6, the STDEV funct on was used to determ ne the standard
dev at on (47 97 hours) of the t me needed to hang drywa n these bu d ngs Any cho ce of va ues of
a pha and beta determ ne the shape of the beta d str but on’s pdf and the mean and standard dev a-
t on for the correspond ng beta random var ab e If you can choose a pha and beta va ues to match
the mean and standard dev at on of the drywa nsta at on t mes computed from th s data, t seems
reasonab e that these a pha and beta va ues w y e d probab t es cons stent w th the observed data
After you enter the mean and standard dev at on for the drywa nsta at on data n ce s C9 and C10,

694  Chapter 70  We bu and beta d str but ons: mode ng mach ne fe and durat on of a project
the worksheet computes va ues for a pha (2 20) n ce C5 and beta (14 66) n ce C6 that ensure that
the mean and standard dev at on of the beta random var ab e match the mean and standard dev a-
t on of the data

FIGURE 70-4  Determ n ng probab t es w th the beta random var ab e.

The BETA DIST(x,a pha,beta,True or 1, ower,upper) funct on determ nes the probab ty that a beta
random var ab e rang ng from ower through upper, w th parameters a pha and beta, assumes a va ue
ess than or equa to x The ast two parameters are opt ona , and f they are om tted, Exce assumes
ower equa s 0 and upper equa s 1 The BETA DIST(x,a pha,beta,Fa se or 0, ower,upper) funct on
returns the pdf for a random var ab e fo ow ng a beta d str but on You can now use the BETA.DIST
funct on to determ ne probab t es of nterest

To compute the probab ty that hang ng drywa w take at east 200 hours, you can use the
formu a n ce C15, 1–BETA DIST(200,a pha,beta,True or 1, ower,upper) The resu t s 2 1 percent Th s
formu a s mp y computes the probab ty that hang ng drywa w take at east 200 hours as 1 – prob-
ability dry walling takes less than or equal to 200 hours

The probab ty that hang ng drywa w take at most 80 hours (58 3 percent) can be computed
w th the formu a n ce C16, BETA DIST(80,a pha,beta,True, ower,upper) And to compute the prob-
ab ty that the task w take from 30 through 150 hours (77 1 percent), n ce C17, use the BETA DIS
T(150,a pha,beta,True, ower,upper)–BETA DIST(30,a pha,beta,True, ower,upper) formu a Th s formu a
computes the probab ty that dry wa ng takes from 30 through 150 hours as the probab ty that dry
wa ng takes ess than or equa to 150 hours m nus the probab ty that dry wa ng takes ess than or
equa to 30 hours The d fference between these probab t es counts on y nstances when dry wa ng
takes from 30 through 150 hours

We bu and beta d str but ons: mode ng mach ne fe and durat on of a project  Chapter 70   695
Problems
The data for th s chapter’s prob ems are conta ned n the Ch70data x sx fi e

1. In the Prob em 1 worksheet, you are g ven data about the durat on of a mach ne’s fet me

• What s the probab ty that the mach ne w ast at east 10 hours?

• What s the probab ty that the mach ne w ast from 1 through 5 hours?

• What s the probab ty that the mach ne w fa w th n 6 hours?

2. You need to c ean your house today In the Prob em 2 worksheet, you are g ven data about
how ong t has taken to c ean your house n the past If you start c ean ng at noon, what are
the chances that you’ be fin shed n t me to eave at 7 00 P M for a mov e?

696  Chapter 70  We bu and beta d str but ons: mode ng mach ne fe and durat on of a project
CHAPTER 71

Making probability statements


from forecasts

Questions answered in this chapter:


■ On what bas s do we eva uate forecasts?

■ If a drug company forecasts that t w se 60 m on un ts of a drug next year, what s the


chance t w se more than 65 m on un ts of that drug next year?

Each day, we are constant y nundated by forecasts Here are some examp es

■ The government pred cts the GNP w grow by 4 percent dur ng the next year

■ The E L y market ng department pred cts that dur ng the next year, demand for a g ven
drug w be 400,000,000 DOT (days of therapy)

■ A Wa Street guru pred cts the Dow w go up 20 percent dur ng the next 12 months

■ The bookmakers forecast that the Ind ana Pacers w beat the Houston Rockets by 6 n the
open ng game of the 2015 NBA season

A though the forecasts we rece ve m ght be the best ava ab e, they are a most sure to be ncor-
rect For examp e, the bookmaker’s pred ct on that the Pacers w w n by 6 po nts s ncorrect un ess
the Pacers w n by exact y 6 po nts In short, any s ng e va ue (or po nt forecast) mp es a d str but on
for the quant ty be ng forecasted How can you find a random var ab e that correct y mode s the
uncerta nty nherent n the po nt forecast? The key to putt ng a d str but on around a po nt forecast
s to have some h stor ca data about the accuracy of past forecasts of the quant ty of nterest For
examp e, w th regard to the forecast for the Dow ndustr a average, you m ght have, for the past 10
years, the forecast made n January of each year for the percentage change n the Dow and the actua
change n the Dow for each of the 10 years

697

Answers to this chapter’s questions
Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

On what basis do we evaluate forecasts?

You can beg n by see ng whether past forecasts exh b t any bias For each past forecast, you deter-
m ne the actua va ue and forecasted va ue Then you average these rat os If your forecasts are unbi-
ased, th s average shou d be around 1 Any s gn ficant dev at on from 1 nd cates a s gn ficant b as
For examp e, f the average of actua and forecasted s 2, actua resu ts tend to be around tw ce the
forecast To correct for a b as, you shou d automat ca y doub e your forecast If the average of actua
and forecasted s 5, actua resu ts tend to be around ha f the actua forecast, so to e m nate b as, you
shou d automat ca y ha ve your forecast After you e m nate forecast b as, you ook at the standard
dev at on of the percentage errors of the unb ased forecast and use the fo ow ng norma random
var ab e to mode the quant ty be ng forecasted

■ Mean = the unb ased forecast

■ Standard dev at on = (unb ased forecast)*(standard dev at on of the percentage errors assoc -
ated w th the unb ased forecasts)

The standard dev at on of the percentage errors measures the accuracy of the past forecasts
C ear y, a sma er standard dev at on of percentage forecast errors s preferred to a arger standard
dev at on

The Drugfore x sx fi e (see F gure 71-1) ustrates the deas of forecast b as and forecast accuracy
The fi e conta ns actua and forecasted sa es ( n m ons of DOT) for years 2005 through 2012 F rst,
these forecasts w be shown to be b ased, and then they’ be corrected for the b as

FIGURE 71-1  Correct ng for forecast b as and measur ng forecast accuracy.

698  Chapter 71  Mak ng probab ty statements from forecasts


To beg n, n ce s F5 F12, check for b as by comput ng actua sa es and forecasted sa es for each
year To do th s, copy the D5/E5 formu a from F5 to F6 F12

Next, n ce F2, compute the b as of the or g na forecasts by averag ng each year’s actua and
forecasted va ue w th the AVERAGE(F5 F12) formu a. Actua sa es tend to come n 8 percent under
forecast To correct past b ased forecasts, mu t p y them by 92 by copy ng the $F$2*E5 formu a from
G5 to G6 G12 In H5 H12, compute each year’s percentage error for the unb ased forecast by copy ng
the (D5-G5)/G5 formu a from H5 to H6 H12 As you can see, for examp e, 2005 actua sa es were 16
percent ess than the unb ased forecast, whereas n 2011, actua sa es were 19 percent arger than the
unb ased forecast

Now eva uate the accuracy of the forecast errors n ce I2 by comput ng the standard dev at on
of the percentage errors w th the STDEV S(H5 H12) formu a The standard dev at on of past unb ased
forecasts has been around 11 4 percent of the unb ased forecast

If a drug company forecasts that it will sell 60 million units of a drug in 2013, what is the
chance it will sell more than 65 million units of the drug in 2013?

Forecast errors often fo ow a norma random var ab e Therefore, after correct ng for b as, you can
assume that forecast errors fo ow a norma random var ab e w th

■ Mean = the unb ased forecast

■ Standard dev at on = (unb ased forecast)*(standard dev at on of the percentage errors assoc -
ated w th the unb ased forecasts)

In your examp e, th s means that you shou d mode drug sa es n 2013 as a norma random var ab e
w th mean = 60( 918) = 55 08 m on and standard dev at on = ( 11375)*55 08 = 6 27 m on You
can now use the Exce NORM.DIST funct on to compute, n ce E18 (see F gure 71-2), the chance of
se ng at east 65 m on un ts n 2013 w th the 1-NORM DIST(65,F15,F16,TRUE) formu a There s a 5 7
percent chance of se ng more than 65 m on un ts of the drug

FIGURE 71-2  Chance of se ng more than 65 m on un ts of the drug.

Problems
1. In Game 7 of the Boston Ce t cs–Los Ange es Lakers 2010 NBA fina s, the Lakers were favored
by seven po nts By ook ng at past NBA games, you w find that bookmakers’ forecasts are
unb ased In add t on, the standard dev at on of bookmaker forecasts n past NBA games s

Mak ng probab ty statements from forecasts  Chapter 71   699


12 po nts Before the game, what wou d you have est mated as the probab ty that the Lakers
wou d w n the game?

2. A ead ng ce phone company forecasts that t w se 3 m on un ts next year of ts bestse -


ng phone In the past, actua sa es have been unb ased, w th forecast errors hav ng a standard
dev at on equa to 10 percent of forecasted sa es What are the chances that fewer than 2 5
m on phones w be so d next year?

3. The USC x sx fi e conta ns the USC footba team’s marg ns of v ctory for years 2005 through
2009 and the bookmaker’s forecast (before the game) for the USC marg n of v ctory Do these
data nd cate that the bookmaker’s forecasts are unb ased? If USC s favored by 10 po nts,
est mate the chance that USC w ns the game

700  Chapter 71  Mak ng probab ty statements from forecasts


CHAPTER 72

Using the lognormal random


variable to model stock prices

Questions answered in this chapter:


■ What s the ognorma random var ab e?

■ Is there a reason stock pr ces m ght fo ow a ognorma random var ab e?

■ How can I mode the future pr ce of any stock as a ognorma random var ab e?

■ How can I compute the probab ty that the M crosoft stock pr ce w exceed $38 s x months
from now?

■ How can I compute the med an pr ce of M crosoft n s x months?

Many peop e are nterested n mode ng the future pr ce of a stock, a commod ty such as o or
wheat, or a future exchange rate For the past 40 years, the lognormal random variable has been the
random var ab e most often used to mode stock pr ces In th s chapter, you earn why the ognor-
ma random var ab e s a reasonab e mode for stock pr ces and how to determ ne the appropr ate
ognorma parameters for any stock The chapter c oses by show ng how the Exce LOGNORM.DIST
and LOGNORM.INV funct ons can be used to ca cu ate probab t es that nvo ve the future pr ce of
a stock

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

What is a lognormal random variable?

A random var ab e Y fo ows a ognorma random var ab e f n Y fo ows a norma random var ab e
When us ng the Exce LOGNORM.DIST and LOGNORM.INV funct ons, a ognorma random var ab e
Y s character zed by two parameters a mean Mu equa to the expected va ue of n Y and a standard
dev at on S gma equa to the standard dev at on of n Y

Is there a reason stock prices might follow a lognormal random variable?

Let Y equa the pr ce of a stock n days from now, P equa the stock’s pr ce today, and Xt equa the
percentage change n the stock’s pr ce dur ng day t Then Y = P*X1*X2* Xn Because the ogar thm of

701

a product s the sum of the ogar thms, t’s true that n Y = n P + n X1 + n X2 + n Xn Suppose the
changes n pr ces on d fferent days are ndependent random var ab es Reca from Chapter 69, “The
norma random var ab e,” that the centra m t theorem mp es that the sum of many ndependent
random var ab es w be a norma random var ab e, even f the nd v dua random var ab es are not
norma y d str buted Th s exp a ns why n Y s ke y to be a norma random var ab e, and th s mp es
that Y s a ognorma random var ab e

How can I model the future price of any stock as a lognormal random variable?

At the c ose of trad ng on August 9, 2013, the pr ce of M crosoft stock was $32 70 Suppose you are
nterested n mode ng the pr ce of M crosoft stock n s x months as a ognorma random var ab e
How can you est mate Mu and S gma? Luck y, nformat on s eas y ava ab e on the Internet to he p
you mode the future pr ce of a stock The Ivo at ty com webs te prov des an est mate of a stock’s
annua vo at ty (ca t S gma ) The annua vo at ty s a surrogate for a stock’s r sk ness or var ab ty
At the c ose of trad ng on August 9, 2013, you can find from Ivo at ty com that the M crosoft mp ed
vo at ty was 22 27 percent To represent S gma as a dec ma , you wr te S gma = 2227 (The method
used to compute mp ed vo at ty s d scussed n Chapter 78, “Pr c ng stock opt ons ”)

From the Investment sect on of finance yahoo com, you can find the consensus op n on of ana ysts
for the pr ce of M crosoft n a year, shown n F gure 72-1

FIGURE 72-1  Ana ysts forecasts for M crosoft stock pr ce n one year.

Let S equa today’s stock pr ce and S1 equa the est mated mean pr ce n one year Then Mu , a sur-
rogate for the annua mean return on the stock, can be est mated by Mu = n (S1/S0)

You know that S equa s $32 70, and S1 equa s $34 92 Therefore (as computed n ce F7 of the
Lognorma x sx fi e; see F gure 72-2), Mu = n (34 92/32 70) = 0 06568

702  Chapter 72  Us ng the ognorma random var ab e to mode stock pr ces


FIGURE 72-2  Us ng ognorma to mode the pr ce of M crosoft stock n s x months.

If you want to mode the pr ce of M crosoft stock t years n the future, you need to know Mut =
Mean of n of M crosoft stock pr ce n t years and S gmat = Standard dev at on of n of M crosoft stock
pr ce n t years It turns out that

Mut = n S + t(Mu – 5S gma ^2) and S gma = S gma * t

For s x months, t = 5 years In ce E9, Mu 5 was computed as n(32 7) + 5*( 06568) – 5*( 2227)2 =
3 507819

In ce E10, you compute S gma.5 = ( 227)* .5 = 0 157473

Therefore, you can mode the pr ce of M crosoft n s x months as a ognorma random var ab e w th
Mu = 3 507819 and S gma = 0 157473

How can I compute the probability that the Microsoft stock price will exceed $38 six months
from now?

The Exce 2013 LOGNORM.DIST(x,Mean,S gma,True or 1) funct on computes the probab ty that a
ognorma random var ab e w th parameters Mean and S gma s ess than or equa to x Chang ng True
(or 1) to Fa se (or 0) returns the he ght of the ognorma pdf at x

In prev ous vers ons of Exce , the LOGNORMDIST funct on returns the same resu ts as LOGNORM
.DIST In ce F13, you can determ ne the chance that the pr ce of a share of M crosoft w exceed $38
Th s s ca cu ated by 1 – Probab ty that share s >=$38, so use the 1-LOGNORM DIST(38,F9,F10,True)
formu a There s a 20 5 percent chance that a share of M crosoft w se for more than $38 n s x
months

In ce F14, you can determ ne the chance that a share of M crosoft w se for ess than or equa to
$20 n s x months w th the LOGNORM DIST(20,F9,F10,True) formu a There s ess than a one percent
chance that a share of M crosoft w se for $20 or ess n s x months

Us ng the ognorma random var ab e to mode stock pr ces  Chapter 72   703
How can I compute the median price of Microsoft in six months?

The LOGNORM INV(p,Mu,S gma) funct on returns the va ue x of a ognorma random var ab e w th
parameters Mu and S gma such that there s a probab ty p that the ognorma random var ab e s ess
than or equa to x

Suppose you want to determ ne the med an pr ce of M crosoft stock n s x months Th s s a pr ce


$x such that there s a 50 percent chance that the M crosoft stock pr ce n s x months w be ess than
or equa to $x In ce F15, you find the med an pr ce n s x months w th the LOGNORM INV(0 5,F9,F10)
formu a The med an pr ce n s x months s $33 38

Remarks
The famous B ack-Scho es opt on-pr c ng formu a s d scussed n Chapter 78 It assumes that the pr ce
of a stock does fo ow a ognorma random var ab e

In recent years, t has become apparent that for many stocks, future stock pr ces take on extreme y
h gh or ow va ues more often than the ognorma random var ab e pred cts Th s has caused ana ysts
to search for other random var ab es w th fat ta s that can be used to mode future stock pr ces For
more deta s on th s top c, see N cho as Ta eb’s best-se ng book, The Black Swan (New York Random
House, 2010) A so, an a ternat ve method for mode ng stock pr ces that does not assume that future
stock pr ces fo ow a ognorma random var ab e s d scussed n Chapter 75, “S mu at ng stock pr ces
and asset a ocat on mode ng ”

Problems
Suppose a stock se s for $30 today The annua vo at ty of the stock s 35 percent, and ana ysts pre-
d ct the expected pr ce of the stock n a year w be $35 Use th s nformat on to answer the fo ow ng
quest ons

1. What s the probab ty that n two years the stock w se for more than $45?

2. What s the probab ty that n two years the stock w se for ess than $25?

3. You are 95 percent sure that the pr ce of the stock n two years w
be between what two
va ues? H nt Use 025 and 975 as the first arguments n the LOGNORM.INV funct on

704  Chapter 72  Us ng the ognorma random var ab e to mode stock pr ces


CHAPTER 73

Introduction to Monte Carlo


simulation

Questions answered in this chapter:


■ Who uses Monte Car o s mu at on?

■ What happens when I type =RAND() n a ce ?

■ How can I s mu ate va ues of a d screte random var ab e?

■ How can I s mu ate va ues of a norma random var ab e?

■ How can a greet ng card company determ ne how many cards to produce?

Data ana ysts wou d ke to est mate the probab t es of uncerta n events accurate y For examp e,
what s the probab ty that a new product’s cash flows w have a pos t ve net present va ue (NPV)?
What s the r sk factor of an nvestment portfo o? Monte Car o s mu at on enab es you to mode s tu-
at ons that present uncerta nty and then p ay them out on a computer thousands of t mes

Note  The term Monte Carlo simulation comes from the computer simulations performed
during the 1930s and 1940s to estimate the probability that the chain reaction needed for
an atom bomb to detonate would work successfully. The physicists involved in this work
were big fans of gambling, so they gave the simulations the code name Monte Carlo.

In the next five chapters, examp es are prov ded of how you can use M crosoft Exce 2013 to per-
form Monte Car o s mu at ons

705

Answers to this chapter’s questions
Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

Who uses Monte Carlo simulation?

Many compan es use Monte Car o s mu at on as an mportant part of the r dec s on-mak ng process
Here are some examp es

■ Genera Motors, Proctor and Gamb e, Pfizer, Br sto -Myers Squ bb, and E L y use s mu at on
to est mate both the average return and the r sk factor of new products At GM, former CEO
R ck Waggoner used th s nformat on to determ ne wh ch products came to market

■ GM uses s mu at on for act v t es such as forecast ng net ncome for the corporat on, pred ct-
ng structura and purchas ng costs, and determ n ng ts suscept b ty to d fferent k nds of r sk
(such as nterest rate changes and exchange rate fluctuat ons)

■ L y uses s mu at on to determ ne the opt ma p ant capac ty for each drug

■ Proctor and Gamb e uses s mu at on to mode and opt ma y hedge fore gn exchange r sk

■ Sears uses s mu at on to determ ne how many un ts of each product ne shou d be ordered


from supp ers—for examp e, the number of pa rs of Dockers trousers that shou d be ordered
th s year

■ O and drug compan es use s mu at on to va ue rea opt ons such as the va ue of an opt on to
expand, contract, or postpone a project

■ F nanc a p anners use Monte Car o s mu at on to determ ne opt ma nvestment strateg es for
the r c ents’ ret rement

What happens when I type =RAND() in a cell?

When you type the =RAND() formu a n a ce , you get a number that s equa y ke y to assume any
va ue between 0 and 1 Thus, around 25 percent of the t me, you shou d get a number ess than or
equa to 0 25; around 10 percent of the t me, you shou d get a number that s at east 0 90, and so
on To demonstrate how the RAND funct on works, take a ook at the Randdemo x sx fi e, shown n
F gure 73-1

706  Chapter 73  ntroduct on to Monte Car o s mu at on


FIGURE 73-1  Demonstrat ng the RAND funct on.

Note  When you open the Sheet1 worksheet in the Randdemo.xlsx file, you will not see the
same random numbers shown in Figure 73-1. The RAND function always recalculates the
numbers it generates when a worksheet is opened or when new information is entered in
the worksheet. The values in the Frozen worksheet are fixed to correspond to Figure 73-1.

The =RAND() formu a was cop ed from ce C3 to C4 C402; the C3 C402 range was named Data
Then, n co umn F, you can track the average of the 400 random numbers (ce F2) and use the
COUNTIF funct on to determ ne the fract ons that are between 0 and 0 25, 0 25 and 0 50, 0 50 and
0 75, and 0 75 and 1 When you press the F9 key, the random numbers are reca cu ated Not ce that
the average of the 400 numbers s a ways approx mate y 0 5 and that around 25 percent of the resu ts
are n nterva s of 0 25 These resu ts are cons stent w th the defin t on of a random number A so note
that the va ues RAND generates n d fferent ce s are ndependent For examp e, f the random num-
ber generated n ce C3 s a arge number (for examp e, 0 99), that te s you noth ng about the va ues
of the other random numbers generated

ntroduct on to Monte Car o s mu at on  Chapter 73   707


y e d a demand of 40,000; and random numbers greater than or equa to 0 75 w y e d a demand
of 69,000 Four hundred random numbers were generated by copy ng the RAND() formu a from
C3 to C4 C402 Then 400 tr a s, or terat ons, of ca endar demand were generated by copy ng the
VLOOKUP(C3, ookup,2) formu a from B3 to B4 B402 Th s formu a ensures that any random number
ess than 0 10 generates a demand of 10,000; any random number between 0 10 and 0 45 generates a
demand of 20,000; and so on In the F8 F11 ce range, the COUNTIF funct on was used to determ ne
the fract on of the 400 terat ons y e d ng each demand When you press F9 to reca cu ate the random
numbers, the s mu ated probab t es are c ose to the assumed demand probab t es

How can I simulate values of a normal random variable?

If you type the NORM INV(rand(),mu,s gma) formu a n any ce , you generate a s mu ated va ue of a
norma random var ab e hav ng a mean Mu and standard dev at on s gma Th s procedure s us-
trated n the S m worksheet n the Norma s m x sx fi e (See F gure 73-3 for the Frozen vers on )

FIGURE 73-3  S mu at ng a norma random var ab e.

Suppose you want to s mu ate 400 tr a s for a norma random var ab e w th a mean of 40,000 and
a standard dev at on of 10,000 (These va ues are typed n ce s E1 and E2, and these ce s are named
mean and s gma, respect ve y ) Copy ng the =RAND() formu a from C4 to C5 C403 generates 400 ran-
dom numbers Copy ng the NORM INV(C4,mean,s gma) formu a from B4 to B5 B403 generates 400
tr a va ues from a norma random var ab e w th a mean of 40,000 and a standard dev at on of 10,000
When you press the F9 key to reca cu ate the random numbers, the mean rema ns c ose to 40,000 and
the standard dev at on c ose to 10,000

Essent a y, for a random number p, the NORM INV(p,mean,s gma) formu a generates the pth per-
cent e of a norma random var ab e w th a mean Mu and a standard dev at on S gma For examp e,
the random number 0 87 n ce C4 (see F gure 73-3) generates approx mate y the e ghty-seventh
percent e of a norma random var ab e w th a mean of 40,000 and a standard dev at on of 10,000 n
ce B4

ntroduct on to Monte Car o s mu at on  Chapter 73   709


It wou d be n ce to have an effic ent way to press F9 many t mes (for examp e, one thousand) for
each product on quant ty and ta y the expected profit for each quant ty Th s s tuat on s one n wh ch
a two-way data tab e comes to the rescue (See Chapter 16, “Sens t v ty ana ys s w th data tab es,” for
deta s about data tab es ) The data tab e used n th s examp e s shown n F gure 73-5

FIGURE 73-5  Two way data tab e for greet ng card s mu at on.

In the A16 A1015 ce range, enter the numbers 1 to 1,000 (correspond ng to the 1,000 tr a s) One
easy way to create these va ues s to start by enter ng 1 n ce A16 Se ect the ce and then, on the
Home tab n the Editing group, c ck Fill (the con w th the down arrow), and se ect Series to open
the Series d a og box In the Series d a og box, shown n F gure 73-6, enter a step va ue of 1 and a
stop va ue of 1,000 In the Series In area, se ect Columns and then c ck OK The numbers 1 through
1,000 w be entered n co umn A, start ng n ce A16

FIGURE 73-6  Us ng the Ser es d a og box to fi n the tr a numbers 1 through 1,000.

ntroduct on to Monte Car o s mu at on  Chapter 73   711


Enter the poss b e product on quant t es (10,000; 20,000; 40,000; 69,000) n ce s B15 E15 You
want to ca cu ate profit for each tr a number (1 through 1,000) and each product on quant ty Refer
to the formu a for profit (ca cu ated n ce C11) n the upper- eft ce of the data tab e (A15) by
enter ng =C11

You can now tr ck Exce nto s mu at ng one thousand terat ons of demand for each product on
quant ty Se ect the tab e range (A15 E1015) and then, n the Data Tools group on the Data tab, c ck
What If Analysis and then se ect Data Table To set up a two-way data tab e, choose the produc-
t on quant ty (ce C1) as the row nput ce and se ect any b ank ce (ce I14 was chosen here) as the
co umn nput ce After you c ck OK, Exce s mu ates one thousand demand va ues for each order
quant ty

To understand why th s works, cons der the va ues p aced by the data tab e n the C16 C1015 ce
range For each of these ce s, Exce uses a va ue of 20,000 n ce C1 In C16, the co umn nput ce
va ue of 1 s p aced n a b ank ce , and the random number n ce C2 reca cu ates The correspond ng
profit s then recorded n ce C16 Then the co umn nput ce va ue of 2 s p aced n a b ank ce , and
the random number n C2 aga n reca cu ates The correspond ng profit s entered n ce C17

By copy ng the AVERAGE(B16 B1015) formu a from ce B13 to C13 E13, you can compute average
s mu ated profit for each product on quant ty By copy ng the STDEV(B16 B1015) formu a from ce
B14 to C14 E14, you can compute the standard dev at on of the s mu ated profits for each order quan-
t ty Each t me you press F9, one thousand terat ons of demand are s mu ated for each order quant ty
Produc ng 40,000 cards a ways y e ds the argest expected profit, so produc ng 40,000 cards appears
to be the proper dec s on

The impact of risk on your decision


If you produce 20,000 nstead of 40,000 cards, the expected profit drops approx mate y 22 percent,
but r sk (as measured by the standard dev at on of profit) drops a most 73 percent Therefore, f you
are extreme y averse to r sk, produc ng 20,000 cards m ght be the r ght dec s on Inc denta y, produc-
ng 10,000 cards a ways has a standard dev at on of 0 cards because f you produce 10,000 cards, you
w a ways se a of them w thout any eftovers

Note  In this workbook, I set the Calculation option to Automatic Except For Tables. (Use
the Calculation command in the Calculation group on the Formulas tab.) This setting en-
sures that the data table does not recalculate unless you press F9, which is a good idea
because a large data table will slow down your work if it recalculates every time you type
something in your worksheet. Note that in this example, whenever you press F9, the mean
profit changes. This happens because each time you press F9, a different sequence of one
thousand random numbers is used to generate demands for each order quantity.

712  Chapter 73  ntroduct on to Monte Car o s mu at on


Confidence interval for mean profit
A natura quest on to ask n th s s tuat on s, “Into what nterva w I be 95 percent sure that the true
mean profit w fa ?” Th s nterva s ca ed the 95 percent confidence interval for mean profit A 95
percent confidence nterva for the mean of any s mu at on output s computed by the fo ow ng
formu a
1.96 * profitst.dev.
Mean Profit +
number iterations

In ce J11, you can compute the ower m t for the 95 percent confidence nterva on mean profit
when 40,000 ca endars are produced w th the D13–1 96*D14/SQRT(1000) formu a In ce J12, the
upper m t for the 95 percent confidence nterva was computed w th the D13+1 96*D14/SQRT(1000)
formu a These ca cu at ons are shown n F gure 73-7

FIGURE 73-7  N nety five percent confidence nterva for mean profit when 40,000 ca endars are ordered.

You can be 95 percent sure that your mean profit when 40,000 ca endars are ordered s between
$55,076 and $61,008

Problems
1. An auto dea er be eves that demand for 2015 mode cars w be norma y d str buted w th a
mean of 200 and a standard dev at on of 30 H s cost of rece v ng an Envoy s $25,000, and he
se s an Envoy for $40,000 Ha f of a the Envoys not so d at fu pr ce can be so d for $30,000
He s cons der ng order ng 200, 220, 240, 269, 280, or 300 Envoys How many shou d he order?

2. A sma supermarket s try ng to determ ne how many cop es of People magaz ne t shou d
order each week The owner be eves the demand for People s governed by the fo ow ng
d screte random var ab e

Demand Probability
15 0.10
20 0.20
25 0.30
30 0.25
35 0.15

The supermarket pays $1 00 for each copy of People and se s t for $1 95 Each unso d copy
can be returned for $0 50 How many cop es of People shou d the store order?

ntroduct on to Monte Car o s mu at on  Chapter 73   713


C H A P T E R 74

Calculating an optimal bid

Questions answered in this chapter:


■ How can I s mu ate a b nom a random var ab e?

■ How can I determ ne whether a cont nuous random var ab e shou d be mode ed as a norma
random var ab e?

■ How can I use s mu at on to determ ne the opt ma b d for a construct on project?

When b dd ng aga nst compet tors on a project, the two major sources of uncerta nty are the number
of compet tors and the b ds subm tted by each compet tor If your b ds are h gh, you’ make a ot of
money on each project, but you’ get very few projects If your b ds are ow, you’ work on ots of
projects but make very tt e money on each one The opt ma b d s somewhere n the m dd e Monte
Car o s mu at on s a usefu too for determ n ng the b d that max m zes expected profit

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

How can I simulate a binomial random variable?

The BINOM INV(n,p,rand()) formu a s mu ates the number of successes n n ndependent tr a s,


each of wh ch has a probab ty of success equa to p As exp a ned n Chapter 73, “Introduct on to
Monte Car o s mu at on,” the RAND funct on generates a number equa y ke y to assume any va ue
between 0 and 1 As shown n the B nom a s m x sx fi e (see F gure 74-1), when you press F9, the
BINOM INV(100,0 9,D3) formu a entered n ce C3 s mu ates the number of free throws that Steve
Nash (a 90-percent fou shooter n the NBA) makes n 100 attempts The BINOM INV(100,0 5,D4)
formu a n ce C4 s mu ates the number of heads tossed n 100 tosses of a fa r co n In ce C5, the
BINOM INV(3,0 4,D5) formu a s mu ates the number of compet tors enter ng the market dur ng a
year n wh ch there are three poss b e entrants and each compet tor s assumed to have a 40 percent
chance of enter ng the market Of course, the RAND() formu a was entered n D3 D5

715

FIGURE 74-1  S mu at ng a b nom a random var ab e.

How can I determine whether a continuous random variable should be modeled as a normal
random variable?

Suppose that you th nk the most ke y b d by a compet tor s $50,000 Reca that the norma prob-
ab ty dens ty funct on (pdf) s symmetr c about ts mean Therefore, to determ ne whether a norma
random var ab e can be used to mode a compet tor’s b d, you need to test for symmetry about the
b d’s mean If the compet tor’s b d exh b ts symmetry about the mean of $50,000, b ds of $40,000
and $60,000, $45,000 and $55,000, and so on shou d be approx mate y equa y ke y If the symmetry
assumpt on seems reasonab e, you can then mode each compet tor’s b d as a norma random var -
ab e w th a mean of $50,000

How can you est mate the standard dev at on of each compet tor’s b d? Reca from the ru e of
thumb d scussed n Chapter 42, “Summar z ng data by us ng descr pt ve stat st cs,” that data sets w th
symmetr c h stograms have rough y 95 percent of the r data w th n two standard dev at ons of the
mean S m ar y, a norma random var ab e has a 95 percent probab ty of be ng w th n two standard
dev at ons of ts mean Suppose that you are 95 percent sure that a compet tor’s b d w be between
$30,000 and $70,000 Th s mp es that 2*(standard dev at on of compet tor’s b d) equa s $20,000, or
the standard dev at on of a compet tor’s b d equa s $10,000

If the symmetry assumpt on s reasonab e, you can now s mu ate a compet tor’s b d w th the
NORM INV(rand(),50000,10000) formu a (See Chapter 73 for deta s about how to mode norma
random var ab es, us ng the NORM.INV funct on )

How can I use simulation to determine the optimal bid for a construction project?

Assume that you’re b dd ng on a construct on project that w cost you $25,000 to comp ete It costs
$1,000 to prepare your b d You have s x potent a compet tors, and you est mate that there s a 50
percent chance that each compet tor w b d on the project If a compet tor p aces a b d, ts b d s
assumed to fo ow a norma random var ab e w th a mean equa to $50,000 and a standard dev at on
equa to $10,000 A so suppose you are on y prepar ng b ds that are exact mu t p es of $5,000 What

716  Chapter 74  Ca cu at ng an opt ma b d


shou d you b d to max m ze expected profit? Remember, the ow b d w ns! You’ find the work for th s
quest on n the B ds m x sx fi e, shown n F gure 74-2 and F gure 74-3

FIGURE 74-2  B dd ng s mu at on mode .

FIGURE 74-3  B dd ng s mu at on data tab e.

Ca cu at ng an opt ma b d  Chapter 74   717


Your strategy shou d be as fo ows

■ Generate the number of b dders

■ For each potent a b dder who actua y b ds, use the norma random var ab e to mode the b d
If a potent a b dder does not b d, you ass gn a arge b d (for examp e, $100,000) to ensure
that he does not w n the b dd ng

■ Determ ne whether you are the ow b dder

■ If you are the ow b dder, you earn a profit equa to your b d, ess project cost, ess $1,000 (the
cost of mak ng the b d) If you are not the ow b dder, you ose the $1,000 cost of the b d

■ Use a two-way data tab e to s mu ate each poss b e b d (for examp e, $30,000, $35,000,  ,
$60,000) one thousand t mes and then choose the b d w th the argest expected profit

To beg n, ass gn the names n the D1 D4 ce range to the E1 E4 range Determ ne n ce E3


the number of b dders w th the BINOM INV(6,0 5,F3) formu a Ce F3 conta ns the RAND() for-
mu a Determ ne wh ch of the potent a b dders actua y b d by copy ng the IF(D9<=Number
b dders,”yes”,”no”) formu a from E9 to E10 E14

Generate a b d for each b dder (nonb dders are ass gned a b d of $100,000) by copy ng the
IF(E9=”yes”,NORM INV(G9,50000,10000),100000) formu a from ce F9 to F10 F14 Each ce n the
G9 G14 ce range conta ns the RAND funct on In ce D17, determ ne whether you are the ow b dder
and w n the project w th the IF(myb d<=MIN(F9 F14),”yes”,”no”) formu a In ce D19, compute profit
w th the IF(D17=”yes”,myb d–costproject–cost b d,–cost b d) formu a, recogn z ng that you rece ve
on y the amount of the b d and pay project costs f you w n the b d

Now you can use a two-way data tab e (shown n F gure 74-3) to s mu ate one thousand b ds
between $30,000 and $60,000 Copy the profit to ce D22 by enter ng the =D19 formu a Se ect the
D22 K1022 tab e range On the Data tab, n the Data Tools group, c ck What-If Analysis and then
c ck Data Table to spec fy the nput va ues for the data tab e The co umn nput ce s any b ank ce
n the worksheet, and the row nput ce s E4 (the ocat on of the b d) C ck ng OK n the Data Tab e
d a og box s mu ates the profit from each b d one thousand t mes

Copy ng the AVERAGE(E23 E1022) formu a from E21 to F21 K21 ca cu ates the mean profit for each
b d Each t me you press F9, you see that the mean profit for one thousand tr a s s max m zed by b d-
d ng $40,000

Problems
1. How wou d the opt ma b d change f you had 12 compet tors?

2. Suppose you are b dd ng for an o we that you be eve w y e d $40 m on ( nc ud ng the


cost of deve op ng and m n ng the o ) n profits Three compet tors are b dd ng aga nst you,
and each compet tor’s b d s assumed to fo ow a norma random var ab e w th a mean of $30
m on and a standard dev at on of $4 m on What shou d you b d (w th n $1 m on)?

718  Chapter 74  Ca cu at ng an opt ma b d


3. A common y used cont nuous random var ab e s the un form random var ab e A un form
random var ab e—wr tten as U(a,b)— s equa y ke y to assume any va ue between two g ven
numbers a and b Exp a n why the a + (b – a)*RAND() formu a can be used to s mu ate U(a,b)

4. Investor Peter F scher s b dd ng to take over a b otech company The company s equa y
ke y to be worth any amount between $0 and $200 per share On y the company tse f knows
ts true va ue Peter s such a good nvestor that the market w mmed ate y est mate the
firm’s va ue at 50 percent more than ts true va ue What shou d Peter b d per share for th s
company?

5. Seatt e Mar ner baseba p ayer Ich ro Suzuk s ask ng for sa ary arb trat on on h s contract
Sa ary arb trat on n Major League Baseba works as fo ows The p ayer subm ts a sa ary that
he th nks he shou d be pa d, as does the team The arb trator (w thout see ng the sa ar es sub-
m tted by the p ayer or the team) est mates a fa r sa ary The p ayer s then pa d the subm tted
sa ary that s c oser to the arb trator’s est mate For examp e, suppose Ich ro subm ts a $12
m on offer, and the Seatt e Mar ners subm t a $7 m on offer If the arb trator says a fa r sa -
ary s $10 m on, Ich ro w be pa d $12 m on, whereas f the arb trator says a fa r sa ary s $9
m on, Ich ro w be pa d $7 m on Assume that the arb trator’s est mate s equa y ke y to
be anywhere between $8 and $11 m on, and the team’s offer s equa y ke y to be anywhere
between $6 m on and $9 m on W th n $1 m on, what sa ary shou d Ich ro subm t?

Ca cu at ng an opt ma b d  Chapter 74   719


CHAPTER 75

Simulating stock prices and asset


allocation modeling

Questions answered in this chapter:


■ I recent y bought 100 shares of GE stock What s the probab ty that dur ng the next year th s
nvestment w return more than 10 percent?

■ I’m try ng to determ ne how to a ocate my nvestment portfo o among stocks, T-b s, and
bonds What asset a ocat on over a five-year p ann ng hor zon w y e d an expected return of
at east 10 percent and m n m ze r sk?

The past few years have shown that future returns on nvestments are h gh y uncerta n Chapter 72,
“Us ng the ognorma random var ab e to mode stock pr ces,” showed how to use the ognorma
random var ab e to mode stock pr ces Many financ a experts have been cr t ca of us ng the ognor-
ma random var ab e to mode stock pr ces because the ognorma underest mates the probab ty
of extreme events (often ca ed b ack swans) Th s chapter exp a ns a re at ve y s mp e approach to
assess ng uncerta nty n future nvestment returns Th s approach s based on the dea of bootstrap-
ping Essent a y, bootstrapp ng s mu ates future nvestment returns by assum ng that the future w
be s m ar to the past For examp e, f you want to s mu ate the stock pr ce of GE n one year, you can
assume that each month’s percentage change n pr ce s equa y ke y to be one of, for examp e, the
percentage changes for the prev ous 60 months Th s method a ows you to generate thousands of
scenar os for the future va ue of your nvestments eas y In add t on to scenar os that assume that
future var ab ty and average returns w be s m ar to the recent past, you can eas y adjust boot-
strapp ng to reflect a v ew that future returns on nvestments w be ess or more favorab e than n
the recent past

After you’ve generated future scenar os for nvestment returns, t’s a s mp e matter to use the
M crosoft Exce So ver to work out the asset a ocat on prob em—that s, how shou d you a ocate
your nvestments to atta n the eve of expected return you want but w th m n mum r sk?

The fo ow ng two examp es demonstrate the s mp c ty and power of the bootstrapp ng approach

721

Answers to this chapter’s questions
Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

I recently bought 100 shares of GE stock. What is the probability that during the next year
this investment will return more than 10 percent?

Suppose that GE stock s current y se ng for $28 50 per share Data for the month y returns on GE (as
we as for M crosoft and Inte ) for the months between August 1997 and Ju y 2002 s nc uded n the
Ges m x sx fi e, shown n F gure 75-1 For examp e, n the month end ng on August 2, 2002 (bas ca y,
th s s Ju y 2002), GE ost 12 1 percent These returns nc ude d v dends ( f any) pa d by each company

FIGURE 75-1  GE, M crosoft, and nte stock data.

The pr ce of GE stock n one year s uncerta n, so how can you get an dea about the range
of var at on n the pr ce of GE stock one year from now? The bootstrapp ng approach s mp y est mates
a return on GE dur ng each of the next 12 months by assum ng that the return dur ng each month s
equa y ke y to be any of the returns for the 60 months sted In other words, the return on GE next
month s equa y ke y to be any of the numbers n the F5 F64 ce range To mp ement th s dea,
you use the RANDBETWEEN(1,60) formu a to choose a scenar o for each of the next 12 months For
examp e, f th s funct on returns 7 for next month, you use the return for GE n ce F11 (4 1 percent),
wh ch s the seventh ce n the range, as next month’s return The resu ts are shown n F gure 75-2
(You’ see d fferent va ues because the RANDBETWEEN funct on automat ca y reca cu ates random
va ues when you open the worksheet )

722  Chapter 75  S mu at ng stock pr ces and asset a ocat on mode ng


To beg n, you enter GE’s current pr ce per share ($28 50) n ce J6 Then you generate a scenar o
for each of the next 12 months by copy ng the RANDBETWEEN(1,60) formu a from K6 to K7 K17
Use a ookup tab e to obta n the GE return based on your scenar o To do th s, you s mp y copy the
VLOOKUP(K6, ookup,5) formu a from L6 to L7 L17 As the formu a nd cates, the B5 F64 range s
named ookup, w th the returns for GE n the fifth co umn of the ookup range In the scenar os shown
n F gure 75-2, you can see, for examp e, that the return for GE s x months nto the future s equa to
the 12/1/2001 data po nt, that s, a 4 6 percent return (Compare ce L11 n F gure 75-2 w th ce F13
n F gure 75-1 )

FIGURE 75-2  S mu at ng GE stock pr ce n one year.

Copy ng the (1+L6)*J6 formu a from M6 to M7 M17 determ nes each month’s end ng GE pr ce The
formu a takes the form of (1 + month’s return)*(GE’s beg nn ng pr ce) F na y, copy ng the =M6 for-
mu a from J7 to J8 J17 computes the beg nn ng pr ce for each month as equa to the prev ous month’s
end ng pr ce

You can now use a data tab e to generate one thousand scenar os for GE’s pr ce n one year and
the one-year percentage return on your nvestment The data tab e s shown n F gure 75-3 In ce J19,
you copy the end ng pr ce w th the =M17 formu a In ce K19, you enter the (M17–$J$6)/$J$6 formu a
to compute the one-year return as (End ng GE pr ce – Beg nn ng GE pr ce)/Beg nn ng GE pr ce

Next, se ect the (J19 K1019) tab e range, c ck What-If Analysis n the Data Tools group on the
Data tab, and then se ect Data Table You set up a one-way data tab e by se ect ng a b ank ce as
the co umn nput ce After you c ck OK n the Data Tab e d a og box, Exce generates one thousand
scenar os for GE’s stock pr ce n one year (The ca cu at on opt on for th s workbook has been set to
Automat c Except For Tab es on the Formu as tab n the Exce Opt ons d a og box You need to press
F9 f you want to see the s mu ated pr ces change )

S mu at ng stock pr ces and asset a ocat on mode ng  Chapter 75   723
FIGURE 75-3  Data tab e for GE s mu at on.

In ce s M20 M24, use the COUNTIF funct on (see Chapter 19, “The COUNTIF, COUNTIFS, COUNT,
COUNTA, and COUNTBLANK funct ons”) to summar ze the range of returns that can occur n one
year For examp e, n ce M20, you can compute the probab ty of os ng money n one year w th the
COUNTIF(returns,”<0”)/1000 formu a (The range conta n ng the one thousand s mu ated returns s
named Returns ) The s mu at on nd cates that, based on the data for 1997–2002, there s rough y a
40 percent chance that your GE nvestment w ose money dur ng the next year You can a so see the
fo ow ng resu ts

■ There s a 45 percent probab ty that returns w be more than 10 percent

■ There s a 15 percent probab ty that returns w be between 0 and 10 percent

■ There s a 12 percent chance that the nvestment w ose between 0 and 10 percent

■ There s a 28 percent chance that the nvestment w ose more than 10 percent

■ The average return for the next year w be approx mate y 10 7 percent

Many pund ts be eve that future stock returns w not be as good as n the recent past Suppose
you fee that n the next year, GE w perform on average 5 percent worse per year than t performed
dur ng the 1997–2002 per od for wh ch you have data You can eas y ncorporate th s assumpt on
nto a s mu at on by chang ng the fina pr ce formu a for GE n ce M17 to (1 + L17)*J17 – 0 05*J6 Th s
s mp y reduces the end ng GE pr ce by 5 percent of ts n t a pr ce, wh ch reduces your returns for the
next year by 5 percent You can see these resu ts n the Ges m ess5 x sx fi e, shown n F gure 75-4

Note that the est mate s now a 49 percent chance that the pr ce of GE stock w decrease dur ng
the next year The average s not exact y 5 percent ower than the prev ous s mu at on because each
t me you run one thousand terat ons, the s mu ated va ues change

724  Chapter 75  S mu at ng stock pr ces and asset a ocat on mode ng


FIGURE 75-4  Pess m st c v ew of the future.

I’m trying to determine how to allocate my investment portfolio among stocks, T-bills, and
bonds. What asset allocation over a five-year planning horizon will yield an annual expected
return of at least 8 percent and minimize risk?

A key dec s on made by nd v dua s, mutua fund managers, and other nvestors s how to a ocate
assets among d fferent asset c asses, g ven the future uncerta nty about returns for these asset
c asses A reasonab e approach to asset a ocat on s to use bootstrapp ng to generate one thousand
s mu ated va ues for the future va ues of each asset c ass and then use the Exce So ver to determ ne
an asset a ocat on that y e ds an expected return yet m n m zes r sk As an examp e, suppose you
are g ven annua returns on stocks, T-b s, and bonds dur ng the per od from 1973 to 2012 You are
nvest ng for a five-year p ann ng hor zon, and based on the h stor ca data, you want to know wh ch
asset a ocat on y e ds a m n mum r sk (as measured by standard dev at on) of annua returns and
y e ds an annua expected return of at east 10 percent You can see th s data n the Asseta s m x sx
fi e, shown n F gure 75-5 (Not a the data s shown )

FIGURE 75-5  H stor ca returns on stocks, T b s, and bonds.

S mu at ng stock pr ces and asset a ocat on mode ng  Chapter 75   725
To beg n, you use bootstrapp ng to generate one thousand s mu ated va ues for stocks, T-b s, and
bonds n five years Assume that each asset c ass has a current pr ce of $1 (See F gure 75-6 )

For each asset c ass, you enter an n t a un t pr ce of $1 n the H10 J10 ce range Next, by copy ng
the RANDBETWEEN(1973,2012) formu a from K10 to K11 K14, you generate a scenar o for each of the
next five years For examp e, for the data shown, next year w be s m ar to 1973, the fo ow ng year
w be s m ar to 1996, and so on Copy ng the H10*(1+VLOOKUP($K10, ookup,L$8)) formu a from
L10 to L10 N14 generates each year’s end ng va ue for each asset c ass For stocks, for examp e, th s
formu a computes the fo ow ng

(Ending year t stock value)=(Beginning year t stock value)*(1+Year t stock return)

FIGURE 75-6  S mu at ng five year returns on stocks, T b s, and bonds.

Copy ng the =L10 formu a from H11 to H11 J14 computes the va ue for each asset c ass at the
beg nn ng of each success ve year

You can now use a one-way data tab e to generate one thousand scenar os of the va ue of stocks,
T-b s, and bonds n five years Beg n by copy ng the Year 5 end ng va ue for each asset c ass to ce s
I16 K16 Se ect the (H16 K1015) tab e range, c ck What If Analysis on the Data tab, and then c ck
Data Table Use any b ank ce as the co umn nput ce to set up a one-way data tab e After c ck ng
OK n the Data Tab e d a og box, you obta n one thousand s mu ated va ues for the va ue of stocks,
T-b s, and bonds over five years It s mportant to note that th s approach mode s the fact that
stocks, T-b s, and bonds do not move ndependent y In each of the five years, the stock, T-b , and
bond returns are a ways chosen from the same row of data Th s enab es the bootstrapp ng approach
to reflect the nterdependence of returns on these asset c asses that has been exh b ted dur ng the
recent past (See Prob em 7 at the end of th s chapter for concrete ev dence that bootstrapp ng
appropr ate y mode s the nterdependence between the returns on your three asset c asses )

726  Chapter 75  S mu at ng stock pr ces and asset a ocat on mode ng


W th th s setup, you’re ready to find the opt ma asset a ocat on, wh ch s ca cu ated n the
Asseta ocat onopt x sx fi e, shown n F gure 75-7 To start, copy the one thousand s mu ated five-year
asset va ues and paste them nto a b ank worksheet (Here, the C4 E1003 ce range was chosen ) In
ce s C2 E2, enter tr a fract ons of your assets a ocated to stocks, T-b s, and bonds, respect ve y In
ce F2, add these asset a ocat on fract ons w th the SUM(C2 E2) formu a Later, you can add the F2=1
constra nt to the So ver mode , wh ch ensures that you nvest 100 percent of your money n one of the
three asset c asses

FIGURE 75-7  Opt ma asset a ocat on mode .

Next, you want to determ ne the fina portfo o va ue for each scenar o To make th s ca cu at on,
you can use a formu a such as (F na portfo o va ue) = (F na va ue of stocks) + (F na va ue of T-b s) +
(F na va ue of bonds) Copy ng the SUMPRODUCT(C4 E4,$C$2 $E$2) formu a from ce F4 to F5 F1003
determ nes the fina asset pos t on for each scenar o

The next step s to determ ne the annua return over the five-year s mu ated per od for each
scenar o that Exce generated Note that (1 + Annua return)5 equa s (F na portfo o va ue)/(In t a
portfo o va ue) Because the n t a portfo o va ue s just $1, th s te s you that Annua return equa s
(F na portfo o va ue)1/5 – 1

By copy ng the (F4/1)^(1/5)–1 formu a from ce G4 to G5 G1003, you can compute the annua
return for each scenar o dur ng the five-year s mu ated per od After nam ng the G4 G1003 range
(wh ch conta ns the s mu ated annua returns) Returns, you can compute the average annua return n
ce I3 w th the AVERAGE(returns) formu a and the standard dev at on of the annua returns n ce I4
w th the STDEV S(returns) formu a

S mu at ng stock pr ces and asset a ocat on mode ng  Chapter 75   727
Now you’re ready to use So ver to determ ne the set of a ocat on we ghts that y e ds an expected
annua return of at east 8 percent, yet m n m zes the standard dev at on of the annua returns The
So ver Parameters d a og box set up to perform th s ca cu at on s shown n F gure 75-8

FIGURE 75-8  So ver Parameters d a og box set up for your asset a ocat on mode .

■ You try to m n m ze the standard dev at on of the annua portfo o return (ce I4)

■ The chang ng ce s are the asset a ocat on we ghts (ce s C2 E2)

■ You must a ocate 100 percent of the money you have to the three asset c asses (F2=1)

■ The expected annua return must be at east 8 percent (I3>=0 08)

■ You assume that no short sa es are a owed, wh ch s mode ed by forc ng the fract on of
the money n each asset c ass to be nonnegat ve To mp ement th s, se ect the Make
Unconstrained Variables Non-Negative check box

■ The m n mum r sk asset a ocat on s 25 3 percent stocks, 72 5 percent T-b s, and 2 2 percent
bonds Th s portfo o y e ds an expected annua return of 8 percent and an annua standard
dev at on of 2 3 percent

728  Chapter 75  S mu at ng stock pr ces and asset a ocat on mode ng


Suppose you be eve that the next 5 years w , on average, produce returns for stocks that are 5
percent worse than they’ve been for the past 30 years It s easy to ncorporate these expectat ons
nto the s mu at on (See Prob em 4 at the end of the chapter )

Problems
Prob ems 1–3 use data n the Ges m x sx fi e

1. Assume that the current pr ce of M crosoft stock s $28 per share What s the probab ty that
n two years the pr ce of M crosoft stock w be at east $35?

2. So ve Prob em 1 aga n, th s t me w th the assumpt on that dur ng the next two years,
M crosoft w on average perform 6 percent better per year than t performed dur ng the
1997–2002 per od for wh ch you have data

3. Assume that the current pr ce of Inte s $20 per share What s the probab ty that dur ng the
next three years, you w earn at east a 30 percent return (for the three-year per od) on a pur-
chase of Inte stock?

Prob ems 4 through 7 use data n the Asseta s m x sx fi e

4. Suppose you be eve that over the next five years, stocks w produce returns that are 5 per-
cent worse per year, on average, than the 1973–2009 data F nd an asset a ocat on among
stocks, T-b s, and bonds that y e ds an expected annua return of at east 6 percent yet m n -
m zes r sk

5. Suppose you be eve that t s two t mes more ke y that nvestment returns for each of the
next five years w be more ke the per od from 1992 to 2001 than the per od from 1972 to
1991 For examp e, the chance that next year w be ke 1993 has tw ce the probab ty that
next year w be ke 1980 Th s be ef causes your bootstrapp ng ana ys s to g ve more we ght
to the recent past How wou d you factor th s be ef nto your portfo o opt m zat on mode ?

6. Many mutua funds and nvestors hedge the r sk that stocks w go down by purchas ng put
opt ons (See Chapter 78, “Pr c ng stock opt ons,” for more d scuss on of put opt ons ) How
cou d an asset a ocat on mode be used to determ ne an opt ma hedg ng strategy that uses
puts?

7. Determ ne the corre at ons (based on the 1973–2009 data) among annua returns on stocks,
T-b s, and bonds Then determ ne the corre at on (based on the one thousand scenar os cre-
ated by bootstrapp ng) among the fina va ues for stocks, T-b s, and assets Does t appear
that the bootstrapp ng approach p cks up the nterdependence among the returns on stocks,
T-b s, and bonds?

S mu at ng stock pr ces and asset a ocat on mode ng  Chapter 75   729
CHAP TER 76

Fun and games: simulating


gambling and sporting event
probabilities

Questions answered in this chapter:


■ What s the probab ty of w nn ng at craps?

■ In five-card draw poker, what s the probab ty of gett ng three of a k nd?

■ Go ng nto the NCAA basketba F na Four, what s the probab ty of each team w nn ng the
tournament?

Gamb ng and fo ow ng sport ng events are popu ar past mes I th nk gamb ng and sports are exc t-
ng because you never know what’s go ng to happen Monte Car o s mu at on s a powerfu too that
you can use to approx mate gamb ng and sport ng event probab t es Essent a y, you est mate
probab ty by p ay ng out a gamb ng or sport ng event s tuat on mu t p e t mes If, for examp e, you
have M crosoft Exce p ay out the game of craps 10,000 t mes and you w n 4,900 t mes, you wou d
est mate the probab ty of w nn ng at craps to equa 4,900/10,000, or 49 percent If you p ay out the
2003 NCAA men’s F na Four 1,000 t mes and Syracuse w ns 300 of the terat ons, you wou d est mate
Syracuse’s probab ty of w nn ng the champ onsh p as 300/1,000, or 30 percent

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

What is the probability of winning at craps?

In the game of craps, a p ayer ro s two d ce If the comb nat on s 2, 3, or 12, the p ayer oses If the
comb nat on s 7 or 11, the p ayer w ns If the comb nat on s a d fferent number, the p ayer cont nues
ro ng the d ce unt he e ther matches the number thrown on the first ro (ca ed the point) or ro s
7 If the p ayer ro s the po nt before ro ng 7, the p ayer w ns If the p ayer ro s 7 before ro ng the
po nt, the p ayer oses By comp ex ca cu at ons, you can show that the probab ty of a p ayer w n-
n ng at craps s 0 493 You can use Exce to s mu ate the game of craps many t mes (two thousand was
chosen for th s examp e) to approx mate th s probab ty

731

In th s examp e, t s cruc a to keep n m nd that you don’t know how many ro s the game w
take Th s examp e shows that the chance of a game requ r ng more than 50 ro s of the d ce s h gh y
un ke y, so you’ p ay out 50 ro s of the d ce After each ro , the game status s tracked as fo ows

■ 0 equa s the game s ost

■ 1 equa s the game s won

■ 2 equa s the game cont nues

The output ce keeps track of the status of the game after the fift eth ro by record ng 1 to
nd cate a w n and 0 to nd cate a oss You can rev ew the work done n the Craps x sx fi e, shown n
F gure 76-1

FIGURE 76-1  S mu at ng a game of craps.

In ce B2, use the RANDBETWEEN funct on to generate the number on the first d e on the first
ro by us ng the RANDBETWEEN(1,6) formu a The RANDBETWEEN funct on ensures that each of ts
arguments s equa y ke y, so each d e has an equa (1/6) chance of y e d ng 1, 2, 3, 4, 5, or 6 Copy ng
th s formu a to the B2 AY3 range generates 50 ro s of the d ce (In F gure 76-1, ro s 8 through 48 were
h dden )

In the B4 AY4 ce range, compute the tota d ce comb nat on for each of the 50 ro s by copy ng
the SUM(B2 B3) formu a from B4 to C4 AY4 In ce B5, determ ne the game status after the first ro
w th the IF(OR(B4=2,B4=3,B4=12),0,IF(OR(B4=7,B4=11),1,2)) formu a Remember that a ro of 2, 3, or
12 resu ts n a oss (enter ng 0 n the ce ); a ro of 7 or 11 resu ts n a w n (1); and any other ro resu ts
n the game cont nu ng (2)

In ce C5, compute the status of the game after the second ro w th the IF(OR(B5=0,B5=1),B5,
IF(C4=$B4,1,IF(C4=7,0,2))) formu a If the game ends on the first ro , ma nta n the status of the game
If a ro makes your po nt, record a w n w th 1 If a ro s a 7, record a oss Otherw se, the game con-
t nues A do ar s gn was added n the reference to co umn B ($B4) n th s formu a to ensure that each
ro tr es to match the po nt thrown on the first ro Copy ng th s formu a from C5 to D5 AY5 records
the game status after ro s 2 through 50

The game resu t s n ce AY5, wh ch s cop ed to C6 so that you can eas y see t Use a one-way
data tab e to p ay out the game of craps two thousand t mes In ce E9, enter the =C6 formu a, wh ch
tracks the outcome of the game (0 f a oss or 1 f a w n) Next, se ect the (D9 E2009) tab e range, c ck
What-If Analysis n the Data Tools group on the Data tab, and then c ck Data Table Here, a one-
way tab e was chosen w th any b ank ce as the co umn nput ce After you press F9, Exce s mu ates
the game of craps two thousand t mes

732  Chapter 76  Fun and games: s mu at ng gamb ng and sport ng event probab t es
In ce E8, you can compute the fract on of the s mu at ons that resu t n w ns w th the
AVERAGE(E10 E2009) formu a For the two thousand terat ons, you w n 49 25 percent of the t me If
you had run more tr a s (for examp e, 10,000 terat ons), you wou d have come c oser to the true prob-
ab ty of w nn ng at craps (49 3%) For nformat on about us ng a one-way data tab e, see Chapter 16,
“Sens t v ty ana ys s w th data tab es ”

In five-card draw poker, what is the probability of getting three of a kind?

An ord nary deck of cards conta ns four cards of each type—four aces, four deuces, and so on up to
four k ngs To est mate the probab ty of gett ng a part cu ar poker hand, you can ass gn the va ue
of 1 to an ace, 2 to a deuce, and on up through the deck so that a jack s ass gned the va ue of 11, a
queen s ass gned 12, and a k ng s ass gned 13

In five-card draw poker, you are dea t five cards Many probab t es are of nterest but use s mu a-
t on to est mate the probab ty of gett ng three of a k nd, wh ch requ res you to have three of one
type of card and no pa rs (If you have a pa r and three of a k nd, the hand s a fu house ) To s mu ate
the five cards drawn, you proceed as fo ows (See the Poker x sx fi e, shown n F gure 76-2 )

■ Assoc ate a random number w th each card n the deck

■ The five cards chosen w be the five cards assoc ated w th the five sma est random numbers,
wh ch g ves each card an equa chance of be ng chosen

■ Count how many of each card (ace through k ng) are drawn

FIGURE 76-2  Est mat ng the probab ty that you draw three of a k nd n a poker game.

To beg n, st a the cards n the deck n ce s D3 D54 four 1s, four 2s, and so on up to four 13s
Copy the RAND funct on from ce E3 to E4 E54 to assoc ate a random number w th each card n the

Chapter 76  Fun and games: s mu at ng gamb ng and sport ng event probab t es   733
deck Copy ng the RANK EQ(E3,$E$3 $E$54,1) formu a from C3 to C4 C54 g ves the rank (ordered from
sma est to argest) of each random number For examp e, n F gure 76-2, you can see that the fourth
3 n the deck (row 14) s assoc ated w th the 23rd sma est random number (You w see d fferent
resu ts n the worksheet because the random numbers are automat ca y reca cu ated when you open
the worksheet )

The syntax of the RANK.EQ funct on s RANK EQ(number,array,1 or 0) If the ast argument of the
RANK.EQ funct on s 1, the funct on returns the rank of the number n the array, w th the sma est
number rece v ng a rank of 1, the second sma est number a rank of 2, and so on If the ast argument
of the RANK.EQ funct on s 0, the funct on returns the rank of the number n the array, w th the arg-
est number rece v ng a rank of 1, the second argest number rece v ng a rank of 2, and so on

In rank ng random numbers, no t es can occur (because the random numbers wou d have to match
16 d g ts)

Suppose, for examp e, that you are rank ng the numbers 1, 3, 3, and 4 and that the ast argument
of the RANK.EQ funct on was 1 Exce wou d return the fo ow ng ranks

Number Rank (smallest number has rank of 1)


1 1
3 2
3 2
4 4

Because 3 s the second sma est number, 3 wou d be ass gned a rank of 2 The other 3 wou d a so
be ass gned a rank of 2 Because 4 s the fourth sma est number, t wou d be ass gned a rank of 4
Understand ng the treatment of t es by the RANK.EQ funct on w he p you comp ete Prob em 1 at
the end of the chapter

By copy ng the VLOOKUP(A3, ookup,2,FALSE) formu a from ce B3 to B4 B7, you can draw five
cards from the deck Th s formu a draws the five cards correspond ng to the five sma est random
numbers (The ookup tab e range C3 D54 has been named ookup ) FALSE was used n the VLOOKUP
funct on because the ranks need not be n ascend ng order

Hav ng ass gned the range name Drawn to the drawn cards (the B3 B7 range), copy ng the
COUNTIF(drawn,I3) formu a from J3 to J4 J15 counts how many of each card are n the hand drawn In
ce J17, determ ne whether the hand nc udes three of a k nd w th the IF(AND(MAX(J3 J15)=3,COUNT
IF(J3 J15,2)=0),1,0) formu a Th s formu a returns a 1 f and on y f the hand has three of one k nd and
no pa rs

Now, use a one-way data tab e to s mu ate four thousand poker hands In ce J19, recopy the
resu ts of ce J17 w th the J17 formu a Se ect the tab e range (I19 J4019) After c ck ng What-If
Analysis n the Data Tools group on the Data tab and then c ck ng Data Table, you set up a one-
way data tab e by se ect ng any b ank ce as the co umn nput ce After you c ck OK, Exce s mu ates
four thousand poker hands In ce G21, record the est mated probab ty of three of a k nd w th the

734  Chapter 76  Fun and games: s mu at ng gamb ng and sport ng event probab t es
AVERAGE(J20 J4019) formu a Est mate the chance of three of a k nd at 1 9 percent (Us ng bas c prob-
ab ty theory, you can show that the true probab ty of draw ng three of a k nd s 2 1 percent )

Going into the 2003 NCAA men’s basketball Final Four, what was the probability of each team
winning the tournament?

You can rate co ege basketba teams by us ng the methodo ogy descr bed n Chapter 34, “Us ng
So ver to rate sports teams,” but t s d fficu t to get the scores of a past games The h gh y respected
Sagar n rat ngs (ava ab e at sagar n com) a ways g ves up-to-date rat ngs for a co ege basketba
teams On the eve of the 2003 men’s F na Four, the Sagar n rat ngs of the four teams were Syracuse
( ed by Carme o Anthony), 91 03; Kansas, 92 76; Marquette ( ed by Dwayne Wade), 89 01; and Texas,
90 66 G ven th s nformat on, you can p ay out the F na Four severa thousand t mes to est mate the
chance that each team w w n

The mean pred ct on for the number of po nts by wh ch the home team w ns s favorite
­rating ­– ­underdog rating In the F na Four, there s no home team, but f there was one, you wou d add
five po nts to the home team’s rat ng (In profess ona basketba , the home edge s four po nts, and
n co ege and profess ona footba , the home edge s three po nts ) Then you can use the NORM.INV
funct on to s mu ate the outcome of each game (See Chapter 69, “The Norma random var ab e,” for a
d scuss on about us ng the NORM.INV funct on to s mu ate a norma random var ab e )

The ke y outcome of the 2003 F na Four was ca cu ated n the F na 4s m x sx fi e, shown n


F gure 76-3 The sem fina s p tted Kansas aga nst Marquette and Syracuse aga nst Texas

FIGURE 76-3  S mu at ng the outcome of the NCAA 2003 F na Four.

To beg n, enter each team’s name and rat ng n the C4 D5 and C8 D9 ce ranges In ce F4, use
the RAND funct on to enter a random number for the Marquette–Kansas game and, n ce F8, enter

Chapter 76  Fun and games: s mu at ng gamb ng and sport ng event probab t es   735
a random number for the Syracuse–Texas game The s mu ated outcome s a ways re at ve to the top
team sted

In ce E4, determ ne the outcome of the Kansas–Marquette game (from the standpo nt of Kansas)
w th the NORM INV(F4,D4–D5,10) formu a Note that Kansas s favored by D4–D5 po nts In ce
E8, determ ne the outcome of the Texas–Syracuse game (from the standpo nt of Syracuse) w th the
NORM INV(F8,D8–D9,10) formu a (The standard dev at on for the d fference between the actua w n-
n ng marg n and po nt spread of a co ege basketba game s 10 po nts )

In ce s G5 and G6, ensure that the w nner of each sem fina game moves on to the fina s A
sem fina outcome of greater than 0 causes the top sted team to w n; otherw se, the bottom sted
team w ns Thus, n ce G5, you enter the w nner of the first game by us ng the IF(E4>0,”KU”,“MARQ”)
formu a In ce G6, enter the w nner of the second game by us ng the IF(E8>0,”SYR”,”TEX”) formu a

In ce H5, enter a random number to s mu ate the outcome of the champ onsh p game Copy ng
the VLOOKUP(G5,$C$4 $D$9,2,FALSE) formu a from I5 to I6 obta ns the rat ng for each team n the
champ onsh p game Next, n ce J5, compute the outcome of the champ onsh p game (from the
reference po nt of the top sted team n ce G5) w th the NORM INV(H5,I5–I6,10) formu a F na y, n
ce K5, determ ne the actua champ on w th the IF(J5>0,G5,G6) formu a

Now you can use a one-way data tab e n the usua fash on to p ay out the F na Four two thou-
sand t mes The s mu ated w nners are n the M12 M2011 ce range Copy ng the COUNTIF($M$12
$M$2011,J12)/2000 formu a from K12 to K13 K15 computes the pred cted probab ty of each team
w nn ng 37 percent for Kansas, 27 percent for Syracuse, 22 percent for Texas, and 14 percent for
Marquette These probab t es can be trans ated to odds by us ng the fo ow ng formu a

prob team loses


Odds against team winning =
prob team wins

For examp e, the odds aga nst Kansas are 1 63 to 1

(1 – 0 37)/0 37 = 1 63

Th s means that f you p aced $1 on Kansas to w n and a bookmaker pa d you $1 63 for a Kansas
champ onsh p, the bet s fa r Of course, the book e w ower these odds s ght y to ensure that he
makes money (See Prob em 6 at the end of th s chapter for a re ated exerc se )

Th s methodo ogy can eas y be extended to s mu ate the ent re NCAA tournament Just use IF
statements to ensure that each w nner advances and use VLOOKUP funct ons to find each team’s
rat ng See the Ncaa2003 x sx fi e for a s mu at on of the 2003 tournament The ana ys s gave Syracuse
(the eventua w nner) a 4 percent chance to w n at the start of the tournament

In th s worksheet comments were used to exp a n the work, wh ch you can see n F gure 76-4 Here
s some background about us ng comments

■ To nsert a comment n a ce , first se ect the ce On the Review tab, n the Comments group,
c ck New Comment and then type your comment text You see a sma red mark n the
upper-r ght corner of any ce conta n ng a comment

736  Chapter 76  Fun and games: s mu at ng gamb ng and sport ng event probab t es
■ To ed t a comment, r ght-c ck the ce conta n ng the comment and c ck Edit Comment

■ To make a comment a ways v s b e, r ght-c ck the ce and c ck Show/Hide Comments


C ck ng Hide Comment when the comment s d sp ayed h des the comment un ess the
po nter s n the ce conta n ng the comment

■ If you want to pr nt your comments, c ck the Page Setup d a og box auncher (the sma
arrow n the bottom-r ght corner of the group) on the Page Layout tab to open the Page
Setup d a og box In the Comments box on the Sheet tab, you can nd cate whether you
want comments pr nted as d sp ayed on the sheet or at the end of the sheet

FIGURE 76-4  Comments n a worksheet.

Problems
1. Suppose 30 peop e are n a room What s the probab ty that at east two of them have the
same b rthday?

2. What s the probab ty of be ng dea t one pa r n five-card draw poker?

3. What s the probab ty of be ng dea t two pa rs n five-card draw poker?

4. In the game of Keno, 80 ba s (numbered 1 through 80) are m xed up, and then 20 ba s are
random y drawn Before the 20 ba s are drawn, a p ayer chooses 10 d fferent numbers If at
east 5 of the numbers are drawn, the p ayer w ns What s the probab ty of w nn ng?

5. Go ng nto the 2003 NBA fina s, the rat ng system descr bed n Chapter 34 rated the San
Anton o Spurs three po nts h gher than the New Jersey Nets Teams p ay unt one team w ns
four games The first two games were at San Anton o, the next three at New Jersey, and the
fina two games were schedu ed for San Anton o What s the probab ty that San Anton o w
w n the ser es?

6. What odds shou d the bookmaker g ve on Kansas w nn ng the F na Four f the bookmaker
wants to earn an average of 10 cents per do ar bet?

Chapter 76  Fun and games: s mu at ng gamb ng and sport ng event probab t es   737
7. What s the probab ty of be ng dea t a flush n five-card draw poker?

8. If you break a 1- nch st ck n two p aces that are random y chosen, you have three sma er
st cks What are the chances that the three st cks form a tr ang e?

9. Suppose each h tter on a baseba team has a 50 percent chance of h tt ng a home run and
a 50 percent chance of str k ng out On average, how many runs w th s team score n an
nn ng?

738  Chapter 76  Fun and games: s mu at ng gamb ng and sport ng event probab t es
CHAPTER 77

Using resampling to analyze data

Question answered in this chapter:


■ I produced n ne batches of a product by us ng a h gh temperature and seven batches by
us ng a ow temperature What s the probab ty that the product y e d s better at the h gh
temperature?

Data ana ysts often need to address quest ons such as these

■ What s the probab ty that a new teach ng techn que mproves student earn ng?

■ What s the probab ty that asp r n reduces the nc dence of heart attacks?

■ What s the probab ty that Mach ne 1 s the most product ve of our three mach nes?

You can use a s mp e yet powerfu techn que known as resampling to make nferences from data
To make stat st ca nferences by us ng resamp ng, you regenerate data many t mes by samp ng
w th rep acement from your data Samp ng w th rep acement from data means that the same data
po nt can be chosen more than once You then make nferences based on the resu ts of th s repeated
samp ng A key too n mp ement ng resamp ng s the RANDBETWEEN funct on Enter ng the
RANDBETWEEN(a,b) funct on y e ds w th equa probab ty any nteger between a and b ( nc us ve)
For examp e, RANDBETWEEN(1,9) s equa y ke y to y e d one of the numbers 1 through 9, nc us ve

Answer to this chapter’s question


Th s sect on prov des the answer to the quest on that s sted at the beg nn ng of the chapter

I produced nine batches of a product by using a high temperature and seven batches by
using a low temperature. What is the probability that the product yield is better at the high
temperature?

The Resamp ey e d x sx fi e, shown n F gure 77-1, conta ns the product y e d from n ne batches of a
product manufactured at a h gh temperature and seven batches manufactured at a ow temperature

The mean y e d at a h gh temperature s 39 74, and the mean y e d at a ow temperature s 32 27


Th s d fference does not prove, however, that mean y e d at a h gh temperature s better than mean
y e d at a ow temperature You want to know, based on your samp e data, the probab ty that y e d
at a h gh temperature s better than at a ow temperature To answer th s quest on, you can random y
generate n ne ntegers between 1 and 9, wh ch creates a resamp ng of the h gh-temperature y e ds

739

For examp e, f you generate the random number 4, the resamp ed data for h gh-temperature y e ds
w nc ude a y e d of 41 40; f you generate the random number 2, the resamp ed data w generate a
y e d of 39 93, and so on Next, you random y generate seven ntegers between 1 and 7, wh ch creates
a resamp ng of the ow-temperature y e ds You can then check the resamp ed data to see whether
the h gh-temperature mean s arger than the ow-temperature mean and then use a data tab e to
repeat th s process severa hundred t mes (The process was repeated 400 t mes n th s examp e )
In the resamp ed data, the fract on of the t me that the h gh-temperature mean s arger than the
ow-temperature mean est mates the probab ty that the h gh-temperature process s super or to the
ow-temperature process

FIGURE 77-1  Product y e ds at h gh and ow temperature.

To beg n, you generate a resamp ng of the h gh-temperature data by copy ng the


RANDBETWEEN(1,9) formu a from ce C16 to C17 C24, as shown n F gure 77-2 A g ven observa-
t on can be chosen more than once or not chosen at a Copy ng the VLOOKUP(C16, ookup,2)
formu a from ce D16 to D17 D24—the range C4 E13 has been named ookup—generates the
y e ds correspond ng to the random resamp ng of the data Next, generate a resamp ng from
the ow-­temperature y e ds Copy ng the RANDBETWEEN(1,7) formu a from E16 to E17 E22 gen-
erates a resamp ng of seven observat ons from the or g na ow-temperature data Copy ng the
VLOOKUP(E16, ookup,3) formu a from F16 to F17 F22 generates the seven actua , resamp ed, ow-
temperature y e ds

In ce D26, compute the mean of the resamp ed h gh-temperature y e ds w th the


AVERAGE(D16 D24) formu a S m ar y, n ce F26, compute the mean of the resamp ed ow-­
temperature y e ds w th the AVERAGE(F16 F22) formu a In ce D29, determ ne whether the resam­
p ed mean for h gh temperature s arger than the resamp ed mean for ow temperature w th the
IF(D26>F26,1,0) formu a

740  Chapter 77  Us ng resamp ng to ana yze data


FIGURE 77-2  mp ementat on of resamp ng.

To rep ay the resamp ng 400 t mes, you can use a one-way data tab e Iterat on numbers 1
through 400 were put n the C32 431 ce range (See Chapter 73, “Introduct on to Monte Car o s mu-
at on,” for an exp anat on of how to use the F Ser es command to create a st of terat on va ues
eas y ) By typ ng =D29 n ce D31, create the formu a that records whether h gh-temperature mean
s arger than ow-temperature mean n the output ce for the data tab e After se ect ng the tab e
range (C31 D431) and then se ect ng Data Table from the What-If Analysis menu n the Data Tools
group on the Data tab, choose any b ank ce n the worksheet as the co umn nput ce You have
now tr cked M crosoft Exce nto p ay ng out the resamp ng 400 t mes Each terat on w th a va ue of
1 nd cates a resamp ng n wh ch h gh temperature has the arger mean Each terat on w th a va ue of
0 nd cates a resamp ng for wh ch ow temperature has a arger mean In ce F31, determ ne the frac-
t on of t me that h gh-temperature y e d has a arger mean by us ng the AVERAGE(D32 D431) formu a
In F gure 77-2, the resamp ng nd cates a 91 percent chance that h gh temperature has a arger mean
than ow temperature Of course, press ng F9 w generate a d fferent set of 400 resamp ngs and g ve
you a s ght y d fferent est mate of the probab ty that h gh-temperature y e d s super or to ow-
temperature y e d

Chapter 77  Us ng resamp ng to ana yze data   741


Problems
1. You are test ng a new flu drug Out of 24 flu v ct ms who were g ven the drug, 20 fe t better
and 4 fe t worse Out of 9 flu v ct ms who were g ven a p acebo, 6 fe t better and 3 fe t worse
What s the probab ty that the drug s more effect ve than the p acebo?

2. A ta k on the dangers of h gh cho estero was g ven to e ght workers Each worker’s cho estero
was tested both before and after the ta k, w th the fo ow ng resu ts What s the probab ty
that the ta k caused the workers to undertake festy e changes that reduced the r cho estero ?

Cholesterol before Cholesterol after


220 210
195 198
250 210
200 199
220 224
260 212
175 179
198 184

3. The beta of a stock s s mp y the s ope of the best-fitt ng ne used to pred ct the month y
return on the stock from the month y return g ven n the Standard & Poor’s (S&P) 500 ndex
A beta that s arger than 1 nd cates that a stock s more cyc ca than the market, whereas a
beta of ess than 1 nd cates that a stock s ess cyc ca than the market The Betaresamp ng
x sx fi e conta ns more than 12 years of month y returns on M crosoft (MSFT), Pfizer (PFE),
other stocks, and the S&P ndex Use th s data to determ ne the probab ty that M crosoft has
a ower beta than Pfizer You w need to use the Exce SLOPE funct on to est mate the beta
for each terat on of resamp ng

4. The Lawdata x sx fi e g ves the LSAT scores and aw schoo GPA for 15 aw schoo students
Based on th s data, you are 95 percent sure the corre at on between LSAT score and GPA s
between wh ch two va ues?

742  Chapter 77  Us ng resamp ng to ana yze data


CHAPTER 78

Pricing stock options

Questions answered in this chapter:


■ What are ca and put opt ons?

■ What s the d fference between an Amer can and a European opt on?

■ As a funct on of the stock pr ce on the exerc se date, what do the payoffs ook ke for
European ca s and puts?

■ What parameters determ ne the va ue of an opt on?

■ How can I est mate the vo at ty of a stock based on h stor ca data?

■ How can I use Exce to mp ement the B ack–Scho es formu a?

■ How do changes n key parameters change the va ue of a ca or put opt on?

■ How can I use the B ack–Scho es formu a to est mate a stock’s vo at ty?

■ I don’t want somebody chang ng my neat opt on-pr c ng formu as How can I protect the
formu as n my worksheet so that nobody can change them?

■ How can I use opt on pr c ng to he p my company make better nvestment dec s ons?

Dur ng the ear y 1970s, econom sts F scher B ack, Myron Scho es, and Robert Merton der ved the
B ack–Scho es opt on-pr c ng formu a, wh ch enab es you to der ve a va ue for a European ca or put
opt on Scho es and Merton were awarded the 1997 Nobe Pr ze n Econom cs for the r efforts (B ack
d ed before 1997, and Nobe pr zes are not awarded posthumous y ) The work of these econom sts
revo ut on zed corporate finance Th s chapter ntroduces you to the r mportant work

Note  For an excellent technical discussion of options, see David G. Luenberger’s book,
Investment Science, 2nd ed. (Oxford University Press, 2013).

743

Answers to this chapter’s questions
Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

What are call and put options?

A call option g ves the owner of the opt on the r ght to buy a share of stock for the exercise price A
put option g ves the owner of the opt on the r ght to se a share of stock for the exerc se pr ce

What is the difference between an American and a European option?

An American option can be exerc sed on or before a date known as the exercise date (often referred to
as the expiration date) A European option can be exerc sed on y on the exerc se date

As a function of the stock price on the exercise date, what do the payoffs look like for
European calls and puts?

Let’s ook at cash flows from a s x-month European ca opt on on shares of IBM w th an exerc se
pr ce of $110 Let P equa the pr ce of IBM stock n s x months The payoff from a ca opt on on these
shares s $0 f P ≤ 110 and P – 110 f P > 110 W th a va ue of P be ow $110, you wou d not exerc se
the opt on If P s greater than $110, you wou d exerc se the opt on to buy stock for $110 and mme-
d ate y se the stock for P, thereby earn ng a profit of P – 110 F gure 78-1 shows the payoff from th s
ca opt on In short, a ca opt on pays $1 for every do ar by wh ch the stock pr ce exceeds the exer-
c se pr ce The payoff for th s ca opt on can be wr tten as Max(0,P – 110) Not ce that the ca opt on
graph n F gure 78-1 (see the Ca worksheet n the Opt onfigures x sx fi e) has a s ope 0 for a va ue of
P sma er than the exerc se pr ce Its s ope s 1 for a va ue of P greater than the exerc se pr ce

FIGURE 78-1  Cash flows from a ca opt on.

You can show that f a stock pays no d v dends, t s never opt ma to exerc se an Amer can ca
opt on ear y Therefore, for stock that does not pay a d v dend, an Amer can and a European ca
opt on both have the same va ue

744  Chapter 78  Pr c ng stock opt ons


Now ook at cash flows from a s x-month European put opt on on shares of IBM w th an exerc se
pr ce of $110 Let P equa the pr ce of IBM n s x months The payoff from the put opt on s $0 f P ≥
110 and P – 110 f P < 110 For a va ue of P be ow $110, you wou d buy a share of stock for P and
mmed ate y se the stock for $110 Th s y e ds a profit of 110 – P If P s arger than $110, t wou d not
be profitab e to buy the stock for P and se t for $110, so you wou d not exerc se the opt on to se
the stock for $110

F gure 78-2 d sp ays the payoff from th s put opt on (see the Put worksheet n the Opt onfigures
x sx fi e) In short, a put opt on pays $1 for each do ar by wh ch the stock pr ce s be ow the exerc se
pr ce A put payoff can be wr tten as Max(0,110 – P) Note that the s ope of the put payoff s –1 for a
va ue of P ess than the exerc se pr ce, and the s ope of the put payoff s 0 for a va ue of P greater than
the exerc se pr ce

FIGURE 78-2  Cash flows from a put opt on.

An Amer can put opt on can be exerc sed ear y, so the cash flows from an Amer can put opt on
cannot be determ ned w thout know edge of the stock pr ce at t mes before the exp rat on date

What parameters determine the value of an option?

In the r der vat on of the B ack–Scho es opt on-pr c ng mode , B ack, Scho es, and Merton showed that
the va ue of a ca or put opt on depends on the fo ow ng parameters

■ Current stock pr ce

■ The opt on’s exerc se pr ce

■ T me ( n years) unt the opt on exp res (referred to as the opt on’s duration)

■ Interest rate (per year on a compounded bas s) on a r sk-free nvestment (usua y T-b s)
throughout the durat on of the nvestment Th s rate s ca ed the risk-free rate For examp e,
f three-month T-b s are pay ng 5 percent, the r sk-free rate s computed as n(1 + 0 05)
(Ca cu at ng the ogar thm transforms a s mp e nterest rate nto a compounded rate )

Chapter 78  Pr c ng stock opt ons   745


Compound nterest s mp y means that at every nstant, you are earn ng nterest on your
nterest

■ Annua rate (as a percentage of the stock pr ce) at wh ch d v dends are pa d If a stock pays 2
percent of ts va ue each year n d v dends, the d v dend rate s 0 02

■ Stock volatility (measured on an annua bas s) An annua vo at ty of, for examp e, 30 per-
cent means that (approx mate y) the standard dev at on of the annua percentage changes
n the stock’s pr ce s expected to be around 30 percent Dur ng the Internet bubb e of the
ate 1990s, the vo at ty of many Internet stocks exceeded 100 percent You can est mate th s
mportant parameter n two ways

The B ack–Scho es pr c ng formu a requ res the pr ce of the stock to fo ow a ognorma random
var ab e See Chapter 72, “Us ng the ognorma random var ab e to mode stock pr ces,” for further
d scuss on of the ognorma random var ab e

How can I estimate the volatility of a stock based on historical data?

To est mate the vo at ty of a stock based on data about the stock’s month y returns, you can proceed
as fo ows

■ Determ ne the month y return on the stock for a per od of severa years

■ Determ ne for each month n(1 + month y return)

■ Determ ne the standard dev at on of n(1 + month y return) Th s ca cu at on g ves you the
month y vo at ty

■ Mu t p y the month y vo at ty by 12 to convert month y vo at ty to an annua vo at ty

Th s procedure s ustrated n the De vo x sx fi e, wh ch est mates the annua vo at ty of De


stock, us ng month y pr ces n the per od from August 1988 through May 2001 (See F gure 78-3, n
wh ch severa rows of data are h dden )

FIGURE 78-3  Comput ng the h stor ca vo at ty for De .

746  Chapter 78  Pr c ng stock opt ons


Copy ng the (B2–B3)/B3 formu a from ce C2 to C3 C154 computes each month’s return on De
stock Then copy ng the 1+C2 formu a from D2 to D3 D154 computes for each month 1 + month’s
return Next, compute n(1 + month’s return) for each month by copy ng the LN(D2) formu a from E2
to E3 E154 and compute the month y vo at ty n ce H3 w th the STDEV S(E2 E154) formu a F na y,
compute an est mate of De ’s annua vo at ty w th the SQRT(12)*H3 formu a De ’s annua vo at ty s
est mated to be 57 8 percent

How can I use Excel to implement the Black–Scholes formula?

To app y the B ack–Scho es formu a n M crosoft Exce , you need nput va ues for the fo ow ng
parameters

■ S = Today’s stock pr ce

■ t = Durat on of the opt on ( n years)

■ X = Exerc se pr ce

■ r = Annua r sk-free rate (Th s rate s assumed to be cont nuous y compounded )

■ σ = Annua vo at ty of stock

■ y = Percentage of stock va ue pa d annua y n d v dends

G ven these nput va ues, the B ack–Scho es pr ce for a European ca opt on can be computed as
fo ows

Define

S σ2
Ln( )+(r – y + )t
X 2
d1 =
σ t

and
d2 = d1 σ t

Then the ca pr ce C s g ven by

C = Se –ytN(d1 ) – Xe –rtN(d2 )

Here, N(x) s the probab ty that a norma random var ab e w th a mean of 0 and a σ equa to
1 s ess than or equa to x For examp e, N(–1) = 16, N(0) = 5, N(1) = 84, and N(1 96) = 975 A
norma random var ab e w th a mean of 0 and a standard dev at on of 1 s ca ed a standard normal
The cumu at ve norma probab ty can be computed n Exce 2013 w th the NORM.S.DIST funct on
Enter ng NORM S DIST(x,True or 1) returns the probab ty that a standard norma random var ab e
s ess than or equa to x For examp e, enter ng the NORM S DIST(–1,True) formu a n a ce w y e d
0 16, wh ch nd cates that a norma random var ab e w th a mean of 0 and a standard dev at on of 1
has a 16 percent chance of assum ng a va ue ess than –1

Chapter 78  Pr c ng stock opt ons   747


The pr ce of a European put P can be wr tten as

P = Se –yt (N(d1 ) – 1) – Xe –rt (N(d2 ) – 1)

In the Bstemp x sx fi e (see F gure 78-4) s a temp ate that computes the va ue for a European ca
or put opt on Enter the parameter va ues n B5 B10 and read the va ue of a European ca n D13 and
a European put n D14

FIGURE 78-4  Va u ng European ca s and puts.

Note Valuing American options is beyond the scope of this book. Interested readers
should refer to Luenberger’s excellent textbook.

As an examp e, suppose that C sco stock se s for $20 today and that you’ve been ssued a seven-
year European ca opt on Assume that the annua vo at ty of C sco stock s 50 percent, and the r sk-
free rate dur ng the seven-year per od s est mated at 5 percent per year Compounded, th s trans ates
to n(1 + 05) = 04879 C sco does not pay d v dends, so the annua d v dend rate s 0 The va ue of
the ca opt on s ca cu ated to be $10 64 A seven-year put opt on w th an exerc se pr ce of $24 wou d
be worth $7 69

How do changes in key parameters change the value of a call or put option?

■ In genera , the effect of chang ng an nput parameter on the va ue of a ca or put s g ven n


the fo ow ng tab e

Parameter European call European put American call American put


Stock pr ce + +
Exerc se pr ce + +
T me to exp rat on ? ? + +

748  Chapter 78  Pr c ng stock opt ons


Vo at ty + + + +
R sk free rate + +
D v dends + +

An ncrease n today’s stock pr ce a ways ncreases the va ue of a ca and decreases the va ue


of a put

■ An ncrease n the exerc se pr ce a ways ncreases the va ue of a put and decreases the va ue of
a ca

■ An ncrease n the durat on of an opt on a ways ncreases the va ue of an Amer can opt on
In the presence of d v dends, an ncrease n the durat on of an opt on can e ther ncrease or
decrease the va ue of a European opt on

■ An ncrease n vo at ty a ways ncreases opt on va ue

■ An ncrease n the r sk-free rate ncreases the va ue of a ca because h gher rates tend to
ncrease the growth rate of the stock pr ce (wh ch s good for the ca ) Th s s tuat on more
than cance s out the fact that the opt on payoff s worth ess as a resu t of the h gher nterest
rate An ncrease n the r sk-free rate a ways decreases the va ue of a put because the h gher
growth rate of the stock tends to hurt the put, as does the fact that future payoffs from the
put are worth ess Aga n, th s assumes that nterest rates do not affect current stock pr ces,
but they do

■ D v dends tend to reduce the growth rate of a stock pr ce, so ncreased d v dends reduce the
va ue of a ca and ncrease the va ue of a put

By us ng one-way and two-way data tab es (see Chapter 16, “Sens t v ty ana ys s w th data tab es,”
for deta s about how to work w th data tab es), you can, f you want, exp ore the spec fic effects of
parameter changes on the va ue of ca s and puts

How can I use the Black–Scholes formula to estimate a stock’s volatility?

Ear er n th s chapter, you saw how to use h stor ca data to est mate a stock’s annua vo at ty The
prob em w th a h stor ca vo at ty est mate s that the ana ys s ooks backward What you rea y want
s an est mate of a stock’s vo at ty ook ng forward Theimplied volatility approach implied volatility
approach s mp y est mates a stock’s vo at ty as the vo at ty va ue that w make the B ack–Scho es
pr ce match the opt on’s market pr ce In short, mp ed vo at ty extracts the vo at ty va ue mp ed
by the opt on’s market pr ce

You can eas y use the Goa Seek command and the nput parameters you’ve been us ng to com-
pute an mp ed vo at ty On Ju y 22, 2003, C sco was se ng for $18 43 An October 2003 ca opt on
w th a $17 50 exerc se pr ce was se ng for $1 85 Th s opt on exp res on October 18 (89 days n the
future) Thus, the opt on has a durat on of 89/365 = 0 2438 years C sco does not expect to pay d v -
dends; assume a T-b rate of 5 percent and a correspond ng r sk-free rate of n(1 + 05) = 0 04879
To determ ne the vo at ty for C sco mp ed by th s opt on pr ce, you enter the re evant parameters n
ce s B5 B10 of the C sco mpvo x sx fi e, wh ch s shown n F gure 78-5

Chapter 78  Pr c ng stock opt ons   749


FIGURE 78-5  Us ng mp ed vo at ty to est mate C sco s vo at ty.

Next, use the Goal Seek d a og box (see F gure 78-6) to determ ne the vo at ty (the va ue n ce
B10) that makes the ca pr ce (the formu a n D13) h t a va ue of $1 85

FIGURE 78-6  Goa Seek sett ngs to find mp ed vo at ty.

Th s opt on mp es an annua vo at ty for C sco of 34 percent, as you can see n F gure 78-5

Note The www.Ivolatility.com website provides an estimate of the volatility of any stock,


either historical or implied.

I don’t want somebody changing my neat option-pricing formulas. How can I protect the
formulas in my worksheet so that nobody can change them?

Sure y, you have sent a worksheet to someone who then changed your carefu y constructed formu-
as Somet mes you want to protect a worksheet so that another user can on y enter nput data but
not mod fy the worksheet’s formu as You can see how to protect a the formu as n the B ack–Scho es
temp ate n the fo ow ng examp e (See the Bstemp x sx and Bstempprotected x sx fi es )

Beg n by un ock ng a the ce s n the worksheet and then ock the ce s you want to protect F rst,
c ck the gray box n the upper- eft corner of the worksheet, where the row and co umn head ngs
ntersect (next to the A and the 1) After you c ck th s box, any format changes you make affect the
ent re worksheet For examp e, f you se ect a bo d format after c ck ng th s box, a the ce s n the
worksheet w use the bo d format

750  Chapter 78  Pr c ng stock opt ons


After se ect ng the ent re worksheet, c ck the Font d a og box auncher (the sma arrow) on the
Home tab Th s opens the Format Cells d a og box, shown n F gure 78-7 On the Protection tab,
c ear the Locked check box, as shown n F gure 78-7, and then c ck OK Now a ce s n the worksheet
are un ocked, wh ch means that even f the worksheet s protected, you can st access these ce s

FIGURE 78-7  Format Ce s d a og box.

Next, se ect a the formu as n the worksheet To do th s, press F5, wh ch opens the Go To d a og
box C ck Special, se ect Formulas, and c ck OK C ck the Format Cells d a og box auncher aga n
and, on the Protection tab, se ect the Locked check box Se ect ng th s box ocks a the formu as

Now you can protect the worksheet, wh ch w prevent a user from chang ng your formu as C ck
Protect Sheet n the Changes group on the Review tab In the Protect Sheet d a og box, se ect the
Select Unlocked Cells check box, as shown n F gure 78-8 Th s opt on a ows users of a temp ate to
se ect un ocked ce s, but the formu as w be off- m ts

Now, when you c ck any formu a, you cannot see or change ts contents Go ahead and try to mess
up a formu a! The resu t of protect ng th s workbook s saved n the Bstempprotected x sx fi e

Chapter 78  Pr c ng stock opt ons   751


FIGURE 78-8  A ow ng users to access un ocked ce s.

How can I use option pricing to help my company make better investment decisions?

Opt on pr c ng can be used to mprove a company’s cap ta budget ng or financ a dec s on-mak ng
process The use of opt on pr c ng to eva uate actua nvestment projects s ca ed real options The
dea of rea opt ons s cred ted to Judy Lewent, the former ch ef financ a officer of Merck Essent a y,
rea opt ons et you put an exp c t va ue on manager a flex b ty, wh ch s often m ssed by trad t ona
cap ta budget ng The fo ow ng two examp es ustrate the concepts of rea opt ons

Note  Refer to Luenberger’s book for a more detailed discussion of real options.

You own an o we Today, your best guess s that the o n the we s worth $50 m on In five
years ( f you own the we ), you w make a dec s on to deve op the o we , at a cost of $70 m on
A w dcatter s w ng to buy the we today for $10 m on Shou d you se the we ?

Of course, the va ue of the o n five years m ght ncrease Even f you assume that the va ue of
the o wou d ncrease by 5 percent a year, the o wou d be worth on y $63 81 m on n five years
Trad t ona cap ta budget ng says that the we s worth ess because the cost to deve op t s more
than the va ue of the o n the we But wa t; n five years’ t me, the va ue of the o n the we w be
d fferent because many th ngs (such as the g oba o pr ce) m ght change There’s a chance that the
o w be worth at east $70 m on n five years If the o s worth $80 m on n five years, deve op-
ng the we n five years wou d return $10 m on

Essent a y, you own a five-year European ca opt on on th s we because the payoff from the we
n five years s the same as the payoff on a European ca opt on w th a stock pr ce of $50 m on, an
exerc se pr ce of $70 m on, and a durat on of five years You can assume an annua vo at ty s m ar
to the vo at ty of a typ ca o company stock (for examp e, 30 percent) If you use a T-b rate of 5
percent, correspond ng to a r sk-free rate of 4 879 percent, n the O we x sx fi e (see F gure 78-9),

752  Chapter 78  Pr c ng stock opt ons


you can determ ne that the va ue of th s ca opt on s $11 47 m on, wh ch means that you shou d not
se the we for $10 m on

Of course, you do not know the actua vo at ty for th s o we Therefore, you can use a one-
way data tab e to determ ne how the va ue of the opt on depends on a vo at ty est mate (See
F gure 78-9 ) From the data tab e, you can see that as ong as the o we ’s vo at ty s at east 27
percent, your o we opt on s worth more than $10 m on

FIGURE 78-9  O we rea opt ons.

As a second examp e, cons der a b otech drug company that s deve op ng a drug for a pharma-
ceut ca firm The b otech company current y be eves the va ue of the drug s $50 m on Of course,
the va ue of the drug m ght drop over t me To protect aga nst a pr ce drop, the b otech company
wants the drug to have a guaranteed va ue of $50 m on n five years If an nsurance company wants
to underwr te th s ab ty, what s a fa r pr ce to charge?

Essent a y, the b otech company s ask ng for a payment of $1 m on n five years for each $1 m -
on by wh ch the va ue of the drug n five years s be ow $50 m on Th s s equ va ent to a five-year
put opt on on the va ue of the drug Assum ng a T-b rate s 5 percent and the annua vo at ty on
comparab e drug stocks s 40 percent (see the Drugabandon x sx fi e, shown n F gure 78-10), the
va ue of th s opt on s $10 51 m on Th s type of opt on s often referred to as an abandonment
option, but t s equ va ent to a put opt on (F gure 78-10 d sp ays a one-way data tab e to show how
the va ue of the abandonment opt on depends on the assumed vo at ty, rang ng from 30 to 45 per-
cent of the drug’s va ue )

Chapter 78  Pr c ng stock opt ons   753


FIGURE 78-10  Ca cu at ng an abandonment opt on.

Problems
1. Use the month y stock returns n the Vo at ty x sx fi e to determ ne est mates of annua vo at -
ty for Inte , M crosoft, and GE

2. A stock s se ng today for $42 The stock has an annua vo at ty of 40 percent, and the
annua r sk-free rate s 10 percent

• What s a fa r pr ce for a s x-month European ca opt on w th an exerc se pr ce of $40?


• How much does the current stock pr ce have to ncrease for the purchaser of the ca opt on
to break even n s x months?

• What s a fa r pr ce for a s x-month European put opt on w th an exerc se pr ce of $40?


• How much does the current stock pr ce have to decrease for the purchaser of the put
opt on to break even n s x months?

• What eve of vo at ty wou d make the $40 ca opt on se for $6? (H nt Use the Goa Seek
command )

3. On September 25, 2000, JDS Un phase stock so d for $106 81 per share On the same day, a
$100 European put exp r ng on January 20, 2001, so d for $11 875 Compute an mp ed vo a-
t ty for JDS Un phase stock based on th s nformat on Use a T-b rate of 5 percent

754  Chapter 78  Pr c ng stock opt ons


4. On August 9, 2002, M crosoft stock was se ng for $48 58 per share A $35 European ca
opt on exp r ng on January 17, 2003, was se ng for $13 85 Use th s nformat on to est mate
the mp ed vo at ty for M crosoft stock Use a T-b rate of 4 percent

5. You have an opt on to buy a new p ane n three years for $25 m on Your current est mate of
the va ue of the p ane s $21 m on The annua vo at ty for the change n the p ane’s va ue s
25 percent, and the r sk-free rate s 5 percent What s the opt on to buy the p ane worth?

6. The current pr ce of copper s 95 cents per pound The annua vo at ty for copper pr ces s 20
percent, and the r sk-free rate s 5 percent In one year, you have the opt on ( f you want t) to
spend $1 25 m on to m ne 8 m on pounds of copper The copper can be so d at whatever
the copper pr ce s n one year It costs 85 cents to extract a pound of copper from the ground
What s the va ue of th s s tuat on to you?

7. You own the r ghts to a b otech drug Your best est mate s that the current va ue of these
r ghts s $50 m on Assum ng that the annua vo at ty of b otech compan es s 90 percent
and the r sk-free rate s 5 percent, what s the va ue of an opt on to se the r ghts to the drug
five years from now for $40 m on?

8. Merck s debat ng whether to nvest n a p oneer b otech project The company est mates
that the worth of the project s –$56 m on Invest ng n the p oneer project g ves Merck the
opt on to own, f t wants to, a much b gger techno ogy that w be ava ab e n four years
If Merck does not part c pate n the p oneer project, t cannot own the b gger project The
b gger project w requ re $1 5 b on n cash four years from now Current y, Merck est mates
the net present va ue (NPV) of the cash flows from the b gger project to be $597 m on
Assum ng a r sk-free rate of 10 percent and that the annua vo at ty for the b gger project
s 35 percent, what shou d Merck do? (Th s s the prob em that started the who e fie d of rea
opt ons!)

9. Deve op a worksheet that uses the fo ow ng nputs to compute annua profit

• Annua fixed cost


• Un t cost
• Un t pr ce
• Annua demand = 10,000 – 100*(pr ce)
Protect the ce s used to compute annua demand and annua profit

Chapter 78  Pr c ng stock opt ons   755


CHAPTER 79

Determining customer value

Questions answered in this chapter:


■ A cred t card company current y has an 80 percent retent on rate How w the company’s
profitab ty mprove f the retent on rate ncreases to 90 percent or h gher?

■ A ong-d stance phone company g ves the compet t on’s customers an ncent ve to sw tch
How arge an ncent ve shou d t g ve?

Many compan es underva ue the r customers When va u ng a customer, a company shou d ook at
the net present va ue (NPV) of the ong-term profits that the company earns from the customer (For
deta ed nformat on about net present va ue, see Chapter 7, “Eva uat ng nvestments by us ng net
present va ue cr ter a ”) Fa ure to ook at the ong-term va ue of a customer often causes a company
to make poor dec s ons For examp e, a company m ght cut ts customer serv ce staff by 10 percent
to save $1 m on, but the resu t ng decrease n serv ce qua ty m ght cause t to ose much more than
$1 m on n customer va ue, wh ch wou d, of course, resu t n the company be ng ess profitab e The
fo ow ng two examp es show how to compute customer va ue

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

A credit card company currently has an 80 percent retention rate. How will the company’s
profitability improve if the retention rate increases to 90 percent or higher?

Th s examp e s based on a d scuss on n Freder ck Re chhe d’s exce ent book, The Loyalty Effect
(Harvard Bus ness Schoo Press, 2001) You can find the samp e data for th s examp e n the Loya ty
x sx fi e, shown n F gure 79-1 Re chhe d est mates the profitab ty of a cred t card customer based
on the number of years the customer has he d a card For examp e, dur ng the first year a customer
has the cred t card, the cardho der generates –$40 profit, wh ch s the resu t of customer acqu s t on
costs and the cost of sett ng up the customer’s account Dur ng each success ve year, the profit gener-
ated by the customer ncreases unt a customer who has owned a card for 20 or more years gener-
ates $161 per year n profits

The cred t-card company wants to determ ne how the va ue of a customer depends on the com-
pany’s retent on rate Current y, the company has an 80 percent retent on rate, wh ch means that at
the end of each year, 20 percent (1 – 0 80) of a customers do not renew the r card (The 20 percent

757

of customers who don’t renew can be referred to as the annua churn rate ) The cred t card company
wants to determ ne the ong-term va ue of a customer for retent on rates of 80 percent, 85 percent,
90 percent, 95 percent, and 99 percent

FIGURE 79-1  Va ue of a cred t card customer.

To determ ne the ong-term va ue of a customer, you start w th a cohort of, for examp e, 100
customers (A cohort s a group of nd v dua s hav ng a stat st ca factor n common The s ze 100 s
arb trary here, but round numbers make t eas er to fo ow the ana ys s ) Then you determ ne how
many of these customers are st around each year w th the (Customers around for year t + 1) =
(Retent on rate)*(Customers around for year t) formu a You can assume that customers qu t on y
at the end of each year Then you use the NPV funct on to determ ne the tota NPV (assum ng a 15
percent d scount rate) generated by the or g na cohort of 100 customers The 15 percent d scount
rate mp es that $1 earned one year from now s worth the same as $1 00/$1 15 of profit earned now
D v d ng th s number by the number of customers n the or g na cohort (100) g ves you the va ue of
an nd v dua customer

F rst, ass gn the names n the B6 B7 ce range to the C6 C7 ce range Enter the number of or g na
customers (100) n ce C9 Copy ng the retent on rate*C9 formu a from ce C10 to the C11 C38 range
generates the number of customers present for each year For examp e, 80 customers w be present
n Year 2

Compute the profit earned each year by mu t p y ng the number of rema n ng c­ ustomers
by each customer’s profit To make th s ca cu at on, copy the C9*B9 formu a from ce D9 to
D10 D38 In ce E4, compute the average NPV generated by an nd v dua customer w th the
(­1­+­Interest­ ­rate)*NPV(Interest rate,D9 D38)/100 formu a Assume cash flows at the ­beg nn ng of the
year and a 15 percent annua d scount rate The port on of the formu a that reads NPV(­Interest­
­rate,D9 D38) computes the average NPV generated by an nd v dua customer, assum ng end-of-year

758  Chapter 79  Determ n ng customer va ue


cash flows Mu t p y ng by (1 + Interest rate) converts the end-of-year cash flow NPV to a beg nn ng-
of-year NPV

W th an 80 percent retent on rate, the average customer s worth $141 72 To determ ne how the
va ue of an nd v dua customer var es w th a change n annua retent on rate, use a one-way data
tab e Enter the re evant annua retent on rates n the F9 F13 ce range In ce G8, enter the formu a
you want the data tab e to ca cu ate (NPV per customer) w th the =E4 formu a Se ect the tab e range
(F8 G13) and then choose Data Table from the What-If Analysis command on the Data tab After
enter ng a co umn nput ce of C6, you obta n the profit ca cu at ons shown n F gure 79-1 Not ce
that ncreas ng the retent on rate from 80 percent to 90 percent near y doub es the va ue of each
customer, wh ch strong y argues for be ng n ce to these customers and aga nst p nch ng penn es on
act v t es re ated to customer serv ce Understand ng the va ue of a customer g ves most compan es a
cruc a ever that can be used to ncrease the r profitab ty

A long-distance phone company gives the competition’s customers an incentive to switch.


How large an incentive should it give?

You work for a phone company n wh ch the average ong-d stance customer spends $400 per year,
and the company generates a 10 percent profit marg n on each do ar spent At the end of each year,
50 percent of the company’s customers sw tch to the compet t on, and w thout any ncent ves, 30 per-
cent of the compet t on’s customers sw tch to your company You’re cons der ng g v ng the compet -
t on’s customers a one-t me ncent ve to sw tch compan es How arge an ncent ve can you g ve and
st break even?

The key to ana yz ng th s prob em (wh ch you can find n the Phone oya ty x sx fi e, shown n
F gure 79-2) s to ook at the NPV for two s tuat ons

■ Situation 1  100 customers beg n w th the compet t on

■ Situation 2  You pay the 100 customers who are w th the compet t on a certa n amount to
sw tch to your company

By fo ow ng through each s tuat on for a per od of t me (for examp e, 20 years), you can use the
Goa Seek command to determ ne the do ar amount x pa d to a person sw tch ng to your company
that makes you nd fferent about the fo ow ng two s tuat ons

■ Situation 1  You have just pa d 100 un oya customers $x each to sw tch to your company

■ Situation 2  The market cons sts of 100 un oya customers

Assume that the ana ys s beg ns on June 30, 2014, and that customers sw tch compan es at most
once per year Ass gn the range names n ce s A2 A6 to ce s B2 B6 The key step n the ana ys s s to
rea ze that (year t + 1 customers w th us) = 3*(year t compet tor customers) + 5*(year t our custom-
ers) S m ar y (year t + 1 customers w th compet t on) = 7*(year t compet t on customers) + 5*(year t
our customers)

Chapter 79  Determ n ng customer va ue   759


FIGURE 79-2  Phone ncent ve ana ys s.

Enter 100 n ce D9 (customers w th us) and 0 n ce E9 (customers w th the compet t on) Th s


customer a gnment corresponds to the s tuat on r ght after the ncent ve s offered to 100 customers
Assume that customers who rece ve the ncent ve must stay w th the company for at east one year
Copy ng the (1–prob eave)*D9+probcome*E9 formu a from D10 to D11 D28 generates the number
of customers dur ng each year (Years 2022 through 2029 are h dden n F gure 79-2 ) Copy ng the
prob eave*D9+(1–probcome)*E9 formu a from E10 to E11 E28 ca cu ates the number of customers
w th the compet t on dur ng each year

In ce F9, generate the profit earned dur ng the first year w th the D9*annrevenue*profitmarg n–
sw tch fee*100 formu a Note that the cost of pay ng the 100 customers w th the compet t on to
sw tch has been subtracted Copy ng the D10*annrevenue*profitmarg n formu a from F10 to F11 F28
generates profit dur ng ater years In ce D5, compute the NPV of the profits assoc ated w th the
ncent ve by us ng the XNPV(0 1,F9 F28,B9 B28) formu a (See Chapter 7 for a d scuss on of the XNPV
funct on )

In a s m ar fash on, n the G8 I28 ce range, generate the profits earned each year from 100 cus-
tomers who were or g na y w th the compet t on On June 30, 2014, 30 of these 100 customers w
have sw tched (even w thout ncent ves) In ce F2, compute the d fference between the NPV w th the
ncent ve and the NPV w thout the ncent ve

F na y, use the Goa Seek command to vary the s ze of the ncent ve (ce B2) to set F2 equa to 0
The Goa Seek d a og box s shown n F gure 79-3 An ncent ve of $34 22 makes the NPV of the two
s tuat ons dent ca Therefore, you cou d g ve ncent ves of up to $34 22 for a customer to sw tch and
st have ncreased profitab ty

760  Chapter 79  Determ n ng customer va ue


FIGURE 79-3  Goa Seek sett ngs to determ ne the max mum ncent ve that ncreases profitab ty.

Problems
1. Wh r sw m App ance s cons der ng g v ng each of ts customers free ma ntenance on each
DVD p ayer purchased The company est mates that th s proposa w requ re t to pay an aver-
age of $2 50 for each DVD p ayer so d today (the cost n today’s do ars) Current y, the market
cons sts of 72,000 consumers whose ast purchase was from Wh r sw m and 86,000 consumers
whose ast purchase was from a compet tor In a g ven year, 40 percent of a consumers pur-
chase a DVD p ayer If the r ast purchase was a Wh r sw m, there s a 60 percent chance that
the r next purchase w be a Wh r sw m If the r ast purchase was not a Wh r sw m, there s a
30 percent chance that the r next purchase w be a Wh r sw m A purchase dur ng the current
year w ead to a $20 profit The contr but on to profit (and ma ntenance cost per purchaser)
from a purchaser grows at 5 percent per year Profits (over a 30-year hor zon) are d scounted
at 10 percent per year

Suppose that you prov de free ma ntenance If the customer’s ast purchase was a Wh r sw m,
the probab ty that the customer’s next purchase w be a Wh r sw m w ncrease by an
unknown amount between 0 percent and 10 percent S m ar y, f you g ve free ma ntenance
and the customer’s ast purchase was not a Wh r sw m, the probab ty that her next purchase
s a Wh r sw m w ncrease by an unknown amount between 0 percent and 10 percent Do
you recommend that Wh r sw m adopt the free ma ntenance po cy?

2. Mr D’s Supermarket s determ ned to p ease ts customers w th a customer advantage card


Current y, 30 percent of a shoppers are oya to Mr D’s A oya Mr D’s customer shops at
Mr D’s 80 percent of the t me An un oya Mr D’s customer shops at Mr D’s 10 percent of the
t me A typ ca customer spends $150 per week, and Mr D’s s runn ng on a 4 percent profit
marg n

The customer advantage card w cost Mr D’s an average of $0 01 per do ar spent You
be eve Mr D’s share of oya customers w ncrease by an unknown amount between 2
percent and 10 percent You a so be eve that the fract on of the t me a oya customer shops
at Mr D’s w ncrease by an unknown amount between 2 percent and 12 percent Shou d Mr
D’s adopt a customer advantage card? Shou d Mr D’s adopt the card f ts profit marg n s 8
percent nstead of 4 percent?

Chapter 79  Determ n ng customer va ue   761


CHAPTER 80

The economic order quantity


inventory model

Questions answered in this chapter:


■ An e ectron cs store se s 10,000 ce phones per year Each t me an order s p aced for a supp y
of ce phones, the store ncurs an order cost of $10 The store pays $100 for each ce phone,
and the cost of ho d ng a ce phone n nventory for a year s assumed to be $20 When the
store orders ce phones, how arge an order shou d t make?

■ A computer manufactur ng p ant produces 10,000 servers per year The cost to produce each
server s $2,000 The cost to set up a product on run of servers s $200, and the cost to ho d a
server n nventory for a year s $500 The p ant can produce 25,000 servers per year f t wants
to When the p ant produces servers, how arge a batch shou d t produce?

When a store orders an tem repeated y, a natura quest on s what quant ty the store shou d order
each t me If the store orders too many tems, t ncurs excess ve nventory or ho d ng costs If the
store orders too few tems, t ncurs excess ve reorder ng costs Somewhere, there must be a happy
med um that m n m zes the sum of annua nventory and order costs

S m ar y, cons der a manufactur ng p ant that produces batches of a product What batch s ze
m n m zes the sum of annua nventory and setup costs? The two examp es n th s chapter show
how to use the econom c order quant ty formu a (deve oped n 1913 by F Harr s of West nghouse
Corporat on) to answer these quest ons

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

763

An electronics store sells 10,000 cell phones per year. Each time an order is placed for a sup-
ply of cell phones, an order cost of $10 is incurred. The store pays $100 for each cell phone,
and the cost of holding a cell phone in inventory for a year is assumed to be $20. When the
store orders cell phones, how large an order should it make?

The s ze of an order that m n m zes the sum of annua nventory and order ng costs can be deter-
m ned after the fo ow ng parameters are known

■ K = Cost per order

■ h = Cost of ho d ng one un t n nventory for a year

■ D = Annua demand for product

You can fo ow an examp e of how to work w th these parameters by us ng the EOQ worksheet n
the Eoq x sx fi e, wh ch s shown n F gure 80-1

FIGURE 80-1  EOQ temp ate.

If q equa s order s ze, annua nventory cost equa s 0 5qh (Throughout th s examp e, th s equat on
s referred to as Equat on 1 ) You der ve Equat on 1 because the average nventory eve (0 5q) w
be ha f the max mum nventory eve To see why the average nventory eve s 0 5q, note that you
can compute the average nventory eve for a cyc e (the t me between the arr va of orders) At the
beg nn ng of a cyc e, an order arr ves, and the nventory eve s q At the end of the cyc e, you are out
of stock, and the nventory eve s 0 Because demand occurs at a constant rate, the average nven-
tory eve dur ng a cyc e s s mp y the average of 0 and q or 0.5q Max mum nventory eve w equa q
because orders are assumed to arr ve at the nstant that the nventory eve s reduced to 0

Because D/q orders are p aced per year, annua order ng cost equa s (D/q)*K (Refer to th s equa-
t on as Equat on 2 ) Us ng ca cu us or the Exce So ver, you can show that the annua sum of nventory
and order ng costs s m n m zed for a va ue of q equa to the econom c order quant ty (EOQ), wh ch s
ca cu ated us ng the fo ow ng formu a (Equat on 3)

EOQ= 2KD
h

764  Chapter 80  The econom c order quant ty nventory mode


From th s formu a, you can see the fo ow ng

■ An ncrease n demand or order ng cost w ncrease the EOQ

■ An ncrease n ho d ng cost w decrease the EOQ

In the Eoq x sx fi e, use Equat on 3 to determ ne EOQ n ce C5 Determ ne annua ho d ng cost n


ce C6 by us ng Equat on 1 Determ ne annua order ng cost n ce C7 w th Equat on 2 Not ce that for
EOQ, the annua order ng cost equa s the annua ho d ng cost, wh ch w a ways be the case In ce
C8, determ ne the tota annua cost ( gnor ng the purchas ng cost, wh ch does not depend on your
order ng strategy) w th the C6+C7 formu a

Of course, you can use one-way and two-way data tab es to determ ne the sens t v ty of the EOQ
and var ous costs to var at ons n K, h, and D In th s examp e, K = $10, D = 10,000 ce phones per
year, and h = $20 per ce phone By nsert ng these va ues n ce s C2 C4, you find the fo ow ng

■ Each order shou d be for 100 ce phones

■ Annua ho d ng and order ng costs each equa $1,000 The EOQ a ways sets annua ho d ng
costs equa to annua order ng costs

■ Tota annua costs (exc us ve of purchas ng costs) equa $2,000

When you are work ng w th EOQ, keep the fo ow ng n m nd

■ The presence of quant ty d scounts nva dates the EOQ because the annua purchase cost
then depends on the order s ze

■ The EOQ assumes that demand occurs at a re at ve y constant rate throughout the year The
EOQ shou d not be used for products for wh ch there s seasona demand

■ Annua ho d ng cost s usua y assumed to be between 10 percent and 40 percent of a prod-


uct’s un t purchas ng cost

■ Inc uded ( n the EOQ Protected worksheet n the Eoq x sx fi e) s a vers on of the EOQ work-
sheet n wh ch a formu as are protected When the sheet s protected, nobody can change
the formu as See Chapter 78, “Pr c ng stock opt ons,” for nstruct ons about how to protect a
worksheet

More Info  For more information about inventory modeling, interested readers can refer to
my book, Operations Research: Applications and Algorithms (Duxbury Press, 2007).

A computer manufacturing plant produces 10,000 servers per year. The cost to produce each
server is $2,000. The cost to set up a production run of servers is $200, and the cost to hold a
server in inventory for a year is $500. The plant can produce 25,000 servers per year if it wants
to. When the plant produces servers, how large a batch should it produce?

W th the EOQ mode , you assume an order arr ves the nstant the order s p aced When a com-
pany manufactures a product nstead of order ng t, an order must be produced and cannot arr ve

Chapter 80  The econom c order quant ty nventory mode    765


nstantaneous y In such s tuat ons, nstead of comput ng the cost-m n m z ng order quant ty, you
need to determ ne the cost-m n m z ng batch s ze When a company produces a product nterna y
nstead of purchas ng the product externa y, the batch s ze that m n m zes costs depends on the fo -
ow ng parameters

■ K = Cost of sett ng up a batch for product on

■ h = Cost of ho d ng each un t n nventory for a year

■ D = Annua demand for the product

■ R = Annua rate at wh ch the product can be produced For examp e, IBM m ght have the
capac ty to produce 25,000 servers per year

If q equa s the s ze of each product on batch, the annua ho d ng cost equa s 0 5*(q/R)*(R – D)*h
(Refer to th s equat on as Equat on 4 ) Equat on 4 fo ows because each batch takes q/R years to pro-
duce, and dur ng a product on cyc e, nventory ncreases at a rate of R – D The max mum nventory
eve , wh ch occurs at the comp et on of a batch, can be ca cu ated as (q/R)*(R – D) The average nven-
tory eve w thus equa 0 5*(q/R)*(R – D)

Because D/q batches are produced per year, annua setup cost equa s KD/q (referred to as
Equat on 5) Us ng ca cu us or the Exce So ver, you can show that the batch s ze that m n m zes the
sum of annua setup and product on-run costs s g ven by the fo ow ng (referred to as Equat on 6)
Th s mode s ca ed the econom c order batch (EOB) s ze

EOB= 2KDR
h(R–D)

From th s formu a, you can determ ne the fo ow ng

■ An ncrease n K or D w ncrease the EOB

■ An ncrease n h or R w decrease the EOB

In the Cont Rate EOQ worksheet n the Contrateeoq x sx fi e, a temp ate s constructed to deter-
m ne the EOB, annua setup, and ho d ng costs The worksheet s shown n F gure 80-2

FIGURE 80-2  Temp ate for comput ng EOB.

766  Chapter 80  The econom c order quant ty nventory mode


For th s examp e, K = $200, h = $500, D = 10,000 un ts per year, and R = 25,000 un ts per year
After enter ng these parameter va ues n the C2 C5 ce range, you find the fo ow ng

■ The batch s ze that m n m zes costs s 115 47 servers Thus, the company shou d produce 115
or 116 servers n each batch

■ The annua ho d ng cost and setup costs equa $17,320 51 Aga n, the EOB w a ways set
annua ho d ng cost equa to annua setup cost

■ Tota annua cost (exc us ve of var ab e product on costs) s $34,641 02

■ 86 6 batches per year w be produced

When you are work ng w th the EOB mode , keep the fo ow ng n m nd

■ If the un t var ab e cost of produc ng a product depends on the batch s ze, the EOB mode s
nva d

■ The EOB assumes that demand occurs at a re at ve y constant rate throughout the year The
EOB shou d not be used for products for wh ch there s seasona demand

■ The annua ho d ng cost s usua y assumed to be between 10 percent and 40 percent of a


product’s un t purchas ng cost

■ Inc uded ( n the Protected worksheet n the Contrateeoq x sx fi e) s a vers on of the EOB
worksheet n wh ch a formu as are protected See Chapter 78 for nstruct ons about how to
protect a worksheet

Problems
1. An app ance store se s HDTVs Annua demand s est mated at 1,000 un ts The cost to carry
an HDTV n nventory for one year s $500, and the cost to p ace an order for HDTVs s $400

• How many HDTVs shou d be ordered each t me an order s p aced?

• How many orders per year shou d be p aced?


• What are the annua nventory and order ng costs?
2. Suppose that the Waterford Crysta company can produce up to 100 ced-tea p tchers per
day Further, suppose that the p ant s open 250 days per year and that annua demand s for
20,000 p tchers The cost to ho d a p tcher n nventory for a year m ght be $10, and the cost
to set up the fac ty to produce ced tea p tchers m ght be $40

• What batch s ze wou d you recommend for ced-tea p tchers?


• How many batches per year shou d be produced?
• What are the annua setup and nventory costs for ced-tea p tchers?

Chapter 80  The econom c order quant ty nventory mode    767


CHAPTER 81

Inventory modeling with uncertain


demand

Questions answered in this chapter:


■ At what nventory eve shou d I p ace an order f my goa s to m n m ze annua ho d ng,
order ng, and shortage costs?

■ What does the term 95-percent service level mean?

Chapter 80, “The econom c order quant ty nventory mode ,” showed you how to use the econom c
order quant ty (EOQ) to determ ne an opt ma order quant ty and product on batch s ze The exam-
p es assumed that demand occurred at a constant rate Thus, f annua demand occurred at a rate of,
for examp e, 1,200 un ts per year, month y demand wou d equa 100 un ts As ong as demand occurs
at a re at ve y constant rate, the EOQ s a good approx mat on of the cost-m n m z ng order quant ty

In rea ty, demand dur ng any t me per od s uncerta n When demand s uncerta n, a natura ques-
t on s how ow to et the nventory eve go before p ac ng an order The nventory eve at wh ch an
order shou d be p aced s ca ed the reorder point C ear y, a h gh reorder po nt w decrease short-
age costs and ncrease ho d ng costs S m ar y, a ow reorder po nt w ncrease shortage costs and
decrease ho d ng costs At some ntermed ate reorder po nt, the sum of shortage and ho d ng costs s
m n m zed The first examp e n th s chapter shows how to determ ne a reorder po nt that m n m zes
expected order ng, shortage, and ho d ng costs based on the fo ow ng two assumpt ons

■ Each un t you are short s back ordered by a customer, and you ncur the shortage cost cB
Th s cost s pr mar y a measure of the customer’s d ssat sfact on caused by ate rece pt of an
ordered tem

■ Each un t you are short resu ts n a ost sa e, and you ncur the shortage cost c S > cB The  ost
sa es cost nc udes the profit ost from the ost sa e as we as the shortage cost nc uded n cB.

The second examp e shows how to determ ne the opt ma reorder po nt based on a service level
approach For examp e, a 95-percent serv ce eve means that you set the reorder po nt at a eve
ensur ng that, on average, 95 percent of a demand s met on t me It s usua y d fficu t to determ ne
the cost of a shortage n e ther the back-ordered case or the ost-sa es case For that reason, most
compan es set reorder po nts by us ng the serv ce eve approach

769

Note  On this book’s companion website, for the back-ordered and lost-sales models, I’ve
included a worksheet named Protected in which all formulas are protected for both the
back-ordered and lost-sales cases. You can use these worksheets as templates.

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

At what inventory level should I place an order if my goal is to minimize annual holding,
ordering, and shortage costs?

As nd cated n Chapter 80, the EOQ depends on the fo ow ng parameters

■ K = Cost per order

■ h = Cost of ho d ng one un t n nventory for a year

■ D = Annua demand for the product Because demand s now uncerta n, you et D stand for
the expected annua demand for the product

The back-order case


See the Reorderpo nt backorder x sx fi e, shown n F gure 81-1, for the data to use n th s examp e
F rst suppose that each shortage resu ts n the back-ordered un ts In other words, a shortage does
not resu t n any ost demand A so assume that each un t you are short ncurs a cost cB In th s case,
the reorder po nt depends on the fo ow ng quant t es

■ EOQ s the econom c order quant ty (the quant ty ordered each t me an order s p aced)

■ K s the cost per order

■ h s the annua ho d ng cost per un t

■ D s the mean annua demand

■ SOC s the cost per un t short

■ annsig s the standard dev at on of annua demand

■ meanLT s the average lead time; that s, the average t me between p ac ng an order and
rece v ng the order

■ sigmaLT s the standard dev at on of ead t me

770  Chapter 81  nventory mode ng w th uncerta n demand


Say that a department store wants to determ ne an opt ma nventory po cy for order ng e ectr c
m xers It has the fo ow ng nformat on

■ It costs $50 to p ace an order for m xers

■ It costs $10 to ho d a m xer n nventory for a year

FIGURE 81-1  Determ n ng the reorder po nt when shortages are backordered.

■ On average, the store se s 1,000 m xers per year

■ A customers who try to purchase a m xer when the store s so d out of them return at a ater
date and buy a m xer when the m xer s n stock The store ncurs a pena ty of $20 for each
un t t s short

■ The annua demand for m xers (based on h stor ca data) has a standard dev at on of 40 8

■ Lead t me s a ways two weeks (0 038 years), w th a standard dev at on of 0

After you enter K, h, and D n ce s C2 C4, the spreadsheet computes the EOQ (100 m xers) n C5
After you enter SOC, annsig, meanLT, and sigmaLT n ce s C7 C10, the spreadsheet computes n ce
C14 the reorder po nt that m n m zes the sum of expected annua ho d ng and shortage costs (51 63
m xers) Thus, the department store shou d order 100 m xers whenever ts stock decreases to 51 62 (or
52) m xers

The safety stock level assoc ated w th a g ven reorder po nt s reorder point–mean lead time
demand The department store ma nta ns a safety stock eve of 51 62 – 38 46 = 13 16 m xers, com-
puted n ce C15 Essent a y, the safety stock s a ways n nventory, resu t ng n extra ho d ng costs A
h gher eve of safety stock w , of course, reduce shortages

Chapter 81  nventory mode ng w th uncerta n demand   771


The lost-sales case
Now suppose that each shortage resu ts n a ost sa e The cost assoc ated w th a ost sa e s usua y
est mated as the back-order pena ty p us the profit assoc ated w th a un t so d Suppose that the
department store earns a $20 profit on each m xer t se s The un t shortage cost for the ost-sa es
case s then $40 ($20 ost profit + $20 back-order pena ty)

In the Reorderpo nt ostsa es x sx fi e, shown n F gure 81-2, you can see the work done to est -
mate the reorder po nt for the ost-sa es case After enter ng the ost-sa es cost of $40 n ce C7 of
the spreadsheet, you find that the opt ma nventory po cy s to order 100 m xers and p ace an order
when nventory s down to 54 23 m xers Your safety stock eve s 15 77 m xers, and 2 4 percent of the
store’s demand for m xers w be unmet Not ce that the assumpt on of a ost sa e has ncreased the
reorder po nt and reduced the probab ty of a shortage Th s happens because the ncreased cost of a
shortage (from $20 to $40) makes the store more eager to avo d shortages

FIGURE 81-2  Determ n ng the reorder po nt when sa es w be ost.

Increased uncerta nty great y ncreases the reorder po nt For examp e, n the ost-sa es case, f the
standard dev at on for ead t me s one week (0 019 years) rather than 0, the reorder po nt ncreases
to 79 50 m xers, and the safety stock more than doub es from when your ead t me was known w th
certa nty

What does the term 95 percent service level mean?

As stated ear er n the chapter, a 95-percent service level s mp y means that you want 95 percent of
your demand to be met on t me Because est mat ng the back-order pena ty and/or the pena ty that
resu ts from a ost sa e s often d fficu t, many compan es set safety stock eve s for products by set-
t ng a serv ce eve Us ng the Serv ce eve reorder x sx fi e (shown n F gure 81-3), you can determ ne
the reorder po nt correspond ng to any serv ce eve you want

772  Chapter 81  nventory mode ng w th uncerta n demand


FIGURE 81-3  Determ nat on of the reorder po nt by us ng the serv ce eve approach.

As an examp e, cons der a pharmacy that s try ng to determ ne an opt ma nventory po cy for a
drug t stocks The pharmacy wou d ke to meet 95 percent of demand for the drug on t me The fo -
ow ng parameters are re evant

■ Each order for the drug costs $50

■ The cost to ho d a un t of the drug n nventory for a year s $10

■ Average demand per year for the drug s 1,000 un ts

■ The standard dev at on of annua demand s 69 28 un ts

■ The t me requ red to rece ve a sh pment of the drug a ways takes exact y one month
(0 083 years)

You enter the serv ce eve you want (0 95) n ce C1 and a other parameters n ce s C2 C4 and
C7 C9 To determ ne the reorder po nt y e d ng the serv ce eve you want, c ck Solver n the Data
Analysis group on the Data tab The So ver mode (see F gure 81-4) adjusts the reorder po nt unt
the percentage of demand met on t me matches the serv ce eve you want Under Options, choose
Multistart (See Chapter 35, “Warehouse ocat on and the GRG Mu t start and Evo ut onary So ver
eng nes ”) Then you put a ower bound of 001 on the reorder po nt (to keep the So ver from try-
ng a negat ve reorder po nt) and an upper bound of 10,000 (fa r y arb trary) on the reorder po nt
If the So ver bumps up aga nst your upper bound, you shou d re ax the bound As you can see n
F gure 81-3, the pharmacy shou d order 100 un ts of the drug whenever ts nventory eve drops to
90 23 un ts Th s reorder po nt corresponds to a safety stock eve of 6 90 un ts

Chapter 81  nventory mode ng w th uncerta n demand   773


FIGURE 81-4  So ver Parameters d a og box for determ n ng the reorder po nt for a 95 percent serv ce eve .

In the fo ow ng tab e, the reorder po nt and safety stock eve s correspond ng to serv ce eve s
between 80 percent and 99 percent are sted

Service-level percentage Reorder point/units Safety stock/units


80 65.34 17.99
85 71.85 11.48
90 79.57 3.76
95 90.23 6.90
99 108.44 25.11

Not ce that mov ng from an 80 percent serv ce eve to a 99 percent serv ce eve ncreases the
reorder po nt by a most 67 percent! A so note that you can atta n a 90-percent serv ce eve w th a
reorder po nt ess than the mean ead t me demand (refer to ce C10 n F gure 81-3) A 90 percent
serv ce eve resu ts n a negat ve safety stock eve , wh ch s poss b e because shortages occur on y
dur ng the ead t me, and ead t mes usua y cover a sma port on of a year

774  Chapter 81  nventory mode ng w th uncerta n demand


Problems
When work ng w th Prob ems 1 and 2, assume that a restaurant serves an average of 5,000 bott es
of w ne per year The standard dev at on of the annua demand for w ne s 1,000 bott es The annua
ho d ng cost for a bott e of w ne s $1 It costs $10 to p ace an order for w ne, and t takes an average
of three weeks (w th a standard dev at on of one week) for the w ne to arr ve

1. Assume that when the restaurant s out of w ne, t ncurs a pena ty of $5 as the resu t of ost
goodw In add t on, the restaurant earns a profit of $2 per bott e of w ne Determ ne an
opt ma order ng po cy for the w ne

2. Determ ne an nventory po cy for w ne that y e ds a 99-percent serv ce eve

3. A reorder po nt po cy s often referred to as a two-b n po cy How can a reorder po nt po cy


be mp emented when two b ns are used to store nventory?

Chapter 81  nventory mode ng w th uncerta n demand   775


CHAPTER 82

Queuing theory: the mathematics


of waiting in line

Questions answered in this chapter:


■ What factors affect the number of peop e and the t me we spend wa t ng n ne?

■ What cond t ons shou d be met before ana yz ng the average number of peop e present or
the average t me spent n a queu ng system?

■ Why does var ab ty degrade the performance of a queu ng system?

■ Can I eas y determ ne the average t me a person spends at a rport secur ty or wa t ng n ne


at a bank?

We have a spent a ot of t me wa t ng n nes, and you’ soon see that a s ght ncrease n serv ce
capac ty can often great y reduce the s ze of the nes we encounter If you run a bus ness, ensur ng
that your customers do not spend too much t me wa t ng s mportant Therefore, bus ness peop e
need to understand the mathemat cs of wa t t me, usua y referred to as queuing theory Th s chapter
shows you how to determ ne the serv ce capac ty needed to prov de adequate serv ce

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

What factors affect the number of people and the time we spend waiting in line?

Th s chapter addresses queu ng prob ems n wh ch a arr v ng customers wa t n one ne for the first
ava ab e serv ce person (To keep th ngs s mp e, serv ce peop e are referred to as servers ) Th s mode
s a fa r y accurate representat on of the s tuat ons you face when you wa t at a bank, n an a rport
secur ty ne, or at the post office By the way, the dea of hav ng customers wa t n one ne started
n about 1970, when banks and post-office branches rea zed that a though wa t ng n one ne does
not reduce the average t me customers spend wa t ng, t does reduce the var ab ty of the t me they
spend n ne, thereby creat ng a fa rer system

777

Three ma n factors nfluence the t me you spend n a queu ng system

■ The number of servers  C ear y, the more servers, the ess t me on average customers spend
n ne, and fewer peop e on average w be present n the ne

■ The mean and the standard deviation of the time between arrivals  The t me between
arr va s s ca ed nterarr va t me If the average nterarr va t me ncreases, the number of
arr va s decreases, wh ch resu ts n shorter nes and ess t me spent n a queu ng system As
you soon see, an ncrease n standard dev at on of nterarr va t mes ncreases the average t me
a customer spends n a queu ng system and the average number of customers present

■ The mean and the standard deviation of the time needed to complete service  If the
average serv ce t me ncreases, you see an ncrease n the average t me a customer spends n
the system and n the number of customers present An ncrease n the standard dev at on of
serv ce t mes ncreases the average t me a customer spends n a queu ng system and the aver-
age number of customers present

What conditions should be met before analyzing the average number of people present or
the average time spent in a queuing system?

When ana yz ng the t me peop e spend wa t ng n nes, mathemat c ans ta k about steady state
character st cs of a system Essent a y, steady state means that a system has operated for a ong t me
More spec fica y, ana ysts wou d ke to know the va ue of the fo ow ng quant t es n the steady state

■ W = Average t me a customer spends n the system

■ Wq = Average t me a customer spends wa t ng n ne before the customer s served

■ L = Average number of customers present n the system

■ Lq = Average number of customers wa t ng n ne

By the way, t s a ways true that L = (1/mean nterarr va t me)*W and Lq = (1/mean nterarr va
t me)*Wq

To d scuss the steady state of a queu ng system mean ngfu y, the fo ow ng must be the case

■ The mean and standard dev at on of both the nterarr va t mes and the serv ce t mes changes
tt e over t me The techn ca phrase s that the d str but on of nterarr va and serv ce t mes s
stat onary over t me

■ (1/mean serv ce t me)*(number of servers) > (1/(mean nterarr va t me)) Th s w be


Equat on 1

778  Chapter 82  Queu ng theory: the mathemat cs of wa t ng n ne


Essent a y, f Equat on 1 s true, you can serve more peop e per hour than are arr v ng For exam-
p e, f mean serv ce t me equa s 2 m nutes (or 1/30 of an hour), and mean nterarr va t me equa s 1
m nute (or 1/60 of an hour), Equat on 1 te s you that 30*(number of servers) > 60, or that the number
of servers must be greater than or equa to 3 for a steady state to ex st If you cannot serve customers
faster than they arr ve, eventua y you fa beh nd and never catch up, resu t ng n an nfin te ne

Why does variability degrade the performance of a queuing system?

To see why var ab ty degrades the performance of a queu ng system, cons der a one-server system
n wh ch customers arr ve every 2 m nutes, and serv ce t mes a ways equa 2 m nutes There w never
be more than one customer n the system Now suppose that customers arr ve every 2 m nutes, but
ha f of a serv ce t mes are 0 5 m nutes and ha f are 3 5 m nutes Even though arr va s are tota y pre-
d ctab e, the uncerta nty n serv ce t me means that eventua y the server fa s beh nd and a ne forms
For examp e, f the first four customers have 3 5-m nute serv ce t mes, after 12 m nutes, four custom-
ers are wa t ng, wh ch s ustrated n the fo ow ng tab e

Time Event Present after event


0 m nutes Arr va 1 person
2 m nutes Arr va 2 peop e
3.5 m nutes Serv ce comp eted 1 person
4 m nutes Arr va 2 peop e
6 m nutes Arr va 3 peop e
7 m nutes Serv ce comp eted 2 peop e
8 m nutes Arr va 3 peop e
10 m nutes Arr va 4 peop e
10.5 m nutes Serv ce comp eted 3 peop e
12 m nutes Arr va 4 peop e

Can I easily determine the average time a person spends at airport security or waiting in line
at a bank?

The Mode worksheet n the Queu ngtemp ate x sx fi e conta ns a temp ate that you can use to
determ ne approx mate va ues for L, W, Lq, and Wq (usua y w th n 10 percent of the r true va ue) The
worksheet s shown n F gure 82-1

Chapter 82  Queu ng theory: the mathemat cs of wa t ng n ne   779


FIGURE 82-1  Queu ng temp ate.

After you enter the fo ow ng data, the temp ate computes Wq, Lq, W, and L The parameters n ce s
B6 B9 can eas y be est mated by us ng past data

■ Number of servers (ce B5)

■ Mean nterarr va t me (ce B6)

■ Mean serv ce t me (ce B7)

■ Standard dev at on of nterarr va t mes (ce B8)

■ Standard dev at on of serv ce t mes (ce B9)

Here’s an examp e of the temp ate n act on You want to determ ne how the operat ng character s-
t cs of an a r ne secur ty ne dur ng the 9 00 A M to 5 00 P M sh ft depends on the number of agents
work ng In the Queu ng Data worksheet n the Queu ngtemp ate x sx fi e, shown n F gure 82-2, nter-
arr va t mes and serv ce t mes are tabu ated (Some rows have been h dden )

By copy ng the AVERAGE(B4 B62) formu a from ce B1 to C1, you find the mean nterarr va t me
s 12 864 seconds, and the mean serv ce t me s 77 102 seconds Because mean serv ce t me s a most
s x t mes as arge as mean nterarr va t me, you need at east s x agents to guarantee a steady state
Copy ng the STDEV S(B4 B62) formu a from ce B2 to C2 te s you that the standard dev at on of the
nterarr va t mes s 4 439 seconds, and the standard dev at on of the serv ce t mes s 48 051 seconds

Return to the queu ng temp ate n the Mode worksheet If you enter these va ues n ce s B6 B9
and enter s x servers n ce B5, you find that d saster ensues In the steady state, near y 236 peop e
w be n ne (ce B19) You’ve probab y been at the a rport n th s s tuat on

780  Chapter 82  Queu ng theory: the mathemat cs of wa t ng n ne


FIGURE 82-2  A r ne nterarr va and serv ce t mes.

Use a one-way data tab e (shown n F gure 82-3) to determ ne how chang ng the number of agents
affects the system’s performance In ce s F10 F14, enter the number of agents to cons der (6 through
10) In ce G9, enter the formu a to compute L(=B19) and, n H9, enter the formu a to compute
W(=B18) Se ect the tab e range (F8 H14) and then c ck Data Table from the What-If Analysis menu
on the Data tab After choos ng ce B5 (the number of servers) as the row nput ce , you obta n the
data tab e shown n F gure 82-3 Not ce that add ng just one t cket agent to the or g na s x agents
reduces the expected number of customers present n ne from 236 to fewer than 7 Add ng the
seventh agent reduces a customer’s average t me n the system from 3,038 seconds (50 6 m nutes)
to 89 seconds (1 5 m nutes) Th s examp e shows that a sma ncrease n serv ce capac ty can great y
mprove the performance of a queu ng system

In ce s F16 K22, you can use a two-way data tab e to exam ne the sens t v ty of the average t me n
the system (W) to changes n the number of servers and standard dev at on of serv ce t mes The row
nput ce s B5, and the co umn nput ce s B9 When seven agents are work ng, an ncrease n the
standard dev at on of serv ce t mes from 40 seconds to 90 seconds resu ts n a 29 percent ncrease n
the mean t me n the system (from 86 2 seconds to 111 8 seconds)

Chapter 82  Queu ng theory: the mathemat cs of wa t ng n ne   781


FIGURE 82-3  Sens t v ty ana ys s for an a rport secur ty ne.

Note  Readers who are interested in a more extensive discussion of the queuing theory
should refer to my book, Operations Research: Applications and Algorithms (Duxbury
Press, 2007).

Problems
A bank has s x te ers Use the fo ow ng nformat on to answer Prob ems 1 to 4

• Mean serv ce t me equa s 1 m nute


• Mean nterarr va t me equa s 25 seconds
• Standard dev at on of serv ce t mes equa s 1 m nute
• Standard dev at on of nterarr va t mes equa s 10 seconds
1. Determ ne the average t me a customer wa ts n ne

2. On average, how many customers are present n the bank ne?

3. Wou d you recommend add ng more te ers?

782  Chapter 82  Queu ng theory: the mathemat cs of wa t ng n ne


4. Suppose t costs $20 per hour to have a te er work ng, and you va ue a customer’s t me at $15
per hour How many te ers shou d you have work ng?

5. Th rty women work on the fifth floor of a bus ness schoo Assume each woman uses the
restroom three t mes a day (the office s open from 8 A M to 5 P M ), and each v s t takes 180
seconds on average, w th a standard dev at on of 90 seconds Assume the standard dev at on
of t me between arr va s to the restroom s 5 m nutes How many to ets wou d you recom-
mend for the women’s restroom?

Chapter 82  Queu ng theory: the mathemat cs of wa t ng n ne   783


CHAPTER 83

Estimating a demand curve

Questions answered in this chapter:


■ What do I need to know to pr ce a product?

■ What s the mean ng of elasticity of demand?

■ Is there any easy way to est mate a demand curve?

■ What does a demand curve te us about a customer’s w ngness to pay for our product?

Every bus ness must determ ne a pr ce for each of ts products Pr c ng a product proper y s d fficu t
Chapter 84, “Pr c ng products by us ng t e- ns,” and Chapter 85, “Pr c ng products by us ng subjec-
t ve y determ ned demand,” descr be some s mp e mode s that m ght a d you n pr c ng a product to
max m ze profitab ty For further ns ghts nto pr c ng, refer to the exce ent book, Power Pricing, by
Robert J Do an and Hermann S mon (Free Press, 1997)

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

What do I need to know to price a product?

Cons der a product such as a candy bar To determ ne a profit-max m z ng pr ce, you need to know
two th ngs

■ The var ab e cost of produc ng each un t of the product (ca th s UC)

■ The product’s demand curve S mp y put, a demand curve te s you the number of un ts of a
product a customer w demand at each pr ce In short, f you charge a pr ce of $p per un t,
the demand curve g ves you a number D(p), wh ch equa s the number of un ts of the product
that w be demanded at pr ce $p Of course, a firm’s demand curve s constant y chang ng
and often depends on factors beyond the firm’s contro (such as the state of the economy and
a compet tor’s pr ce)

After you know UC and the demand curve, the profit correspond ng to a pr ce of $p s s mp y
(p – UC)*D(p) After you have an equat on for D(p), wh ch g ves the quant ty of the ­product demanded
at each pr ce, you can use the M crosoft Exce So ver feature to find the profit-max m z ng pr ce, wh ch
you’ see n Chapter 84 and Chapter 85

785

What is the meaning of elasticity of demand?

G ven a demand curve, the price elasticity for demand s the percentage decrease n demand resu t-
ng from a 1 percent ncrease n pr ce When e ast c ty s arger than 1 percent, demand  s pr ce e ast c
When demand s pr ce e ast c, a pr ce cut ncreases revenue When e ast c ty s ess than 1 percent,
demand s pr ce ne ast c When demand s pr ce ne ast c, a pr ce cut decreases revenue Here are
some observed est mates of e ast c t es

■ Sa t, 0 1 (very ne ast c)

■ Coffee, 0 25 ( ne ast c)

■ Lega fees, 0 4 ( ne ast c)

■ TV sets, 1 2 (s ght y e ast c)

■ Restaurant mea s, 2 3 (e ast c)

■ Fore gn trave , 4 0 (very e ast c)

A 1 percent decrease n the cost of fore gn trave , for examp e, w resu t n a 4 percent ncrease n
demand for fore gn trave

Is there any easy way to estimate a demand curve?

Us ng q to represent the quant ty demanded of a product, the two most common y used forms for
est mat ng demand curves are as fo ows

■ Linear demand curve  In th s case, demand fo ows a stra ght- ne re at onsh p of the form
q = a – bp For examp e, q = 10 – p s a near demand curve (Here, a and b can be determ ned
by us ng a method descr bed ater n the chapter ) When the demand curve s near, the e as-
t c ty s constant y chang ng

■ Power demand curve  In th s s tuat on, the demand curve s descr bed by a power curve
of the form q = apb, b<0 (See Chapter 55, “The power curve,” for more nformat on ) Aga n,
a and b can be determ ned by the method descr bed ater n the chapter The equat on
q = 100p-2 s an examp e of a power demand curve If demand fo ows a power curve, for any
pr ce the e ast c ty equa s –b Thus, for the demand curve q = 100p-2, the pr ce e ast c ty of
demand a ways equa s 2

Suppose that a product’s demand curve fo ows a near or power demand curve If you know the
current pr ce and demand for a product and the product’s pr ce e ast c ty of demand, determ n ng the
product’s demand curve s a s mp e matter Here are two examp es

A product s current y se ng for $100, and demand equa s 500 un ts The product’s pr ce e ast c-
ty for demand s 2 Assum ng the demand curve s near, you want to determ ne the equat on of the
demand curve The so ut on s n the L nearfit x sx fi e, wh ch s shown n F gure 83-1

786  Chapter 83  Est mat ng a demand curve


FIGURE 83-1  F tt ng a near demand curve.

G ven two po nts, you know that a un que stra ght ne passes through those two po nts, and you
actua y know two po nts on the demand curve One po nt s p = 100, and q = 500 Because e ast c-
ty of demand equa s 2, a 1 percent ncrease n pr ce resu ts n a 2 percent decrease n demand Thus,
f p = 101 (a 1 percent ncrease), demand drops by 2 percent of 500 (10 un ts) to 490 Thus, p=101,
and q = 490 s a second po nt on the demand curve You can now use the Exce trend ne to find the
stra ght ne that passes through the (100,500) and (101,490) po nts

You beg n by enter ng these po nts n the worksheet n the D5 E6 ce range, as shown n
F gure 83-1 Se ect the D4 E6 range and, on the r bbon, n the Charts group on the Insert tab, choose
Scatter, Scatter With Straight Lines After se ect ng th s opt on for a Scatter chart, you see the
graph has a pos t ve s ope Th s mp es that h gher pr ces ead to h gher demand, wh ch cannot be
correct The prob em s that w th on y two data po nts, Exce assumes that the data po nts you want
to graph are n separate co umns, not separate rows To be sure that Exce understands that the
nd v dua po nts are n separate rows, c ck ns de the graph and, on the r bbon, c ck the Design tab
n the Chart Tools sect on C ck Switch Row/Column n the Data sect on of the Design tab (Note
that by c ck ng the Se ect Data button, you can change the source data that generates your chart )
Now r ght-c ck one of the po nts, c ck Add Trendline, and then se ect Linear and Display Equation
On Chart You see the stra ght- ne p ot, comp ete w th the equat on shown n F gure 83-1 Because x
s pr ce and y s demand, the equat on for the demand curve s q = 1500 – 10p Th s equat on means
that each $1 ncrease n pr ce costs you 10 un ts of demand Of course, demand cannot be near for
a va ues of p because for arge va ues of p, a near demand curve w y e d negat ve demand For
pr ces near the current pr ce, however, the near demand curve s usua y a good approx mat on of
the product’s true demand curve

Chapter 83  Est mat ng a demand curve   787


As a second examp e, aga n assume that a product s current y se ng for $100, and demand equa s
500 un ts The product’s pr ce e ast c ty for demand s 2 Now fit a power demand curve to th s nfor-
mat on See the Powerfit x sx fi e, shown n F gure 83-2

FIGURE 83-2  Power demand curve.

In ce E3, enter a tr a va ue for a Then, n ce D5, enter the current pr ce of $100 Because
e ast c ty of demand equa s 2, you know that the demand curve has the form of q = ap-2, where a s
unknown In ce E5, enter the demand for a pr ce of $100, correspond ng to the va ue of a n ce E3,
w th the a*D5^-2 formu a Now you can use the Goa Seek command (for deta s, see Chapter 17, “The
Goa Seek command”) to determ ne the va ue of a that makes the demand for pr ce $100 equa to
500 un ts Set ce E5 to the va ue of 500 by chang ng ce E3 You find that a va ue for a of 5 m on
y e ds a demand of 500 at a pr ce of $100 Thus, the demand curve (graphed n F gure 83-2) s g ven
by q = 5,000,000p-2 For any pr ce, the pr ce e ast c ty of demand on th s demand curve equa s 2

What does a demand curve tell us about a customer’s willingness to pay for our product?

Suppose you are try ng to se a software program to a Fortune 500 company Let q equa the number
of cop es of the program the company demands and et p equa the pr ce charged for the software
Suppose you have est mated that the demand curve for software s g ven by q = 400 – p C ear y,
your customer s w ng to pay ess for each add t ona un t of the software program Locked ns de
th s demand curve s nformat on about how much the company s w ng to pay for each un t of the
program Th s nformat on s cruc a for max m z ng profitab ty of sa es

Rewr te the demand curve as p = 400 – q Thus, when q = 1, p = $399 and so on Now try to figure
out the va ue the customer attaches to each of the first two un ts of the program Assum ng that
the customer s rat ona , the customer w buy a un t f and on y f the va ue of the un t exceeds your
pr ce At a pr ce of $400, demand equa s 0, so the first un t cannot be worth $400 At a pr ce of $399,
however, demand equa s 1 un t Therefore, the first un t must be worth someth ng between $399
and $400 S m ar y, at a pr ce of $399, the customer does not purchase the second un t At a pr ce of

788  Chapter 83  Est mat ng a demand curve


$398, however, the customer s purchas ng two un ts, so the customer does purchase the second un t
Therefore, the customer va ues the second un t somewhere between $399 and $398

It can be shown that the best approx mat on of the va ue of the ith un t purchased by the customer
s the pr ce that makes demand equa to i – 0 5 For examp e, by sett ng q equa to 0 5, the va ue
of the first un t s 400 – 0.5 = $399.50 S m ar y, by sett ng q = 1 5, the va ue of the second un t s
400 – 1 5 =$398 50

Problems
1. Suppose you are charg ng $60 for a board game you nvented and have so d three thousand
un ts dur ng the past year E ast c ty for board games s known to equa 3 Use th s nformat on
to determ ne a near and power demand curve

2. For each of your answers n Prob em 1, determ ne the va ue consumers p ace on the two thou-
sandth un t purchased of your game

Chapter 83  Est mat ng a demand curve   789


CHAPTER 84

Pricing products by using tie-ins

Question answered in this chapter:


■ How does the fact that customers buy razor b ades as we as razors affect the profit-­
max m z ng pr ce of razors?

Certa n consumer product purchases frequent y resu t n the purchase of re ated products, or t­ ie-ins
Here are some examp es

Original purchase Tie-in product


Razor Razor b ades
Men s su t Sh rt and/or t e
Persona computer Software tra n ng manua
V deo game conso e V deo game

Us ng the techn ques descr bed n Chapter 83, “Est mat ng a demand curve,” t’s easy to determ ne
a demand curve for the product that’s or g na y purchased You can then use the M crosoft Exce
So ver to determ ne the or g na product pr ce that max m zes the sum of the profit earned from the
or g na and the t e- n products The fo ow ng examp e shows how th s ana ys s s done

Answer to this chapter’s question


Th s sect on prov des the answer to the quest on that s sted at the beg nn ng of the chapter

How does the fact that customers buy razor blades as well as razors affect the profit-­
maximizing price of razors?

Suppose that you’re current y charg ng $5 00 for a razor, and you’re se ng 6 m on razors Assume
that the var ab e cost of produc ng a razor s $2 00 F na y, suppose that the pr ce e ast c ty of demand
for razors s 2 What pr ce shou d you charge for razors?

Assume ( ncorrect y) that no purchasers of razors buy b ades You determ ne the demand curve
(assum ng a near demand curve) as shown n F gure 84-1 (You can find th s data and the chart on
the No B ades worksheet n the Razorsandb ades x sx fi e ) Two po nts on the demand curve are pr ce
= $5 00, demand = 6 m on razors and pr ce = $5 05 (an ncrease of 1 percent), demand = 5 88 m -
on (2 percent ess than 6 m on) After draw ng a chart and nsert ng a near trend ne as shown n

791

Chapter 83, you find the demand curve equat on s y = 18 – 2 4x Because x equa s pr ce and y equa s
demand, you can wr te the demand curve for razors as fo ows demand ( n m ons) = 18 – 2 4(price)

FIGURE 84-1  Determ n ng the profit max m z ng pr ce for razors.

Assoc ate the names n ce C6 and the C9 C11 range w th ce s D6 and D9 D11 Enter a tr a pr ce n
D9 and determ ne demand for that pr ce n ce D10 w th the 18-2 4*pr ce formu a Determ ne n ce
D11 the profit for razors by us ng the demand*(pr ce–un t cost) formu a

Now, use So ver to determ ne the profit-max m z ng pr ce The So ver Parameters d a og box s
shown n F gure 84-2

Max m ze the profit ce (ce D11) by chang ng the pr ce (ce D9) The mode s not near because
the target ce mu t p es two quant t es—demand and (pr ce – cost)—each depend ng on the chang-
ng ce So ver finds that charg ng $4 75 for a razor max m zes profit (Max mum profit s $18 15
m on )

Now suppose that the average purchaser of a razor buys 50 b ades and that you earn $0 15 of
profit per b ade purchased How does th s change the pr ce you shou d charge for a razor? Assume
that the pr ce of a b ade s fixed (In Prob em 3 at the end of the chapter, the b ade pr ce changes ) The
ana ys s s n the B ades worksheet, wh ch s shown n F gure 84-3

792  Chapter 84  Pr c ng products by us ng t e ns


FIGURE 84-2  So ver Parameters d a og box set up for max m z ng razor profit.

FIGURE 84-3  Pr ce for razors w th b ade profit nc uded.

Chapter 84  Pr c ng products by us ng t e ns   793


Use the Create From Selection command n the Defined Names group on the Formulas tab to
assoc ate the names n ce s C6 C11 w th ce s D6 D11 (For examp e, ce D10 s named Demand )

Note  Astute readers will recall that cell D10 of the No Blades worksheet was also named
Demand. What does Excel do when you use the range name Demand in a formula? Excel
simply refers to the cell named Demand in the current worksheet. In other words, when you
use the range name Demand in the Blades worksheet, Excel refers to cell D10 of that work-
sheet and not to cell D10 in the No Blades worksheet.

In ce s D7 and D8, enter the re evant nformat on about b ades In D9, enter a tr a  pr ce for
razors and, n D10, compute demand w th the 18-2 4*pr ce formu a Next, n ce D11, compute tota
profit from razors and b ades w th the demand*(pr ce–un t cost)+demand*b ades per razor*profit
per b ade formu a Not ce that demand*b ades per razor*profit per b ade s the profit from b ades

The So ver setup s exact y as was shown ear er, n F gure 84-2 Change the pr ce to max m ze the
profit Of course, now the profit formu a nc udes the profit earned from b ades Exce shows that
profit s max m zed by charg ng on y $1 00 (ha f the var ab e cost!) for a razor Th s pr ce resu ts from
mak ng so much money from b ades You are much better off ensur ng that many peop e have razors
even though you ose $1 00 on each razor so d Many compan es do not understand the mportance
of the profit from t e- n products Th s eads them to overpr ce the r pr mary product and not max -
m ze the r tota profit

Problems

Note  In all the following problems, assume a linear demand curve.

1. You are try ng to determ ne the profit-max m z ng pr ce for a v deo game conso e Current y,
you are charg ng $180 and se ng 2 m on conso es per year It costs $150 to produce a
conso e, and pr ce e ast c ty of demand for conso es s 3 What pr ce shou d you charge for a
conso e?

2. Now assume that, on average, a purchaser of your v deo game conso e buys 10 v deo games,
and you earn $10 profit on each v deo game What s the correct pr ce for conso es?

3. In the razor and b ade examp e, suppose the cost to produce a b ade s $0 20 If you charge
$0 35 for a b ade, a customer buys an average of 50 b ades Assume the pr ce e ast c ty of
demand for b ades s 3 What pr ce shou d you charge for a razor and for a b ade?

4. You are manag ng a mov e theater that can hand e up to e ght thousand patrons per week
The current demand, pr ce, and e ast c ty for t cket sa es, popcorn, soda, and candy are g ven
n F gure 84-4 The theater keeps 45 percent of t cket revenues Un t cost per t cket, popcorn
sa es, candy sa es, and soda sa es are a so g ven Assum ng near demand curves, how can the

794  Chapter 84  Pr c ng products by us ng t e ns


theater max m ze profits? Demand for food s the fract on of patrons who purchase the g ven
food

FIGURE 84-4  Mov e prob em data.

5. A prescr pt on drug s produced n the Un ted States and so d nternat ona y Each un t of the
drug costs $60 to produce In the German market, you are se ng the drug for 150 euros per
un t The current exchange rate s 0 667 US do ars per euro Current demand for the drug s
100 un ts, and the est mated e ast c ty s 2 5 Assum ng a near demand curve, determ ne the
appropr ate sa es pr ce ( n euros) for the drug

Chapter 84  Pr c ng products by us ng t e ns   795


CHAPTER 85

Pricing products by using


subjectively determined demand

Questions answered in this chapter:


■ Somet mes I don’t know the pr ce e ast c ty for a product In other s tuat ons, I don’t be eve a
near or power demand curve s re evant Can I st est mate a demand curve and use So ver
to determ ne a profit-max m z ng pr ce?

■ How can a sma drugstore determ ne the profit-max m z ng pr ce for pst ck?

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

Sometimes I don’t know the price elasticity for a product. In other situations, I don’t believe a
linear or power demand curve is relevant. Can I still estimate a demand curve and use Solver
to determine a profit-maximizing price?

When you don’t know the pr ce e ast c ty for a product or don’t th nk you can re y on a near or
power demand curve, a good way to determ ne a product’s demand curve s to dent fy the owest
pr ce and h ghest pr ce that seem reasonab e You can then try to est mate the product’s demand
w th the h gh pr ce, the ow pr ce, and a pr ce m dway between the h gh and ow pr ces G ven these
three po nts on the product’s demand curve, you can use the M crosoft Exce Trend ne feature to fit a
quadrat c demand curve w th the fo ow ng formu a (Equat on 1)

Demand=a(price)2+b(pri=ce)+c

For any three spec fied po nts on the demand curve, va ues of a, b, and c ex st that w make
Equat on 1 exact y fit the three spec fied po nts Because Equat on 1 fits three po nts on the demand
curve, t seems reasonab e to be eve that the equat on w g ve an accurate representat on of
demand for other pr ces You can then use Equat on 1 and So ver to determ ne max mum profit,
wh ch s g ven by the (pr ce–un t cost)*demand formu a The fo ow ng examp e shows how th s pro-
cess works

797

How can a small drugstore determine the profit-maximizing price for lipstick?

Suppose that a drugstore pays $0 90 for each un t of pst ck t orders The store s cons der ng charg-
ng from $1 50 through $2 50 for a un t of pst ck The store th nks that at a pr ce of $1 50, t w se
60 un ts per week (See F gure 85-1 and the L pst ckpr ce x sx fi e ) At a pr ce of $2 00, the store th nks
t w se 51 un ts per week, and at a pr ce of $2 50, 20 un ts per week What pr ce shou d the store
charge for pst ck?

FIGURE 85-1  L pst ck pr c ng mode .

You beg n by enter ng the three po nts w th wh ch you chart the demand curve n the E3 F6 ce
range After se ect ng E3 F6, c ck the Charts group on the r bbon’s Insert tab and then se ect the
first opt on for a Scatter chart You can then r ght-c ck a data po nt and se ect Add Trendline In the
Format Trendline d a og box (see F gure 85-2), choose Polynomial and se ect 2 n the Order box (to
obta n a quadrat c curve of the form of Equat on 1) Se ect Display Equation On Chart

798  Chapter 85  Pr c ng products by us ng subject ve y determ ned demand


FIGURE 85-2  Configur ng the Format Trend ne d a og box for se ect ng a po ynom a demand curve.

Exce creates the chart shown n F gure 85-1 The est mated demand curve (Equat on 2) s
Demand = –44*Price2 + 136*Price – 45

Next, you nsert a tr a pr ce n ce I2 You compute product demand by us ng Equat on 2 n ce I3


w th the –44*pr ce^2+136*pr ce–45 formu a. (Ce I2 s named Pr ce ) Then you compute week y profit
from pst ck sa es n ce I4 w th the demand*(pr ce–un t cost) formu a (Ce E2 s named Un t Cost,
and ce I3 s named Demand ) Then you use So ver to determ ne the pr ce that max m zes profit
The So ver Parameters d a og box s shown n F gure 85-3 Note that you must constra n the pr ce to
be between the owest and the h ghest spec fied pr ces ($1 50 through $2 50) If you a ow So ver to
cons der pr ces outs de th s range, the quadrat c demand curve m ght s ope upward, wh ch mp es
that a h gher pr ce wou d resu t n arger demand Th s resu t s unreasonab e, wh ch s why you shou d
constra n the pr ce

The resu t s that the drugstore shou d charge $2 04 for a un t of pst ck Th s y e ds sa es of 49 4 un ts


per week and a week y profit of $56 24

The approach to pr c ng out ned n th s chapter requ res no know edge of the concept of pr ce
e ast c ty Inherent y, the So ver cons ders the e ast c ty for each pr ce when t determ nes the profit-
max m z ng pr ce Th s approach can eas y be app ed by organ zat ons that se thousands of d ffer-
ent products The on y data that needs to be spec fied for each product s ts var ab e cost and the
three g ven po nts on the demand curve

Chapter 85  Pr c ng products by us ng subject ve y determ ned demand   799


FIGURE 85-3  Configur ng the So ver Parameters d a og box to ca cu ate pst ck pr c ng.

Problems
1. Suppose t costs $250 to produce a v deo game conso e A pr ce from $200 through $400 s
under cons derat on Est mated demand for the game conso e s shown n the fo ow ng tab e

Price Demand (in millions)


$200 2
$300 0.9
$400 0.2

What pr ce shou d you charge for a game conso e?

2. Th s prob em uses the demand nformat on g ven n Prob em 1 Each game owner buys an
average of 10 v deo games You earn $10 profit per v deo game What pr ce shou d you
charge for the game conso e?

800  Chapter 85  Pr c ng products by us ng subject ve y determ ned demand


3. You are try ng to determ ne the correct pr ce for a new week y magaz ne The var ab e cost of
pr nt ng and d str but ng a copy of the magaz ne s $0 50 You are th nk ng of charg ng from
$0 50 through $1 30 per copy The est mated week y sa es of the magaz ne are shown n the
fo ow ng tab e

Price Demand (in millions)


$0.50 2
$0.90 1.2
$1.30 0.3

In add t on to sa es revenue from the magaz ne, you can charge $30 per one thousand cop es
so d for each of the 20 pages of advert s ng n each week’s magaz ne What pr ce shou d you
charge for the magaz ne?

Chapter 85  Pr c ng products by us ng subject ve y determ ned demand   801


CHAPTER 86

Nonlinear pricing

Questions answered in this chapter:


■ What s near pr c ng?

■ What s non near pr c ng?

■ What s bund ng, and how can t ncrease profitab ty?

■ How can I find a profit-max m z ng, non near pr c ng p an?

Answers to this chapter’s questions


Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

What is linear pricing?

Chapter 84, “Pr c ng products by us ng t e- ns,” and Chapter 85, “Pr c ng products by us ng sub-
ject ve y determ ned demand,” show how to determ ne a profit-max m z ng pr ce for a product In
those chapters’ examp es, however, the mp c t assumpt on s made that no matter how many un ts a
customer purchases, she s charged the same amount per un t Th s mode s known as linear pric-
ing because the cost of buy ng x un ts s a stra ght- ne funct on of x; name y, cost of x units = (unit
price)*x You see n th s chapter that nonlinear pricing can often great y ncrease a company’s profit

What is nonlinear pricing?

A nonlinear pricing scheme s mp y means that the cost of buy ng x un ts s not a stra ght- ne funct on
of x We have a encountered non near pr c ng strateg es Here are some examp es

■ Quantity discounts  The first five un ts m ght cost $20 each and the rema n ng un ts $12
each Quant ty d scounts are common y used by compan es se ng software and computers
An examp e of the cost of purchas ng x un ts s shown n the Non near Pr c ng Examp es work-
sheet n the N p x sx fi e, wh ch s shown n F gure 86-1 Not ce that the graph has a s ope of 20
for five or fewer un ts purchased and a s ope of 12 for more than five un ts purchased

803

FIGURE 86-1  Cost of quant ty d scount p an.

■ Two-part tariff  When you jo n a country c ub, you usua y pay a fixed fee for jo n ng the
c ub and then a fee for each round of go f you p ay Suppose that your country c ub charges
a membersh p fee of $500 per year and charges $20 per round of go f Th s type of pr c ng
strategy s ca ed a two-part tariff For th s pr c ng po cy, the cost of purchas ng a g ven num-
ber of rounds of go f s shown n F gure 86-2 Aga n, ook at the Non near Pr c ng Examp es
worksheet n N p x sx Note that the graph has a s ope of 520 from zero through one un t
purchased and a s ope of 20 for more than one un t purchased Because a stra ght ne must
a ways have the same s ope, you can see that a two-part tar ff s h gh y non near

FIGURE 86-2  Cost of two part tar ff.

What is bundling, and how can it increase profitability?

Pr ce bund ng nvo ves offer ng a customer a set of products for a pr ce ess than the sum of the
products’ nd v dua pr ces To ana yze why bund ng works, you need to understand how a rat ona
consumer makes dec s ons For each product comb nat on ava ab e, a rat ona consumer ooks at the

804  Chapter 86  Non near pr c ng


va ue of what you are se ng and subtracts the cost to purchase t Th s y e ds the consumer surplus
of the purchase A rat ona consumer buys noth ng f the consumer surp us of each ava ab e opt on s
negat ve Otherw se, the consumer purchases the product comb nat on hav ng the argest consumer
surp us

So how can bund ng ncrease your profitab ty? Suppose that you se computers and pr nters and
have two customers The va ues each customer attaches to a computer and a pr nter are shown here

Customer Computer value Printer value


1 $1,000 $500
2 $500 $1,000

You on y offer the computer and pr nter for sa e separate y By charg ng $1,000 for a pr nter and
for a computer, you w se one pr nter and one computer and rece ve $2,000 n revenue Now sup-
pose that you offer the pr nter and computer n comb nat on for $1,500 Each customer buys both the
computer and the pr nter, and you rece ve $3,000 n revenue By bund ng the computer and pr nter,
you can extract more of the consumer’s tota va uat on Bund ng works best f customer va uat ons
for the bund ed products are negat ve y corre ated In th s examp e, the negat ve corre at on between
the va ues for the bund ed products resu ts because the customer who p aces a h gh va ue on a
pr nter p aces a ow va ue on a computer, and the customer who p aces a ow va ue on a pr nter p aces
a h gh va ue on a computer

When you go to a theme park such as D sney and, you don’t buy a t cket for each r de You buy a
t cket to enter the theme park or you don’t go Th s s an examp e of pure bundling because the con-
sumer does not have the opt on to pay for a subset of the offered products Th s approach reduces
nes ( mag ne a ne at every r de) and resu ts n more profit

To see why th s bund ng approach ncreases profitab ty, suppose there s on y one customer and
that the number of r des the customer wants to go on s governed by a demand curve that s ca cu-
ated as (Number of r des) = 20 – 2*(Pr ce of r de) From the d scuss on of demand curves n Chapter
83, “Est mat ng a demand curve,” you know that the va ue the consumer g ves to the ith r de s the
pr ce that makes demand equa to i – 0 5 Thus, you know that i – 0 5 = 20 – 2*(value of ride i) or, so v-
ng for the va ue of r de i, that (value of ride i) = 10 25 – (i/2) The first r de s worth $9 75, the second
r de s worth $9 25, and so on to the twent eth r de, wh ch s worth $0 25

Assume you charge a constant pr ce per r de and that t costs $2 n var ab e costs per r de You seek
the profit-max m z ng near pr c ng scheme On the OnePr ce worksheet n the N p x sx fi e, shown n
F gure 86-3, you see how to determ ne the profit-max m z ng pr ce per r de

Assoc ate the range names n C8 C10 w th ce s D8 D10 Enter a tr a pr ce n ce D8 and compute
the number of r de t ckets purchased n ce D9 w th the 20–(2*D8) formu a Compute the profit n ce
D12 w th the Demand*(pr ce–un t cost) formu a You can now use the So ver to max m ze the va ue n
D12 (profit) by chang ng ce D8 (pr ce) A pr ce of $6 resu ts n e ght r de t ckets be ng purchased, and
you earn a max mum profit of $32

Chapter 86  Non near pr c ng   805


FIGURE 86-3  Profit max m z ng near pr c ng scheme.

Now pretend that you’re ke D sney and and offer on y a bund e of 20 r des to the customer You
set a pr ce equa to the sum of the customer’s va uat ons for each r de ($9 75 + $9 25 + $0 75 +
$0 25 = $100 00) The customer va ues a 20 r des at $100 00, so the customer w buy a park entry
t cket for $100 00 You earn a profit of $100 00 – $2 00(20) = $60 00, wh ch a most doub es your profit
from near pr c ng

How can I find a profit-maximizing, nonlinear pricing plan?

In th s sect on, you see how you can determ ne a profit-max m z ng, two-part-tar ff pr c ng p an for
the amusement park examp e Proceed as fo ows

1. Hypothes ze tr a va ues for the fixed fee and the pr ce per r de

2. Determ ne the va ue the customer assoc ates w th each r de Va ue of r de i = 10 – 5(i – 5)


= 10 25 – 0 5i

3. Determ ne the cumu at ve va ue assoc ated w th buy ng i r des

4. Determ ne the pr ce charged for i r des F xed fee + i*(pr ce per r de)

5. Determ ne the consumer surp us for buy ng i r des Va ue of i r des – pr ce of i r des

6. Determ ne the max mum consumer surp us

7. Determ ne the number of un ts purchased If the max mum consumer surp us s negat ve, no
un ts are purchased Otherw se, use the MATCH funct on to find the number of un ts y e d ng
the max mum surp us

8. Use a VLOOKUP funct on to ook up revenue correspond ng to the number of un ts


purchased

9. Compute profit as revenue – costs

10. Use a two-way data tab e to determ ne a profit-max m z ng fixed fee and pr ce per r de

The work for th s approach s n the Two-Part Tar ff worksheet n the N p x sx fi e, wh ch s shown n
F gure 86-4

To beg n, name ce F2 F xed and ce F3 LP Enter tr a va ues for the fixed fee and the pr ce per
r de n ce s F2 and F3 Next, determ ne the va ue the consumer p aces on each r de by copy ng the

806  Chapter 86  Non near pr c ng


10 25–(D6/2) formu a from ce E6 to E7 E25 You find that the customer p aces a va ue of $9 75 on the
first r de, $9 25 on the second r de, and so on

FIGURE 86-4  Determ nat on of opt ma two part tar ff.

To compute the cumu at ve va ue of the first i r des, copy the SUM($E$6 E6) formu a from F6 to
F7 F25 Th s formu a adds up a va ues n co umn E that are n or above the current row By copy ng
the fixed fee+pr ce per r de*D6 formu a from G6 to G7 G25, you can compute the cost of i r des For
examp e, the cost of five r des s $68 50

Reca that the consumer surp us for i r des equa s (Value of i rides) – (Cost of i rides) By copy ng the
F6–G6 formu a from ce H6 to the H7 H25 range, you compute the consumer’s surp us for purchas ng
any number of r des For examp e, the consumer surp us for purchas ng five r des s –$24 75, wh ch s
the resu t of the arge fixed fee

In ce H4, compute the max mum consumer surp us w th the MAX(H6 H25) formu a Remember
that f the max mum consumer surp us s negat ve, no un ts are purchased Otherw se, the consumer
w purchase the number of un ts y e d ng the max mum consumer surp us Therefore, by enter ng the
IF(H4>=0,MATCH(H4,H6 H25,0),0) formu a n ce I1, you determ ne the number of un ts purchased ( n
th s case, 15) Not ce that the MATCH funct on finds the number of rows you need to move down n
the H6 H24 range to find the first match to the max mum surp us

Now name the D5 G25 range ookup You can then ook up tota revenue n the fourth co umn of
th s range based on the number of un ts purchased (wh ch s a ready computed n ce I1) The tota
revenue s computed n ce I2 w th the IF(I1=0,0,VLOOKUP(I1, ookup,4)) formu a Not ce that f no
r des are purchased, you earn no revenue Compute tota product on cost for r des purchased n ce
I3 w th the I1*C3 formu a In ce J6, compute profit as revenues ess costs w th the I2–I3 formu a

Chapter 86  Non near pr c ng   807


Now you can use a two-way data tab e to determ ne the profit-max m z ng comb nat on of fixed
fee and pr ce per r de The data tab e s shown n F gure 86-5 (Many rows and co umns are h dden )
In sett ng up the data tab e, the fixed fee was var ed between $10 00 and $60 00 (the va ues n the
K10 K60 range), and the pr ce per r de was var ed between $0 50 and $5 00 (the va ues n L9 BE9)
Profit was recomputed n ce K9 w th the =J6 formu a

Se ect the tab e range (ce s K9 BE60) and then, on the Data tab, n the Data Tools group, c ck
What-If Analysis Se ect Data Table The co umn nput ce s F2 (the fixed fee), and the row nput ce
s F3 (the pr ce per r de) C ck ng OK n the Table d a og box computes the profit for each fixed fee
and pr ce per r de comb nat on represented n the data tab e

FIGURE 86-5  Two way data tab e comput ng opt ma two part tar ff.

To h gh ght the profit-max m z ng two-part tar ff, use cond t ona formatt ng; se ect the L10 BE60
range C ck Conditional Formatting on the Home tab, c ck Top/Bottom Rules, and then c ck Top
10 Items Change the 10 n the d a og box to a 1 so that on y the argest profit s formatted Here,
a fixed fee of $56 00 and a pr ce per r de of $2 50 earns a profit of $63 50, wh ch a most doub es
the profit from near pr c ng A fixed fee of $59 00 and a pr ce per r de of $2 30 a so y e ds a profit
of $63 50

Because a quant ty-d scount p an nvo ves se ect ng three var ab es (cutoff, h gh pr ce, and ow
pr ce), you cannot use a data tab e to determ ne a profit-max m z ng quant ty-d scount p an You

808  Chapter 86  Non near pr c ng


m ght th nk you cou d use a So ver mode (w th chang ng ce s set to cutoff, h gh pr ce, and ow pr ce)
to determ ne a profit-max m z ng quant ty-d scount strategy Before Exce 2010, the So ver often had
d fficu ty determ n ng opt ma so ut ons when the target ce s computed by us ng formu as con-
ta n ng IF statements The Exce 2013 So ver hand es the quant ty-d scount prob em w th ease, even
w th the use of IF statements In the Qd x sx fi e (see F gure 86-6), use the Evo ut onary So ver eng ne
to find the profit-max m z ng quant ty-d scount p an Assume that a un ts bought up to a cutoff
(ca ed CUT) are so d at a h gh pr ce (ca ed HP) and that the rema n ng tems are so d at a ow pr ce
(ca ed LP) The on y change n the spreadsheet setup s n co umn G After nam ng ce s F1 F3 w th the
names n E1 E3, compute the amount a person wou d pay to buy any number of un ts by copy ng the
IF(D6<=Cut,D6*HP,HP*Cut+(D6-Cut)*LP) formu a from G6 to G7 G25 The So ver Parameters d a og
box setup s shown n F gure 86-7 As descr bed n Chapter 35, “Warehouse ocat on and the GRG
Mu t start and Evo ut onary So ver eng nes,” use the Evo ut onary So ver here because the mode uses
IF statements that nvo ve chang ng ce s The Mutat on Rate under Evo ut onary So ver opt ons was
changed to 5 Note that you must constra n the cutoff po nt to be an nteger; use an upper bound
of $20 for a the chang ng ce s Of course, f So ver had chosen a pr ce near $20, you wou d have
re axed the upper bound on the pr ce chang ng ce s

The So ver found a max mum profit of $63 97, obta ned by charg ng $18 48 for the first four un ts
purchased and $1 84 for the rema n ng un ts The customers w buy 16 un ts If you had run So ver
onger, t wou d have found the true max mum profit, wh ch s $64 00

FIGURE 86-6  Use of So ver to find the profit max m z ng quant ty d scount p an.

Chapter 86  Non near pr c ng   809


FIGURE 86-7  So ver sett ngs for max m z ng a quant ty d scount p an.

Problems
You own a sma country c ub and have three types of customers who va ue each round of go f they
p ay dur ng a month as shown n the fo ow ng tab e

Round no. Customer type 1 Customer type 2 Customer type 3


1 $60 $50 $40
2 $50 $45 $30
3 $40 $30 $20
4 $30 $15 $10
5 $20 $0 $0
6 $10 $0 $0

810  Chapter 86  Non near pr c ng


1. F nd a profit-max m z ng two-part tar ff

2. Suppose you w offer a pure bund e For examp e, a member can p ay up to five rounds
of go f for $60 per month The member has no opt on to choose from other than the pure
bund e What pure bund e max m zes your profit?

Chapter 86  Non near pr c ng   811


CHAPTER 87

Array formulas and functions

Questions answered in this chapter:


■ What s an array formu a?

■ How can I nterpret formu as such as (D2 D7)*(E2 E7) and SUM(D2 D7*E2 E7)?

■ I have a st of names n one co umn These names change often Is there an easy way to
transpose the sted names to one row so that changes n the or g na co umn of names are
reflected n the new row?

■ I have a st of month y stock returns Is there a way to determ ne the number of returns from
–30 percent through –20 percent, –10 percent through 0 percent, and so on that w auto-
mat ca y update f I change the or g na data?

■ Can I wr te one formu a that w sum up the second d g t of a st of ntegers?

■ Is there a way to ook at two sts of names and determ ne wh ch names occur on both sts?

■ Can I wr te a formu a that averages a numbers n a st that exceed the st’s med an va ue?

■ I have a sa es database for a sma makeup company that sts the sa esperson, product, un ts
so d, and do ar amount for every transact on I know I can use database stat st ca funct ons
or COUNTIFS, SUMIFS, and AVERAGEIFS to summar ze th s data Can I a so use array funct ons
to summar ze the data and answer quest ons such as how many un ts of makeup a sa esperson
so d, how many un ts of pst ck were so d, and how many un ts were so d by a spec fic sa es-
person or were pst ck?

■ What are array constants and how can I use them?

■ How can I ed t array formu as?

■ G ven quarter y revenues for a toy store, can I est mate the trend and seasona ty of the store’s
revenues?

■ G ven a st of transact ons n d fferent countr es, how can I ca cu ate the med an s ze of a
transact on n each country?

813

Answers to this chapter’s questions
Th s sect on prov des the answers to the quest ons that are sted at the beg nn ng of the chapter

What is an array formula?

Array formu as often prov de a shortcut or more effic ent approach to perform ng comp ex ca cu a-
t ons w th M crosoft Exce An array formu a can return a resu t n e ther one ce or a range of ce s
Array formu as perform operat ons on two or more sets of va ues, ca ed array arguments Each array
argument used n an array formu a must conta n exact y the same number of rows and co umns

When you enter an array formu a, you must first se ect the range n wh ch you want Exce to p ace
the array formu a’s resu ts Then, after enter ng the formu a n the first ce of the se ected range, you
must press Ctrl+Shift+Enter If you fa to press Ctr +Sh ft+Enter, you’ obta n ncorrect or nonsens ca
resu ts The process of enter ng an array formu a and then press ng Ctr +Sh ft+Enter can be referred to
as array-entering a formu a

Exce a so conta ns a var ety of array functions Chapter 42, “Summar z ng data by us ng descr pt ve
stat st cs,” d scusses the MODE.MULT array funct on You met two array funct ons (LINEST and TREND)
n Chapter 57, “Introduct on to mu t p e regress on,” and Chapter 58, “Incorporat ng qua tat ve fac-
tors nto mu t p e regress on ” As descr bed n those chapters, to use an array funct on or formu a,
you must first se ect the range n wh ch you want the formu a or funct on’s resu ts p aced Then, after
enter ng the funct on or formu a n the first ce of the se ected range, you must press Ctr +Sh ft+Enter
Th s chapter ntroduces you to three other usefu array funct ons TRANSPOSE, FREQUENCY, and
LOGEST You a so earn how to wr te your own array formu as

As you’ see, you cannot de ete any part of a ce range that conta ns resu ts computed w th an
array formu a In add t on, you cannot paste an array formu a nto a range that conta ns both b ank
ce s and array formu as For examp e, f you have an array formu a n ce C10 and you want to copy
t to the C10 J15 ce range, you cannot s mp y copy the formu a to th s range because the range
conta ns both b ank ce s and the array formu a n ce C10 To work around th s d fficu ty, copy the
formu a from C10 to D10 J10 and then copy the contents of C10 J10 to C11 J15

The best way to earn how array formu as and funct ons work s by ook ng at some examp es, so
et’s get started

How can I interpret formulas such as (D2:D7)*(E2:E7) and SUM(D2:D7*E2:E7)?

On the Tota Wages worksheet n the Arrays x sx fi e s sted the number of hours worked and the
hour y wage rates for s x emp oyees, as you can see n F gure 87-1

If you want to compute each person’s tota wages, you cou d s mp y copy the D3*E3 formu a from
F2 to F3 F7 There s certa n y noth ng wrong w th that approach, but us ng an array formu a prov des
a more e egant so ut on Beg n by se ect ng the F2 F7 range, where you want to compute each per-
son’s tota earn ngs Then enter the =(D2 D7*E2 E7) formu a and press Ctr +Sh ft+Enter You see that
each person’s tota wages are correct y computed A so, f you ook at the Formu a bar, you see that
the formu a appears as {=(D2 D7*E2 E7)} The cur y brackets are the way Exce te s you that you’ve

814  Chapter 87  Array formu as and funct ons


created an array formu a (You don’t enter the cur y brackets that show up at the beg nn ng and end
of an array formu a, but the cur y brackets nd cate that a formu a s an array formu a n th s chapter )

FIGURE 87-1  Us ng array formu as to compute hour y wages.

To see how th s formu a works, c ck n the Formula bar, h gh ght D2 D7 n the formu a, and then
press F9 You see {3;4;5;8;6;7}, wh ch s the way Exce creates the D2 D7 ce range as an array Now
se ect E2 E7 n the Formula bar and then press F9 aga n You see {6;7;8;9;10;11}, wh ch s the way
Exce creates an array correspond ng to the E2 E7 range The nc us on of the aster sk (*) te s Exce to
mu t p y the correspond ng e ements n each array Because the ce ranges be ng mu t p ed nc ude
s x ce s each, Exce creates arrays w th s x tems, and because you se ected a range of s x ce s, each
person’s tota wage s d sp ayed n ts own ce Had you se ected a range of on y five ce s, the s xth
tem n the array wou d not be d sp ayed

Suppose you want to compute the tota wages earned by a emp oyees One approach s to use
the =SUMPRODUCT(D2 D7,E2 E7) formu a Aga n, however, try to create an array formu a to compute
tota wages Beg n by se ect ng one ce (ce G2 s chosen here) n wh ch to p ace the resu t Then
enter the =SUM(D2 D7*E2 E7) formu a n ce G2 After press ng Ctr +Sh ft+Enter, you obta n (3)(6) +
(4)(7) + (5)(8) + (8)(9) + (6)(10) + (7)(11) = 295 To see how th s formu a works, se ect the D2 D7*E2 E7
port on n the Formula bar and then press F9 You see SUM({18;28;40;83;60;77}), wh ch shows that
Exce created a s x-e ement array whose first e ement s 3*6(18), whose second e ement s 4*7(28), and
so on, unt the ast e ement, wh ch s 7*11(77) Exce then adds up the va ues n the array to obta n
the tota of $295

I have a list of names in one column. These names change often. Is there an easy way to
transpose the listed names to one row so that changes in the original column of names are
reflected in the new row?

The Transpose worksheet n the Arrays x sx fi e, shown n F gure 87-2, sts a set of names n ce s
A4 A8 The goa s to st these names n one row (the C3 G3 ce range) If you knew that the or g na
st of names wou d never change, you cou d accomp sh th s goa by copy ng the ce range and then
us ng Transpose n the Paste Special d a og box (See Chapter 13, “The Paste Spec a command,”
for deta s ) Unfortunate y, f the names n co umn A change, the names n row 3 wou d not reflect
those changes f you use Paste Spec a , Transpose What you need n th s s tuat on s the TRANSPOSE
funct on

Chapter 87  Array formu as and funct ons   815


FIGURE 87-2  Us ng the TRANSPOSE funct on.

The TRANSPOSE funct on s an array funct on that changes rows of a se ected range nto co -
umns and v ce versa To beg n us ng TRANSPOSE n th s examp e, you se ect the C3 G3 range,
where you want the transposed st of names to be p aced Then, n ce C3, you array-enter the
=TRANSPOSE(A4 A8) formu a The st of names s now d sp ayed n one row More mportant, f you
change any of the names n A4 A8, the correspond ng name w change n the transposed range

I have a list of monthly stock returns. Is there a way to determine the number of returns from
–30 percent through –20 percent, –10 percent through 0 percent, and so on that will auto-
matically update if I change the original data?

Th s prob em s a job for the FREQUENCY array funct on The FREQUENCY funct on counts how many
va ues n an array (ca ed the data array) occur w th n g ven va ue ranges (spec fied by a b n array) The
syntax of the FREQUENCY funct on s FREQUENCY (data array,bin array)

To ustrate the use of the FREQUENCY funct on, ook at the Frequency worksheet n the Arrays
x sx fi e, shown n F gure 87-3 It sts month y stock returns for a fict t ous stock n the A4 A77 ce
range

FIGURE 87-3  Us ng the FREQUENCY funct on.

816  Chapter 87  Array formu as and funct ons


You find n ce s A1 and A2 (us ng the MIN and MAX funct ons) that a returns are from –44 per-
cent through 53 percent Based on th s nformat on, you can set up b n va ue boundar es n ce s
C7 C17, start ng at –0 4 and end ng at 0 6 Now se ect the D7 D18 range, where you want the resu ts
of the FREQUENCY funct on to be p aced In th s range, ce D7 w count the number of data po nts
ess than or equa to –0 4, D8 w count the number of data po nts greater than –0 4 and ess than or
equa to –0 3, and so on Ce D17 w count a data po nts greater than 0 5 and ess than or equa to
0 6, and ce D18 w count a the data po nts that are greater than 0 6

Enter the =FREQUENCY(A4 A77,C7 C17) formu a and then press Ctr +Sh ft+Enter Th s formu a te s
Exce to count the number of data po nts n A4 A77 (the data array) that e n each of the b n ranges
defined n C7 C17 The resu ts show that one return s greater than –0 4 and ess than or equa to
–0 3 Th rteen returns are greater than 0 1 and ess than or equa to 0 2 If you change any of the data
po nts n the data array, the resu ts generated by the FREQUENCY funct on n ce s D7 D17 w reflect
the changes n your data

Can I write one formula that will sum up the second digit of a list of integers?

In the A4 A10 ce range n the Sum Up 2nd D g t worksheet n the Arrays x sx fi e, seven ntegers are
sted (See 87-4 ) You wou d ke to wr te one formu a that sums up the second d g t of each number
You cou d obta n th s sum by copy ng the VALUE(MID(A4,2,1)) formu a from B4 to B5 B10 Th s for-
mu a returns (as a numer ca va ue) the second character n ce A4 Then you cou d add up the B4 B10
range and obta n the tota of 27

FIGURE 87-4  Summ ng second d g ts n a set of ntegers.

An array funct on makes th s process much eas er S mp y se ect ce C7 and array-enter the
=SUM(VALUE(MID(A4 A10,2,1)) formu a Your array formu a w return the correct answer, 27

To see what th s formu a does, h gh ght MID(A4 A10,2,1) n the Formula bar and then press F9
You see {“4”;”5”;”6”;”6”;”0”;”3”;”3”} Th s str ng of va ues shows that Exce has created an array cons st-
ng of the second d g t (v ewed as text) n the A4 A10 ce range The VALUE port on of the formu a
changes these text str ngs nto numer ca va ues, wh ch are added up by the SUM port on of the
formu a

Chapter 87  Array formu as and funct ons   817


Not ce that n ce A11, a number w th one d g t s entered Because th s number has no second
d g t, the MID port on of your formu a returns #VALUE How can you mod fy th s array formu a to
account for the poss b e nc us on of one-d g t ntegers? S mp y array-enter the {SUM(IF(LEN(A4 A11)
>=2,VALUE(MID(A4 A11,2,1)),0))} formu a n ce E8 Th s formu a rep aces any one-d g t nteger w th a
0, so you st obta n the correct sum

Is there a way to look at two lists of names and determine which names occur on both lists?

In the Match ng Names worksheet n the fi e Arrays x sx fi e, two sts of names appear ( n co -
umns D and E), as you can see n F gure 87-5 Here, you want to determ ne wh ch names on
L st 1 a so appear on L st 2 To accomp sh th s, you se ect the C5 C28 range and array-enter the
={MATCH(D5 D28,E5 E28,0)} formu a n ce C5 Th s formu a oops through the C5 C28 ce s In ce
C5, the formu a ver fies whether the name n D5 has a match n co umn E If a match ex sts, the
formu a returns the pos t on of the first match n E5 E28 If no match ex sts, the formu a returns #NA
(for not ava ab e) S m ar y, n ce C6, the formu a ver fies whether the second name on L st 1 has a
match You see, for examp e, that Artest does not appear on the second st but Harr ngton does (first
matched n the second ce n the E5 E28 range)

FIGURE 87-5  F nd ng dup cates n two sts.

818  Chapter 87  Array formu as and funct ons


To enter Yes for each name n L st 1 w th a match n L st 2, and No for each L st 1 name w thout a
match, se ect the B5 B28 ce range and array-enter the {IF(ISERROR(C5 C28),”No”,”Yes”)} formu a n ce
B5 Th s formu a d sp ays No for each ce n C5 C28 conta n ng the #NA message and Yes for a ce s
return ng a numer ca va ue Note that =ISERROR(x) y e ds True f the formu a x eva uates to an error
and y e ds Fa se otherw se

Can I write a formula that averages all numbers in a list that are greater than or equal to the
list’s median value?

On the Average Those > Med an worksheet n the Arrays x sx fi e, shown n F gure 87-6, the D5 D785
range (named Pr ces) conta ns a st of pr ces You want to average a pr ces that are at east as arge
as the med an pr ce In ce F2, compute the med an w th the Med an(pr ces) formu a In ce F3, com-
pute the average of numbers greater than or equa to the med an by enter ng the =SUMIF(pr ces,”>=”
&F2,pr ces)/COUNTIF(pr ces,”>=”&F2) formu a Th s formu a adds up a pr ces that are at east as arge
as the med an va ue (243) and then d v des by the number of pr ces that are at east as arge as the
med an The average of a pr ces at east as arge as the med an pr ce s $324 30

FIGURE 87-6  Averag ng pr ces at east as arge as the med an pr ce.

An eas er approach s to se ect ce F6 and array-enter the =AVERAGE(IF(pr ces>


=MEDIAN(pr ces),pr ces,””))} formu a Th s formu a creates an array that conta ns the row’s pr ce f the
row’s pr ce s greater than or equa to the med an pr ce or a space otherw se Averag ng th s array
g ves you the resu ts you want

Chapter 87  Array formu as and funct ons   819


I have a sales database for a small makeup company that lists the salesperson, product, units
sold, and dollar amount for every transaction. I know I can use database statistical functions
or COUNTIFS, SUMIFS, and AVERAGEIFS to summarize this data. Can I also use array functions
to summarize the data and answer questions such as how many units of makeup a salesper-
son sold, how many units of lipstick were sold, and how many units were sold by a specific
salesperson or were lipstick?

The Makeuparray x sx fi e conta ns a st of 1,900 sa es transact ons made by a makeup company For
each transact on, the transact on number, sa esperson, transact on date, product so d, un ts so d, and
do ar vo ume are sted You can see some of the data n F gure 87-7

FIGURE 87-7  Makeup database.

Th s data can eas y be summar zed by us ng database stat st ca funct ons, as descr bed n
Chapter 48, “Summar z ng data w th database stat st ca funct ons,” or by us ng the COUNTIFS and
SUMIFS funct ons (See Chapter 19, “The COUNTIF, COUNTIFS, COUNT, COUNTA, and COUNTBLANK
funct ons,” and Chapter 20, “The SUMIF, AVERAGEIF, SUMIFS, and AVERAGEIFS funct ons”) As you’
see n th s sect on, array funct ons prov de an easy, powerfu a ternat ve to these funct ons

■ How many units of makeup did Jen sell?  You can eas y answer th s quest on by us ng the
SUMIF funct on In th s worksheet, the J5 J1904 ce range s named Name and the M5 M1904
ce range Un ts The SUMIF(Name,”Jen”,Un ts) formu a was entered n ce E7 to sum up a the
un ts so d by Jen The tota s 9,537 un ts  You can a so answer th s quest on by array-enter ng
the =SUM(IF(J5 J1904=”Jen”,M5 M1904,0))} formu a n ce E6 Th s formu a creates an array
that conta ns the un ts so d for a transact on made by Jen and a 0 for a other transact ons

820  Chapter 87  Array formu as and funct ons


Therefore, summ ng th s array a so y e ds the number of un ts so d by Jen—9,537—as you can
see n F gure 87-8

FIGURE 87-8  Summar z ng data w th array formu as.

■ How many units of lipstick did Jen sell?  Th s quest on requ res a cr ter on that uses two
co umns (Name and Product) You cou d answer th s quest on by us ng the database stat st ca
funct on formu a =DSUM(J4 N1904,4,E9 F10), wh ch s entered n ce F7 Th s formu a shows
that Jen so d 1,299 un ts of pst ck You can a so obta n th s answer by us ng the array formu a
entered n ce F6, =SUM((J5 J1904=”jen”)*(L5 L1904=” pst ck”)*M5 M1904)}

To understand th s formu a, you need to know a b t about Boo ean arrays The port on of th s
formu a that reads (J5 J1904=”jen”) creates a Boo ean array For each entry n J5 J1904 that
equa s Jen, the array nc udes the va ue True, and for each entry n J5 J1904 that does not
equa Jen, the array conta ns False S m ar y, the (L5 L1904=” pst ck”) port on of th s formu a
creates a Boo ean array w th a True correspond ng to each ce n the range that conta ns the
word lipstick and a Fa se correspond ng to each ce n the range that does not When Boo ean
arrays are mu t p ed, another array s created us ng the fo ow ng ru es

• True*True = 1
• True*Fa se = 0
• Fa se*True = 0
• Fa se*Fa se = 0

Chapter 87  Array formu as and funct ons   821


In short, mu t p y ng Boo ean arrays m m cs the AND operator Mu t p y ng the product of the
Boo ean arrays by the va ues n the M5 M1904 range creates a new array In any row n wh ch
Jen so d pst ck, th s array conta ns the un ts so d In a other rows, th s array conta ns a 0
Summ ng th s array y e ds Jen’s tota pst ck sa es (1,299)

■ How many units were sold by Jen or were lipstick?  In ce G7, the database stat st ca func-
t on =DSUM(J4:N1904,4,E12:F14) was used to find that a un ts that were so d by Jen or that
were pst ck tota 17,061 In ce G6, compute the number of un ts that were so d by Jen or
that were pst ck by array-enter ng the {SUM(IF((J5 J1904=”jen”)+(L5 L1904=” pst ck”),1,0)
*M5 M1904)} formu a

Aga n, the port on of th s formu a that reads (J5 J1904=”jen”)+(L5 L1904=” pst ck”) creates two
Boo ean arrays The first array conta ns True f and on y f Jen (the formu a s not case sens t ve)
s the sa esperson The second array conta ns True f and on y f the product so d s pst ck
When Boo ean arrays are added, the fo ow ng ru es are used

• Fa se + True = 1
• True + True = 1
• True + Fa se = 1
• Fa se + Fa se = 0
In short, add ng Boo ean arrays m m cs the OR operator Therefore, th s formu a creates an
array n wh ch each row where Jen s the sa esperson or pst ck s the product so d mu t p es
the number of un ts so d by 1 In any other row, the number of un ts so d s mu t p ed by 0
The same resu t s obta ned as w th the database stat st ca formu a (17,061)

■ Can I summarize the number of units of each product sold by each salesperson?  Array
formu as make answer ng a quest on such as th s a snap You beg n by st ng each sa es-
person’s name n the A17 A25 ce range and each product name n the B16 F16 ce range
Now you array-enter the {SUM(($J$5 $J$1904=$A17)*($L$5 $L$1904=B$16)*$M$5 $M$1904)}
formu a n ce B17.

Th s formu a counts on y un ts of eye ner so d by Ash ey (1,920 un ts) By copy ng th s formu a


to C17 F17, you can compute the un ts of each product so d by Ash ey Copy the formu as n
C17 F17 to C18 C25 and compute the number of un ts of each product so d by each sa esper-
son Not ce that you must add a do ar s gn to A n the reference to ce A17 so that you a ways
pu the person’s name, and you add a do ar s gn to the 16 n the reference to ce B16 so that
you a ways pu the product

Note  Astute readers might ask why not simply select the formula in B17 and try to copy
it in one step to fill in the table. Remember that you cannot paste an array formula into a
range that contains both blank cells and array formulas, which is why you must first copy
the formula in B17 to C17:F17 and then drag it down to complete the table.

822  Chapter 87  Array formu as and funct ons


What are array constants and how can I use them?

You can create your own arrays and use them n array formu as S mp y enc ose the array va ues n
cur y brackets—{ } You need to enc ose text n doub e quotat on marks (“ “) as we You can a so
nc ude the og ca va ues True and False as entr es n the array Formu as or symbo s such as do ar
s gns or commas are not a owed n array constants

As an examp e of how an array constant m ght be used, ook at the Creat ng Powers worksheet n
the Arrays x sx fi e, shown n F gure 87-9

FIGURE 87-9  Creat ng second and fourth powers of sa es.

In th s worksheet, you’re g ven sa es dur ng s x months, and you want to create for each month the
second, th rd, and fourth power of sa es S mp y se ect the D4 F9 range, wh ch s where you want the
resu t ng computat on to be p aced Array-enter the =C4 C9^{2,3,4} formu a n ce D4 In the D4 D9
ce range, th s formu a oops through and squares each number n C4 C9 In the E4 E9 ce range, the
formu a oops through and cubes each number n C4 C9 F na y, n the F4 F9 ce range, the formu a
oops through and ra ses each number n C4 C9 to the fourth power The array constant {2,3,4} s
requ red to et you oop through d fferent power va ues

How can I edit array formulas?

Suppose you have an array formu a that creates resu ts n mu t p e ce s and you want to ed t, move,
or de ete the resu ts You cannot ed t a s ng e e ement of the array To ed t an array formu a, make
a change to any ce w th n the array and then press Ctr +Sh ft+Enter to app y the change Now, the
ent re array w be updated

Given quarterly revenues for a toy store, can I estimate the trend and seasonality of the
store’s revenues?

The Toysrustrend x sx fi e, shown n F gure 87-10, conta ns quarter y revenues ( n m ons of do ars)
for a toy store dur ng the years of 1997 through 2002 You wou d ke to est mate the quarter y trend
n revenues as we as the seasona ty assoc ated w th each quarter (first quarter equa s January–
March; second quarter equa s Apr –June; th rd quarter equa s Ju y–September; fourth quarter equa s
October–December) A trend of 1 percent per quarter, for examp e, means that sa es are ncreas ng
at 1 percent per quarter A seasona ndex for the first quarter of 0 80, for examp e, means that sa es
dur ng Quarter 1 are approx mate y 80 percent of an average quarter

The tr ck to so v ng th s prob em s to use the LOGEST funct on Suppose that you are try ng to
pred ct a var ab e y from ndependent var ab es x1, x2, , xn, and you be eve that for some va ues of

Chapter 87  Array formu as and funct ons   823


a, b1, b2, , bn, the re at onsh p between y and x1, x2, , xn s g ven by y = a(b1)x1(b2)x2(bn)xn (Ca
th s Equat on 1 )

FIGURE 87-10  Toy revenue trend and seasona ty est mat on.

The LOGEST funct on s used to determ ne va ues of a, b1, b2, , bn that best fit th s equat on to
the observed data To use the LOGEST funct on to est mate trend and seasona ty, note the fo ow ng

■ y equa s quarter y revenues

■ x1 equa s the quarter number (L sted n chrono og ca order, the current quarter s Quarter 1,
the next quarter s Quarter 2, and so on )

■ x2 equa s 1 f the quarter s the first quarter of the year and 0 otherw se

■ x3 equa s 1 f the quarter s the second quarter of the year and 0 otherw se

■ x4 equa s 1 f the quarter s the th rd quarter of the year and 0 otherw se

You need to choose one quarter to eave out of the mode (The fourth quarter was chosen here )
Th s approach s s m ar to the one used w th dummy var ab es n Chapter 58 The mode you choose
to est mate s then y = a(b1)x1(b2)x2(b3)x3(b4)x4 When the LOGEST funct on determ nes va ues of a, b1,
b2, b3, and b4 that best fit the data, the va ues are nterpreted as fo ows

■ a s a constant used to sca e the forecasts

■ b1 s a constant that represents the average per-quarter percentage ncrease n toy store sa es

824  Chapter 87  Array formu as and funct ons


■ b2 s a constant that measures the rat o of first-quarter sa es to the om tted quarter’s (fourth
quarter) sa es

■ b3 s a constant that measures the rat o of second-quarter sa es to the om tted quarter’s sa es

■ b4 s a constant that measures the rat o of th rd-quarter sa es to the om tted quarter’s sa es

To beg n, create the dummy var ab es for Quarters 1–3 n the G6 I27 ce range by copy ng the
IF($D6=G$4,1,0) formu a from G6 to G6 I27 Remember that a fourth quarter s known to Exce
because a three dummy var ab es equa 0 dur ng the fourth quarter, wh ch s why you can eave out
the dummy var ab e for th s quarter

Se ect the K6 O6 ce range, where you want LOGEST to p ace the est mated coeffic ents The
constant a w be p aced n the r ght-most ce , fo owed by the coeffic ents correspond ng to the
order ng of the ndependent var ab es Thus, the trend coeffic ent w be next to the constant, then
the Quarter 1 coeffic ent, and so on

The syntax to use for the LOGEST funct on s LOGEST(y range,x range,True,True) After array-
enter ng the =LOGEST(E6 E27,F6 I27,True,True)} formu a n ce K6, you obta n the coeffic ent est mates
shown n F gure 87-10 The equat on to pred ct quarter y revenues ( n m ons) s as fo ows

4219.57*(1.0086)quarter number*(.435)Q1dummy*(.426)Q2dummy*(.468)Q3dummy

Dur ng the first quarter, the Q1 dummy equa s 1, and the Q2 and Q3 dumm es equa 0 (Reca
that any number ra sed to the power 0 equa s 1 ) Thus, dur ng a first quarter, quarter y revenues are
pred cted to equa 4219 57*(1 0086)quar er number*( 435)

Dur ng a second quarter, the Q1 dummy and the Q3 dummy equa 0, and the Q2 dummy equa s
1 Dur ng th s quarter, quarter y revenues are pred cted to equa 4219 57*(1 0086)quar er number *( 426)
Dur ng a th rd quarter, the Q1 dummy and the Q2 dummy equa 0 and the Q3 dummy equa s 1
Quarter y revenues dur ng th s quarter are pred cted to equa 4219 57*(1 0086)quar er number*( 468)
F na y, dur ng a fourth quarter, the Q1, Q2, and Q3 dumm es equa 0 Dur ng th s quarter, quarter y
revenues are pred cted to equa 4219 57*(1 0086)quar er number

In summary, you have est mated a quarter y upward trend n revenues of 0 9 percent (around 3 6
percent annua y) After adjust ng for the trend, you find the fo ow ng

■ Quarter 1 revenues average 43 5 percent of Quarter 4 revenues

■ Quarter 2 revenues average 42 6 percent of Quarter 4 revenues

■ Quarter 3 revenues average 46 8 percent of Quarter 4 revenues

To create a seasona ndex for each quarter, you g ve the om tted quarter (Quarter 4) a va ue of 1
and find that an average quarter has a we ght equa to the fo ow ng (see ce K2 n F gure 87-10)

.435 + .426 + .468 + 1 = .582


4

Chapter 87  Array formu as and funct ons   825


Then you can compute the re at ve seasona ndex for Quarters 1–3 by copy ng the K6/$K$2 for-
mu a from K4 to L4 M4 The Quarter 4 seasona ty s computed n ce M2 w th the 1/K2 formu a After
adjust ng for the trend, you can conc ude the fo ow ng

■ Quarter 1 sa es are 80 percent of a typ ca quarter

■ Quarter 2 sa es are 73 percent of a typ ca quarter

■ Quarter 3 sa es are 75 percent of a typ ca quarter

■ Quarter 4 sa es are 172 percent of a typ ca quarter

Suppose you want to generate the forecast for each quarter correspond ng to the fitted equat on
(Equat on 1) You can use the Exce GROWTH funct on to create th s forecast The GROWTH funct on
s an array funct on w th the GROWTH(known ys,known xs,new xs,True) syntax Th s formu a g ves the
pred ct ons for the new xs when Equat on 1 s fitted to the data conta ned n the ranges spec fied by
known ys and known xs Thus, se ect ng the J6 J27 range and array-enter ng the ={GROWTH(E6 E27,
F6 I27,F6 I27,TRUE)} formu a n ce J6 generates forecasts from Equat on 1 for each quarter’s revenue
For examp e, the forecast for Quarter 4 of 1997, us ng Equat on 1, s $4 366 b on

Given a list of transactions in different countries, how can I calculate the median size of a
transaction in each country?

The Med ans x sx (see F gure 87-11) conta ns the revenue generated by a company’s transact ons n
France, the Un ted States, and Canada Here, you want to ca cu ate the med an s ze of the transac-
t ons n each country Suppose, for examp e, you want to compute the med an s ze of a transact on n
the Un ted States An easy way to do th s s to create an array that conta ns on y the US revenues and
rep aces other revenues by a b ank space Then you can have Exce  compute the med an of th s new
array After nam ng the data n co umn C Country and nam ng the data n co umn D Revenue, you
can array-enter the =MEDIAN(IF(Country=F5,Revenue,””)) formu a n ce G5 to rep ace the revenue
n each row conta n ng a non-US transact on by a b ank space and ca cu ate the med an s ze of US
transact ons ($6,376 50) Copy ng th s formu a from G5 to G6 G7 computes the med an transact on
s ze for Canada and France In effect, th s approach deve ops a MEDIANIF funct on that s ana o-
gous to the AVERAGEIF funct on of Chapter 20 Of course, th s approach cou d be used to create a
STDEVIF, PERCENTIF, or other stat st ca funct on that performs ca cu at ons on any spec fied subset of
your data

826  Chapter 87  Array formu as and funct ons


FIGURE 87-11 F nd ng med an transact on s ze n each country.

Problems
A data for Prob ems 1 through 5 are n the Chapter87data x sx fi e

1. The Dup cate worksheet conta ns two sts of names Use an array formu a to count the num-
ber of names appear ng on both sts

2. The F nd Errors worksheet conta ns some ca cu at ons Use an array formu a to count the num-
ber of ce s conta n ng errors (H nt Use the ISERROR funct on n your array formu a )

3. The Sa es worksheet conta ns 48 months of sa es at a toy store Create an array formu a to add
(beg nn ng w th Month 3) every fifth month of sa es (H nt You m ght want to use the Exce
MOD funct on MOD(number,d v sor) y e ds the rema nder after the number s d v ded by the
d v sor For examp e, MOD(7,5) y e ds 2 )

4. Use an array funct on to compute the th rd, fifth, and seventh power of each month’s sa es

5. The Product worksheet conta ns sa es dur ng Apr through August of Products 1 through 7
Sa es for each month are sted n the same co umn Rearrange the data so that sa es for each
month are sted n the same row, and changes to the or g na data are reflected n the new
arrangement you have created

Chapter 87  Array formu as and funct ons   827


6. Use the data n the H stor ca nvest x sx fi e to create a count of the number of years n wh ch
stock, bond, and T-b returns are from –20 percent through –15 percent, –15 percent through
–10 percent, and so on

7. An M by N matr x s a rectangu ar array of numbers conta n ng m rows and n co umns For


examp e,

1 2 3
4 5 6
7 8 9

s a 3-by-3 matr x Cons der two matr ces, A and B Suppose that the number of co umns n
matr x A equa s the number of rows n matr x B Then you can mu t p y matr x A by matr x B
(The product s wr tten as AB ) The entry n row I and co umn J of AB s computed by app y ng
the SUMPRODUCT funct on to row I of A and co umn J of B AB w have as many rows as A
and as many co umns as B The Exce MMULT funct on s an array funct on w th wh ch you can
mu t p y matr ces Use the MMULT funct on to mu t p y the fo ow ng matr ces

1 2 3 1 2 3
A= 4 5 6 and B= 1 2 0
7 7 0 3 3 0

8. A square matr x has the same number of rows and co umns G ven a square matr x A, suppose
there ex sts a matr x B whereby AB equa s a matr x n wh ch each d agona entry equa s 1 and
a other entr es equa 0 You can then say that B s the nverse of A The Exce array funct on
MINVERSE finds the nverse of a square matr x Use the MINVERSE funct on to find the nverse
for matr ces A and B n Prob em 7

9. Suppose you have nvested a fract on fi of your money n nvestment i (i = 1,2, ,n) In add -
t on, suppose the standard dev at on of the annua percentage return on nvestment i s si and
the corre at on between the annua percentage return on nvestment i and nvestment j s ñij
You wou d ke to know the var ance and standard dev at on of the annua percentage return
on your portfo o Th s can eas y be computed by us ng matr x mu t p cat on Create the fo -
ow ng three matr ces

• Matr x 1 equa s a 1 by n matr x whose ith entry s sifi


• Matr x 2 equa s an n by n matr x whose entry n row i and co umn j s ñij

• Matr x 3 s an n by 1 matr x whose ith entry s sifi


The var ance of the annua percentage return on your portfo o s s mp y (Matr x 1)*(Matr x
2)*(Matr x 3) The data n H stor ca nvest x sx g ves annua returns on stocks, bonds, and
T-b s Use the MMULT and TRANSPOSE funct ons to est mate (based on the g ven h stor ca
data) the var ance and standard dev at on of a portfo o that nvests 50 percent n stocks, 25
percent n bonds, and 25 percent n T-b s

828  Chapter 87  Array formu as and funct ons


Prob ems 10 through 13 use the data n the Makeupdb x sx fi e

10. How many do ars’ worth of p g oss d d Jen se ?

11. What was the average number of pst ck un ts so d by Jen n the East reg on?

12. How many do ars of sa es were made by Em ee or n the East reg on?

13. How many do ars’ worth of pst ck were so d by Co een or Zaret n the East reg on?

14. Use the data n the Chapter58data x sx fi e to est mate the trend and seasona components of
the quarter y revenues of Ford and GM

15. In the toy store examp e (us ng the Toysrustrend x sx fi e), use the data for 1999–2001 to fore-
cast quarter y revenues for 2002

16. The L ydata x sx fi e conta ns nformat on from a market research survey that was used to
gather ns ghts to a d n des gn ng a new b ood pressure drug F fteen experts (s x from L y
and n ne from other compan es—see co umn N) were asked to compare five sets of four
potent a L y products The fifth cho ce n each scenar o s that a compet tor’s drug s chosen
over the four sted L y drugs

For examp e, n the first scenar o, the second opt on cons dered wou d be a L y drug that
reduced b ood pressure 18 po nts, resu ted n 14 percent of s de effects, and so d for $16

The I5 N21 range conta ns the cho ces each expert made for each of the five scenar os For
examp e, the first expert (who worked for L y) chose a compet tor’s drug when faced w th
Scenar o 1 and chose the first sted drug when faced w th Scenar o 2 Use th s nformat on to
answer the fo ow ng

• Enter a formu a that can be cop ed from I2 to I2 M5 that ca cu ates the pr ce for each sce-
nar o and opt on n I2 M5

• Enter an array formu a n I23 that can be cop ed to I23 I32 and then to J23 M32 that ca -
cu ates for each quest on the frequency of each response (1–5), broken down by L y and
non-L y experts Thus for Quest on 1, one L y expert responded 1, three responded 2,
and two responded 5

17. The Arrayexam1data x sx fi e conta ns sa es by company and date Your job s to break sa es
down on a quarter y bas s by us ng array formu as

Summar ze (us ng on y array formu as) by company and by quarter as shown n F gure 87-12

Chapter 87  Array formu as and funct ons   829


FIGURE 87-12  Format for Prob em 17 answer.

For examp e, L7 shou d conta n Quarter 1 (January 1 through March 31) ACS sa es, and so on
Ver fy your answer w th a P votTab e

18. Exp a n why array-enter ng the =SUM(1/COUNTIF(Info,Info)) formu a w y e d the number


of un que entr es n the Info range App y th s formu a to the data n the Un que x sx fi e and
ver fy that t returns the number of un que entr es

19. The Sa ar es x sx fi e conta ns the sa ar es of NBA p ayers Wr te an array formu a that adds the
four argest p ayer sa ar es H nt Use the array constant {1,2,3,4} n conjunct on w th the LARGE
funct on Then genera ze your formu a so that you can enter any pos t ve nteger n, and your
formu a w add the n argest sa ar es H nt If ce G9 conta ns an nteger n, when you array-
enter a ROW(Ind rect(“1 ”&G9)) formu a, Exce w create an array constant {1,2, ,n}

830  Chapter 87  Array formu as and funct ons


Index

Symbols A
& (and) operator,  38, 164 abandonment opt on,  753 754
* (aster sk) w dcard,  164 ABS funct on,  322
for MATCH funct on,  28 abso ute va ue funct on,  322
^ (caret symbo ), for ra s ng number to a power,  61, 585 Access database, oad ng data from,  457
: (co on), to nd cate t me,  112 accumu ated deprec at on,  102
$ (do ar s gn) accuracy of forecasts,  574 575
and ce references,  12 est mat ng,  627
n cond t ona formatt ng formu a,  211 for pred ct ng month y cost based on un ts
>= (greater than or equa to) character,  164 produced,  602 603
(m nus) s gns, n P votTab e,  395 Add Constra nt d a og box,  299
<> (not equa to) operator,  163 B n opt on,  298
+ (p us) s gn, n P votTab e,  395 for product m x so ver prob em,  277 278
##############, d sp ay of,  112 Add ns d a og box
#D V/0! va ue,  104 Ana ys s Too Pak,  361
#N/A (Not Ava ab e) response,  16, 18, 129, 191 COM Add ns,  469
and charts,  551 add t on, w th Paste Spec a ,  119
from MODE funct on,  372 ADDRESS funct on,  192
from VLOOKUP,  103 Add Scenar o d a og box,  156
#NUM error Advanced F ter d a og box,  518
from RR funct on,  68, 69 Advanced F ter feature,  517 518
from XNPV funct on,  64 advert s ng
#NUM! error,  104, 497 mpact on sa es,  632, 635
#Per,  76 p ot show ng sa es as funct on,  582
n FV funct on,  77 age
#REF! error,  104 group ng data by,  412
#VALUE error,  44, 497, 818 nfluence on trave spend ng,  412 413
#VALUE! error,  104 AGGREGATE funct on,  103
? (quest on mark) w dcard,  164 a ternat ve hypothes s,  623
“ “ (quotat on marks) Amazon.com.x sx fi e,  641
for F statement text,  98 Amazon.x sx fi e,  209
for MATCH text va ues,  28 Amer can opt ons,  744, 748
for text n cr ter a,  163 ampersand (&), concatenat on w th,  38, 164
(underscore), n range names,  13 ana ys s of var ance. See ANOVA (ana ys s of var ance)
24 hour m tary t me,  112 Ana ys s Too Pak
{ } (cur y brackets), for array formu as,  814 for h stogram,  555
nsta ng,  598

831
analytics

ana yt cs,  261 266 MODE.MULT funct on as,  372


d fficu t es n mp ement ng,  264 265 for summar z ng sa es database
mportance,  263 transact ons,  820 822
know edge needed for,  263 264 for sum of second d g t n nteger st,  817 818
pred ct ve,  261 262, 264 TRANSPOSE funct on,  815 816
prescr pt ve,  262 263 TREND funct on,  614
trends n,  265 arrays
ana yt cs profess ona s, cert ficat on for,  263 of pr ces greater than med an,  819
Ana yze tab Worksheet range name as,  192
Changed Data Source,  409 Arrays.x sx fi e
F e d tems,  421 Average Those > Med an worksheet,  819
P votChart,  403, 413 Creat ng Powers worksheet,  823
and (&) operator,  38, 164 Frequency worksheet,  816
AND operator,  210, 493 Match ng Names worksheet,  818
for database cr ter a,  503 Tota Wages worksheet,  814
n F statement,  97, 98 Transpose worksheet,  815
an mated charts, chang ng t me ser es scatter ASC character, funct on to prov de,  38
to,  480 482 ASC characters.x sx fi e,  38
annua cost of cap ta ,  61 As ansa es.x sx fi e,  177
annua ho d ng cost,  766 Asseta ocat onopt.x sx fi e,  727
assumpt ons,  765 Asseta s m.x sx fi e,  725
m n m z ng,  770 772 Ass gn.x sx fi e,  330
annua revenue, comput ng,  140 assumpt ons
annua setup cost,  766 annua ho d ng cost for nventory,  765
annua var ab e cost,  140 find ng ce s affected by,  130 132
annua vo at ty of stock r sk ness,  702 for s mu at on,  724
annu ty n worksheet mode s,  139
number of per ods n,  76 aster sk (*) w dcard,  164
va ue n future do ars,  77 for MATCH funct on,  28
va ue of,  75 aud t ng too ,  127 138.  See also  nqu re add n
ANOVA (ana ys s of var ance) for mu t p e worksheets,  134
one way,  623 628 Aud ttwosheetstemp.x sx fi e,  137
two way,  629 640 Aud ttwosheets.x sx workbook,  134
Anova: S ng e Factor d a og box,  625 AutoComp ete
ANOVA tab e co umn head ngs for,  233
for auto sa es data,  608 w th range names,  9, 355
s gn ficance,  609 AutoF feature,  115
Anova: Two Factor W thout Rep cat on d a og AutoF ter,  503
box,  631 m tat ons,  517
App ynames.x sx fi e,  10 Automat c ca cu at on mode, for data tab es,  143
area chart, stacked,  548 Automat c Except For Data Tab es,  143
argument, error from,  104 automat c sca ng, for GRG So ver eng ne,  317
array arguments,  814 Autotemp.x sx fi e, Data worksheet,  605
array constants,  823 average
array formu as,  814 mov ng, t me ser es understood w th,  641 644
ed t ng,  823 t me wa t ng n ne at a rport or at bank,  779 782
nterpret ng,  814 815 AVERAGE funct on,  632
array funct ons,  814 for average annua return,  727
FREQUENCY funct on,  555, 816 817 copy ng,  98, 712
L NEST funct on,  603 604 for b as ca cu at on,  699

832  Index
call option

for mean nterva t me,  780 B nom a examp es.x sx fi e,  671
for mean of resamp ed h gh temperature b nom a random var ab e,  670 671
y e ds,  740 negat ve,  675 676
for mov ng averages,  653 s mu at ng,  715 716
#N/A error,  103 B nom a s m.x sx fi e,  715
samp e mean from,  371 B NOM. NV funct on,  673, 715, 718
TR MMEAN funct on vs.,  381 b n ranges,  359, 361
AVERAGE F funct on,  170, 172 count ng un ts n each,  555
AVERAGE FS funct on,  170, 172 defin ng,  360
average nventory eve ,  766 b n va ue boundar es,  817
average quant ty of sa es,  172 B ack, F scher,  743
axes B ack Scho es opt on pr c ng formu a,  704
secondary, for combo charts,  536 537 for stock vo at ty est mates,  749 750
x and y mp ement ng,  747 748
of h stogram,  361 b ack swans (extreme events),  721
abe for,  572 The B ack Swan (Ta eb),  704
sca e for spark ne,  488 b ank ce s, count ng,  162, 165
of scatter chart,  569 b ank rows, add ng to P votTab e,  406 407
b ank worksheet, creat ng,  506
bonds, a ocat ng nvestments,  725 728
B Boo ean arrays,  821, 822
bootstrapp ng,  721, 722
ba ance sheets,  99 104
for asset a ocat on,  725 726
ba oon oan,  79
break even
ba oon payment,  81
Goa Seek to determ ne,  150
band chart,  547 548
for reta er,  144
Bandchart.x sx fi e,  547
two way data tab e for,  145
Banded Co umns too ,  235
Bstempprotected.x sx fi e,  751
Banded Rows too ,  235
Bstemp.x sx fi e,  748
bar graph, creat ng,  44
bubb e charts,  565
Baseba .x sx fi e,  29
bund ng,  804 806
base of t me ser es,  645
bus ness var ab es, est mat ng re at onsh p
basketba team members, ab t es,  564 565
between,  569
Basketba .x sx fi e,  214
butterfly spread,  107
best case scenar o,  156
By Chang ng Ce , for Goa Seek,  149
BETA.D ST funct on,  691, 695 696
beta of stock,  742
beta random var ab e,  691, 694 696
Bezos.x sx fi e,  144
C
b as n past forecasts,  698 ca cu ated co umns,  455
b ds DAX formu as for,  467
ca cu at ng opt ma ,  715 720 ca cu ated fie ds,  455
for construct on project, s mu at on for de et ng,  426
opt ma ,  716 718 n P votTab e,  421 422
est mat ng standard dev at on of ca cu ated tems,  424 427
compet tors ,  716 de et ng,  426
B ds m.x sx fi e,  716 Ca cu ated tem.x sx fi e,  424
b nary chang ng ce s, n mode ng,  298 ca cu at ons, mov ng resu ts of,  117
b nary programm ng prob ems, so v ng,  301 302 ca opt on,  744
B NOM.D ST funct on,  671 672, 672 mpact of key parameter changes,  748 749
B NOMD ST funct on,  671

Index  833
call price

ca pr ce,  747 bounds on,  329


cap ta budget ng for forecast ng,  657
opt on pr c ng to mprove,  752 n mode ng,  298
So ver for,  297 304 n opt m zat on mode ,  268
caret symbo [^], for ra s ng number to a power,  61, for product m x So ver mode ,  275
585 for software project se ect on prob em,  298
cascad ng st se ect on,  355 for So ver workforce schedu ng,  286
case sens t v ty, of F ND funct on,  37 for transportat on prob em,  291
cash flows characters.  See also text str ngs
from ca opt on,  744 CLEAN funct on to remove nv s b e,  39
compar ng,  59 count for text str ng,  37
from European put opt on,  745 F ND funct on to extract,  41
find ng RR,  68 max mum number n formu as,  105
find ng RR for rregu ar y spaced,  71 CHAR funct on,  38
net present va ue of, nterest rate and,  67 Chartdynam crange.x sx fi e,  183
number of years for payback of n t a nvestment charts,  533 568
cost,  31 32 add ng trend ne,  572
Category abe .x sx fi e,  542 automat c updates after add ng data,  236
ce ranges.  See also cond t ona formatt ng band chart for check ng nventory eve s, 
gett ng stat st cs descr b ng,  381 547 548
MATCH funct on to ocate pos t on for va ue bas ng on tab e,  237
n,  28 bubb e,  565 566
OFFSET funct on for reference to,  175 186 chang ng t me ser es scatter to an mated, 
se ect ng a data n co umn or row,  120 480 482
va ue ookup from,  15 check boxes to contro ser es,  551 552
ce references C ustered Co umn 2D,  549
$ (do ar s gn) and,  12 co umn abe s, troub eshoot ng d sp ay,  542
n ND RECT funct on,  187 194 comb nat on,  534 536
ce s secondary ax s for,  536 537
co or of, sort ng based on,  226 227 cond t ona co ors n,  556 557
count ng based on character st cs,  165 data abe s,  542 544
count ng those conta n ng number,  162 based on ce contents,  544 547
count of those meet ng g ven cr ter on,  162 dynam c,  549 551
dependency between,  87.  See also c rcu ar of data po nts,  569
references Gantt,  553
extract ng data to separate,  41 43, 180 h dden data appearance,  539
find ng those affected by assumpt ons,  130 132 h stogram automat c update for new data, 
formatt ng for hours, SUM and,  114 555 556
h gh ght ng dependents for act ve,  132 L ne W th Markers,  551
gnor ng,  103 st box to se ect ser es,  552 553
v ew ng va ue changes,  130 m ss ng data and,  538 539
ce va ues, shad ng to d sp ay d fferences,  203 204 mov ng average,  643
centered mov ng averages, ca cu at ng,  653 Mu t p es to create,  482 483
centra m t theorem,  687, 702 Pareto,  562 563
centra ocat on measures,  371 374 p ctures n co umn graphs,  540 541
cert ficat on for ana yt cs profess ona s,  263 n Power V ew,  469
ceter s par bus,  608 creat ng,  473 474
Change Tab e Name too ,  235 fi ter ng,  474 478
chang ng ce s fi ter ng w th s cer,  476 477
A D fferent constra nts for,  335 fi ter ng w th T es,  477

834  Index
conditional formatting

radar,  564 565 co or sca es,  203 204


res z ng,  473 for cond t ona formatt ng,  197
scatter,  569 COLUMN funct on,  192
of cumu at ve un ts produced and un t co umn graphs, p ctures n,  540 541
costs,  584 585 co umn abe s, n charts, troub eshoot ng
var ab e changes d sp ayed w th,  565 d sp ay,  542
separate for each product,  482 483 Co umn Labe s zone, n P votTab e F e d st,  390
sorted data as bas s,  554 555 co umns
Stacked 2D bar,  553 ca cu ated,  455
stacked area,  548 c ear ng fi ters from,  506
Stacked Co umn,  473 copy ng formu a to a ce s n,  98
stor ng as temp ate,  548 formu a to return ast number n,  181
tab es n,  542 freez ng to keep v s b e,  97
thermometer for progress d sp ay,  548 549 h d ng,  19
updates automat ca y,  183 h d ng or unh d ng,  144
vert ca ne for separat on,  564 NDEX funct on to reference,  25
waterfa ,  557 558 as named range,  9
chart t t es, nk ng to ce s,  549 551 rea gn ng data to rows,  118 119
Chart Too s Layout tab, Ana ys s, Trend ne,  570 referenc ng by name,  90
check boxes,  246 se ect ng a data n,  119
for scro bar,  252 comb nat on charts,  534 536
to contro ser es chart ng,  551 552 Comb nat onstemp.x sx fi e,  534
churn rate,  758 comb n ng text str ngs,  41
c rcu ar references,  9, 87 92, 102 combo box,  246
reso v ng,  88 90 Combobox.x sx fi e,  256
C rcu ar.x sx fi e,  88 combo charts, secondary ax s for,  536 537
C scoexpo.x sx fi e,  577 comments n worksheets,  736 737
c t es, st of d stances between,  23 24 compact form for P votTab e,  393
C eanexamp e.x sx fi e,  44 compar ng workbooks, nqu re add n for,  136 137
CLEAN funct on,  39, 44 compound nterest,  745
c ear ng computed cr ter a, for database funct ons,  495
data va dat on,  355 CONCATENATE funct on,  38, 41
fi ters from co umn or database,  506 Cond co ors.x sx fi e,  556
C ear Ru es, for cond t ona formatt ng,  197 cond t ona formatt ng,  195 222
C ustered Co umn 2D chart,  549 based on rat ng for p ayer ab t es,  214 215
coeffic ents chart co ors,  556 557
of dummy var ab es,  609 copy ng w th Format Pa nter,  218 219
of ndependent var ab es,  612 custom z ng ru es,  199 200
nterpret ng n regress on equat on,  608 609 data bars,  201 202
cohort,  758 dates as bas s for,  199
co aps ng P votTab e fie ds,  395 396 de et ng,  209
co on (:), to nd cate t me,  112 de et ng ru e,  200
co or emp oyee rat ngs h gh ghted w th,  332 333
of ce or font, sort ng based on,  226 227 H gh ght Ce s,  198 199
n charts, cond t ona formatt ng of,  556 557 con sets n,  203 204
cod ng month y stock returns,  207 208 opt ons,  196
fi ter ng by,  513 order of precedence for ru es,  209
for spark nes,  488 out ers h gh ght ng w th,  375 382
for weekend dates,  213 P votTab e w th,  407 409
Co orsca e nvestment.x sx fi e,  203 for profit max m z ng two part tar ff,  808

Index  835
Conditional Formatting Rules Manager dialog box

for revenue quarters,  209 212 cost of goods so d (COGS),  101


se ect ng ce s hav ng,  209 costs
togg ng on and off,  252 253 of nventory shortage,  769
Cond t ona Formatt ng Ru es Manager d a og nventory to m n m ze annua ho d ng, order ng
box,  200, 212 and shortage costs,  770 772
formu a opt on,  211 of ost sa es,  769
Use A Formu a,  210 m n m z ng for nventory and orders,  763 765
cond t ona tests. See  F statements month y fixed,  573
confidence nterva , for mean profit,  712 operat ng, exp a n ng month y var at on,  574
confl ct, n cond t ona formatt ng ru es,  209 pred ct ng for factory product on of 3
Conso date d a og box,  523 products,  597 602
conso dat ng data,  521 526 var ab e,  574
constra nts COUNTA funct on,  162, 166, 180
on pr ce,  799 COUNTBLANK funct on,  162, 165
for product m x So ver mode ,  275 COUNT funct on,  162, 165, 495
for software project se ect on prob em,  298 OFFSET funct on w th,  181
So ver hand ng of,  300 COUNT F funct on,  162, 163, 164, 331, 554, 707, 724,
for So ver workforce schedu ng,  286 734, 736, 819
for transportat on prob em,  291, 292 ser a number for date n,  165
construct on project, s mu at on for opt ma COUNT FS funct on,  162, 170
b d,  716 718 array funct on a ternat ves,  820
consumer surp us of purchase,  805, 807 mu t p e cr ter a for,  165
cont nuous random var ab e,  665 country
mode ng as norma random var ab e,  716 ca cu at ng med an s ze of revenue,  826 827
Contrateeoq.x sx fi e, Cont Rate EOQ worksheet,  766 d sp ay ng sa es data by,  478 479
Convert Text To Co umns W zard,  180 track ng revenues based on,  177 178
extract ng data w th,  43 47 craps
Convert to Range too ,  235 determ n ng status after first ro ,  99
copy ng probab ty of w nn ng,  731 733
array formu as,  814 Create From Se ect on,  4 5
cond t ona formatt ng w th Format Pa nter,  Create L nks To Source Data opt on, for conso dat ng
218 219 data,  524, 525
fi tered transact ons to d fferent worksheet,  506 Create P votTab e d a og box,  388 389, 448, 463
formatt ng automat ca y,  231 235 Create Re at onsh p d a og box,  443
formu as automat ca y,  231 235 Create Spark nes d a og box,  486
formu a to a ce s n co umn,  98 cred t card company, retent on rate,  757 759
HLOOKUP funct on,  331 Cred tun on.x sx fi e, Or g na worksheet,  655
sp nner buttons,  248 Cr medata.x sx fi e,  480
worksheets,  236 CR TB NOM funct on,  673
corre at on cr ter a
and regress on toward the mean,  595 for database funct ons,  493
re at onsh p to r squared va ue,  594 for SUM F funct on, ru es for,  170
summar z ng re at onsh ps w th,  589 596 mu t p e, for COUNT FS funct on,  165
Corre at on d a og box,  591 592 mu t p e for sort,  224
corre at on matr x,  593 594 ranges setup,  497
CORREL funct on,  594 CUM PMT funct on,  81 82
Costest mate.x sx fi e,  571, 574 CUMPR NC funct on,  81 82
cost m n m z ng batch s ze,  766 767 cumu at ve cash flow, ca cu at ng,  32
cost of cap ta ,  61 cur y brackets ({ }), for array formu as,  814
RR vs.,  70 current t me, d sp ay ng,  113

836  Index
Data tab

Custom AutoF ter d a og box,  507, 512 of dates,  53


customers on mu t p e worksheets,  124
determ n ng va ue,  757 762 prevent ng date errors,  351
factors mpact ng traffic,  655 658 prevent ng nonnumer c va ue,  352
graph c summary of da y counts,  485 487 state abbrev at ons st for,  353
ncent ves to sw tch compan es,  759 760 of t me and date n one ce ,  112
custom z ng con sets,  206 of t mes,  112
Custom L sts d a og box, for custom sort order,  228 too t ps for,  350
cutoffs, comput ng for out er,  376 updat ng ca cu at ons after,  409
data abe s n charts,  542 544
based on ce contents,  544 547
D Data Mode ,  441 454
add ng data to,  442 443, 447
dashboards, dynam c,  559 561
bas cs,  441 442
data
de et ng data from,  448
chang ng for spark nes,  488
P votTab e creat on w th,  444 446, 448 449
conso dat ng,  521 526
Qu ck Exp ore opt on,  446 447
extract ng from P votTab e,  427 429
Datamode temp.x sx fi e
extract ng to separate ce ,  180
Reps worksheet,  442
h dden, charts and,  539
Sa es worksheet,  442
h stograms for summar z ng,  359 368
data po nts,  359
mport ng
graph of,  569
from nternet,  345 348
data sets
from text fi e or document,  339 344
defin ng typ ca va ue for,  370 374
oad ng nto PowerP vot,  456 463
descr pt ve stat st cs for compar ng,  377
m ss ng, charts and,  538 539
find ng second sma est or argest number n,  379
prepar ng for Power V ew,  470 473
measur ng spreads,  374 375
rea gn ng from row or co umn,  118 119
percent e rank ng n,  377 379
reapp y ng fi ter after changes,  517
range of,  375
sort ng for subtota s,  530
rank ng numbers n,  380
summar z ng. See descr pt ve stat st cs
tr mmed mean,  380 381
va dat ng,  349 358
data sources
Data Ana ys s command, runn ng regress on
creat ng re at onsh p between,  462 463
w thout,  603 604
Data tab
Data Ana ys s d a og box,  360
Data Ana ys s,  360, 612
Anova: S ng e Factor,  623, 624
Anova: Two Factor W thout Rep cat on,  630
Anova: Two Factor w th Rep cat on,  633 634
Corre at on,  591
Regress on,  608, 612
Descr pt ve Stat st cs,  369
data ana ys s, resamp ng for,  739 742
Regress on,  598
data array,  816.  See also arrays
So ver,  269, 275, 773
data bars,  201 202
Data Too s
for cond t ona formatt ng,  197
Conso date,  523
n P votTab e,  407
Text To Co umns,  180
database,  503
Text To Co umns, De m ted,  43
c ear ng fi ters from,  506
Data Va dat on,  349, 352
oad ng data from,  457
C ear A ,  355
Number F ters for,  507
Get Externa Data,  470
database stat st ca funct ons,  491 500
From Web,  345
data entry
Out ne, Subtota ,  527
automat c chart updates after add ng,  236
Re at onsh ps,  443, 449

Index  837
Data Table dialog box

Remove Dup cates,  514 515 sa es stat st cs based on,  495


Sort & F ter ser a number for,  111
Advanced,  517 Dates.x sx fi e,  54, 57, 58
F ter,  503 DATEVALUE funct on,  55
Sort,  224 DAVERAGE funct on,  494
Sort A To Z,  229 DAX (Data Express on Language) funct ons,  455,
What f Ana ys s 466 468
Data Tab e,  141, 142, 143, 145, 496, 718, 723, DAY funct on,  58
726, 732, 734, 781 DAY funct on (DAX),  467
Goa Seek,  150 day of week
Scenar o Manager,  156 Autofi for,  115
Data Tab e d a og box,  141 se ect ng,  256
data tab es DCOUNT funct on,  495
comb n ng w th funct ons,  143 144 debt.  See also  oans
for EOQ sens t v ty,  765 comput ng,  101
one way debugg ng, formu a segment va ue d sp ay for,  181
for mpact of agent count,  781 dec s ons, mathemat ca mode s for,  262
for poker hand s mu at on,  734 defau t sett ngs, number of worksheets n
for resamp ng,  741 workbook,  124
sav ng va ues n,  142 Define Name command,  5 7
scenar o generat on w th,  723 724 degrees of freedom,  604
two way,  711 de et ng
data va dat on array formu as and,  814
c ear ng,  355 ca cu ated tem or ca cu ated fie d,  426
se ect ng ce s w th sett ngs,  355 cond t ona formatt ng,  197, 200, 209
Data Va dat on d a og box data from Data Mode ,  448
Error A ert tab,  350, 351 dup cates from tab es,  235
nput Message tab,  350 range names,  6
st va dat on n,  353 354 re at onsh ps,  449 450
Sett ngs tab,  350, 351 subtota s,  528
DATED F funct on,  58 59 de m ted opt on, for mport ng data,  339, 341
Datedv.x sx fi e,  351 De vo .x sx fi e,  746
DATE funct on,  58 demand
Date ookup.x sx fi e,  19 constra nt,  293
A Date Occurr ng d a og box,  199 e ast c ty of,  786
dates subject ve y determ ned, for product
Autofi for day of week,  115 pr c ng,  797 802
ca cu at ng n re at on to another date,  56 demand curve
co or for weekend,  213 and customer w ngness to pay for
cond t ona formatt ng based on,  199 product,  788 789
data entry of,  53 est mat ng,  785 790
determ n ng number of workdays between demand po nts,  291
two,  57 dens ty funct on of random var ab e,  684
entry w th t me n one ce ,  112 dependency between ce s,  87.  See also c rcu ar
extract ng month, year, day from,  58 references
fi ter ng based on,  508 510 dependents,  130
Genera format of,  55 h gh ght ng for act ve ce ,  132
prevent ng data entry errors,  351 dependent var ab es,  569
pr ce ookup based on,  19 graph for,  571
nfluence of two factors,  629

838  Index
error values

non near effect of ndependent var ab e nterpret ng coeffic ents of,  609
on,  615 616 dup cates, remov ng from tab e,  235
deprec at on, comput ng,  102 durat on of act v ty, mode ng,  691, 694 696
descr pt ve stat st cs,  369 384 dynam c dashboards,  559 561
data sets compar son w th,  377 Dynam ch stograms.x sx fi e,  555
for range of ce s,  381 dynam c abe s, charts w th,  549 551
Descr pt ve Stat st cs d a og box,  370 dynam c range,  355, 525
deseasona zat on of sa es est mates,  652 654 name for,  182
Des gn tab Dynam crange.x sx fi e,  182
Add Chart E ement, Data Labe s,  545
Layout Group, Report Layout,  393
Map,  479 E
Tab e Sty e Opt ons, Tota Row check box,  238
Eastandwestconso dated.x sx fi e,  525
Deve oper tab
econom c order quant ty nventory mode ,  763 768
Contro s, nsert,  245, 248
economy, nfluence on pres dent a e ect ons,  610
nsert,  253, 256
Ed t Formatt ng Ru e d a og box,  203, 205, 214, 376
Form Contro s,  552
ed t ng
DGET funct on,  497 498
array formu as,  823
Dget.x sx fi e,  497
comments,  737
d sab ng F ash F ,  47
cond t ona formatt ng ru e,  209
d scounted cash flow,  61
range names,  6
d scount rate, for cash flows NPV equa z ng zero,  72
re at onsh ps,  449 450
d screte random var ab e,  664, 666, 683
Ed t the Ru e Descr pt on d a og box,  202
s mu at ng va ues,  708 709
80/20 ru e,  562
D scretes m.x sx fi e, S m worksheet,  708
e ast c ty,  583
D sp ay Equat on On Chart opt on for trend ne,  572
of demand,  786
D sp ay R Squared Va ue On Chart opt on for
ema addresses, F ash F to create,  46
trend ne,  572
emp oyee rat ngs, cond t ona formatt ng for
d stances between c t es, funct on to return,  23 24
h gh ght ng,  332 333
D ST NCTCOUNTemp.x sx fi e,  450
Enab e terat ve Ca cu at on,  87, 88, 102
D ST NCT COUNT funct on,  450 452
end ng ba ances, for each month,  80
D ST NCT funct on (DAX),  467
end ng t me, ca cu at ng number of hours between
d str but on prob ems, So ver for,  291 296
start ng t me and,  114
#D V/0! va ue,  104
Eoq.x sx fi e, EOQ worksheet,  764
d v dends,  101
error a ert,  350
d v s on
Error Check ng,  128
w th Paste Spec a ,  119
Error Check ng d a og box,  129
by zero,  104
errors
document, mport ng data from,  339 344
from dummy var ab e,  606
do ar s gn ($)
n forecasts,  660
and ce references,  12
randomness of,  661 662
n cond t ona formatt ng formu a,  211
errors (res dua s)
“dr ng down” n P votTab e,  427 429
for data po nts,  574
Drugfore.x sx fi e,  698
for trend ne and data po nt,  573
DSUM funct on,  493 494, 821, 822
Errortrap.x sx fi e,  103
w th cr ter a range of Name and Product,  496
Errortypes.x sx fi e,  104
SUM funct on vs.,  491 492
error va ues,  103
syntax,  493
#D V/0! va ue,  104
dummy var ab es,  606 607
#N/A (Not Ava ab e),  16, 18, 129, 191, 818
creat ng,  825

Index  839
Esc key, stopping Solver with

from MODE funct on,  372 Exponent a d st.x sx fi e, Dens ty worksheet,  681
from VLOOKUP,  103 exponent a graph,  570
#NUM!,  497 exponent a growth, m tat ons,  580
#VALUE,  497, 818 exponent a growth mode ng,  577 580
Esc key, stopp ng So ver w th,  321 obta n ng best fitt ng curve,  578
est mates extract ng characters, F ND funct on for,  41
accuracy of forecasts,  627 extract ng data
of demand curve,  785 790 Convert Text To Co umns W zard,  43 47
deseasona zat on for sa es,  652 from P votTab e,  427 429
probab t es of uncerta n events,  705 714 to separate ce ,  41 43, 180
of revenue trends and seasona ty,  823 826 extreme events (b ack swans),  721
European opt on,  744 extreme skewness,  380 381
European put opt ons
cash flow from,  745
pr ce of,  748 F
stock purchase w th,  95 96
Fa r, Roy,  610
Eva uate Formu a d a og box,  181
favor te rat ng underdog rat ng,  735
Evo ut onary So ver eng ne,  270, 323, 327, 809
Fax.x sx fi e,  584
pena t es and,  329 334
feas b e so ut on,  270
trave ng sa esperson prob em n,  337
fie ds
worker ass gnment to workgroups,  330 332
ass gn ng to creat P votTab e report,  465
exact near re at onsh p,  607
ca cu ated,  455
Exce 2007, cond t ona formatt ng feature
n database,  503
changes,  195
n P votTab e, co aps ng and expand ng,  395 396
Exce Error Trap capab ty,  128
fi tered transact ons, copy ng to d fferent
Exce Eva uate Formu a feature,  181
worksheet,  506
Exce finfunct ons.x sx fi e,  79
fi ter ng,  501 520
Exce Opt ons d a og box
based on date,  508 510
Add ns,  135
by beg nn ng etter of name,  512
So ver Add n,  269
charts
Advanced,  47
w th s cer,  476 477
Ed t ng Opt ons,  47
w th T es,  477
Custom ze R bbon, Ma n tabs,  245
c ear ng from co umn or database,  506
Formu as
by co or,  513
Automat c Except for Data Tab es,  143
P votTab e fie ds,  397 403
Enab e terat ve Ca cu at ons,  87, 88, 102
Power V ew charts,  474 478
Work ng W th Formu as,  429
reapp y ng after data changes,  517
Use Automat c Sca ng,  307
Tab e s cers for,  240
Exce So ver. See So ver
top 30 revenue va ues by sa esperson,  513 514
exerc se date,  744
transact ons,  503 504, 505
exerc se pr ce,  744
transact ons by months,  511 512
Ex st ng Connect ons d a og box,  447
F na 4s m.x sx fi e,  735
expand ng P votTab e fie ds,  395 396
financ a ana ysts, geometr c mean use by,  381
exper ence curve,  583
financ a funct ons,  76
exper ment,  663
CUM PMT funct on,  81 82
exp rat on date,  744
CUMPR NC funct on,  81 82
EXPON.D ST funct on,  681
FV funct on,  77
EXPOND ST funct on,  681
PMT funct on,  79
exponent a curve, sum of squared errors for,  585
NPER funct on,  82

840  Index
function keys

NPV funct on,  75 76 Format Trend ne d a og box,  570, 572, 798 799
PMT funct on,  79 Exponent a ,  578
PPMT funct on,  79 Power,  584
financ a p ann ng, So ver for,  305 312 forms, d sp ay ng contro s,  245
F ND funct on,  37, 41, 42, 180 Formu a Aud t ng too bar,  128
F nmathso ver.x sx fi e, PMT By So ver Formu a AutoComp ete,  233
worksheet,  306 Formu a bar,  2
F rst Co umn too ,  235 array formu as n,  814
five card draw poker, probab ty of three of a k nd formu as.  See also array formu as
hand,  733 734 add ng range name to,  8
fixed costs, month y,  573 aud t ng too to trace,  131
fixed w dth opt on, for mport ng data,  339, 341 copy ng automat ca y,  231 235
flagg ng fie ds, conta n ng text str ng,  497 copy ng resu ts on y,  117
F ash F ,  45 d sp ay ng range names n ex st ng,  10
d sab ng,  47 entry for arge co umn of numbers,  315
to extract data,  180 ND RECT funct on to read range name port on
F ashfi .x sx fi e,  45 n,  191
Font d a og box, auncher,  751 nqu re add n to d sp ay re at onsh ps,  137
fonts max mum number of characters n,  105
co or of, sort ng based on,  226 227 past ng range names nto,  165
s ze for h stogram,  362 protect ng from change,  750 751
W ngd ngs,  546 547 range names n,  2
forecasts se ect ng a n worksheet,  751
accuracy for pred ct ng month y cost based on three d mens ona ,  123 126
un ts produced,  602 603 togg ng d sp ay w th va ue d sp ay,  128
bas s for eva uat ng,  698 700 Formu as tab
errors,  699 Ca cu at on
randomness of,  661 662 Automat c Except For Data Tab es,  143
standard dev at on of,  632 Ca cu at on,  712
est mat ng accuracy,  627 Create From Se ect on,  8
generat ng from mu t p e regress on,  613 614 Defined Names,  183, 192
one way ANOVA for,  627 Create From Se ect on,  1, 4, 163, 794
probab ty statements from,  697 700 Define Name, App y Names,  11
rat o to mov ng average,  651 654 Name Manager,  182
sa es based on sa es representat ves and Formu a Aud t ng,  127
d str cts,  632 Eva uate Formu a,  181
spec a events mpact ng,  655 662 Trace Dependents,  130
Format Ce s d a og box,  55, 198, 207 Trace Precedents,  134
date d sp ay n,  54 Name Manager,  6, 233
Protect on tab,  751 Define Name,  5
Format Contro d a og box,  252 FORMULATEXT funct on,  128
for check box,  254 four per od mov ng average,  642 643
for sp nner button,  249 Freeze Panes command,  97, 251 252
Format Data Ser es, F , P cture,  541 FREQUENCY array funct on,  555, 816 817
Format Pa nter, copy ng cond t ona formatt ng F stat st c,  604
w th,  218 219 funct on keys
formatt ng.  See also cond t ona formatt ng F3 for past ng range names,  165
copy ng automat ca y,  231 235 F4 for chang ng do ar s gns n ce reference,  211
P votTab e changes,  395 F9 for terat ons,  712

Index  841
functions

F9 for reca cu at on,  143 Grocer espt.x sx fi e,  387


F9 to d sp ay formu a segment va ue,  181 A Row F e ds worksheet,  391
funct ons S cers worksheet,  405
comb n ng w th data tab e,  143 144 grocery sa es at severa stores, summar es,  387 388
max m z ng n GRG Non near eng ne,  320 gross fixed assets,  102
m n m z ng n GRG Non near eng ne,  321 gross nat ona product (GNP),  607
Funct on W zard, He p On Th s Funct on,  103 group box, opt on button n,  255
future va ue (Fv),  76 Group ng d a og box,  413
of PMT funct on,  79 group ng tems, n P votTab e,  423 424
FV funct on,  77 GROWTH funct on,  826
guess, for RR funct on,  68

G
gamb ng probab t es s mu at on,  731 738
H
Gantt chart,  553 Header Row too ,  235
Gauss Se de terat on,  89 head ngs for P votTab e,  388
gender He p On Th s Error,  128
nfluence on amount spent on trave ,  411 412 He p On Th s Funct on,  103
non near effect on sa ary,  617 618 H dden.x sx fi e,  539
Genera format of date,  55 h d ng
genet c a gor thms,  323 co umns,  19, 144
geometr c mean,  381 Grand Tota ,  426
GEOMMEAN funct on,  382 rows,  144
Geommean.x sx fi e,  381 subtota s n P votTab e,  406 407
Ges m ess5.x sx fi e,  724 H gh ght Ce s cond t ona formatt ng,  196, 198 199
GETP VOTDATA funct on,  427 429, 559 561 H gh ghtce s.x sx fi e,  198
turn ng off,  429 h gh po nts on Spark nes,  487
Getp votdata.x sx fi e,  427 H stogram d a og box,  361
GET.WORKBOOK macro,  192 h stograms,  44
G oba warm ng2011.x sx fi e,  197 automat c update for new data,  555 556
Goa Seek command,  149 154, 759, 788 common shapes,  363 365
for a gebra story prob ems,  151 152 compar ng from d fferent data sets,  366
for mp ed vo at ty,  749 750 for data summar es,  359 368
Goa Seek d a og box,  150, 151, 760 761 gaps between bars,  362
Go To d a og box,  134, 209, 751 H stor ca nvesttemp.x sx fi e,  7
Spec a ,  355 H stor ca nvest.x sx fi e,  206
grad ent fi , for data bars,  201 HLOOKUP funct on,  16, 19
Grand Tota , h d ng,  426 copy ng,  331
n P votTab e,  406 ho d ng costs, safety stock and,  771
graph c summary, of da y customer counts,  ho days, WORKDAY funct on and,  56
485 487 Ho and, John,  323
graphs. See charts Home tab
greater than or equa to (>=) character,  164 Ce s, Format, H de & Unh de,  19, 144
GRG Mu t start,  326 Cond t ona Formatt ng,  197
GRG non near eng ne,  269, 317 Data Bars,  407
m n m z ng funct ons n,  321 New Ru e,  254, 332, 376
opt m zat on mode s n,  320 323 Top/Bottom Ru es,  808
troub e n,  322 D agram V ew,  462
GRG Non near tab, Mu t start opt on,  321 Ed t ng, F ,  711

842  Index
Insert tab

for PowerP vot w ndow,  456 pred ct ve power of,  601


Sty es, Cond t ona Formatt ng,  196 p va ue of,  601 602, 608
hor zonta ookup,  15 NDEX funct on,  23 26, 336, 552, 554
HOUR funct on,  113 MATCH funct on and,  29
hours ndex.x sx fi e,  23
ca cu at ng number to comp ete job,  113 nd rectconso date.x sx fi e,  191
ce formatt ng, SUM and,  114 ND RECT funct on,  187 194, 355
HTML tab e, mport ng from,  345 product sa es summary from,  191 192
HYPERGEOM.D ST funct on,  674 675 to read range name port on n formu a,  191
Hypergeom.d st.x sx fi e,  674 SUM funct on w th,  188
hypergeometr c random var ab e,  673, 674 675 nd rectmu t sheet.x sx fi e,  189
nd rects mp eex.x sx fi e,  187
ndustr es, earn ng curve est mates for var ous,  586
I nfeas b e so ut on,  281
NFORMS ( nst tute for Operat ons Research and
con sets,  545
Management Sc ence),  263
for cond t ona formatt ng,  197
nput assumpt ons, n worksheet mode s,  139
sort ng data based on,  227
nput ce s, nk ng sp nner buttons to,  249 250
FERROR funct on,  103, 550, 560
nput range, for h stogram,  361
F statements,  93 110
nqu re add n,  135 138
for break even ana ys s,  145
to d sp ay formu a re at onsh ps,  137
nested,  95 96, 105
for re at onsh ps between worksheets,  137
OR operator,  99
workbook compar son,  136 137
purchase pr ce as funct on of number of un ts
workbook nformat on from,  136
purchased,  94 95
nqu re tab,  136
So ver and,  809
Ce Re at onsh p,  137
w th ROW and MOD funct ons,  104
Worksheet Re at onsh ps,  137
fstatement.x sx fi e
nsert Ca cu ated F e d d a og box,  421
Craps worksheet,  99
nsert Ca cu ated tem d a og box,  426
Hedg ng worksheet,  95
nsert ng
Quant ty D scount worksheet,  94
comments,  736
gnored ce s,  103
worksheets n workbook,  124
mp ed vo at ty approach,  749
nsert P ctures d a og box,  541
mport ng data
nsert P votTab e command,  418
from nternet,  345 348
nsert tab
to PowerP vot,  457
Charts
text fi es for,  459
L ne,  236
from text fi e or document,  339 344
Scatter,  545, 571, 578, 798
ncent ves, for customers to sw tch compan es, 
Scatter, Bubb e Chart,  565
759 760
Scatter, Scatter w th Stra ght L nes,  787
ncome before taxes, comput ng,  102
Scatter W th Smooth L nes And Markers, 
ncome statements,  99 104
641 642
ncome.x sx fi e,  216
Co umn Charts,  534
ndependent random var ab es,  666
F ters
norma d str but on of sum,  687
S cers,  240
ndependent var ab es,  569
T me ne,  429
coeffic ents of,  612
P votTab e,  448
graph for,  571
Add Th s Data To The Data Mode ,  442
mu t p e,  597
Radar chart,  564
non near effect on dependent var ab e,  615 616
Reports, Power V ew,  469, 470

Index  843
installing Analysis ToolPak

S cer,  405 uncerta nty of future returns,  721


Spark nes nv s b e characters, CLEAN funct on to remove,  39
L ne,  485 PMT funct on,  79
W n/Loss,  490 RR. See  nterna rate of return ( RR)
Tab es,  232 RR funct on,  68
P votTab e,  388 RR.x sx fi e,  68, 72
Worksheet,  506 SERROR funct on,  819
nsta ng Ana ys s Too Pak,  598 SFORMULA funct on,  128
nteger, for date d sp ay,  54 SFORMULATEXT.x sx fi e,  128
nteger Opt ma ty sett ng,  301 302 SNUMBER funct on,  352 353
nteger programm ng prob ems, so v ng,  301 terat ons
nteract ons.x sx fi e enab ng for ca cu at ons,  87, 88
Data worksheet,  616 F9 funct on keys for,  712
Non near ty worksheet,  615 s mu at ng,  712
nteract on, test ng for presence n regress on, 
616 619
nterarr va t me,  778 J
mean,  780
James, B ,  264
NTERCEPT funct on,  575, 653
job shop schedu ng prob ems,  335
ntercept of ne, n stra ght ne re at onsh p,  575
nterest
accumu at ng for severa per ods,  81
payment amount n oan,  79
K
nterest expense, comput ng,  101 keyboard funct on keys
nterest ncome, comput ng,  101 F3 for past ng range names,  165
nterest rate,  607 F4 for chang ng do ar s gns n ce reference,  211
ca cu at ng for borrowed amount,  81 F9 for terat ons,  712
and cash flows NPV,  67 F9 for reca cu at on,  143
nterest rate per per od,  76 F9 to d sp ay formu a segment va ue,  181
nterna rate of return ( RR),  67 74 KP s (Key Performance nd cators),  455
find ng for rregu ar y spaced cash flows,  71 Kurtos s,  373
mod fied,  71
nternet Exp orer, Export To M crosoft Exce
from,  348 L
nternet, mport ng data from,  345 348 abe s
nva d data, Exce defau t response to,  350 charts w th dynam c,  549 551
nva d range name,  13 for h stogram,  362
nventory for x and y ax s,  572
band chart for check ng eve s,  547 548 Labe sandtab es.x sx fi e,  542
econom c order quant ty nventory mode ,  Labe sfromce s.x sx fi e,  544
763 768 LARGE funct on,  31, 379
mode ng w th uncerta n demand,  769 776 Last Co umn too ,  235
nvestments Last year.x sx fi e,  11
a ocat ng portfo o among stocks, T b s, and ead t me, uncerta nty mpact,  772
bonds,  725 728 eap year, Exce and 1900,  54
ca cu at ng number of years for payback g ven earn ng curve,  583
annua cash flow,  31 32 d scovery,  586
net present va ue cr ter a for eva uat ng,  59 66 for fax mach ne product on,  585
pr c ng opt ons for dec s ons,  752 754 east squares ne,  573
probab ty of ga n,  722 724 LEFT funct on,  37, 40, 42, 180

844  Index
mean

Lefthand ookup.x sx fi e,  177 ow po nts on Spark nes,  487


eft s de ookup,  177 Loya ty.x sx fi e,  757
Lemonade.x sx fi e,  140
LEN funct on,  37, 41
Lenora.x sx fi e,  40 M
Lewent, Judy,  752
macroeconom c var ab es,  607
ab t es.  See also  oans
macros, fi e suffix,  192
comput ng,  101
Make Unconstra ned Var ab es Non Negat ve
fet me of mach ne, mode ng,  691 693
sett ng,  309
near demand curve,  786, 787
Makeup2007.x sx fi e,  170
a ternat ve,  797
Makeuparray.x sx fi e,  820
near equat ons, Exce terat ve procedure for,  89
Makeupfi ter.x sx fi e,  502
L nearfit.x sx fi e,  786
Makeupsorttemp.x sx fi e
near graph,  570
Dates worksheet,  228
near mode s,  279 280, 301
Makeup worksheet,  223, 226
near pr c ng,  803
Makeupsort.x sx fi e,  229
near prob em so v ng,  319
Makeupsubtota s.x sx fi e,  527
opt m zat on,  269
Makeupt me ne.x sx fi e,  429
near re at onsh ps,  572
Manage d a og box, Exce Add ns,  598
exact,  607
Manage Re at onsh ps d a og box,  449
ne charts, creat ng,  473
Manage Ru es d a og box, Stop f True opt on, 
L NEST funct on,  603 604
216 218
L neupsch38.docx fi e,  339
Manage Ru es, for cond t ona formatt ng,  197
L neupsch38.txt fi e,  340
manufactur ng p ant, product on s ze,  765 767
L ne W th Markers chart,  551
MAPE (mean abso ute percentage error),  649
pst ck, profit max m z ng pr ce for,  798
market trends,  97
st boxes,  246
mass ma ng trave brochure,  410 414
to choose charted ser es,  552 553
Matchex.x sx fi e,  28
sts
MATCH funct on,  27 34, 429, 550, 807, 818
compar ng for common entr es,  818 819
to compute payback per od,  32
se ect ng tem from,  256
to find h ghest va ue n st,  30
oans
OFFSET funct on and,  177
ca cu at ng month y payments,  79
mathemat ca mode s for dec s ons,  262
per ods for payback,  82
mathemat ca operat ons,  41
LOGEST funct on,  823 824
Matrad ngru e.x sx fi e,  97
Log ca examp es.x sx fi e,  210
matr ces, mu t p y ng,  828
og ca funct ons,  210
MAX funct on,  101, 744, 807
ognorma random var ab e,  701 704, 721
to find h ghest va ue n st,  30
LOGNORM.D ST funct on,  701, 703
max m z ng funct on, n GRG Non near eng ne,  320
LOGNORM. NV funct on,  701, 704
max m z ng profitab ty, month y product m x
ookup funct ons,  15 22.  See also MATCH funct on
for,  273 282
* (aster sk) as w dcard,  28
max mum nventory eve ,  766
based on r ght most co umn n range,  177
Max mum T me W thout mprovement,  329
HLOOKUP funct on,  16, 19
mean,  371
for product pr ce from product D,  18
forecast ng use of,  627
VLOOKUP funct on,  15 16
geometr c,  381
ookup, random number to n t ate,  708
nformat on from,  375
ost sa es case, for nventory,  772 774
mode vs.,  373
ost sa es cost,  769
of norma random var ab e,  684 685
LOWER funct on,  38

Index  845
mean profit, confidence interval for

of random var ab e,  664 665 month y fixed cost,  573


regress on toward, corre at on and,  595 month y operat ng cost, forecast for,  598
of resamp ed h gh temperature y e ds,  740 month y payments, ca cu at ng for oans,  79
of sums of ndependent random var ab es,  688 months
of t me between arr va s,  778 extract ng from date,  58
of t me needed to comp ete serv ce,  778 formu a to return product sa es for spec fic,  29
tr mmed,  380 381 sort ng chrono og ca y,  228
as unb ased forecast,  698 MonthtoMonth.x sx fi e,  431
mean profit, confidence nterva for,  712 mortgage
measures of centra ocat on,  371 374 Goa Seek for determ n ng amount based on
MED AN funct on,  372, 819 payments,  150
MED AN F funct on,  826 month y payment based on oan amount and
med an of samp e,  372 nterest rate,  143 144
Med ans.x sx fi e,  826 Mortgagedt.x sx fi e,  143
merger, nd cator on graph,  564 mortgage payments, So ver to determ ne for var ab e
merg ng scenar os n workbooks,  158 nterest rate,  306 307
Merton, Robert,  743 Mov estemp.x sx fi e,  179
metr cs n baseba ,  264 mov ng averages
m croch p manufacturer, P votTab es for summar z ng ca cu at ng,  653
data,  417 420 t me ser es understood w th,  641 644
M crosoft Power Query for Exce ,  348 mov ng average trad ng ru es,  96 99
M crosoft Word document, mport ng data Mrcostest.x sx fi e, Data worksheet,  597
from,  339 mu t p e peaks on h stogram,  365
m dd e of year, NPV when cash flow occurs at,  62 Mu t p e Ranges, P votTab e s cers and,  436
M D funct on,  37, 41, 42, 817 mu t p e regress on,  574
m tary t me,  112 bas cs,  597 604
M N funct on,  326, 710 funct on for forecast ng from equat on,  613 614
m n m z ng funct ons, n GRG Non near eng ne,  321 output,  600
m nus ( ) s gns, n P votTab e,  395 qua tat ve factors n,  605 614
M NUTE funct on,  113 res dua output,  600
M NVERSE funct on,  828 mu t p cat on
M RR funct on,  71 of matr ces,  828
M ss ngdata.x sx fi e,  538 w th Paste Spec a ,  119
MMULT funct on,  828 Mutat on Rate,  329
mode,  372 373
mean vs.,  373
MODE funct on,  372 N
Modefunct ons.x sx fi e,  372
#N/A (Not Ava ab e) response,  16, 18, 129, 191
mode ng non near t es,  615 622
and charts,  551
MODE.MULT funct on,  372
from MATCH funct on,  818
MODE.SNGL funct on,  372
from MODE funct on,  372
MOD funct on,  104
from VLOOKUP,  103
mod fied nterna rate of return,  71
Name box, range name creat on w th,  2 3
Monte Car o s mu at on,  158
#NAME? error,  104
bas cs,  705 714
Name Manager,  6 7, 182, 233
for opt ma b d ca cu at on,  715
d a og box,  9
uses,  706
names.  See also range names
month day year format,  54
fi ter ng by beg nn ng etter of,  512
MONTH funct on,  58
referenc ng co umns or rows by,  90
MONTH funct on (DAX),  467

846  Index
#NUM! error

nav gat ng worksheets,  391 non near pr c ng,  803 812


NCAA men s basketba F na Four, probab ty of profit max m z ng,  806 810
team w n,  735 737 non near So ver mode ,  317
negat ve b nom a random var ab e,  675 676 nonnumer c va ue
Negat vedatabars.x sx fi e,  202 prevent ng data entry of,  352
negat ve kurtos s,  374 nonpr nt ng characters, CLEAN funct on to
negat ve near re at onsh p,  590 remove,  39
negat ve y skewed h stogram,  364 nonsmooth funct ons,  270
negat ve skew,  373 nonsmooth opt m zat on prob ems,  323
NEGB NOM.D ST funct on,  675 norma cumu at ve funct on,  686
Negb nom.d st.x sx fi e,  675 Norma examp es.x sx fi e, Norma worksheet,  686
nest ng norma random var ab es,  683 690
F statements,  95, 105 appropr ateness for rea wor d s tuat ons, 
st se ect on,  355 687 688
subtota s,  530 find ng probab t es for,  686
net fixed assets,  102 percent es for,  687
net ncome after taxes,  102 propert es,  683 685, 684 685
net present va ue (NPV),  59 66 s mu at ng va ues,  709
for cash flows NORM.D ST funct on,  686
nterest rate and,  67 NORM. NV funct on,  709, 687, 735 736
at rregu ar nterva s,  62 64 NORM.S.D ST funct on,  747
rece ved at year s beg nn ng,  62 not equa to (<>) operator,  163
defin t on of term,  60 61 NOT operator,  210
of ong term profits from customer,  757 NOW funct on,  113
projects contr but ng greatest,  297 NPER funct on,  82
NETWORKDAYS funct on,  57 NPV. See net present va ue (NPV)
NETWORKDAYS. NTL funct on,  57 NPVaud tscenar o.x sx fi e,  155
New Formatt ng Ru e d a og box,  201 202, 407 408 NPVaud t.x sx fi e,  136, 137
Use A Formu a To Determ ne Wh ch Ce s To Or g na Mode worksheet,  130
Format,  659 NPV funct on,  61 62, 75 77, 758
New Name d a og box,  5, 12, 183, 192 NPVsp nnerstemp.x sx fi e, Or g na Mode
New Ru e, for cond t ona formatt ng,  197 worksheet,  247
New Web Query d a og box,  346 NPV.x sx fi e,  59
Nfl2009apr 2010.x sx fi e,  313 nu hypothes s,  623, 626
NFL teams Number F ters for database,  507
po nt spreads,  314 317 numbers
summar z ng sequence of w ns or osses,  ass gn ng cons to range,  205
489 490 convert ng text to,  41
95 percent serv ce eve ,  772 774 convert ng to text str ng,  38
N p.x sx fi e count ng ce s conta n ng,  162
Non near Pr c ng Examp es worksheet,  803, 804 count of ce s n range conta n ng,  165
OnePr ce worksheet,  805 not n ascend ng order, for ookup,  18
Two Part Tar ff worksheet,  806 ra s ng to a power,  61
nonadjacent se ect ons, group ng,  424 rank ng n data sets,  380
nonb ank ce s, count ng,  162, 166 #NUM error
noncont guous ranges, nam ng,  3 from RR funct on,  68
non near t es from XNPV funct on,  64
mode ng,  615 622 #NUM! error,  104
test ng for presence n regress on,  616 619

Index  847
observations

O P
observat ons. See data po nts Page Break Between Groups,  528
OData feed,  457 Page Setup d a og box, Sheet tab,  737
Offsetcost.x sx fi e,  178 Pareto chart,  562 563
Offsetexamp e.x sx fi e,  176 Pareto.x sx fi e,  562
OFFSET funct on,  175 186, 233, 429 Paste L nk,  119
COUNT funct on w th,  181 Paste Name d a og box,  2, 8
dynam c range names from,  183 Paste Prev ew d a og box,  460 461
MATCH funct on and,  177 Paste Spec a command,  142
SUM funct on w th,  178 Paste Spec a d a og box,  117 122
O we .x sx fi e,  752 Transpose,  118, 593, 815
one way ANOVA,  623 628 Pastespec a .x sx fi e
Onewayanova.x s fi e, ns g worksheet,  626 Paste Spec a D v de Before worksheet,  119
Onewayanova.x sx fi e,  624 Paste Spec a Transpose worksheet,  118
one way data tab e,  140 141 Paste Spec a Va ue worksheet,  117
operat ng costs past ng range names nto formu a,  165
exp a n ng month y var at on,  574 pattern recogn t on techno ogy, F ash F use
product on re at onsh p to,  571 574 of,  45 47
operat ng ncome, comput ng,  101 payback per od,  31, 147
opt ma b d, ca cu at ng,  715 720 Payback.x sx fi e,  31
opt ma product m x, So ver for determ n ng,  Paymentgs.x sx fi e,  150
273 284 payment on the pr nc pa ,  79
opt ma so ut on,  270 payment (Pmt),  76
opt m zat on mode n FV funct on,  77
chang ng ce s n,  268 present va ue of,  76
GRG non near eng ne for,  320 323 pena t es, Evo ut onary So ver and,  329 334
prob em constra nts,  268 #Per,  76
So ver for,  267 272 n FV funct on,  77
target ce s,  267 268 for PMT funct on,  79
opt on buttons,  246 percentage return, ca cu at ng for stock purchase
for product pr ce se ect on,  255 256 w th European put opt ons,  95 96
opt ons PERCENT LE.EXC funct on,  377, 378 379
parameters determ n ng va ue,  745 746 PERCENT LE funct on,  377, 378
pr c ng for nvestment dec s ons,  752 754 PERCENT LE. NC funct on,  377, 378
Opt ons d a og box. See Exce Opt ons d a og box percent es
order costs, m n m z ng,  770 772 for norma random var ab es,  687
order of precedence, for cond t ona formatt ng rank ng n data set,  377 379
ru es,  200, 209 PERCENTRANK.EXC funct on,  377, 379
OR operator,  210, 493 PERCENTRANK funct on,  377, 379
database funct ons w th,  495 PERCENTRANK. NC funct on,  377, 379
n F statement,  99 percent va ues, sp nner button for,  250
out ers,  375, 574, 603 performance, track ng sa es over t me,  545 546
comput ng cutoffs for,  376 per ods for oan payback,  82
cond t ona formatt ng for h gh ght ng,  375 382 perpetu ty,  83
n forecasts,  659 661 Peyton.x sx fi e,  345
out ne form, for P votTab e,  394 Phone oya ty.x sx fi e,  759
output ce s, n Scenar o Manager,  155 P cturegraph.x sx fi e,  540
p ctures n co umn graphs,  540 541
P votChart, summar z ng P votTab e w th,  403 404

848  Index
prescriptive analytics

P votChart Too s,  414 poker, probab ty of three of a k nd hand,  733 734
P votTab e,  521 Pop Out/Pop n cons, for charts or tab es,  475
add ng b ank rows,  406 407 popu at on,  323
bas cs,  386 387 popu at on standard dev at on,  375
bas ng on data n severa ocat ons,  434 436 popu at on var ance,  375
ca cu ated fie d n,  421 422 portfo o nsurance,  96
co aps ng and expand ng fie ds,  395 396 pos t on, MATCH funct on to ocate for va ue n
cond t ona formatt ng n,  407 409 range,  28
creat ng pos t ve kurtos s,  374
based on ex st ng,  436 pos t ve near re at onsh p,  589 590
w th Data Mode ,  444 446, 448 449 pos t ve y skewed h stogram,  364
w th PowerP vot,  463 465 pos t ve skew,  373
“dr ng down” n,  427 429 power curve,  569, 581 588
extract ng data from,  427 429 power demand curve,  786, 788
fie d ass gnments for creat ng report,  465 a ternat ve,  797
format changes for,  395 Powerexamp es.x sx fi e,  581
format for scenar o summary,  158 power graph,  570
group ng tems n,  423 424 PowerP vot,  442, 455 468
head ngs for,  388 bas cs,  455 456
h d ng subtota s n,  406 407 enab ng add n,  456
ayouts,  393 394 mport ng data to,  457
reason for name,  395 mport ng text fi es for,  459
refresh ng,  447 oad ng data nto,  456 463
report fi ter,  404 405, 422 P votTab e creat on w th,  463 465
sa es summary for month compared same month s cers use w th,  466
prev ous year,  432 433 PowerP vot F e ds d a og box,  463 464
s cers for,  405 406, 422 PowerP vot tab, Manage,  458
Mu t p e Ranges and,  436 Power Query,  348
sort ng and fi ter ng fie ds,  397 403 Power V ew,  442, 469 484
summar z ng b ank sheet,  471
data by t me per ods,  429 430 charts
grocery sa es at severa stores,  387 388 creat ng,  473 474
tota sa es to date,  431 432 fi ter ng,  474 478
w th P votChart,  403 404 fi ter ng w th s cer,  476 477
P votTab e And P votChart W zard,  434 436 fi ter ng w th T es,  477
add ng to Qu ck Access too bar,  436 data preparat on for,  470 473
P votTab e F e d st,  390 392 d sp ay ng sa es data by state or country, 
P votTab e Opt ons d a og box,  406 478 479
P votTab e Too s Ana yze tab,  396 Mu t p es feature,  482 483
P votTab e Too s Des gn tab, B ank Rows,  406 PPMT funct on,  79
p us (+) s gn, n P votTab e,  395 precedents,  130
PMT funct on,  79 pred ct ons
n two way tab e,  143 accuracy of,  574 575
So ver to ver fy accuracy,  306 307 of future va ues of t me ser es,  645 650
Pmt (payment),  76 rea t me,  265
n FV funct on,  77 of sports outcomes,  313
po nt forecast,  697 US auto sa es,  605 609
po nt spreads for games, So ver mode for,  313 US pres dent a e ect ons,  610 613
PO SSON.D ST funct on,  680 pred ct ve ana yt cs,  261 262, 264
Po sson random var ab e,  679 682 prescr pt ve ana yt cs,  262 263

Index  849
present value (Pv)

present va ue (Pv).  See also net present va ue (NPV) pred ct ng costs for 3 products,  597 602
n FV funct on,  77 re at onsh p to operat ng costs,  571 574
for PMT funct on,  79 r sk mpact on dec s on,  712
pres dent a e ect ons n US, pred ct ng,  610 613 So ver to determ ne ocat on,  291 294
prev ous year, creat ng range name for,  12 product fe cyc e, and abor t me sav ngs,  583
pr ce e ast c ty,  786 Product ookup.x sx fi e,  29
unknown,  797 products
pr ce per un t, comput ng,  234 formu a to return sa es for spec fic month,  29
pr c ng pr c ng,  785
average of a greater than med an,  819 tota cost by deve opment stages,  178 179
bund ng and,  804 806 profit,  275
as funct on of number purchased,  94 comput ng,  140
mpact of changes,  140 profitab ty,  140
mpact on sa es,  632, 635 bund ng and,  804 806
near,  803 month y product m x to max m z ng,  273 282
ookup profit max m z ng pr ce,  142
based on date,  19 determ n ng,  785
product D for,  18 19 for razor,  791 796
non near,  803 812 pro forma financ a statements, debt as p ug,  99 104
opt ons for nvestment dec s ons,  752 754 Proforma.x sx fi e,  99
products,  785 progress
profit max m z ng,  142 thermometer chart for d sp ay ng,  548 549
stock opt ons,  743 756 waterfa chart to track,  557 558
two part tar ff,  804 projects, So ver to determ ne acceptab e,  297 300
w th subject ve y determ ned demand,  797 802 PROPER funct on,  38
w th t e ns,  791 796 Protect Sheet d a og box,  751
pr nc pa Ptab eexamp e.x sx fi e,  417
accumu at ng for severa per ods,  81 Ptcustomers.x sx fi e, Data worksheet,  398
payment amount n oan,  79 purchase pr ce. See pr c ng
pr nt ng comments,  737 pure bund ng,  805
probab t es put opt on,  744
nvo v ng samp ng,  673 mpact of key parameter changes,  748 749
NCAA men s basketba F na Four, team s ope of payoff,  745
w n,  735 737 p va ue
for norma random var ab e,  686 and effect of factor on sa es,  631
for Po sson random var ab e,  680 of ndependent var ab e,  601 602, 608
s mu at ng for gamb ng and sport ng and non near re at onsh ps,  616
events,  731 738 PV funct on,  75
statements from forecasts,  697 700 Pv (present va ue).  See also net present va ue (NPV)
probab ty dens ty funct on (pdf),  665 666 n FV funct on,  77
for cont nuous random var ab e,  683 684 for PMT funct on,  79
probab ty statements, ess than or equa to s gn (≤)
n,  684
prob em constra nts, n opt m zat on mode ,  268 Q
Prodm xtemp.x sx fi e,  136
quadrat c demand curve, Trend ne to fit,  797
Prodm x.x sx fi e,  283
qua tat ve factors n mu t p e regress on,  605 614
Feas b e So ut on worksheet,  273
qua tat ve ndependent var ab e, quarter of year
product D, for product pr ce ookup,  18 19
as,  606
product on
quant tat ve ndependent var ab es,  605
determ n ng appropr ate eve ,  710 712

850  Index
records

quant ty d scounts mean, var ance, and standard dev at on of, 


EOQ and,  765 664 665
and non near pr c ng,  803 804 norma ,  683 690
quer es,  503 s mu at ng va ues,  709
quest on mark (?) w dcard,  164 Po sson,  679 682
Queu ngtemp ate.x sx fi e un form,  719
Mode worksheet,  779 We bu ,  691 693
Queu ng Data worksheet,  780 range ookup argument,  16, 18
queu ng theory,  777 784 range names,  1 14
average t me wa t ng n ne at a rport or at app y ng to ent re worksheet,  11
bank,  779 782 AutoComp ete of,  9
cond t ons for ana ys s,  778 779 automat ca y nc ud ng new data,  182 183
var ab ty degrad ng performance,  779 creat ng,  1 7
Qu ck Access too bar, add ng P votTab e And w th Create From Se ect on,  4 5
P votChart W zard to,  436 w th Define Name,  5 7
Qu ck Exp ore opt on, n Data Mode ,  446 447 w th Name box,  2 3
quotat on marks (“ “) d sp ay ng n ex st ng formu as,  10
for MATCH text va ues,  28 dup cate n mu t p e worksheets,  794
for text n arrays,  823 error from undefined,  104
for text n cr ter a,  163 for tab e range,  17
for text n F statement,  98 past ng nto formu a,  165
past ng st nto worksheet,  11
restr ct ons,  13
R scope for,  6
range of ce s
R2 va ue,  574, 602
gett ng stat st cs descr b ng,  381
corre at on re at onsh p to,  594
MATCH funct on to ocate pos t on for va ue
for east squares ne,  575
n,  28
radar chart,  564 565
OFFSET funct on for reference to,  175 186
Radar.x sx fi e,  564
se ect ng a data n co umn or row,  120
ra s ng number to a power,  61, 585
va ue ookup from,  15
RANDBETWEEN funct on,  722 723, 726, 732
range of data set,  375
Randdemo.x sx fi e,  706
RANK.AVG funct on,  380
RAND funct on,  706 708, 710, 715, 735
RANK.EQ funct on,  380, 734
random zed b ocks,  629 640
RANK funct on,  380, 546, 554
output,  631
rank ng numbers, n data sets,  380
random var ab es,  663 668
Rate,  76
beta,  691, 694 696
n FV funct on,  77
b nom a ,  670 671
for PMT funct on,  79
negat ve,  675 676
RATE funct on,  81
s mu at ng,  715 716
rat ng for p ayer ab t es, cond t ona formatt ng
cont nuous,  665
based on,  214 215
mode ng as norma random var ab e,  716
Rat oma.x sx fi e,  651, 652
defin t on,  663
rat o to mov ng average forecast method,  651 654
d screte,  664, 666, 683
Razorsandb ades.x sx fi e, No B ades worksheet,  791
s mu at ng va ues,  708 709
razors, profit max m z ng pr ce of,  791 796
govern ng t me between arr va s,  681
rea opt ons,  752
hypergeometr c,  673, 674 675
rea t me pred ct ons,  265
ndependent,  666
rec proca cost a ocat on method,  91
ognorma ,  701 704, 721
records,  503

Index  851
rectangular range of cells, naming

rectangu ar range of ce s, nam ng,  2 Requ red Bounds On Var ab es sett ng,  323
reference ce s, for OFFSET funct on,  175 Resamp ey e d.x sx fi e,  739
#REF! error,  104 resamp ng for data ana ys s,  739 742
refresh ng P votTab es,  447 res dua s
refresh sett ngs, for web query,  347 for data po nts,  574
reg ona worksheets, set up for,  124 n forecasts,  660
reg on, ca cu at ng tota revenue and un ts so d randomness of,  661 662
by,  527 530 from pres dent a e ect on equat on,  613
regress on.  See also mu t p e regress on sum of squares,  604
est mat ng ndependent var ab e coeffic ents for trend ne and data po nt,  573
for,  656 Res ze Tab e too ,  235
standard error for,  602 res z ng charts,  473
sum of squares,  604 reso v ng c rcu ar references,  88 90
test ng for presence of non near ty and resu t ce s, n Scenar o Manager,  155
nteract on n,  616 619 reta er, profit potent a based on revenue and
toward the mean, corre at on and,  595 expenses,  144 145
Regress on d a og box,  598, 599 reta ned earn ngs, comput ng,  101, 102
regress on equat on, ho d ng back data for ret rement p ann ng,  305
va dat ng,  611 So ver for,  307 309
Re chhe d, Freder ck,  757 returned un ts, tota s of,  171
re at onsh ps revenue
between corre at on and r squared va ue,  594 ca cu at ng med an s ze n each country,  826 827
creat ng ca cu at ng tota ,  233
w th n Data Mode ,  443 444 ca cu at ng tota by reg on,  527 530
between data sources,  462 463 cond t ona formatt ng for quarters,  209 212
ed t ng or de et ng,  449 450 est mat ng trends and seasona ty,  823 826
power curve for mode ng,  581 fi ter ng top 30 va ues by sa esperson,  513
of stock returns,  591 593 fitt ng trend curve to recent growth,  577 580
stra ght ne est mates,  569 576 mov ng average graph of,  643
summar z ng, corre at ons for,  589 596 sort ng customers by,  402 403
rema nder from d v s on, MOD funct on to track ng based on country,  177 178
return,  105 Reverse con Order, n cond t ona formatt ng,  206
Remove Dup cates too ,  235, 514 515 Rev ew tab
remov ng. See de et ng Changes, Protect Sheet,  751
reorder po nt Comments, New Comment,  736
n back order case,  770 771 R GHT funct on,  37, 43
nventory eve for,  769 r sk free rate,  745
n ost sa es case,  772 r sk, mpact on product on dec s on,  712
Reorderpo nt ostsa es.x sx fi e,  772 Rock.x sx fi e,  162
Repeatedh sto.x sx fi e,  44 Ros ng, Hans,  480
Rep ace Current Subtota s,  528 ROW funct on,  104, 192
REPLACE funct on,  38 Row Labe s zone, n P votTab e F e d st,  390
rep cat on rows
two factor ANOVA w th,  632 add ng b ank n P votTab e,  406 407
two way ANOVA w thout,  630 of database,  503
report fi ters freez ng to keep v s b e,  97
m tat ons of,  405 h d ng or unh d ng,  144
for P votTab e,  422 gnor ng those w th errors,  103
Report F ter zone, n P votTab e F e d st,  391 ncreas ng he ght of,  248
REPT funct on,  37, 44 NDEX funct on to reference,  25

852  Index
service time, mean

rea gn ng data to co umn,  118 119 scatter chart,  564, 569


referenc ng by name,  90 for C sco trend curve,  579
se ect ng a data n,  120 of cumu at ve un ts produced and un t
RSQ funct on,  575 costs,  584 585
w th smooth nes and markers,  641 642
var ab e changes d sp ayed w th,  565
S Scenar o Manager,  155 160
Scenar o Manager d a og box,  157
safety stock eve ,  771
scenar os, data tab e to generate,  723 724
Sagar n rat ngs,  735
Scenar o Va ues d a og box,  157
sa ary
Scho es, Myron,  743
find ng h ghest n st,  29 31
scope
non near effect of years of exper ence,  617
for range name,  6
wages*hours formu a for comput ng,  13
worksheets vs. workbooks,  9
sa es
scro bars,  246, 247
average number of un ts so d per
check box for,  252
transact on,  172
S curve,  643
average quant ty of,  172
SEARCH funct on,  37
breakdown by sa esperson n reg on,  530 531
seasona demand, EOQ and,  765
ca cu at ng un ts of,  171
seasona ndexes,  651 652
comput ng,  101
comput ng,  653
deseasona zat on of est mates,  652
seasona ty
forecast based on sa es representat ves and
n forecast ng future sa es,  652
d str cts,  632
for t me per od,  645
mpact of pr ce and advert s ng,  632
Secondaryax s.x sx fi e,  536
nterpret ng effects of pr ce and advert s ng
SECOND funct on,  113
on,  635
seconds (t me), d sp ay ng,  113
p ott ng as funct on of advert s ng,  582
Se ect A So v ng Method st,  269
summar z ng transact ons,  238 240
se ect ng
summary worksheet by country,  191 192
a data n co umn,  120
tota do ar amount based on year,  171
a formu as n worksheet,  751
tota do ar amount by sa esperson,  170 171
ce s hav ng cond t ona formatt ng,  209
trends and seasona ty n forecast ng future,  652
ce s w th data va dat on sett ngs,  355
sa es database, array funct ons to summar ze, 
day of the week,  256
820 822
st tems,  256
sa es force
noncont guous ranges,  3
ana ys s of effect veness,  630 631
sens t v ty ana ys s,  139 148, 155 160
comp ete st of,  514
w th mu t p e key nputs, sp nner buttons
sa es stat st cs, database funct on for,  493 498
for,  247 252
Sa esstr pp ng.x sx fi e,  42
sequenc ng prob ems,  335
Sa estracker.x sx fi e,  545
ser a number for dates,  54, 111
samp e standard dev at on,  374 375
n COUNT F funct on,  165
samp e var ance,  374 375
ser es chart ng, check boxes to contro ,  551 552
samp ng, probab t es nvo v ng,  673
Ser es d a og box,  711
Sandp.x sx fi e,  207
SER ES funct on,  184
sav ng
ser es n chart, st box to se ect,  552 553
charts as temp ates,  548
ser es abe s, nk ng to ce s,  549 551
va ues n data tab e,  142
serv ce eve approach,  769
Sca es consdatabars.x sx fi e,  204
Serv ce eve reorder.x sx fi e,  772
sca ng, for spark ne ax s,  488
serv ce t me, mean,  780

Index  853
Set Cell, for Goal Seek

Set Ce , for Goa Seek,  149, 151 for financ a p ann ng,  305 312
Set Va ues Do Not Converge resu t, from So ver ack of so ut on from,  282 283
mode ,  283 near prob em so v ng,  319
SHEET funct on,  192 non near mode ,  317
SHEETS funct on,  192 opt ma product m x from,  273 284
sh pp ng opt m zat on w th,  267 272
company ocat on for two warehouses,  325 327 quant ty d scount w th F statements,  809
m n m z ng costs,  293 for ret rement p ann ng,  307 309
So ver to determ ne ocat on for,  291 294 smooth ng constants va ues from,  647 648
shortage cost,  769 sports teams rat ngs w th,  313 318
m n m z ng,  770 772 transportat on or d str but on prob ems n, 
Show Ca cu at on Steps,  128 291 296
Show Data n H dden Rows And Co umns,  539 to ver fy PMT funct on accuracy,  306 307
s gn ficance, n ANOVA tab e,  609 workforce schedu ng w th,  285 290
S mp ex LP eng ne,  269, 279, 280 So ver Add n, act vat ng,  269 270
s mu at on So ver Opt ons d a og box,  301 302
assumpt ons for,  724 So ver Parameters d a og box,  269, 275 277
of gamb ng and sport ng event for asset a ocat on mode ,  728
probab t es,  731 738 for determ n ng forecast parameters,  658
for opt ma b d for construct on project,  716 718 Evo ut onary So ver prob em n,  329
of stock pr ces,  721 730 Make Unconstra ned Var ab es Non Negat ve
s ze of charts, chang ng,  473 sett ng,  309
SKEW funct on,  373 for max m z ng quant ty d scount p an,  809 810
skewness for max m z ng razor profit,  792 793
extreme,  380 381 for mortgage payments determ nat on,  307
n h stogram,  364 for NFL rat ngs,  316
measure,  373 for One warehouse prob em,  325
s cers for product m x prob em,  279
fi ter ng charts w th,  476 477 for profit max m z ng pr ce,  799
P votTab es w th,  405 406, 422 for project se ect on mode ,  299
Mu t p e Ranges and,  436 for reorder po nt for 95 percent serv ce eve ,  774
PowerP vot use of,  466 for ret rement p ann ng,  309
for tab es,  240 for transportat on prob em,  293
S cer Too s Opt ons tab,  240 for trave ng sa esperson prob em,  337
formatt ng opt ons,  406 for W nters s mode ,  648
S oan Conference on Sports Ana yt cs,  263 for workforce prob em,  287
SLOPE funct on,  575, 653 Sort d a og box,  224
s ope of funct on sort ng w thout us ng,  229 230
n GRG Non near eng ne,  320 sorted data, as chart bas s,  554 555
of put payoff,  745 Sortedgraphx.x sx fi e,  554
of stra ght ne re at onsh p,  575 sort ng,  223 230
SMALL funct on,  31, 379 based on ce or font co or,  226 227
smooth ng parameters n W nters s method,  646 custom st for,  228
So ver data for subtota s,  530
for cap ta budget ng,  297 304 con sets as bas s for,  227
Esc key for stopp ng,  321 months chrono og ca y,  228
est mat ng ndependent var ab e coeffic ents mu t p e cr ter a for,  224
w th,  656 P votTab e fie ds,  397 403
Evo ut onary So ver,  323, 327 transact on data,  223 226
pena t es and,  329 334

854  Index
SUM function

Sort Largest To Sma est command, for stat on wagons, fam y factors n purchase
P votTab e,  397 dec s on,  414 417
Sort Z To A,  397 Stat on.x sx fi e,  415
spaces, remov ng from text str ng,  37, 40 STDEV funct on,  375, 712
Spark nes,  485 490 STDEV.P funct on,  375
automat c updates,  490 STDEV.S funct on,  375, 727
mod fy ng,  487 488 STDEVS funct on,  658
Spark nes.x sx fi e,  485 steady state character st cs of system,  778 779
L ne Spark ne worksheet,  486 487 STEYX funct on,  574
Spark ne Too s Des gn tab,  487 Stockcorre .x sx fi e,  591
spec a events, forecasts mpacted by,  655 662 stock pr ces
sp nner buttons,  246, 247 ognorma random var ab e for mode ng, 
copy ng and past ng,  248 701 704
creat ng,  248 med an n future,  704
for percent va ues,  250 opt ons,  743 756
nk ng to nput ce s,  249 250 s mu at ng,  721 730
sport ng events probab t es s mu at on,  731 738 stock returns
sports teams rat ngs, So ver for,  313 318 co or cod ng,  207 208
SQL Server database, oad ng data from,  457 re at onsh p of,  591 593
SQRT funct on,  324, 325, 632 stocks
squared errors, sum of,  657 a ocat ng nvestments,  725 728
square matr x,  828 annua vo at ty of r sk ness,  702
Stacked 2D bar chart,  553 beta of,  742
Stacked area chart,  548 purchase w th European put opt ons,  95 96
Stacked Co umn chart,  473 transact on costs,  99
standard dev at on webs te for vo at ty est mates,  750
of b ds, est mat ng,  716 Stop f True opt on,  216 218
of forecast errors,  632 stopp ng So ver, Esc key for,  321
nformat on from,  375 store orders, determ n ng quant ty,  763 765
of norma random var ab e,  684 685 Storesa es.txt fi e,  458
of random var ab e,  664 665 story prob ems n a gebra, Goa Seek for,  151 152
samp e,  374 375 stra ght ne re at onsh p
of sums of ndependent random var ab es,  688 est mates,  569 576
of t me between arr va s,  778 s ope,  575
of t me needed to comp ete serv ce,  778 structure of worksheet mode ,  127
unb ased forecast and,  698 sty es
standard error of the regress on,  574, 602 for P votTab e,  395
standard norma ,  747 for spark nes,  488
start ng t me, ca cu at ng number of hours between SUBST TUTE funct on,  39 40, 45
end ng t me and,  114 Subtota d a og box,  527 529
state abbrev at ons subtota s,  527 532
st for data entry,  353 de et ng,  528
for named ranges,  4, 7 n P votTab e, h d ng,  406 407
Statedv.x sx fi e,  353 nest ng,  530
states subtract on, w th Paste Spec a ,  119
d sp ay ng sa es data by,  478 479 SUM funct on,  807, 817
st ng n descend ng order of sa es,  554 ce formatt ng for hours,  114
Statestemp.x sx fi e,  4 DSUM funct on vs.,  491 492
States.x sx fi e,  6, 7, 460 ND RECT funct on w th,  188

Index  855
SUMIF function

ma nta n ng or g na range after row n charts,  542 544


nsert on,  189 190 data source st as,  355
OFFSET funct on w th,  177, 178 for h stogram,  555
for reta ned earn ngs ca cu at on,  101 remov ng dup cates from,  235
SUM F funct on,  169, 170, 819, 820 Tab e s cers,  240
SUM FS funct on,  170, 172, 493, 497 Tab e Sty es too ,  236
array funct on a ternat ves,  820 Tab e Too s contextua tab,  235
Sum nd rect.x sx fi e,  188 Tab e Too s Des gn tab,  232
summar z ng tabu ar form, for P votTab e,  394
bubb e chart for three var ab es,  565 Ta eb, N cho as, The B ack Swan,  704
w th database stat st ca funct ons,  491 500 target ce s
graph of da y customer counts,  485 487 n opt m zat on mode ,  267 268
grocery sa es at severa stores,  387 388 for product m x So ver mode ,  275
NFL team sequence of w ns or osses,  489 490 for software project se ect on prob em,  298
P votTab es,  417 420 for So ver workforce schedu ng,  286
data by t me per ods,  429 430 for transportat on prob em,  291, 292
w th P votChart,  403 404 taxes
re at onsh ps, corre at ons for,  589 596 comput ng,  102
sa es database transact ons, array funct ons comput ng rates based on ncome,  16 18
for,  820 822 T b s, a ocat ng nvestments,  725 728
sa es for month compared same month prev ous Teasa es1.x sx fi e, Power V ew 2 worksheet,  475
year,  432 433 Teasa esfi terbycharts.x sx fi e,  476
Subtota command for,  527 532 Teasa esmu t p es.x sx fi e,  482
tota sa es to date w th P votTab e,  431 432 Teasa ess cer.x sx fi e,  476
Summary Be ow Data,  528 Teasa est es.x sx fi e,  477
summary report for scenar os,  157 temperature data, v sua nd cators for,  197
summary worksheet, for sa es by country,  191 temp ates, stor ng charts as,  548
sum of squared errors (SSE),  657 text fi es
for exponent a curve,  585 mport ng data from,  339 344
sum of squares regress on,  604 mport ng for PowerP vot,  459
sum of squares res dua ,  604 text fi ters,  503, 512
SUMPRODUCT funct on,  274 275, 286, 292, 298, 815 text funct ons,  35 50
supp y constra nt,  292 CHAR funct on,  38
supp y po nts,  291 CLEAN funct on,  39, 44
Sw tch To Workbook Exce con,  460 CONCATENATE funct on,  38, 41
symbo s, n range names,  13 F ND funct on,  37, 41, 42
symmetr c h stogram,  363 LEFT funct on,  37, 40, 42
symmetry about the mean, test ng for,  716 LEN funct on,  37, 41
LOWER funct on,  38
M D funct on,  37, 41, 42
T PROPER funct on,  38
REPLACE funct on,  38
Tab eexamp etemp.x sx fi e,  231
REPT funct on,  37, 44
Tab emakeuptemp.x sx fi e,  238
R GHT funct on,  37, 43
tab e range
SEARCH funct on,  37
range names for,  17
SUBST TUTE funct on,  39 40, 45
for VLOOKUP,  15
TR M funct on,  37, 40
tab es,  231 244
UPPER funct on,  38
AutoComp ete opt ons for,  233
VALUE funct on,  38, 41, 45
bas ng chart on,  237
Textfunct ons.x sx fi e,  36

856  Index
trimmed mean of data set

Text mport W zard,  339 344 today s date, formu a to automat ca y d sp ay,  55
text str ngs togg ng,  109
character count for,  37 formu a d sp ay w th va ue d sp ay,  128
comb n ng,  41 To erance sett ng, for So ver,  301
convert ng to number,  38, 41 too t ps, for data entry,  350
convert ng to t me,  113 Top 10 F ter d a og box,  401
find ng first occurrence of match n,  27 Top 10 tems, for P votTab e ayout,  400
flagg ng fie ds conta n ng,  497 Top/Bottom Ru es, for cond t ona formatt ng,  197
quotat on marks for,  823 tota assets,  102
n F statement,  98 tota cost of product, by deve opment stages, 
n MATCH funct on,  28 178 179
remov ng spaces from,  37 tota hours, SUM funct on for,  114
repeat ng,  37 tota product on cost, pred ct ng as funct on of un ts
return ng characters from,  37 produced,  581
Text That Conta ns opt on, for cond t ona tota revenue, comput ng,  233
formatt ng,  199 tota sa es to date, summar z ng w th
thermometer chart,  548 549 P votTab e,  431 432
three d mens ona formu as,  123 126 To Va ue, for Goa Seek,  149
t e ns, pr c ng w th,  791 796 Toysrustrend.x sx fi e,  823
T es, for fi ter ng charts,  477 Trace Dependents,  130, 132
t me Trace Errors,  129
between arr va s, random var ab e Trace Precedents,  130, 132 133
govern ng,  681 transact ons
ca cu at ng number of hours between start ng costs for stock,  99
and end ng,  114 fi ter ng,  503 504, 505
computat ons w th,  112 fi ter ng by co or,  513
creat ng sequence of regu ar y spaced fi ter ng by months,  511 512
nterva s,  115 sort ng data,  223 226
data entry of,  112 transportat on prob ems, So ver for,  291 296
w th date n one ce ,  112 Transport.x sx fi e,  291
d sp ay ng current,  113 TRANSPOSE funct on,  815 816
format for d sp ay ng,  112 Transpose opt on for Paste Spec a ,  118
ser a number for,  111 trave brochure, mass ma ng,  410 414
summar z ng P votTab e data by per ods,  Trave data.x sx fi e, Data worksheet,  410
429 430 trave ng sa esperson prob em (TSP),  336 337
track ng sa es performance over,  545 546 trend curves,  569
T ME funct on,  113 for re at onsh p of var ab es,  589
T me ne feature,  429 430 TREND funct on,  613 614
t me ser es trend nes
character st cs,  645 add ng to chart,  572
mov ng averages for understand ng,  641 644 determ n ng best fitt ng,  573
pred ct ng future va ues,  645 650 to fit quadrat c demand curve,  797
seasona ndexes for,  651 652 fitt ng to centered mov ng averages,  653
trend of,  651 trends
t me ser es scatter chart, chang ng to n forecast ng future sa es,  652
an mated,  480 482 of t me ser es,  645
T MEVALUE funct on,  113 TR M funct on,  37, 40
T me.x sx fi e,  112, 113 TR MMEAN funct on,  381
t t e of chart,  572 Tr mmean.x sx fi e,  381
TODAY funct on,  55, 113 tr mmed mean of data set,  380 381

Index  857
Tsp.xlsx file

Tsp.x sx fi e,  336 #VALUE error,  44


Tufte, Edward,  485 #VALUE! error,  104
two part tar ff,  804 Va ue F e d Sett ngs command,  391
determ n ng opt ma ,  807 Va ue F e d Sett ngs d a og box,  416, 419 420
two way ANOVA,  629 640 Average,  411 412
w th rep cat on,  632 Number Format,  395
sa es forecasts w th,  635 VALUE funct on,  38, 41, 45, 817
Twowayanova.x sx fi e, Random zed B ocks va ue of customer, determ n ng,  757 762
worksheet,  630 Va ues fie d, d sp ay cho ces,  421
two way data tab e,  140, 142, 143 va ues, togg ng formu a d sp ay w th,  128
for break even po nt,  145 Va ues zone, n P votTab e F e d st,  390
VAR funct on,  375
var ab e cost,  574
U var ab e nterest rate, So ver to determ ne mortgage
payments,  306 307
unb ased forecasts,  698
var ab es
uncerta n demand, nventory mode ng w th, 
corre at on between,  589
769 776
est mat ng re at onsh p between,  569
uncerta n events, est mat ng probab t es,  705 714
ndependent vs. dependent,  569
uncerta nty, mode ng nherent, n po nt
macroeconom c,  607
forecast,  697
non near effect of ndependent var ab e on
underscore ( ), n range names,  13
dependent,  615 616
unemp oyment rates,  607
random,  663 668
Unfreeze Panes command,  97, 252
scatter chart for d sp ay ng changes,  565
Ungroup command,  424
var ance.  See also ANOVA (ana ys s of var ance)
unh d ng co umns or rows,  144
of random var ab e,  664 665
un form random var ab e,  719
samp e,  374 375
un que nterna rate of return,  68 69
of sums of ndependent random var ab es,  688
guarantee ng,  70
VAR.P funct on,  375
use of,  70 71
VAR.S funct on,  375
Un que Records On y opt on for fi ter,  518
vert ca ne for chart separator,  564
US auto sa es, pred ct ng,  605 609
Vert ca ne.x sx fi e,  564
US c t es, approx mate d stance between,  324
vert ca ookup,  15
US pres dent a e ect ons, pred ct ng,  610 613
V ew tab
un ts produced, pred ct ng tota product on cost as
Freeze Panes,  251 252
funct on of,  581
Unfreeze Panes,  252
un ts so d, ca cu at ng tota by reg on,  527 530
W ndows
UPPER funct on,  38
Arrange A ,  522
Use A Formu a To Determ ne Wh ch Ce s To Format
Freeze Panes,  97
sett ng,  332
V s b e Ce s On y opt on for copy ng,  506
Use Funct on d a og box,  528
v s b ty of comments,  737
user forms,  245
VLOOKUP funct on,  15 16, 315, 709, 710, 657, 723,
menu,  248
734, 736
* (aster sk) as w dcard,  28

V Exce Data Mode vs.,  442


to find h ghest va ue n st,  30
Va ent ne.x sx fi e, S m worksheet,  710 for tax rate based on ncome,  16 18
va dat ng data,  349 358 vo at ty of stocks,  746 747
va dat ng regress on equat on, ho d ng back data B ack Scho es formu a for est mat ng,  749 750
for,  611 webs te for est mates,  750

858  Index
zones, in PivotTable Field list

W workdays, determ n ng the number between two


dates,  57
wa t ng n ne workforce schedu ng
factors affect ng t me spent,  777 778 Evo ut onary So ver for,  330 332
mathemat cs of,  777 784 So ver for,  285 290
Wa martrev.x sx fi e,  104 worksheets
warehouse ocat on for sh pp ng company,  323 assumpt ons n mode s,  139
Warehouse oc.x sx fi e comments n,  736 737
One warehouse worksheet,  323 copy ng,  236
Two warehouses worksheet,  325 copy ng fi tered transact ons to d fferent,  506
Watch W ndow,  130 d sp ay ng mu t p e,  522
waterfa charts,  557 558 dup cate range names n mu t p e,  794
Waterfa charts.x sx fi e, A Pos t ve worksheet,  557 formu as for ce s n mu t p e,  123 126
web query, refresh sett ngs for,  347 nqu re add n for re at onsh ps between,  137
WEEKDAY funct on,  58, 213 nsert ng n workbook,  124
weekend st ng a n workbook,  192 193
co or for dates,  213 nav gat ng,  391
custom z ng defin t on of,  57 past ng range names st nto,  11
WE BULL.D ST funct on,  691, 694 scope vs. workbook scope,  9
We bu random var ab e,  691 693 structure of mode ,  127
What f Ana ys s,  141
Data Tab e,  141, 142, 143, 145, 496, 718, 723, 726,
732, 734, 781 X
Goa Seek,  150
x ax s
Scenar o Manager,  156
of h stogram,  361
w dcards
abe for,  572
* (aster sk) n MATCH funct on,  28
sca e for spark ne,  488
n database funct on cr ter a,  497
of scatter chart,  569
? (quest on mark) as,  164
X RR funct on,  71
W ngd ngs font,  546 547
.x sm fi e suffix,  192
w n/ oss spark ne,  490
XNPV funct on,  62, 760
W nters s method,  645 650
XY chart,  571.  See also scatter chart
n t a z ng,  646 647
parameter defin t ons,  645 646
smooth ng constants est mates,  647 649
Word document, mport ng data from,  339
Y
Workbook Ana ys s Report d a og box,  136 y ax s
Workbook Connect ons d a og box,  447, 448 abe for,  572
workbooks sca e for spark ne,  488
comb n ng reg on sa es n,  521 526 of scatter chart,  569
creat ng b ank worksheet n,  506 YEAR funct on,  58
d sp ay ng a range names n,  2 YEAR funct on (DAX),  467
nqu re add n nformat on on,  136 years of exper ence, non near effect on sa ary, 
nqu re add n to compare,  136 137 617 618
nsert ng worksheets,  124
st ng a worksheets n,  192 193
merg ng scenar os n,  158 Z
scope vs. worksheet scope,  9
zero, d v s on by,  104
WORKDAY funct on,  56
zones, n P votTab e F e d st,  390 392
WORKDAY. NTL funct on,  56

Index  859
About the author

WAYNE L . WINSTON s Professor Emer tus at the Ind ana Un vers ty Ke ey Schoo of
­ us ness and s present y a V s t ng Professor at the Bauer Co ege of Bus ness at the ­Un vers ty
B
of Houston He has won over 45 teach ng awards, has taught Exce and Exce mode ng to
thousands of bus ness ana ysts at Fortune 500 compan es, and has consu ted w th many
organ zat ons, nc ud ng the Da as Maver cks and New York Kn cks NBA teams He has wr tten
15 books on Exce , management sc ence, and operat ons research, nc ud ng Mathletics, wh ch
descr bes the math beh nd the exc t ng new fie d of sports ana yt cs

Das könnte Ihnen auch gefallen