You are on page 1of 184

MANAGING &

TABULATING DATA IN
MICROSOFT EXCEL
Learn the Power Features of Excel

8 HOUR TUTORIAL PROGRAM

SORTING, FILTERING,
PIVOT REPORTS,
DATA VALIDATION,
FORMS AND MORE

Excel for Professionals  2002-2006 VJ Books. All rights reside with the author

Contact vgupta1000@hotmail.com for corporate training in basic to advanced Excel


Managing & Tabulating Data in Excel

M
Maaan
M naaagggiiin
n nggg &
n &T
& Taaabbbu
T ulllaaatttiiin
u nggg D
n Daaatttaaa iiin
D nE
n Exxxccceeelll
E

Volume 4 of the series E


Exxxccceeelll fffooorrr P
E Prrrooofffeeessssssiiiooon
P naaalllsss
n
Volume 1: Excel For Beginners
Volume 2: Charting in Excel
Volume 3: Excel-- Beyond The Basics
Volume 4: Managing & Tabulating Data in Excel
Volume 5: Statistical Analysis with Excel
Volume 6: Financial Analysis using Excel

Published by VJ Books Inc

All rights reserved. No part of this book may be used or reproduced in any form or by
any means, or stored in a database or retrieval system, without prior written
permission of the publisher except in the case of brief quotations embodied in
reviews, articles, and research papers. Making copies of any part of this book for any
purpose other than personal use is a violation of United States and international
copyright laws.

First year of printing: 2002

Date of this copy: Tuesday, November 21, 2006

This book is sold as is, without warranty of any kind, either express or implied,
respecting the contents of this book, including but not limited to implied warranties
for the book's quality, performance, merchantability, or fitness for any particular
purpose. Neither the author, the publisher and its dealers, nor distributors shall be
liable to the purchaser or any other person or entity with respect to any liability, loss,
or damage caused or alleged to be caused directly or indirectly by the book.

This book is based on Excel versions 97 to XP. Excel, Microsoft Office, Microsoft
Word, and Microsoft Access are registered trademarks of Microsoft Corporation.

Publisher: VJ Books Inc, Canada

Author: Vijay Gupta

2
A
ABBO
OUUTT TTH
HEE A
AUUTTH
HOORR
Vijay Gupta has taught statistic, econometrics, and finance to institutions in the US
and abroad, specializing in teaching technical material to professionals.

He has organized and held training workshops in the Middle East, Africa, India, and
the US. The clients include government agencies, financial regulatory bodies, non-
profit and private sector companies.

A Georgetown University graduate with a Masters degree in economics, he has a


vision of making the tools of econometrics and statistics easily accessible to
professionals and graduate students. His books on SPSS and Regression Analysis
have received rave reviews for making statistics and SPSS so easy and “non-
mathematical.” The books are in use by over 150,000 users in more than 140
nations.

He is a member of the American Statistics Association and the Society for Risk
Analysis.

In addition, he has assisted the World Bank and other organizations with
econometric analysis, survey design, design of international investments, cost-
benefit, and sensitivity analysis, development of risk management strategies,
database development, information system design and implementation, and training
and troubleshooting in several areas.

Vijay has worked on capital markets, labor policy design, oil research, trade,
currency markets, and other topics.

Positions held include CEO of Synagoge Analytics, Vice-President of Blackstone


Technologies, Statistics Advisor to BearingPoint, and Senior Consultant to the World
Bank.

3
Managing & Tabulating Data in Excel

4
CHAPTER 1 SAVING (OPENING) IN (FROM) DIFFERENT FILE FORMATS 19

1.1 Spreadsheet, Database, Text & Statistical Software 19


Excel worksheet versions 2.0 to 4.0. 20
1.1.a Lotus 1–2–3 versions 1.0 to 4.0, Quattropro and dBase versions I to IV 20
1.1.b Text 21
1.1.c Many formats save only one worksheet 21
1.1.d Many formats cannot store information on cell formatting, comments, etc 22
1.1.e Statistical application files: SPSS, SAS, STATA, etc 22
1.1.f Database applications: Access, Oracle, MS SQL Server, FoxPro, Paradox, other 22
1.2 Special Formats: Adobe PDF, Html, Web Archive, XML 22
1.3 Workspace— “I Have To Work On Several Files Together Each Day…Can't I Open
Them All At One Time?” 22
Creating a workspace 23
Using the workspace— Opening several files together 23

1.4 New In The XP Version Of Excel: Document Recovery And Safe Mode 24
CHAPTER 2 DATA ENTRY FORM 26

2.1 An Easier Way To Type In Data Plus A Multi-Series “Find” Utility (Data /Form) 26
2.2 Form Based Data Entry 26
2.2.a New data 26
2.3 Using The Form As A “Find” Or “Search” Utility 27
A Summary Of The Two Roles Of Data/Form 29
CHAPTER 3 REDUCING ERRORS IN DATA ENTRY— VALIDATION AND
AUTOCORRECT 32

3.1 Validating Data During Data-Entry 32


3.1.a Validation for numeric data 33
3.1.b Message shown to person entering the data into cells that have “data validation” criteria
36
3.1.c Error Alert 37
3.1.d The validation rule in action 37
3.1.e Validation for text entry 39
3.1.f Testing the validation 40
3.1.g Ensuring that only a string from a set can be entered 41
3.2 Removing Validation Rules From A Range 43
3.3 Copying And Pasting Validation Rules 43
3.4 Selecting All Cells With The Same Data Validation Rule 44
3.5 Using “Forms” And “Data Validation” 44
3.6 Autocorrect 44
CHAPTER 4 USING FILL AND OTHER TOOLS TO SAVE ON TYPING TIME 46
Managing & Tabulating Data in Excel

4.1 Making Excel Fill In Numbers And Dates 46


4.1.a Filling years/integers 46
4.1.b Filling in every alternate year 48
4.2 Auto Fill — Filling From Pre-Defined Lists Of Days, Months, Other 49
4.2.a Filling weekdays 51
4.3 Creating A New “Custom List” 52
4.4 Filling Missing Values 55
4.4.a Using constant increase in values 56
4.4.b Using constant growth rates 57
4.5 Filling Formats 58
4.6 Copying The Active Cell 58
4.7 Using A Right-Click-On-Mouse For Quick-Filling 58
4.8 Placing Data Entry Icons Onto The Toolbar 59
4.9 “Speech To Text” 59
CHAPTER 5 “CONDITIONAL FORMATTING”— COLOR–CODING DATA PATTERNS
61

5.1 Understanding The Dialog 61


5.2 Defining The Condition 62
5.3 Step 1: Defining The Condition/Criteria 62
5.4 Step 2: Defining the format to use for Cells that satisfy the condition 62
5.5 Understanding The “Conditional Format” 63
Step 3: Adding more conditional formats 64

5.6 Defining A “Dynamic” Condition 64


5.7 Deleting Conditional Formats 66
5.8 Selecting All Cells With The Same Conditional Format Rule 66
CHAPTER 6 SORTING 68

6.1 Basic sorting 68


6.2 Names of series or columns 69
6.3 Case sensitivity 70
6.4 Sorting by rows 70
6.5 Sorting ranges that do not cover entire columns or rows 72
6.6 Choosing the entire worksheet 72
CHAPTER 7 FILTER (“HIDING THE DATA YOU DO NOT WANT TO VIEW”) 75

7.1 By one criterion on one column 75


7.1.a The Filtering arrows 76
7.1.b Choosing the value to use as the Filtering criterion 76
7.1.c The result: a Filtered worksheet 77
7.1.d Copying and pasting the Filtered rows 77

6
Contents

7.2 Removing the Filter 78


7.3 Custom Filtering — using multiple criterion, logical conditions, etc 78
7.3.a Example of a Filter that has two criteria over one series/column 78
7.3.b Using the wildcard asterisk (*) 79
7.4 Filtering using criteria from more than one column/series 79
7.5 New in the XP version of Excel 81
7.6 Icons for Sorting and Filtering 81
CHAPTER 8 SELECTING ALL CELLS/CONTENT ACROSS THE WORKSHEET THAT
SATISFY A CRITERION 84

8.1 The “GO TO” option 84


8.1.a Selecting cells with comments, empty cells, unhidden cells, cells in the contiguous
region of the currently active cell 85
8.2 Conditional Formatting 86
8.3 Selecting based on Data Validation 86
8.4 Selecting based on formulae 87
8.4.a Constants 87
8.4.b Formula Results 88
8.5 Selecting based on cell references in formulas 89
8.5.a Selecting all cells whose formulas reference the active cell (directly or/and indirectly)
89
8.5.b Selecting all cells referenced (directly or/and indirectly) by the formula in the active
cell 89
8.6 GO TO / SPECIAL as a search tool 90
CHAPTER 9 SUBTOTALS 91

9.1 Basics 91
9.2 Before making subtotals 91
9.3 Obtaining subtotals 91
9.3.a Choosing the subtotaling formula: average, sum, etc 93
9.4 Viewing only those rows that have subtotals 94
9.5 Removing subtotals 94
9.6 The “Consolidation” tool 94
CHAPTER 10 PIVOT REPORTS 97

10.1 The four steps in making a two-dimensional Pivot Report 97


10.1.a Step 1: Opening the Pivot Report wizard 98
10.1.b Step 2: Choosing the data for tabulation 100
10.1.c Step 3a: Designing the Pivot Report 100
10.1.d Step 3b: Choosing the formula for aggregation/tabulation 102
10.1.e Step 4a: Options 104
Format options: 105
Data options 106
External data options 106

7
Managing & Tabulating Data in Excel

10.1.f Step 4b: Wrapping it up — creating the Pivot Report 106


10.2 Modifying/editing a Pivot Report 108
10.2.a Modifying the structure of a Pivot Report 109
10.2.b Adding a new function (and thus a new row series) 110
10.2.c Editing fields 112
Selecting a field 112
Viewing the options available for modifying/editing a field 113
10.2.d Deleting a field 116
10.3 Refreshing the Report 116
10.4 Pivot Report example with a third dimension (row, column and page) 116
10.4.a Viewing different “pages” 117
10.4.b Making a new worksheet for each “page” 118
10.4.c Making a new chart for each “page” 118
10.5 Pivot reports from Scenarios 119
10.6 OLAP: New feature in the XP version of Excel 119
10.7 Icons for Pivoting 119
CHAPTER 11 “IF-THEN” ANALYSIS: SCENARIOS AND GOAL SEEK 121

11.1 Scenarios (for “If this assumption-then this result”) 121


11.1.a Defining the Scenarios 122
Using the Scenarios 124
Scenario summary 125
Using the “Group and Outline” tool 126
Scenario-based Pivot Tables 128

11.2 Goal Seek (“If I want this cell to have a certain result, what value should that cell take)
130
11.2.a Setting the desired value for the “target” cell (the one with the formula that references
the “solution” cell) 130
11.2.b Choosing the “solution” cell 130
Running the utility 131
CHAPTER 12 LINKING TO A DATABASE 133

Important definition: “Query” 133

12.1 Understanding the structure of a database file 134


Analogy between the structures of a database file and an Excel file 135

12.2 Linking to data from a database (or, “creating and executing a data query”) 135
12.2.a Step 1: Choosing the Database File from which data will be imported 135
12.2.b Step 2: Choosing the Columns/Fields/Variables to Import 137
Selecting fields for import into Excel 139
12.2.c Step 3: (Pre–) Filtering the data to be imported 141
12.2.d Step 4: Pre–sorting the data to be imported 145
12.2.e Step 5: Saving the Query (that is, saving steps 1–4) 146
12.2.f Step 6: Wrapping it up— getting the data into Excel 147
12.3 Refreshing the link between the Excel range and data in the database file 148
12.4 Editing an existing query 149
12.5 Using “External data source” to create a Pivot Report 149
12.6 New in the XP version of Excel: OLAP 150

8
Contents

12.6.a Data from the Internet 150


12.7 Icons relevant to External Data 150
CHAPTER 13 READING ASCII TEXT DATA 152

13.1 Understanding ASCII Text data 152


Why is data stored and distributed in this format? 152
What is special about this format? 153
Fixed–width/Column 153
Delimited/Free-Field 154

13.2 Reading delimited/Free-Field ASCII Text data 154


13.2.a Step 1: Choosing whether the format is delimited or Fixed-width 155
13.2.b Step 2: Choosing the correct Delimiter: tab, comma, space, etc 156
Determining if Excel or you have chosen the wrong Delimiter 156
13.2.c Step 3: Define the data formats (if not done automatically/correctly by Excel) 157
13.2.d Converting into an Excel file 158
13.3 Reading Fixed-width ASCII TEXT 159
CHAPTER 14 PASTE SPECIAL 164

14.1 Pasting The Result Of A Formula, But Not The Formula 164
14.2 Other Selective Pasting Options 166
14.2.a Pasting only the formula (but not the formatting and comments) 166
14.2.b Pasting only formats 167
14.2.c Pasting data validation schemes 167
14.2.d Pasting all but the borders 167
14.2.e Pasting comments only 167
14.3 Performing An Algebraic “Operation” When Pasting One Column/Row/Range On To
Another 168
14.3.a Multiplying/dividing/subtracting/adding all cells in a range by a number 168
14.3.b Multiplying/dividing the cell values in cells in several “pasted on” columns with the
values of the copied range 168
14.4 Switching Rows To Columns 168
CHAPTER 15 SAVING OR TRANSFORMING TO SPECIAL WEB AND DOCUMENT
FORMATS 170

15.1 Converting to a PDF (Adobe Acrobat) file 170


15.1.a Creating a PDF (Adobe Acrobat) file from the printout 170
15.1.b Other tools for converting one or multiple files into PDF 172
15.2 Saving as an HTML file 172
15.2.a Interactivity when saving a worksheet 172
15.2.b Interactivity when saving a chart 174
15.3 New in the XP version of Excel: Web Archive format and XML 175
15.3.a Web Archive 176
15.3.b XML 181

INDEX 181

9
Managing & Tabulating Data in Excel

10
Contents

Mapping of menu options with


sections of the book and in the series of books

You may be looking for a section that pertains to a particular menu option in Excel. I
now briefly lay out where to find (in the series) a discussion of a specific menu option
of Excel.

Table 1: Mapping of the options in the “FILE“ menu


Menu Option Section that discusses the option
OPEN chapter 1
SAVE
SAVE AS Volume 1: Excel For Beginners

SAVE AS WEB PAGE 15.2


SAVE WORKSPACE 1.3
SEARCH Volume 1: Excel For Beginners
PAGE SETUP Volume 1: Excel For Beginners
PRINT AREA Volume 1: Excel For Beginners
PRINT PREVIEW Volume 1: Excel For Beginners
PRINT Volume 1: Excel For Beginners
PROPERTIES Volume 1: Excel For Beginners

Table 2: Mapping of the options in the “EDIT“ menu


Menu Option Section that discusses the option
UNDO Volume 1: Excel For Beginners
REDO Volume 1: Excel For Beginners
CUT Various
COPY
PASTE
OFFICE CLIPBOARD Volume 1: Excel For Beginners
PASTE SPECIAL Volume 3: Excel– Beyond The Basics
FILL chapter 4
CLEAR Volume 1: Excel For Beginners
DELETE SHEET Volume 1: Excel For Beginners
MOVE OR COPY SHEET Volume 1: Excel For Beginners
FIND Volume 1: Excel For Beginners
REPLACE Volume 1: Excel For Beginners
GO TO Volume 3: Excel– Beyond The Basics
LINKS Volume 3: Excel– Beyond The Basics

11
Managing & Tabulating Data in Excel

Menu Option Section that discusses the option


Volume 3: Excel– Beyond The Basics
OBJECT
Volume 2: Charting in Excel

Table 3: Mapping of the options in the “VIEW“ menu


Menu Option Section that discusses the option
NORMAL Volume 1: Excel For Beginners
PAGE BREAK PREVIEW Volume 1: Excel For Beginners
TASK PANE Volume 1: Excel For Beginners
Volume 1: Excel For Beginners
TOOLBARS
Volume 3: Excel– Beyond The Basics
FORMULA BAR Leave it on (checked)
STATUS BAR Leave it on (checked)
HEADER AND FOOTER Volume 1: Excel For Beginners
COMMENTS Volume 3: Excel– Beyond The Basics
FULL SCREEN Volume 1: Excel For Beginners
ZOOM Volume 1: Excel For Beginners

Table 4: Mapping of the options in the “INSERT“ menu


Menu Option Section that discusses the option
CELLS Volume 1: Excel For Beginners
ROWS Volume 1: Excel For Beginners
COLUMNS Volume 1: Excel For Beginners
WORKSHEETS Volume 1: Excel For Beginners
CHARTS Volume 2: Charting in Excel
PAGE BREAK Volume 1: Excel For Beginners
Volume 1: Excel For Beginners
Volume 3: Excel– Beyond The Basics
FUNCTION
Volume 5: Statistical Analysis with Excel
Volume 6: Financial Analysis using Excel
FUNCTION/FINANCIAL Volume 6: Financial Analysis using Excel
FUNCTION/STATISTICAL Volume 5: Statistical Analysis with Excel
FUNCTION/LOGICAL Volume 3: Excel– Beyond The Basics
FUNCTION/TEXT Volume 3: Excel– Beyond The Basics
FUNCTION/INFORMATION Volume 3: Excel– Beyond The Basics
FUNCTION/LOOKUP Volume 3: Excel– Beyond The Basics
FUNCTION/MATH & TRIG Volume 3: Excel– Beyond The Basics
FUNCTION/ENGINEERING Volume 3: Excel– Beyond The Basics

12
Contents

Menu Option Section that discusses the option


FUNCTION/DATABASE Volume 3: Excel– Beyond The Basics
Volume 1: Excel For Beginners
FUNCTION/DATE & TIME Volume 5: Statistical Analysis with Excel
Volume 6: Financial Analysis using Excel
NAME Volume 1: Excel For Beginners
COMMENT Volume 3: Excel– Beyond The Basics
PICTURE Volume 2: Charting in Excel
DIAGRAM Volume 2: Charting in Excel
OBJECT Volume 3: Excel– Beyond The Basics
HYPERLINK Volume 3: Excel– Beyond The Basics

Table 5: Mapping of the options inside the “FORMAT“ menu


Menu Option Section that discusses the option
CELLS Volume 1: Excel For Beginners
ROW Volume 1: Excel For Beginners
COLUMN Volume 1: Excel For Beginners
SHEET Volume 1: Excel For Beginners
AUTOFORMAT Volume 1: Excel For Beginners
CONDITIONAL FORMATTING chapter 5
STYLE Volume 1: Excel For Beginners

Table 6: Mapping of the options inside the “TOOLS“ menu


Menu Option Section that discusses the option
SPELLING Volume 1: Excel For Beginners
ERROR CHECKING Volume 3: Excel– Beyond The Basics
SPEECH 4.9
SHARE WORKBOOK Volume 3: Excel– Beyond The Basics
TRACK CHANGES Volume 3: Excel– Beyond The Basics
PROTECTION Volume 3: Excel– Beyond The Basics
ONLINE COLLABORATION Volume 3: Excel– Beyond The Basics
GOAL SEEK Volume 3: Excel– Beyond The Basics
Volume 5: Statistical Analysis with Excel
SCENARIOS
Volume 6: Financial Analysis using Excel
AUDITING Volume 3: Excel– Beyond The Basics
The option will take you to a Microsoft site that provides
TOOLS ON THE WEB
access to resources for Excel
MACROS In upcoming book on “Macros for Microsoft Office”

13
Managing & Tabulating Data in Excel

Menu Option Section that discusses the option


Volume 3: Excel– Beyond The Basics
ADD-INS
Volume 5: Statistical Analysis with Excel
AUTOCORRECT Volume 3: Excel– Beyond The Basics
CUSTOMIZE Volume 3: Excel– Beyond The Basics
OPTIONS Volume 1: Excel For Beginners

Table 7: Mapping of the options inside the “DATA” menu


Menu Option Section that discusses the option
SORT chapter 6
FILTER chapter 7
FORM chapter 2
SUBTOTALS chapter 9
VALIDATION chapter 3
TABLE Volume 3: Excel– Beyond The Basics
CONSOLIDATION section 48.5
GROUP AND OUTLINE Volume 1: Excel For Beginners
PIVOT REPORT chapter 10
EXTERNAL DATA chapter 12

Table 8: Mapping of the options inside the “WINDOW“ menu


Menu Option Section that discusses the option
HIDE Volume 3: Excel– Beyond The Basics
SPLIT Volume 1: Excel For Beginners
FREEZE PANES Volume 1: Excel For Beginners

Table 9: Mapping of the options inside the “HELP“ menu


Menu Option Section that discusses the option
OFFICE ASSISTANT Volume 1: Excel For Beginners
HELP Volume 1: Excel For Beginners
WHAT’S THIS Volume 1: Excel For Beginners

14
Contents

Are there not enough Excel books in the market? I have asked myself this question
and concluded that there are books “inside me,” based on what I have realized from
observation by friends, students, and colleagues that I have a “vision and knack for
explaining technical material in plain English.”

Read the book practicing the lessons on the sample files provided in the zipped file
you downloaded. I hope the book is useful and assists you in increasing your
productivity in Excel usage. You may be pleasantly surprised at some of the features
shown here. They will enable you to save time.

The “Make me a Guru” series teach technical material in simple English. A lot of
thinking went into the sequencing of chapters and sections. The book is broken down
into logical “functional” components. Chapters are organized into sections and sub-
sections. This creates a smooth flowing structure, enabling “total immersion”
learning. The current series is broken down into a multi-level hierarchy:

—Chapters, each teaching a specific skill/tool.

— Several sections within each chapter. Each section shows aspect of the
skill/tool taught in the chapter. Each section is numbered—for example,
“Section 1.2” is the numbering for the second section in chapter 1.

— A few sub-sections (and maybe one further segmentation) within each section.
Each sub-section lists a specific function, task, or proviso related to the
“master” section. The sub-sections are numbered——for example, “1.2.a” for
the first sub-section in the second section of chapter 1.

Unlike other publishers, I do not consider you dummies or idiots. Each and everyone
had the God given potential to achieve mastery in any field. All one needs is a guide
to show you the way to master a field. I hope to play this role. I am confident that
you will consider your self an Excel “Guru” (in terms of the typical use of Excel in
your profession) and so will others.

Once you learn the way to master a windows application, this new approach will
enable you to pick up new skills” on the fly.” Do not argue for your limitations. You
have none.

I hope you have a great experience in learning with this book. I would love feedback.
Please use the feedback form on our website vgupta.com. In addition, look for
updates and sign up for an infrequent newsletter at the site.

15
Managing & Tabulating Data in Excel

MANAGING & TABULATING DATA


Excel has extremely powerful data entry, data management, and tabulation tools.
The combination of tools provide almost database like power to Excel. Unfortunately,
the poor quality of the menu layout and the help preclude the possibility of the user
self-learning these features.

BASICS
The fundamental operations in Excel are taught in Volume 1: Excel For Beginners,
Volume 2: Charting in Excel, and Volume 3: Excel– Beyond The Basics

FUNCTIONS
I teach the writing of formulas and associated topics in Volume 3: Excel– Beyond The
Basics. I show, in a step-by-step exposition, the proper way for writing cell
references in a formula. The book describe tricks for copying/cutting and pasting in
several examples. In addition, I discuss special pasting options.

Finally, different types of functions are classified under logical categories and
discussed within the optimal category. The categories include financial, Statistical,
Text, Information, Logical, and “Smart” Logical.

FINANCE
In three chapters on financial functions, I list the functions used for estimating loan
repayments (for example, like a car loan or house mortgage), discount cash flow
analysis (used often for estimating the returns and present values of multi-period
investment projects), and parameters associated with securities market instruments
like bonds and T-bills.

If your interest is Investment Banking or Feasibility Studies (Project Finance), you


should learn Scenarios, the Solver utility, and Goal Seek. With Scenarios, you can
perform basic risk analysis.

STATISTICS PROCEDURES
Three chapters teach statistics functions including the use of Excel functions for
building Confidence Intervals and conducting Hypothesis Testing for several types of
distributions. The design of hypothesis tests and the intermediate step of
demarcating critical regions are taught lucidly.

CHARTING
Please refer to book two in this series. The book title is Charting in Excel.

Sample data
All the sample data files are included in the zipped file.

16
Contents

Most of the tutorials use publicly available data from the International labor
Organization (ILO). I used a simple data set with only a few columns and
observations. All the sample data files are included in the zipped file.

17
Saving or transforming to special web and document formats

CHAPTER 1
SSA
AVVIIN
NGG ((O
OPPEEN
NIIN
NGG)) IIN
N ((FFRRO
OMM)) D
DIIFFFFEERREEN
NTT FFIILLEE FFO
ORRM
MAATTSS

In this chapter, I briefly discuss the following topics:

— SAVING/OPENING TO/FROM FILE FORMATS LIKE LOTUS 1–2–3 VERSIONS 1.0 TO 4.0,
QUATTROPRO AND DBASE VERSIONS I TO IV, TEXT.

— STATISTICAL APPLICATION FILES: SPSS, SAS, STATA, ETC

— DATABASE APPLICATIONS: ACCESS, ORACLE, MS SQL SERVER, FOXPRO, PARADOX,


OTHER

— WORKSPACE— “I HAVE TO WORK ON SEVERAL FILES TOGETHER EACH DAY…CAN'T I


OPEN THEM ALL AT ONE TIME?”

— USING THE WORKSPACE— OPENING SEVERAL FILES TOGETHER

— NEW IN EXCEL XP: DOCUMENT RECOVERY AND SAFE MODE

1.1 SPREADSHEET, DATABASE, TEXT & STATISTICAL SOFTWARE

Excel XP, 2000, and 97 can open files from various file formats, including:

— Current and older versions of Excel workbooks

— Older versions of Excel workbooks

— Other spreadsheet applications like Lotus 1–2–3, Quattropro, and Microsoft


Works. This includes older versions of these file formats.

— Text files (delimited and fixed column width —see chapter 13 on page 152)

— Web pages

— Database applications like Access, Paradox, dBase, etc. This includes older
versions of these file formats. The use of ODBC connectivity (direct
linking to a database with automatic updating) is taught in chapter 12 on
page 133.

— Special data or reference storing formats like “.dif” and “.slk.”

Excel cannot read directly from statistical software like SAS, SPSS, and STATA.

These statistical applications provide an option to output data files in Excel format.

19
Managing & Tabulating Data in Excel

Using the mouse, select the menu path FILE/OPEN or FILE/SAVE AS and click on
the arrow next to the box “Open as type” or “Save as type” as shown in the next
figure.

You will see several options for the file type from which Excel will read in data (and
to which Excel will save data). Several of the formats are historical versions of Excel.

Figure 1: The FILE/OPEN or FILE/SAVE AS dialog (user-input form)

Excel worksheet versions 2.0 to 4.0.


If the option includes the text “Excel worksheet” then only the active worksheet is
saved. This is useful if you want to read Excel files into software like SPSS, SAS and
other applications that do not read Excel workbooks but do read Excel worksheets.

Figure 2: Old Excel formats

1.1.A LOTUS 1–2–3 VERSIONS 1.0 TO 4.0, QUATTROPRO AND DBASE VERSIONS I TO IV

You can save as a Lotus 1–2–3 workbook (versions WK4 to WK1) and as different

20
Saving or transforming to special web and document formats

versions of Quattropro. Older spreadsheet formats save only the active worksheet.

Figure 3: Lotus 1–2–3 formats

dBase II–IV are excellent “transport” formats. Almost all data applications read
these formats.

The applications that read dBase include SAS, SPSS, STATA, Access, and many
other data warehousing and data mining software.

Figure 4: Quattropro and the popular dBase formats

1.1.B TEXT

Different text formats include cross platform support— in Windows, saving an Excel
file as a text file will allow the file to be read in DOS or the Mac). The process of
reading data from such files is taught in chapter 13.

Figure 5: Some special data formats (you can ignore these)

Figure 6: Text formats

1.1.C MANY FORMATS SAVE ONLY ONE WORKSHEET

Older spreadsheet formats, database and text formats will save only the active
worksheet. Excel will inform you of this (as shown in the next figure) and give you
the option of canceling the save task.

21
Managing & Tabulating Data in Excel

1.1.D MANY FORMATS CANNOT STORE INFORMATION ON CELL FORMATTING, COMMENTS, ETC

Excel will inform you if the file-format you are saving will save all attributes of the
worksheet/workbook.

In most cases, the attributes that cannot be saved are cosmetic formatting features
and embedded objects like charts, drawing tools, etc.

Figure 7: Some formats save only raw data

1.1.E STATISTICAL APPLICATION FILES: SPSS, SAS, STATA, ETC

Most of these applications will read and write some formats that Excel can
read/write. These formats include Excel 4 worksheet and dBase III.

1.1.F DATABASE APPLICATIONS: ACCESS, ORACLE, MS SQL SERVER, FOXPRO, PARADOX, OTHER

Most of these applications will read and write some formats that Excel can
read/write. These formats include Excel 4 worksheet and dBase III.

1.2 SPECIAL FORMATS: ADOBE PDF, HTML, WEB ARCHIVE, XML

This topic is taught in chapter 15.

1.3 WORKSPACE— “I HAVE TO WORK ON SEVERAL FILES TOGETHER EACH


DAY…CAN'T I OPEN THEM ALL AT ONE TIME?”

Assume you are working on a project in which you use 12 files. Further, these files
are saved in different drives/directories or paths. (So, some are in “C:\data\,” some
in “M:\projects\ttvgr\vijay\,” and so on.) Assume further that you have to open all
files simultaneously before doing any work. This can be achieved by, either (a)
writing all the file names along with their path (location), or (b), using the
“Workspace” feature.

22
Saving or transforming to special web and document formats

Creating a workspace
Assume the 12 files you need for one work session are open (and no other files are
open). Select the option FILE/SAVE WORKSPACE. Write a name for this group of
files you have been working on (see Figure 8). Click on the button “Save.”

Figure 8: Saving links to all open Excel files as one Workspace

Using the workspace— Opening several files together


When you want to work on the group of files again— open Excel, pick the menu
option FILE/OPEN and open the workspace file as shown in Figure 9. The 12 Excel
files you were working on earlier open!

23
Managing & Tabulating Data in Excel

Figure 9: When you open the Workspace, Excel opens all the Excel files that were open when you last saved
the Workspace

1.4 NEW IN THE XP VERSION OF EXCEL: DOCUMENT RECOVERY AND SAFE


MODE

The document recovery feature is excellent in the XP version of Excel. If the


application freezes/crashes, the PC crashes, or you lose connection to a power source,
the chances of losing the work you did on the file since the last save is low. Excel
keeps a tab on your changes and creates a recovery backup continuously. On re-
launching Excel, the recovery files are displayed in the task pane, as well as the last
saved files, along with the times and dates of these files last save (by you or by
Excel’s document recovery tool). You can choose which version(s) to save.

A related feature is the ability to open an application in “Safe Mode,” and resolve the
problems with the application using this mode.

24
Managing & Tabulating Data in Excel

CHAPTER 2

D
DAATTA
A EEN
NTTRRYY FFO
ORRM
M

This chapter teaches the following topics:

— AN EASIER WAY TO TYPE IN DATA PLUS A MULTI-SERIES “FIND (DATA /FORM)

— FORM BASED DATA ENTRY

— NEW DATA

— USING THE FEATURE AS A “FIND “SEARCH

2.1 AN EASIER WAY TO TYPE IN DATA PLUS A MULTI-SERIES “FIND” UTILITY


(DATA /FORM)

Assume you have to type in data for a few series. You find typing on the worksheet
directly to be a pain. An easier way is to use a form. Use the sample file “Advanced
Files1.xls.”

2.2 FORM BASED DATA ENTRY

First, in the first rows of consecutive columns, enter the title for the series in that
column (as in the sample file).

Using the mouse, select the menu path DATA/FORM. You will see a “form” for
entering the data. (For a pictorial reproduction, see Figure 10.) Excel has
automatically picked up the “Series Names” from the first row. (The series on the
worksheet are named “Series Name,” “Country Name,” “1995,” “2000” and “2010”).

2.2.A NEW DATA

You can enter the data for a new case/row by clicking on “New” and typing in the
data for the first series, pressing the “TAB and then entering the data for the next
series and so on. “Delete” will delete an entire row.

26
Data Entry Form

Figure 10: The form for data entry

2.3 USING THE FORM AS A “FIND” OR “SEARCH” UTILITY

An additional advantage of the DATA/FORM feature is that it is also a powerful


“find” facility. Click on the button “Criteria.”

Figure 11: Using the “Criteria” option to make the data entry form into a data search form

After you click on “Criteria,” the dialog (user-input form) shown in Figure 12 opens.
Compare that dialog with the dialog shown in the previous figure.

Note that the buttons on the right half of the dialog have changed. The button “New”
is unavailable and there is no “Delete” button. The button “Clear” replaces “Delete.”
Use Clear for removing all the conditions in the Criteria dialog. The button “Form”
switches to the data entry form dialog.

27
Managing & Tabulating Data in Excel

Figure 12: The “Criteria” dialog. Note the title “Criteria” at the top-right.

Enter the criterion for finding data. (For a pictorial reproduction, see Figure 13.)

Figure 13: A multiple series criteria for finding data

Clicking on the button “Clear” will remove all criteria while clicking on the button
“Restore” will restore the defaults. In addition, in general, when in the “Find” or
“Criteria” facility, you return to the “Form” facility for data entry by clicking on the
button “Form.”

Now, when you click on the button “Find Next” you will be taken to the next row/case
in which the country name is Algeria, the values of the data for 1995, 2000, and 2010
are greater than 10000, 15000 and 17000, respectively. (For a pictorial reproduction,
see Figure 15.)

28
Data Entry Form

Figure 14: Use the “Find Next” button to locate the next observation (row) whose data satisfies the
“criteria.”

Figure 15: After clicking on the button “Find Next” you will see the next row/case that satisfies all four
conditions of the criteria

Note that you are back in the “Form” facility.

A Summary Of The Two Roles Of Data/Form


Special
Role Function Common buttons
Buttons/options

Form” Enabling data entry, New: allows data Find next, Find

29
Managing & Tabulating Data in Excel

Special
Role Function Common buttons
Buttons/options

facility editing of existing data, entry for a new row previous: the criteria
deletion or addition of is defined using the
rows Delete: deletes the “Find” or “Criteria”
current row facility

Criteria: switches to
the “Criteria” or
“Find” facility

Finding rows that meet Clear: removes all


Find next, Find
a set of criteria based on the criteria
previous:
Find” or the same series as in the
automatically reverts
“Criteria” “form” facility. (Note Restore: Form:
dialog back to the
facility that the Left hand side switches to the
“Form” data entry
series labels are same “Form” facility for
facility
for both) data entry

30
Managing & Tabulating Data in Excel

CHAPTER 3

RREED
DUUC
CIIN
NGG EERRRRO
ORRSS IIN
NDDA
ATTA
A EEN
NTTRRYY—
—VVA
ALLIID
DAATTIIO
ONNA
ANND
D
AAUUTTO
OCCOORRRREEC
CTT

This chapter teaches the following topics:

— VALIDATION FOR NUMERIC DATA

— MESSAGE SHOWN TO PERSON ENTERING THE DATA INTO CELLS THAT HAVE “DATA
VALIDATION

— ERROR ALERT

— THE VALIDATION RULE IN ACTION

— VALIDATION FOR TEXT ENTRY

— TESTING THE VALIDATION

— ENSURING THAT ONLY A STRING FROM A SET CAN BE ENTERED

— REMOVING VALIDATION RULES FROM A RANGE

— COPYING AND PASTING VALIDATION RULES

— USING “FORMS” AND “DATA VALIDATION“

3.1 VALIDATING DATA DURING DATA-ENTRY

If you are typing data straight into Excel, you may want to take steps to reduce the
chance of making typing errors. For a small amount of data, a visual scan after data
entry may suffice as a data validation technique. However, when the amount of data
is large and/or you want to ensure that invalid data is not entered in a cell, then you
should use the option DATA/VALIDATION.

Open a new Excel file. Assume you want to enter data into three columns:

• In column F, a series of numbers

• In column G, a series of text entries

• In column H, the appropriate country name from a list you have

Further, assume you want the data to satisfy the following “validation” rules or
criteria:

32
Reducing Errors in Data Entry – “Validation” & “Autocorrect”

1. The data in column F must be in number format and larger than


12,000,000 (or a blank or empty cell). If, while typing in the data, any
value is entered that does not satisfy these criteria, then Excel should give
me a warning. Read page 33 for the way to ensure that these criteria are
set.

2. The data in column G must be in text format and cannot be of a length


longer than eight letters (this includes any spaces). Read page 39 for the
way to ensure that these criteria are set.

3. The data in column H can only be one of the values in a chosen set of cells.
Read page 41 for the way to ensure that this criterion is set.

3.1.A VALIDATION FOR NUMERIC DATA

Select cell F1 and type in a title for the data that will be typed into this column. The
next figure illustrates this.

Figure 16: Write the label

Click on the letter “F” at the top of the spreadsheet so that the entire column “F” is
selected/highlighted. (Alternatively, use the mouse to select a limited range like
“F1:F81.”)

Access the feature through the menu path DATA/VALIDATION. Click on the tab
“Settings.”

Figure 17: The Data Validation dialog (user-input form)

Setting the first validation rule

In the area “Allow” choose the option “Whole Number”. The next figure illustrates
this. You have set the first validation rule: “any data entered in column F must be a
whole number; the data cannot be text, dates, numbers with decimals, etc.”

33
Managing & Tabulating Data in Excel

Figure 18: Setting the Validation Criteria

When you click on the option “Whole Number,” the dialog (user-input form) will
change and include new boxes that are relevant for writing validation rules for whole
numbers. (For a pictorial reproduction, see Figure 19.) These rules typically are of
the type “less than,” “equal to,” “greater than,” etc.

Figure 19: Setting a Validation Criteria that will only permit the entry of “Whole Numbers” into the
underlying column/range

Setting the second validation rule

Now you have to set the second validation rule: “any data entered in column F cannot
have a value that is greater than 120000, unless it is a blank/empty cell.”

34
Reducing Errors in Data Entry – “Validation” & “Autocorrect”

Step 1: Click on the downward arrow next to the box “Data1“. The next figure
illustrates this. In the area “Data,” choose the comparison option “greater than or
equal to” as shown in Figure 20.

Because you have chosen “Greater than or equal to,” the dialog has modified and now
no longer has a box for “Maximum2“! (For obvious reasons, that box is useless if you
are looking for numbers “Greater than or equal to”!)

Figure 20: Defining the Criteria

Step 2: Enter the second validation rule into this box as shown in Figure 21.

Allowing empty cells (that is, data points)


Select the option “Ignore blank.”

You have defined the validation rule for column F.

1 Excel has “dynamic” menus. The dialog adapts and changes once you choose a
validation rule in the area “Allow.” Excel knows the variable has to a whole number.
The relevant additional criteria have to be based on this logic. Therefore, Excel
shows “Data,” “Minimum” and “Maximum.” Compare with the options shown in the
dialog when your validation rules are for text data (see Figure 102 on page 40) and
for a defined list (see Figure 107 on page 41).
2 As mentioned in the previous footnote, Excel has “dynamic” menus and dialogs. The
dialog adapts and changes once you choose a “comparison operator / rule” in the area
“Data.” Try different options.

35
Managing & Tabulating Data in Excel

Figure 21: The completed Validation Criteria

Nevertheless, do not click as yet on the button OK!

Next, you need to ensure that the rule does its job of precluding the input of invalid
data. For that, you use an “input message” and an “error alert.” The former informs
the person entering data into a cell about any validation rule that governs the set of
acceptable data in that cell. The latter gives an “error alert” warning if inappropriate
data/text is entered into a cell that has validation criteria. Excel will not permit any
invalid data. I now show how to use these two methods.

3.1.B MESSAGE SHOWN TO PERSON ENTERING THE DATA INTO CELLS THAT HAVE “DATA
VALIDATION” CRITERIA

Within the DATA/VALIDATION dialog, click on the tab “Input Messages.”

Enter a short title and an “Input message”— this message will pop-up and inform the
person entering data into column “F” that the data has to follow the rules mentioned
in the message. (See two figure’s down to view what the message box will look like in
action.)

When the cursor is over any cell in column “F,” this message will be displayed. The
message should provide information on the validation rule.

36
Reducing Errors in Data Entry – “Validation” & “Autocorrect”

Figure 22: Entering text that will be seen when a person enters data into any cell within the range that has a
validation criterion

3.1.C ERROR ALERT

Even more important than the “Input Message” tab is the “Error Alert” tab. The title
and message you write here will inform the person typing the data if a data value
entered did not satisfy the criteria set by your validation rules. (I will show some
examples.)

Figure 23: Enter the text that should be shown if invalid data is entered into any cell in a range that has
validation criteria for data entry

Now you can execute the dialog by clicking on the button OK. The validation rules,
and accompanying input message and error alert have been set for column “F.”

3.1.D THE VALIDATION RULE IN ACTION

Click in cell F2. Even before you start entering any data/text into the cell, Excel
displays the “Input Message” as a pop-up text-box. This message reminds you about

37
Managing & Tabulating Data in Excel

the validation rule.

Figure 24: The “Input Message” in practice

Type a valid number in cell F2, and leave F3 blank (which


conforms to our validation rule).

Enter another valid number in cell F4.

Figure 25: Try this example

Assume that In cell F5 you make a mistake in typing. Notice the letter “w” — the
addition of this letter makes the entire cell “text” data and not a whole number as
required by the validation rules.

Figure 26: On entering invalid data…..(see next figure)

When you push down the ENTER key the error message you wrote earlier (for an
illustration of this, see Figure 23 on page 37) is displayed in a dialog (user-input
form.)

Figure 27: The “Error Alert” is displayed

38
Reducing Errors in Data Entry – “Validation” & “Autocorrect”

Click on “Retry” and enter a valid number.

Reminder:
The Validation Rule for column F is “must be in number format and larger than
12,000,000 (or a blank or empty cell).”

Figure 28: After choosing “Retry” and entering in valid data, no Error Alert is displayed

In cell F6, type a value that was a Whole Number but below the minimum acceptable
whole number. You are warned/informed about the mistake. For an illustration of
the warning, refer to the figure below.

Figure 29: Another example of attempting to enter invalid data results in…(see next figure)

This entry is not valid because it is less than the minimum acceptable valid value in
the cell— 12000000. Excel displays the Error Alert warning. Click on “Retry” and
enter a valid number.

Figure 30: The “Error Alert” being displayed

3.1.E VALIDATION FOR TEXT ENTRY

For textual data, you can set the rules for the length of the cell entry. Choose cell G1
and enter a name for the series.

Step 1:
Highlight the column G. In the area “Allow” choose the option “Text Length. You
have set the first validation rule.

39
Managing & Tabulating Data in Excel

Step 2: Choose a “Maximum” text length of “8.” The second validation rule is defined.

Figure 31: Validation Criteria allowing only text of certain length

Click on the tab “Input Message” and type in an appropriate message.

Click on the tab “Error Alert” and write a message that will display whenever invalid
data is entered. (As you did in the previous example).

Execute the dialog by clicking on the button OK.

Figure 32: Always enter an “Error Alert” that describes the valid criteria

3.1.F TESTING THE VALIDATION

Write the text “Vijay Gupta” into cell G2. The length of this entry is 11 (10 letters
plus 1 blank space) — implying that the entry is invalid.

40
Reducing Errors in Data Entry – “Validation” & “Autocorrect”

Figure 33: On entering invalid data...…(see next figure)

The entry is invalid and an error message is displayed. The next figure reproduces
this message.

Figure 34: ….an “Error Alert” is displayed. Note that this alert mentions the valid criteria.

3.1.G ENSURING THAT ONLY A STRING FROM A SET CAN BE ENTERED

Choose cell H1 and enter a name for the series.

Figure 35: Key (Type)-in the label

Select the entire column H and go to DATA/VALIDATION. Within the dialog (user-
input form) that opens, choose the option “List” in the area “Allow.” (For a pictorial
reproduction, see Figure 36 below.)

Figure 36: Ensuring that the data is only valid if it belongs to a list of possible values

The “List” is a set of possible values that the cells in column H can take. The cells
cannot have any other values.

41
Managing & Tabulating Data in Excel

Assume that the list you want to use is the list of country names; it is in the range
“B2 to B17.”

Click on the right edge of the white text-box “Source” and click on the range “B2 to
B17.” The dialog should look like the one in Figure 37.

Figure 37: The “List” Validation Criteria is defined

Click on the tab “Error Alert” and type in a message that you want displayed when
incorrect data is entered. Execute the dialog by clicking on the button OK.

Figure 38: Make sure that the “Error Alert” provides the valid criteria in the error message

Choose cell H2. When you click on it, you will see a downward arrow at the edge of
the cell. Click on the arrow and the entire list of countries is displayed! Instead of
typing in a country name, you can just choose it from the list. Therefore, apart from
reducing chances of mistakes in data entry, it also saves on typing time.

42
Reducing Errors in Data Entry – “Validation” & “Autocorrect”

Figure 39: Using the “List” Validation Criteria can save on typing

Figure 40: Selecting a valid value from the valid list

3.2 REMOVING VALIDATION RULES FROM A RANGE

Highlight the range from which you want to remove the validation settings. (The
range may be a subset of the entire range for which you had set the validation rule.)
Choose the menu option DATA/VALIDATION and click on the button “Clear All”.
The next figure illustrates this.

Figure 41: Removing Validation Rules from a range

3.3 COPYING AND PASTING VALIDATION RULES

In the situation that requires the same validation rules for ranges in many
worksheets/files, you can save time by copying and pasting the validation rules.

First, select the cells that have the validation rules you want to use as the model. Go
to EDIT / COPY. Select the range on which you want to “impose” the validation
rules. Go to EDIT/PASTE SPECIAL and choose the option “Validation” in the area
“Paste.” See Volume 3: Excel– Beyond The Basics for more on pasting validation
rules.

43
Managing & Tabulating Data in Excel

3.4 SELECTING ALL CELLS WITH THE SAME DATA VALIDATION RULE

Refer to Volume 3: Excel– Beyond The Basics.

3.5 USING “FORMS” AND “DATA VALIDATION”

The best data entry practice is the combined use of DATA/FORM (taught in the
previous chapter) and DATA/VALIDATION. The combination lends Excel quasi-
database ability. Filtering and Pivoting (taught later in the book) extend this ability.

3.6 AUTOCORRECT

The AUTOCORRECT tool automatically corrects common spelling errors and


mistakes in capitalization. The user can also define spellings that should be
corrected, as well as spellings or other typos that should not be autocorrected. The
tool is taught in Volume 4: Managing & Tabulating Data in Excel

44
Managing & Tabulating Data in Excel

CHAPTER 4

UUSSIIN
NGG FFIILLLL A
ANND
DOOTTH
HEERR TTO
OOOLLSS TTO
O SSA
AVVEE O
ONN TTYYPPIIN
NGG TTIIM
MEE

This chapter teaches the following topics:

— MAKING EXCEL FILL IN NUMBERS AND DATES

— FILLING YEARS/INTEGERS

— FILLING IN EVERY ALTERNATE YEAR

— AUTO FILL — FILLING FROM PRE-DEFINED LISTS OF DAYS, MONTHS, OTHER

— CREATING A NEW “CUSTOM LIST“

— FILLING MISSING VALUES

— USING CONSTANT INCREASE IN VALUES

— USING CONSTANT GROWTH RATES

— FILLING FORMATS

— USING THE RIGHT MOUSE FOR QUICK-FILLING

— PLACING DATA ENTRY ICONS ONTO THE TOOLBAR

Please use an empty Excel worksheet to practice this and the next section. Create a
new Excel file to try the examples shown in this chapter.

4.1 MAKING EXCEL FILL IN NUMBERS AND DATES

Assume you want to type in the series of numbers (1991, 1992….1999) or (1991,
1993… 2003) on to consecutive cells in a row or column. One way of doing this would
be to type in each number manually. A faster approach is to use EDIT/FILL. Section
4.1.a uses this approach.

In 4.2, I show how to “fill” months and weekdays.

In 4.3, I show how to define a “Custom Lists” of names. For each such defined list,
you can use EDIT/FILL to save time and preclude the possibility of typos.

4.1.A FILLING YEARS/INTEGERS

Open a new Excel file. Assume you want to use EDIT/FILL to type in the series of
numbers (1991, 1992….1999) on to consecutive cells in a row or column. Type the
first number in the series (for an illustration of this, see Figure 42).

46
Using Fill & other Tools to Save Time

Figure 42: Entering the start point for the Fill

Click on the cell you just typed into (cell B1 in this example), and drag the mouse
over the cells where you want to “fill” the series.

You can drag to the right or to the bottom. In the illustration in the next figure, I
drag it to the right across a row. For a pictorial reproduction, see Figure 43.

Figure 43: Use the mouse to drag over the cells you want to fill

Access the feature through the menu path EDIT/FILL/SERIES.

Figure 44: The menu option and sub–options for Fill. Choose the sub-menu “Series.”

Figure 45 reproduces the dialog that opens. Excel has automatically detected that
the “Series (is) in Rows.” (That is, that you want to fill the numbers on consecutive
cells on a row.) Choose the option “Linear” in the area “Type.”

Figure 45: Choosing the basis for the Fill

Note that Excel auto selects the “Step value” of 1. A step value of 1 implies that each
consecutive cell will have a value that is “1 + the preceding cells value.”

47
Managing & Tabulating Data in Excel

Select the option “Trend.” The next figure illustrates this.

Figure 46: Filling with a Linear Trend that increments by one for each cell

Execute the dialog by clicking on the button OK. Excel fills the series. For a
pictorial reproduction, see Figure 47.

Figure 47: The series is filled with a “Linear Trend of one”

4.1.B FILLING IN EVERY ALTERNATE YEAR

Assume you want to fill the series (1991, 1993, 1995...) — that is, every alternate
year/integer.

The procedure is the same as in the previous example with one difference— choosing
a “Step Value” of 2 as shown in Figure 48. (Compare this with the step value of one
in the previous example.)

Figure 48: Filling with a Linear Trend that increments by two for each cell

Execute the dialog by clicking on the button OK. As you can observe in Figure 49,
the fill now uses steps of 2.

48
Using Fill & other Tools to Save Time

Figure 49: The series is filled with a “Linear Trend of two”

Use EDIT/FILL even if the desired series included text along with a number
sequence (for example, a series like “yr91, yr92,…, yr99”).

4.2 AUTO FILL — FILLING FROM PRE-DEFINED LISTS OF DAYS, MONTHS,


OTHER

Assume you want to fill the series of months.

Go to the first cell you want in the series and type in the name of the month with
which you want to start the series. (As shown in the next figure, I chose “Jan” but
that need not be the case.)

Figure 50: Type the initial month for generating a sequential series. You can also type “Janu,” .., “January”

Click on the cell with the text “Jan” and lightly drag the mouse over the cells into
which you want the series filled. As the next figure shows, I have dragged the mouse
down over a column this time and not to the right across a row as in the examples
above. You can Fill series in all four directions.

Figure 51: Select the range to Fill

Using the mouse, select the menu path EDIT/FILL/SERIES.

The dialog (user-input form) that opens is shown in the next figure.

49
Managing & Tabulating Data in Excel

Note that Excel has automatically determined that the series are in a column
because you dragged the mouse down.

Choose the option “AutoFill3.”

Figure 52: Using “Autofill” to Fill in the series of months

Execute the dialog by clicking on the button OK. Excel fills the list— the next figure
shows the filled range.

Figure 53: The Filled series of months

3 Choose the option “Date if the cell's data is defined as “Data Type.” A detailed
discussion of this is beyond the scope of this book.

50
Using Fill & other Tools to Save Time

4.2.A FILLING WEEKDAYS

Type in “Monday” or any other day and drag down or to the right. Follow the menu
path EDIT/FILL/SERIES.

Figure 54: Type the initial weekday for generating a sequential series

Choose the option “AutoFill.” Execute the dialog by clicking on the button OK.

Figure 55: Using “AutoFill” to Fill in the series of weekdays

Excel fills the weekday series — the next figure shows the result.

Figure 56: The Filled series of weekdays

51
Managing & Tabulating Data in Excel

4.3 CREATING A NEW “CUSTOM LIST”

You can create new “lists” that Excel will fill in automatically. Assume you have
three lists you work with often:

• Employee names (Seligman, Gupta, Smith, Snipes, Stallone, Ali,


Kinnuken, Singh, Gunter, Mandela, Berger…)

• Client names (Nike, Adidas, Reebok, Old Navy, Bata…)

• Account names (Citibank, Chase, UBS, American Express, 1st Capital…)

(Note: the client and account names are registered trademarks of the respective
companies.)

You want the ability to type in only one word from a list (for example, the word
“Nike”) and fill in the series with other words in the list “Client name” by using
EDIT/FILL/SERIES.

First, type the names of all members of each list onto a spreadsheet. (Use a different
row for each list — as shown in Figure 57.)

Figure 57: Type the names of all members of each list onto a spreadsheet

Now you have to inform Excel that these lists are to be included as lists for
EDIT/FILL/SERIES/AUTOFILL. Select the menu path TOOLS/OPTIONS/CUSTOM
LISTS (for an illustration of this, see Figure 58).

52
Using Fill & other Tools to Save Time

Figure 58: The tab “Custom Lists” in the dialog (user-input form) “TOOLS/OPTIONS.” Notice the lists for
months and weekdays in the left half of the dialog. In the examples in the previous section, Excel used these
lists to fill in the series.

In Figure 58, notice the lists for months and weekdays in the left half of the dialog.
In the examples in 4.2, Excel used these lists to fill in the series.

In Figure 58, focus on the area inside the dark–bordered rectangle. You want to
“Import” lists from cells. Click on the area marked by the arrow in Figure 58.
Choose the cells in the worksheet that has the lists as shown in Figure 59.

Figure 60: Choose the worksheet that has the lists

Choose the cells that have the list entries for one list (for example, the clients list.)
See the next figure for an illustration.

53
Managing & Tabulating Data in Excel

Figure 61: Choose the cells that have the entries for one list

Click on the small box marked by the arrow in Figure 61.

Figure 62: Importing the new “Custom List”

Execute the dialog by clicking on the button “Import.” A new list is created as shown
in Figure 63.

54
Using Fill & other Tools to Save Time

Figure 63: The new list is added to the “Custom Lists”

Repeat the above steps for the other two lists. Execute the dialog by clicking on the
button OK.

In the future, you just have to type in one entry from the client list (for example,
“Nike”) and use EDIT/FILL/SERIES to fill in the rest of the list.

Figure 64: After repeating the process for other lists, you will have created several “Custom Lists”

4.4 FILLING MISSING VALUES

FILL is also used for replacing/filling–in missing values from a numerical series. The
methods available for filling in the missing data are:

• Linear Interpolation (Linear in Absolute Value)

• Constant Growth Interpolation (Linear in Growth Rate)

55
Managing & Tabulating Data in Excel

4.4.A USING CONSTANT INCREASE IN VALUES

Assume your data has two series: x and y as shown in the picture below— Figure 654.
The series x is missing data for the years 1993 and 1994. You want to use Excel to
fill the missing values using a simple mathematical algorithm for the fill.

Figure 65: Type this sample data into an Excel worksheet

Highlight the cells with the missing data and the first non–missing data cell on each
end. (For an illustration, see Figure 66.)

Figure 66: Highlight the two ends of the range with missing data

Follow the menu path EDIT/FILL/SERIES. Choose the options “Linear.” Excel
automatically calculates the step value of 0.165. (For an illustration, see Figure 67.)

Figure 67: Choose the “Linear” type of Fill

The missing cells are filled (for an illustration of this, see Figure 68). The step value
of “0.16” implies that Excel added 0.16 for each increment. (So, the data for 1993
equals the data for 1992 plus 0.16. The data for 1994 is the new value for 1993 plus

4 On an empty Excel sheet, type in the data as shown in Figure 136 and work along
with this book.
5 The formula is: ((end value)-(start value)) / (number of missing values) = (3.6-3.12) / 3
= .16

56
Using Fill & other Tools to Save Time

0.16. And so on for the following years.)

Figure 68: The missing data is filled with a linear trend

4.4.B USING CONSTANT GROWTH RATES

A better method of filling in missing values is to use a constant growth rate. That is,
instead of the above example in which every increment was the same absolute
number, the increment will represent the same growth rate6 from year to year but
not the same absolute values.

The implementation of the “constant growth” method follows the same steps as for
the constant linear trend example described earlier. The only difference is that you
choose the option “Growth” and check the option “Trend” as shown in Figure 69 (the
number 0.16 is from the previous example and will not play a role here.)

Figure 69: Example of using a “Growth” type of Fill

Excel fills the series. Figure 70 shows the result. Compare the numbers estimated
using a constant growth trend with those obtained using a constant linear trend
(shown in Figure 68).

6 Excel calculates and uses a constant growth rate “r” based on the compound growth
(or “compound interest") formula: 3.6 = 3.12*(1 + r)3

57
Managing & Tabulating Data in Excel

Figure 70: The missing values are filled with numbers based upon a constant Growth rate

4.5 FILLING FORMATS

Assume you want to copy the format of a cell to a range of adjacent cells in the same
row or column. Select the active cell and the “target” range and choose the menu
option EDIT/FILL/FORMATS.

4.6 COPYING THE ACTIVE CELL

Assume you want to copy a cell and paste onto to a range of adjacent cells in the
same row or column. Select the active cell and the “target” range. Select the option
EDIT/FILL/COPY.

4.7 USING A RIGHT-CLICK-ON-MOUSE FOR QUICK-FILLING

You can access EDIT/FILL using the mouse.

Click on the first cell in the series. Follow this with clicking on the right–mouse at
the location shown by the arrow and dragging the mouse over the other cells where
you want to fill–in. Leave the mouse. You will see the options for EDIT/FILL. (For
an illustration, see Figure 71.) Choose the option “Series” — the EDIT/FILL dialog
opens. Follow the steps shown in the examples above.

Figure 71: Tip for quickly accessing the Fill menu

58
Using Fill & other Tools to Save Time

4.8 PLACING DATA ENTRY ICONS ONTO THE TOOLBAR

You can customize the set of icons shown on the toolbars at the top of the screen.
This can save time by enabling you to place the often–used buttons onto the toolbar.
Please refer to Volume 3: Excel– Beyond The Basics to learn how and why to
customize toolbars and the icons shown in them.

Go to VIEW/TOOLBARS/CUSTOMIZE. Click on the category “Data” and you will


see some icons for specific data management tasks. You can place these icons on the
toolbar and use them as shortcuts to access data management features.

Figure 72: Icons for data management

4.9 “SPEECH TO TEXT”

The menu option TOOLS/SPEECH in the XP version of Excel does not function well.
You need a high quality microphone, “correct” accent and diction, and the time to
make the Speech Recognition software recognize your pronunciation.

Stand-alone speech recognition applications can be configured to work with earlier


versions of Excel. Unless you are purchasing high-end Speech Recognition software,
you will be disappointed with the tool. Such high-end software is used in the health
industry. Nevertheless, even there, the recorded speech is transcribed into text by a
human.

59
“Conditional Formatting”— Color–coding data patterns

CHAPTER 5

““C
COON NDDIITTIIO
ONNA
ALL FFO
ORRM
MAATTTTIIN
NGG””—
—CCO
OLLO
ORR––C
COOD
DIIN
NGGD
DAATTA
A
PPA
ATTTTEERRN
NSS

This chapter illustrates the use of the following features:

— UNDERSTANDING THE DIALOG

— DEFINING THE CONDITION

— STEP 1: DEFINING THE CONDITION/CRITERIA

— STEP 2: DEFINING THE FORMAT TO USE FOR CELLS THAT SATISFY THE CONDITION

— UNDERSTANDING THE “CONDITIONAL FORMAT“

— DEFINING A “DYNAMIC” CONDITION

— DELETING CONDITIONAL FORMATS

CONDITIONAL FORMATTING is an excellent utility for quickly color–coding


patterns in data. As you go through this example, the usefulness of this utility will
become clear.

5.1 UNDERSTANDING THE DIALOG

Access the feature through the menu path FORMAT/CONDITIONAL


FORMATTING. The dialog shown in Figure 73 opens.

Figure 73: The “Conditional Formatting” dialog

Condition

Forma
5
t

5 the data in a cell than


In this box, you have to tell Excel: “If condition 1 is satisfied by
format the cell using Format 1 which you have defined. If condition 1 is not satisfied
by the data in a cell than do not format the cell using Format 1.
5

61
5
Managing & Tabulating Data in Excel

5.2 DEFINING THE CONDITION

Figure 74 to Figure 77 show how to set the first conditional format. Let us go
through this process systematically.

5.3 STEP 1: DEFINING THE CONDITION/CRITERIA

Assume the conditional format is:

“If the value of the cell is between 10,000,000 and 12,000,000 then give the

cell the formatting I will define by pressing the button Format.'“

First, define the condition as shown in Figure 74.

Figure 74: Defining the first condition

5.4 STEP 2: DEFINING THE FORMAT TO USE FOR CELLS THAT SATISFY THE
CONDITION

Click on the button “Format7“and (as shown in Figure 75 and Figure 76) choose the
formatting desired for those cells that satisfy the condition “Cell value is between
10,000,000 and 12,000,000.”

Select the tab “Patterns” and choose the fill color for the cells.

7 On clicking “Format,” I got the dialogs shown in Figure 208 and Figure 209. I chose a
font style (see Figure 208) and a pattern/background shading (see Figure 209).

62
“Conditional Formatting”— Color–coding data patterns

Figure 75: Choose a pattern

I recommend using bright yet light and distinct colors. Dark colors will make the
reading of cell data a bit of a pain in the eye.

After selecting the pattern, you may want to select a font style also. I recommend
using patterns only. If you set font features in a conditional format, select different
font colors for every conditional format.

Figure 76: Choose a font style, color, etc.

5.5 UNDERSTANDING THE “CONDITIONAL FORMAT”

After clicking on the button “OK,” you will be back to the CONDITIONAL
FORMATTING dialog. (For a pictorial reproduction of this, see Figure 77).

63
Managing & Tabulating Data in Excel

Figure 77: The first condition and the concomitant formatting are defined

The formatting style you chose is displayed in the area “Preview of


format to use when condition is true.” The 'condition' mentioned is what you had
defined— “Cell Value is between 10,000,000 and 12,000,000.”

Step 3: Adding more conditional formats


Assume you want to add more conditional formats (the maximum allowed is three).
In the dialog shown in Figure 77, see the button “Add.” Click on this button. The
result is that the dialog becomes bigger with a new sub–section titled “Condition 2”
as shown in Figure 78 below.

Figure 78: Adding conditions to the ‘Conditional Format “

As you did for condition 1, define the expression for condition 2 and condition 3 and
the formatting style to be applied if the condition is satisfied. I do not show all the
steps because they are the same as for condition 1.

5.6 DEFINING A “DYNAMIC” CONDITION

In this example, the condition does not reference a fixed number (as in Figure 79

64
“Conditional Formatting”— Color–coding data patterns

where the fixed number is 100,000,000) but, instead, a cell on the Excel worksheet.

This can be termed as a “dynamic” condition, because it changes if the referenced


cells value changes (this cell is “E14” in my example). If the value in cell E14
changes, then any conditional format definition that references the value in cell E14
will also change.

Figure 79: Another example of defining a condition

Figure 80: Example of defining a “dynamic” condition. If the definition cell (“E14”) changes, then you may
see a change in formatting of the cells using this definition.

After defining the conditional formats, execute the dialog by clicking on the button
OK. The formatting of cells that meet the criteria you defined will change to the
formats defined by you.

You may find that a lower level of magnification (“zoom”) allows the
patterns in the data to be seen more easily. Change the zoom level by selecting the
menu option VIEW/ZOOM and making the change. The next figure illustrates this.

Excel offers preset options of magnifications/reductions from “200%” to “25%.” You


can set a custom level by typing the value into the box “Custom (and selecting the
option “Custom”). I usually set the zoom to 85%.

65
Managing & Tabulating Data in Excel

Figure 81: ZOOM dialog

5.7 DELETING CONDITIONAL FORMATS

Select the area that is under conditional formatting. Go to


FORMAT/CONDITIONAL FORMATTING and click on the button “Delete.” The
dialog shown in the next figure opens. You can delete conditional formats by
pressing on the button “Delete” and choosing the appropriate options from the dialog
that opens.

Figure 82: Dialog for deleting Conditions in a Conditional Format

5.8 SELECTING ALL CELLS WITH THE SAME CONDITIONAL FORMAT RULE

This topic is taught in Volume 3: Excel– Beyond The Basics.

66
Managing & Tabulating Data in Excel

CHAPTER 6

SSO
ORRTTIIN
NGG

This chapter discusses the following topics:

— BASIC SORTING

— CASE SENSITIVITY

— SORTING BY ROWS

— SORTING RANGES THAT DO NOT COVER ENTIRE COLUMNS OR ROWS

6.1 BASIC SORTING

I use a simple data set for this example –”Advanced File2.xls.” The set has five
columns; each column corresponds to one series/series. (For an illustration, see
Figure 83.)

Follow these basic rules for facilitating effective data handling:

• Always write the series name in the first row.

• Do not leave the first column empty

Figure 83: The sample data

Choose the columns you want to Sort by clicking the mouse on a column title (like
“A”) and then dragging the mouse over the other columns you want to Sort.

Select the option DATA/SORT. In the dialog (user-input form), choose the series by
which you want to Sort.

Choose a series by (a) clicking on the down–arrow next to the topmost white box, and,
(b) picking a series from the list of series.

Sorting by two or three series

Repeat this process with a second (and, after that, a third) choice of series name in

68
Sorting

the middle (and, after that, lowest) box in the dialog. Excel first sorts by the series
whose name is in the topmost box. Within each value of this series, it sorts the data
by the values of the series whose name is in the middle box.

I show an example with two series in the next figure.

Figure 84: The dialog for Sorting

6.2 NAMES OF SERIES OR COLUMNS

How does Excel know the names of the series? It has picked them up from the first
row. I allowed this by clicking on “Header row” in the area “My list has.” If you look
at the worksheet, notice that the first row has the label for each series. These are the
“headers.” If there is no such header row, then choose “No Header row” in the area
“My list has.”

Figure 85: Choose if your data series have a label/heading in the first cell of each data series

Execute the dialog by clicking on the button OK.

The result is shown in Figure 86. The data is sorted— first by “Country Name,” then
by “Series Name.”

69
Managing & Tabulating Data in Excel

Figure 86: Compare the Sorted data with the original data shown in Figure 83

6.3 CASE SENSITIVITY

Click on the button Options. The dialog (user-input form) that opens is shown in
Figure 87. Within this box, you can fine–tune the Sorting options.

If you want the Sorting to be “Case Sensitive” (so that AA6 is higher ranked than
aa6), then select the option “Case Sensitive.”

Figure 87: Opting for “Case Sensitive” Sorting

6.4 SORTING BY ROWS

In rare cases, you may have to Sort ‘by rows’. Choose the rows you want to use for
defining the sorting criterion. Drag the mouse over the entire data that needs to be
sorted (including the labels for each row, usually in column A).

Choose the menu option DATA/SORT. The SORT dialog opens.

70
Sorting

Figure 88: Sorting by rows — click on the “Options button and… (see next figure)

Click on the “options” button and choose the option “Sort left to right” in the area
“Orientation” (for an illustration of this, see Figure 89).

Figure 89: Select “Sort left to right” for “Sorting by rows”

Execute the dialog by clicking on the button OK. You will be returned to the “Sort”
dialog, but it will look different from the dialog you were in earlier.

The dialog it will ask you for the “Rows to Sort by.” Figure 90 shows the “Sort” dialog
when sorting by rows. Compare it to the generic “Sort” dialog shown in Figure 88
above.

71
Managing & Tabulating Data in Excel

Figure 90: The dialog for Sorting when you are sorting by rows

6.5 SORTING RANGES THAT DO NOT COVER ENTIRE COLUMNS OR ROWS

Assume your main data is in the cells “A1:D180.” However, in cells below row “180”
and/or to the right of column “D” you have some formulae and text that you do not
want to include in the Sorting. This can be done easily — the process is similar to
the examples above.

The only exception is that you do not click on the column or row titles while selecting
the range to Sort; instead, you highlight the cells that define the range you want to
Sort.

6.6 CHOOSING THE ENTIRE WORKSHEET

Choose the entire worksheet be clicking on the gray button on top of row title “1” and
to the left of column title “A.” The area is pointed out by the arrow in Figure 91. Try
it on a sample worksheet.

Figure 91: Selecting the sample data

72
Sorting

Use this when you want apply a method to all the cells/rows/columns in a worksheet,
but be careful of not to make Excel and the computer waste system resources by
applying procedures to a large number of empty cells.

73
Filter ("Hiding the Data you do not want to View")

CHAPTER 7

FFIILLTTEERR ((““H
HIID
DIIN
NGG TTH
HEE D
DAATTA
A YYO
OUU D
DOON
NOOTT W
WAAN
NTT TTO
O
VVIIEEW W””))

This chapter teaches the following topics:

— BY ONE CRITERION ON ONE COLUMN

— THE FILTERING ARROWS

— CHOOSING THE VALUE TO USE AS THE FILTERING CRITERION

— THE RESULT: A FILTERED WORKSHEET

— COPYING AND PASTING THE FILTERED ROWS

— REMOVING THE FILTER

— CUSTOM FILTERING — USING MULTIPLE CRITERION, LOGICAL CONDITIONS, ETC

— EXAMPLE OF A FILTER THAT HAS TWO CRITERIA OVER ONE SERIES/COLUMN

— USING THE WILDCARD “*”

— FILTERING USING CRITERIA FROM MORE THAN ONE COLUMN/SERIES

— ICONS FOR SORTING AND FILTERING

Filtering is used to hide the data one is not interested in viewing at present. For
example, you may want to view only those rows that have data for the country
Algeria. Alternatively, only the data for Algeria and (within the rows having Algeria
data) only for those Algerian's in the sample who are less than 20 years in age.
(Please look at and work along side on the sample data set— “Advanced File2.xls;”
otherwise, you may not completely grasp this section.) Filtering provides this ability.

The chapter shows several examples of “Filtering.” Using this feature, you can define
criteria to “Filter out” (or hide) the data you do not want to view on screen. Filtering
has several uses; the section shows some of these.

7.1 BY ONE CRITERION ON ONE COLUMN

Open the sample data file supplied8 in the zipped file and work along with the
section.

8 The sample is in one of the Excel files provided in the zipped file: ““Advanced
File2.xls.”

75
Managing & Tabulating Data in Excel

Access the feature through the menu path DATA/FILTER/AUTOFILTER as shown


in Figure 92.

Figure 92: The menu option for Filtering

7.1.A THE FILTERING ARROWS

Now the Filter is “on.” On the worksheet, you will observe small downward arrows
on each of the first rows. (I have made huge ovals around them in Figure 93.)

Figure 93: The indicators that a column is “Filter–ready”

7.1.B CHOOSING THE VALUE TO USE AS THE FILTERING CRITERION


Click on one of the arrows. A list will “drop down.” (For an illustration, see the next figure.)
Figure 94: Looking at the “drop–down” list of possible Filtering criteria

This list contains each unique value of the series “Series Name” (or, equivalently,
each unique value of the column a, except the value in the first cell) and some other
options:

• “(All)” does no Filtering.

• “(Top 10)” chooses the rows that have the 10 most occurring values in that
column.

• “(Custom)” is very powerful and is discussed later in this section

Assume you want only to view the data for those in the category “Age 15 — 19 years.”
Click on that label in the list displayed by Excel.

76
Filter ("Hiding the Data you do not want to View")

7.1.C THE RESULT: A FILTERED WORKSHEET

The worksheet will only show data for the rows in which the “Series Name” series
has the value you chose (“Age 15 — 19 years”). All else is hidden (and not deleted).
If you look at the row numbering on the left, you will see non–consequent numbers
(3, 16, 29, etc.) as highlighted by the rectangle in Figure 95. The “unfiltered” (or
“Filtered out”) rows are hidden9.

Figure 95: The results of a simple Filter— one-value criteria for one data series

7.1.D COPYING AND PASTING THE FILTERED ROWS

One use of Filtering is to make a new worksheet with only the Filtered data.

Therefore, after you have done the Filter above, highlight all the rows, click on
EDIT/COPY, go to an empty worksheet, click on the first cell and choose the menu
option EDIT/PASTE. You now have a new worksheet with data for only the
category10 you chose in the Filter. (For an illustration of this, see Figure 96.)

9 Unhide the rows by selecting the option DATA / FILTER / AUTOFILTER.


10 You chose “Series Name” = “Age 15-19 Years.”

77
Managing & Tabulating Data in Excel

Figure 96: Copying and pasting the Filtered data


(which will be a subset of the entire data set)

7.2 REMOVING THE FILTER

Select the option DATA/FILTER and choose AUTOFILTER. The Filtering arrows
will be removed and the “Filtered out” rows (which were hidden when they had been
filtered out) will be unhidden and visible again.

7.3 CUSTOM FILTERING — USING MULTIPLE CRITERION, LOGICAL


CONDITIONS, ETC

Typically, one would use a more complex Filter. These are created using the option
“Custom.” Thus, this time click on the option “(Custom).”

Figure 97: Choosing the powerful “Custom Filter” criteria

7.3.A EXAMPLE OF A FILTER THAT HAS TWO CRITERIA OVER ONE SERIES/COLUMN

Try an example choosing rows that meet either of two criteria:

• Series Name = “Age 15— 19 years”

• Series Name = “Age 20— 24 years”

78
Filter ("Hiding the Data you do not want to View")

Figure 98: Using the “Custom AutoFilter” dialog

7.3.B USING THE WILDCARD ASTERISK (*)

Try a more complex example—

Filter all rows in which the cell in the column “Series Name” contains the
text 15 (and other stuff) but does not contain the text 64.

Figure 99: Using a wildcard and two conditions to define a custom AutoFilter

The options for this Filter are shown in Figure 99. The * is called a wildcard. It
means “any other character/digit/text.” So “*15*” will choose any cell that contains
“15.” The choice “2?” will choose any cell that contains 2 followed by some characters
(for example, 20, 24, and 29).

Removing the Filter

Choose the menu option DATA/FILTER and choose AUTOFILTER. The Filtering
arrows will be removed and the “Filtered out” rows (which were hidden when they
had been filtered out) will be unhidden and visible again.

7.4 FILTERING USING CRITERIA FROM MORE THAN ONE COLUMN/SERIES

You can also filter using criteria from more than one series.

79
Managing & Tabulating Data in Excel

Step 1:
First, click on the arrow next to “Series Name,” choose “(Custom),” and choose
criteria as shown in Figure 99. Execute the dialog by clicking on the button OK. The
worksheet will be Filtered based on these criteria based on the column/series “Series
Name.”

Step 2:
Now, Filter the Filtered data by running a Filter through a second column/series—
“Country Name.” Click on the arrow next to “Country Name” and choose custom
criteria as shown in Figure 100 and the figure next after that.

Figure 100: Setting up an additional Filtering criteria

Figure 101: Defining the custom AutoFilter for the second column used in this complex “Filter based on 2–
column/series”

The worksheet will only show the data that corresponds to both the multi–column

80
Filter ("Hiding the Data you do not want to View")

Filters.11 (For an illustration of this, see Figure 102.)

Figure 102: The results of Filtering across categories of two columns

You can have as many levels of Filtering as the number of columns with series. Each
additional column you filter with adds more criterions to the set defined by the
previous columns being used to define the Filter.

7.5 NEW IN THE XP VERSION OF EXCEL

You may insert or delete columns while the sheet is in filter mode.

7.6 ICONS FOR SORTING AND FILTERING

The icons shown in the right half of the next figure will be useful for Sorting and
Filtering data. You can customize the set of icons shown on the toolbars at the top of
the screen. This can save time by enabling you to place the often–used buttons onto
the toolbar.

Please refer to Volume 3: Excel– Beyond The Basics to learn how and why to
customize toolbars and the icons shown in them.

11 The two Filters are shown in Figure 611 and Figure 613.

81
Managing & Tabulating Data in Excel

Figure 103: The Data menu icons

82
Managing & Tabulating Data in Excel

CHAPTER 8

SSEELLEEC
CTTIIN
NGGA ALLLL C
CEELLLLSS//CCO ONNTTEEN
NTT A AC CRROOSSSS TTH
HEE
WWO ORRKKSSH HEEEETT TTH
HAATT SSA
ATTIISSFFYY A
AC CRRIITTEERRIIO
ONN

This chapter teaches how to:

– USE “GO TO – SPECIAL”

– SELECT CELLS ON THE BASIS OF SPECIAL CRITERIA AND EXCEL FUNCTIONALITIES

8.1 THE “GO TO” OPTION

Excel’s “Go To- Special” feature allows you to make smart range selections without
programming. Using the mouse, select the menu path EDIT/GO TO.

Figure 104: The GO TO dialog

Click on the button “Special.” The relevant dialog is shown in the next figure. The
options inside this dialog (user-input form) allow smart range selection. The dialog is
shown below.

84
Selecting all Cells/content across the Worksheet that Satisfy aCriterion

Figure 105: GO TO/SPECIAL dialog

8.1.A SELECTING CELLS WITH COMMENTS, EMPTY CELLS, UNHIDDEN CELLS, CELLS IN THE
CONTIGUOUS REGION OF THE CURRENTLY ACTIVE CELL

— “Comments” selects all the comments (and their underlying cells) in the
worksheet. You can choose to format all cells with comments with a
comment cell formatting (font, patterns, etc), delete all comments,
hide/autofit/size the rows or columns that contain the cells that have
comments, or use other features only on the cells that contain comments.
Excel displays a message if it cannot find any cell with a comment. This is
a shortcut for determining if a worksheet has any comments.

— “Blanks” selects all the blanks in the data worksheet, including formatted
but empty cells.

— “Current region” selects the region around the current cell. A region ends
if Excel encounters blank rows or columns.

— “Last cell” selects the last cell that has content or formatting. A shortcut:
press the key CNTRL, and, while the key is pressed, press the key END.

Assume you started with a large amount of data in a


workbook. While working on the spreadsheet you cleared the contents of
many cells/rows/columns, but Excel is not showing any reduction in file
size. The reason may be that the “cleared” cells are still stored in memory
because they have some formatting that was not “cleared.” You can use
the “Last Cell” utility to determine whether Excel is still storing the
“cleared” cells. (The solution is to select the “cleared” range(s) and using
EDIT / DELETE to remove all content and formatting from the range(s).)

85
Managing & Tabulating Data in Excel

— “Visible cells only” selects all cells except those that are in hidden rows or
columns. This feature is extremely useful is the purpose of hiding was too
exclude rows/columns from certain procedures.

8.2 CONDITIONAL FORMATTING

This topic requires familiarity with “Conditional Formatting,” which is taught in


chapter 5 on page 61.

Conditional formats” and “All” selects all cells that have a conditional formatting
defined on them. Once these cells are selected, you can:

1. Highlight them and place a marker like bold font on all the cells,

2. Remove the “Conditional: formats by going to FORMAT/CONDITIONAL


FORMATTING and pressing on the button “Remove.”

Figure 106: Selecting all cells that have any Conditional Formats

Conditional formats” and “Same” selects all cells that satisfy the same conditional
formatting as the current cell. After making such a selection, you can conduct
procedures specifically on these “criteria-satisfying” cells.

In fact, this selection utility enhances and extends (beyond the initial purpose) the
usefulness of “Conditional Formatting” and “Data Validation.”

Figure 107: Selecting all cells that satisfy the same “conditional formatting” as the active cell

8.3 SELECTING BASED ON DATA VALIDATION

This topic requires knowledge about “Data Validation,” a topic taught in Volume 4:
Managing & Tabulating Data in Excel.

Step 1:

86
Selecting all Cells/content across the Worksheet that Satisfy aCriterion

Pick the menu option EDIT/GO TO, click on the button “Special.” Select the option
“Data Validation” in the dialog that opens.

The option “All” selects all cells that have validation rules defined for validating data
entry.

Figure 108: Selecting all cells that have any Data Validation Conditions

The option “Same” selects all cells that have the same validation rules (for validating
data entry) as the current cell.

Step 2:
Sect the scope of the selection – “All” or “Same.”

Figure 109: Selecting all cells that satisfy the same Data Validation rules as the active cell

8.4 SELECTING BASED ON FORMULAE

This topic requires knowledge about Functions and Error Values. These are taught
in Error! Reference source not found. on page Error! Bookmark not defined..

8.4.A CONSTANTS

Step 1:
Pick the menu option EDIT/GO TO, click on the button “Special.” Select the option
“Constants” in the dialog that opens. (See next figure.)

Constants” selects all named constants of the data type defined by the selected check
boxes amongst the check boxes:

• Numbers

• Text

• Logicals

• Errors

87
Managing & Tabulating Data in Excel

Step 2:
Select one of these four options

Figure 110: Constants

8.4.B FORMULA RESULTS

Step 1:
Pick the menu option EDIT/GO TO, click on the button “Special.” Select the option
“Formulas” in the dialog that opens. (See next figure.)

“Formulas” selects all cells that have a formula and the formula result conforms to
the data type chosen in this dialog. The data types conform to the four possible
results of a formula:

• Number

• Text

• Logical (True or False)

• (Formula-) Errors – the values (#N/A, #VALUE!, #REF!, #DIV/0!, #NUM!,


#NAME?, and #NULL!


Step 2:
Select one of these four options.

Figure 111: Formulas

Note:
Date and Time functions evaluate to a serial number that corresponds to a specific
point on the time continuum. Thus, they are “Numbers.”

88
Selecting all Cells/content across the Worksheet that Satisfy aCriterion

8.5 SELECTING BASED ON CELL REFERENCES IN FORMULAS

This topic requires knowledge about “Function Referencing” (refer to Error!


Reference source not found. on page Error! Bookmark not defined.) and” Formula
Auditing” (refer to chapter 14 on page 164).

8.5.A SELECTING ALL CELLS WHOSE FORMULAS REFERENCE THE ACTIVE CELL (DIRECTLY OR/AND
INDIRECTLY)

You can select all the cells whose formula references the active cell. These formula
cells are called “Dependents.”

Step 1:
Pick the menu option EDIT/GO TO, click on the button “Special.” Select the option
“Dependents” in the dialog that opens. (See next figure.)

Step 2:
Select “Direct only” or “All levels” from the two buttons below the “Dependents”
button.

• The option “Direct only” restricts the selection to cells directly referencing the
current cell.

• The option “All levels” selects all cells that reference –however indirectly - the
active cell.

Figure 112: Selecting all cells whose formula is dependent upon the value of the active cell

Figure 113: Selecting all cells whose formula has a direct reference to the active cell

8.5.B SELECTING ALL CELLS REFERENCED (DIRECTLY OR/AND INDIRECTLY) BY THE FORMULA IN
THE ACTIVE CELL

You can select all the cells that are used as references in the active cell’s formula.
These referenced cells are called “Precedents.”

89
Managing & Tabulating Data in Excel

Step 1:
Pick the menu option EDIT/GO TO, click on the button “Special.” Select the option
“Precedents” in the dialog that opens.

Figure 114: Select “Precedents”

Step 2:
Select “Direct only” or “All levels” from the two buttons below the “Dependents”
button.

• The option “Direct only” restricts the selection to only directly referenced cells
– that is, the cells referenced by the formula in the current cell.

• The option “All levels” selects cells referenced directly or indirectly in the
formula of the current cell. Indirect references are the cells referenced by
the cells directly referenced by the formula in the current cell.

8.6 GO TO / SPECIAL AS A SEARCH TOOL

GO TO/SPECIAL can play a role as a search tool. For example, in the circumstance
that no criterion-satisfying cell could be located, Excel displays a message with
information to this effect. For example, choosing the options shown in the next figure
will tell you if any of the formulas return errors. (In addition, the selection facilitates
easy deletion of error-containing cells.)

90
Subtotals

CHAPTER 9

SSUUBBTTO
OTTA
ALLSS

This chapter teaches the following topics:

— BEFORE MAKING SUBTOTALS

— OBTAINING SUBTOTALS

— CHOOSING THE SUBTOTALING FORMULA: AVERAGE, SUM, ETC

— VIEWING ONLY THOSE ROWS THAT HAVE SUBTOTALS

— REMOVING SUBTOTALS

9.1 BASICS

Subtotal adds new rows that capture sub–totals for groups defined by consecutive
rows. If you want to make a table with only the sub–totals (or any other aggregate
function) then use the powerful Pivot Report feature. (I discuss Pivot Reports in the
next chapter.)

The data set for this chapter is “Advanced File2.xls.”

9.2 BEFORE MAKING SUBTOTALS

The data set for this section is “Advanced File2.xls.” I am going to produce the
“subtotals of the variables '1995', '2000' and '2010' by categories of the series 'Country
Name’.”

You should first select the option DATA/SORT and choose to Sort the data by the
series you choose in “at each change in.” (See chapter 6 and Figure 115.)

Figure 115: You have to Sort the data before creating subtotals

9.3 OBTAINING SUBTOTALS

Access the feature through the menu path DATA/SUBTOTAL. The dialog (user-

91
Managing & Tabulating Data in Excel

input form) for Subtotals is shown in Figure 116.

Figure 116: The subtotals dialog

In the area “at each change in” define the criterion for the sub–totals. (The examples
are shown in Figure 115 and Figure 117). Choose “at each change in 'Country
Name’.” That is, when a new category12 is found, then the sub–total of the previous
category is inserted.

Choose the columns whose data you want sub–totaled— click to the left of the
column/series name in the area “Add subtotal to.” (For an illustration, see Figure
117.)

12 In this example, each category is the name of a country

92
Subtotals

Figure 117: Choosing the variables whose subtotals are desired

9.3.A CHOOSING THE SUBTOTALING FORMULA: AVERAGE, SUM, ETC

Click on the arrow next to “Use function” and choose the aggregate function as shown
in Figure 11813.

Figure 118: Choosing the method for subtotaling

13 Note: the same function does the aggregation for all the series you chose. In Pivot
Reports, you do not have this restriction. More on that on page 84.

93
Managing & Tabulating Data in Excel

Figure 119: The data worksheet with new rows containing the subtotals

Execute the dialog by clicking on the button OK. The subtotals will be calculated and
inserted into new rows on the data worksheet (as shown in the rightmost figure).

9.4 VIEWING ONLY THOSE ROWS THAT HAVE SUBTOTALS

Use the “group collapsing minus indicators” taught in Volume 1: Excel For Beginners
to view only those rows that contain totals.

9.5 REMOVING SUBTOTALS

Assume you want to remove the rows with the totals. Deleting each row is a pain.

An easier way: choose the menu option DATA/SUBTOTALS. Click on the button
“Remove All.”

Figure 120: Removing subtotals

9.6 THE “CONSOLIDATION” TOOL

This tool (accessed through DATA/CONSOLIDATION) is unreliable and quirky,


especially in terms of accepting and retaining cell references. I do not recommend
using this tool. Far better consolidation of data can be done using Pivot Reports
(refer to the next chapter on the next page), the Statistics Add-In (refer to Volume 5:
Statistics Analysis With Excel), or just manual formula construction (refer to Volume

94
Subtotals

3: Excel– Beyond The Basics or Volume 5: Statistics Analysis With Excel).

95
Pivot Reports

CHAPTER 10

PPIIV
VOOTT RREEPPO
ORRTTSS

This chapter teaches the following topics:

— THE FOUR STEPS IN MAKING A TWO-DIMENSIONAL PIVOT REPORT

— STEP 1: OPENING THE PIVOT REPORT WIZARD

— STEP 2: CHOOSING THE DATA FOR TABULATION

— STEP 3A: DESIGNING THE PIVOT REPORT

— STEP 3B: CHOOSING THE FORMULA FOR AGGREGATION/TABULATION

— STEP 4A: OPTIONS

— STEP 4B: WRAPPING IT UP — CREATING THE PIVOT REPORT

— MODIFYING/EDITING A PIVOT REPORT

— MODIFYING THE STRUCTURE OF A PIVOT REPORT

— ADDING A NEW FUNCTION (AND THUS A NEW ROW SERIES)

— EDITING FIELDS

— SELECTING A FIELD

— VIEWING THE OPTIONS AVAILABLE FOR MODIFYING/EDITING A FIELD

— DELETING A FIELD

— REFRESHING THE REPORT

— PIVOT REPORT EXAMPLE WITH A THIRD DIMENSION (ROW, COLUMN, AND PAGE)

— VIEWING DIFFERENT “PAGES”

— MAKING A NEW WORKSHEET FOR EACH “PAGE”

— MAKING A NEW CHART FOR EACH “PAGE”

— ICONS FOR PIVOT

Pivot Report is the most powerful feature for making tables by aggregating over data.
Pivot Reports give Excel the tabulating power of SPSS, SAS, and other statistical
software.

With Pivot Reports, you can create new worksheets of data in which the data is at an
aggregate level. After that is done, the aggregated data on this new worksheet can
be used to make graphs, calculate formulas, etc.

10.1 THE FOUR STEPS IN MAKING A TWO-DIMENSIONAL PIVOT REPORT

I will take you through an example to illustrate how to make a Pivot Report. Please

97
Managing & Tabulating Data in Excel

experiment on the sample data set14 included in the zipped file you downloaded.

10.1.A STEP 1: OPENING THE PIVOT REPORT WIZARD15

Access the feature through the menu path DATA/PIVOT REPORTS (Excel 97) or
DATA/PIVOT REPORTS and PIVOT CHART REPORT (Excel XP).

Figure 121: Accessing the menu for a Pivot Report

The first dialog of the Pivot Report wizard opens and (shown in Figure 122) asks you
for the location/data you want analyzed (tabulated). Usually you will use an Excel
List16,17.

This step of the wizard has been completed.

Move on to the next step/dialog by clicking on the button Next.

14 The sample data set is on sheet “base” in the file “Sample Pivot1.xls.”
15 A “wizard” is a series of dialogs used for processes that need multiple dialogs. A
wizard typically has the buttons “Next,” “Back,” and “Finish.” These buttons allow
you to move to the next dialog, the previous dialog and to finish the process,
respectively. You should be able to separate out the four steps in the Pivot Report
wizard by the end of this chapter.
16 “Multiple consolidation ranges” allows you to choose data that is in different
worksheets or in non-adjacent ranges on the same sheet (or both).
17 After you read 0 on page 120 the usefulness and procedure for using “External data
source” will become apparent. At the end of 0 you will be presented a challenging
task — to combine the data management features learnt in that and the current
chapter on Pivots.

98
Pivot Reports

Figure 122: The first dialog of the Pivot wizard in Excel 97

Figure 123: The first dialog of the Pivot wizard in the XP version of Excel

Figure 124: Excel XP and later versions provide the option of creating charts in additions to tables

99
Managing & Tabulating Data in Excel

10.1.B STEP 2: CHOOSING THE DATA FOR TABULATION

A small dialog opens (for an illustration of this, see Figure 125). With the mouse,
highlight the data18 you want summarized in the Pivot Report19. This step of the
wizard has been completed.

Move to the next step/dialog by clicking on the button Next.

Figure 125: The dialog for step two of the Pivot wizard

10.1.C STEP 3A: DESIGNING THE PIVOT REPORT

The third dialog of the Pivot Report wizard opens in Excel 97. In Excel XP, an
interim step is needed. The dialog shown in Figure 126 opens. Click on the button
“layout.” The dialog for Pivot layout (same as in Excel 97) opens. (For an illustration
of this, see Figure 127.)

18 Usually you do not need to do this as Excel automatically picks up the range of data
on the sheet that is active.
19 The Browse button allows one to use data from Excel files other than the active file.

100
Pivot Reports

Figure 126: First dialog in step three of the Pivot wizard in the XP version of Excel

Click on the button “Layout.” The layout dialog is the same as in Excel 97.

Figure 127: Step three of the Pivot wizard in Excel 97 and the second stage in step three of the wizard in
Excel 2000 & later versions

Now you are ready to construct the table. A table has three components:

— The rows

— The columns

— The data cells (which has summarized data like the means of series)

Drag and move “Country Name” to the area “ROW,” “Series Name” to the area

101
Managing & Tabulating Data in Excel

“COLUMN“— as you can see in Figure 128. (Note: you can use more than one row or
column series; the column variables usually should have only a few categories— for
ease of printing.)

You should see similar options if you are using the sample data set which is on
worksheet “base” in the file “Sample Pivot1.xls.”

Figure 128: Creating the layout for the Pivot Report —


selecting the series to aggregate over the rows and columns of the Pivot Report

10.1.D STEP 3B: CHOOSING THE FORMULA FOR AGGREGATION/TABULATION

Drag the first data cell qualifier into the area “DATA” as shown in Figure 129. Note
that Excel has automatically called it “Count of…”

Figure 129: Choosing the data series whose aggregated values will form the content of the Pivot Report

Changing the function

102
Pivot Reports

Assume you want a different function— “Sum of” and instead of “Count of.”

Double-click on the button “Count of 1995.” The dialog shown in Figure 130 opens.
Choose the appropriate formula.

Figure 130: Selecting the formula for aggregation

Note:
By clicking on “Number” you can choose the number format of the cells of the data in
the output worksheet. The button Options allows further customization. (The
specifics are beyond the scope of this book.)

Execute the dialog by clicking on the button OK. Do the same for any other series
you want displayed in the data cells. (For example, choose the “Sum of the series
2000” as shown in Figure 131.)

Figure 131: Completing the Pivot layout

103
Managing & Tabulating Data in Excel

The use of the area “PAGE” will be shown in 10.3 on page 116. This step of the
wizard has been completed. Move on to the next step/dialog by clicking on the button
Next.

10.1.E STEP 4A: OPTIONS

Click on the button Options.

Figure 132: Step four of the Pivot wizard in Excel 97

Figure 133: Stage one of step four of the Pivot wizard


in the XP version of Excel

104
Pivot Reports

Figure 134: Stage two of step four of the Pivot wizard in the XP version of Excel

Name: you can give the Pivot Report a custom name. The name should not have any
blank spaces.

Format options:
• Grand totals for columns and rows will calculate the field for each column or
row category.

• Auto Format table will give the Pivot Report a formatting that looks good in a
printout.

• Subtotal hidden page items: beyond the scope of this book.

• Merge labels: experiment and judge if merging labels makes the table easier
to read.

• Preserve formatting: preserves the formatting of the data type

• For error values, show: you can choose to have errors displayed as blanks, or
with a special notation like “#Error.”

105
Managing & Tabulating Data in Excel

• For empty cells, show: you can choose to have empty cells displayed as
blanks, or with a custom sign such as “—” or “Empty” or “#Null.”

Try the other format options and observe how they affect the “Print Preview” of the
Pivot Report.

Data options
• Save data with (Pivot) table layout: deselect the option if all you want
to save is the Pivot Report design. You will then have to refresh the
table manually each time you re–open the file and want to complete
the Pivot Report.

• Enable drilldown: select this option.

• Refresh on open: this option re–calculates the fields in the Pivot


Report. Select if you want to ensure that the table is always updated
and current (with respect to the source data)

• Refresh every X minutes: you can choose this option instead of


“Refresh on open.”

External data options

• If you are using an external data source, then you may want to “Save
the password” so that the updating of the Pivot Report with new data
does not require a password each time.

• The option “background query” is beyond the scope of this book.

• The option “Optimize memory” should be selected if the processing of


the external data (in making the Pivot Report) utilizes too much of
active memory or resources of the computer.

10.1.F STEP 4B: WRAPPING IT UP — CREATING THE PIVOT REPORT

You may prefer to use a new worksheet. All the steps of the wizard have been
completed. Execute the wizard by clicking on the button Finish.

106
Pivot Reports

Figure 135: Completing the Pivot wizard in Excel 97

Figure 136: Completing the Pivot wizard in the XP version of Excel

The Pivot Report is made. It is shown in Figure 137.

Figure 137: The Pivot Report

You have already run a Pivot on this data— do you notice the Pivot worksheets for
the old Pivot?

107
Managing & Tabulating Data in Excel

10.2 MODIFYING/EDITING A PIVOT REPORT

The story is not over! Pivot Reports are very powerful because

(1) You can make graphs and calculate statistics at a more aggregate level then you
could with the original worksheet.

(2) You can change Pivot Reports even after they are made! Changing them is made
easy by the “Pivot Report” toolbar. You will view this toolbar floating over the
worksheet with a Pivot Report.20 The toolbar is shown in the next figure.

Figure 138: The Pivot toolbar with icons for modifying the Pivot Report

Experiment and witness what happens when you click different options on this
toolbar. In particular, find the options that allow you to:

— Edit the Pivot Report design (shown in Figure 129) – 2nd from left in top
row of icons

— Change the Function choices (shown in Figure 130) – 3rd from left in top
row of icons

— If you choose to place a series in the area “PAGE” as will be shown in 10.3
on page 116, this allows you to make separate worksheets for each category
of the PAGE series – – 4th from left in top row of icons

Pivot Reports can be modified further. Click anywhere on the Pivot Report and then
click on the right mouse.

The menu shown in Figure 139 will be visible.

20 If you do not see this toolbar, choose the menu option VIEW / TOOLBARS and choose
PIVOT REPORT.

108
Pivot Reports

Figure 139: The shortcut menu for a Pivot Report

10.2.A MODIFYING THE STRUCTURE OF A PIVOT REPORT

The option “Wizard” takes you back to the Step 3 of the “Pivot Report Wizard” (for an
illustration of this, see Figure 140). If you desire, you can make changes to the Pivot
Report design.

In the example illustrated in the next figure, you have added a data series “Sum of
Change...”

Figure 140: Adding additional series for the data area

The other options in the shortcut menu are beyond the scope of this book.

109
Managing & Tabulating Data in Excel

(Nevertheless, if you feel confident, play around with the options “Select” and
“Options.”)

10.2.B ADDING A NEW FUNCTION (AND THUS A NEW ROW SERIES)

Let us insert a new function/field to the Pivot Report. The function is “percentage
change from 1995 to 200021.”

Choose the option “Insert” from the shortcut menu shown in Figure 139. The dialog
shown in Figure 141 opens.

Figure 141: Adding a new function for a data field

First, as shown in the next figure, write the name of the new function.

Figure 142: Naming the new data field

At this point, go to the area “Formula:” and delete the zero.

21 The desired formula is “='2000' / '1995' -1.”

110
Pivot Reports

Figure 143: Typing the formula for the new data field— 1

Go to the area “Fields:” and choose the series name “2000.” Then click on the button
“Insert Field.” A reference to the series “2000” is automatically inserted into the
formula.

Figure 144: Typing the formula for the new data field— 2

Figure 145: Typing the formula for the new data field— 3

Type the operator for division.

Figure 146: Typing the formula for the new data field— 4

You may repeat the steps I did for inserting a


reference to “2000”— this time inserting a Figure 149: Typing the formula for the new
data field— 5
reference to the series “1995.” (For an
illustration of this, see the next three figures.)

Figure 147: Typing the formula for the new data field— 6

Type “–1.” The formula is complete.

Figure 148: Typing the formula for the new data field— 7

The completed dialog is shown in Figure 150.

111
Managing & Tabulating Data in Excel

Figure 150: Typing the formula for the new data field— 8

Execute the dialog by clicking on the button OK. The new field is added to the Pivot
Report as shown in Figure 151.

Figure 151: The Pivot Report with the new field

The rows labeled “Sum of Change 95— 2000” were not in the original Pivot Report.
Compare this figure with Figure 137.

10.2.C EDITING FIELDS

Assume you want to make changes to all the cells that relate to the field “Sum of
Change 95— 2000.”

Selecting a field
First, you have to select all the data that relates to the field “Sum of Change 95—
2000.” The usual click–and–drag (or CONTROL and click) method of selecting cells
will not work. In a Pivot Report, one selects a set of data by selecting a cell that

112
Pivot Reports

contains the label for that field.

Click on cell “B5” (or “B8”— any cell with the label “Sum of Change 95— 2000”). You
will witness that all the cells that contain text/data on the particular field are
automatically chosen and highlighted.

By clicking on cell B5, you select all the cells that relate to the field of “Sum of
Change 95— 2000.” Unlike a normal Excel worksheet, this is the way to select
items/cells in a Pivot Report. This is shown in Figure 152. After selecting, you can
delete/format/edit the labels and data for the field.

Figure 152: Selecting all the data and labels for one data field

Viewing the options available for modifying/editing a field


After selecting the field, click on the right mouse to view the shortcut menu shown in
Figure 153.

113
Managing & Tabulating Data in Excel

Figure 153: The shortcut menu for modifying/formatting the cells for one data field

Choose the option “Format Cells22.” The dialog shown in Figure 154 opens. Choose
the number format of “percentage.”

Make any other choices you desire.

Execute the dialog by clicking on the button OK.

22 The option “Insert” was discussed in the previous sub-section. The option “Format
cells” is discussed in this sub-section. The next sub-section briefly explains the
purpose of the other options in the menu.

114
Pivot Reports

Figure 154: Formatting the cells underlying the data for only one data field

The cell formats are changed, but only for the cells related to the field “Change 95—
2000.”

Similar changes for other fields


Repeat the steps corresponding to Figure 152 to Figure 155.

Figure 155: The number format of the data has been changed

Note:
If you select a series label (like “Age 0— 19 and over 64 years” (in cell C2 — refer to
the previous figure) then the data selected will include the data in column C. After
selecting the label (and thereby the data and label) click on the right mouse and try
out some of the options in the pop–up menu that appears.

115
Managing & Tabulating Data in Excel

10.2.D DELETING A FIELD

The “Delete” option removes (from the Pivot Report) the selected field.

10.3 REFRESHING THE REPORT

The option “Refresh Data” re–creates the Pivot Report. This option is useful if there
is any change in the data on which the table is based.

10.4 PIVOT REPORT EXAMPLE WITH A THIRD DIMENSION (ROW, COLUMN


AND PAGE)

Using the same data set, this time, select the option DATA/PIVOT REPORT and
choose the design shown in Figure 156. Alternatively, click on the old Pivot two–
dimensional Pivot Report, and then click on the right mouse.

From the options in the pop–up menu, select the option “Wizard.” Change the design
by dragging and dropping the buttons for each series. In the example below, you can
see that “Country name” has been moved from the area “Column” to the area “Page.”

This section's results are shown in the files “Sample Pivot2.xls” and “Sample
Pivot3.xls.”

Start with “Sample Pivot1.xls.” (That is, continue from the previous sub–section).
Change the Pivot Wizard such that it has a third dimension “Page.” You can use the
layout I show in the next figure.

Figure 156: Adding a third dimension (the “PAGE” option) to a Pivot Report

116
Pivot Reports

Drag and move the series “Country Name” to the indicator for “Page.” (For an
illustration of this, see Figure 156.) Follow the other steps as in the previous
example.

The Pivot Report is shown in Figure 157. I show this result in the file “Sample
Pivot2.xls.” Note that, at the top of the Pivot Report (in cell B1), you see a downward
arrow (and the text “(All).”

Figure 157: Using the Filter dropdown box for viewing each “page” in a three–dimensional Pivot Report —
1

10.4.A VIEWING DIFFERENT “PAGES”

Click on the downward arrow in cell B1 You will get a view of the list of possible
values for the series you placed in the area “Page” in the Pivot Report design shown
in Figure 156. Part of this list is shown in Figure 158. If you click on one value/item
in the list, the Pivot Report will change to show a table based on the data only for
that item. (If you choose the item “Algeria,” the Pivot Report will change to the one
shown in Figure 159.

Figure 158: Using the Filter dropdown box for viewing each “page” in a three–dimensional Pivot Report —
2

Therefore, when you do a “3–D” Pivot Report, you are creating several Pivot Reports,
one for each of the categories in the series placed in the “Page” area.

117
Managing & Tabulating Data in Excel

Figure 159: Using the Filter dropdown box for viewing each “page” in a three–dimensional Pivot Report —
3

10.4.B MAKING A NEW WORKSHEET FOR EACH “PAGE”

Click anywhere within the Pivot Report. Click on the right mouse. The menu shown
in Figure 160 will be displayed.

Choose the option “Show Pages.” Excel will make a separate worksheet for each item
in the list in cell B1. You will have 19 worksheets! This is an extremely powerful
tool.

The result is shown in the sample file “Sample Pivot3.xls.”

Figure 160: Making a new worksheet for each category of the variables in the third dimension

10.4.C MAKING A NEW CHART FOR EACH “PAGE”

In Excel XP, you can also request Charts from the results of the Pivoting procedure.
Excel will produce multiple charts for a three–dimension Pivot layout (that is, a row,
column, and page dimension).

118
Pivot Reports

Design a Pivot layout that produces the multiple charts shown


in the sample file “Sample Pivot3.xls.”

10.5 PIVOT REPORTS FROM SCENARIOS

This topic is taught in Volume 3: Excel– Beyond The Basics.

10.6 OLAP: NEW FEATURE IN THE XP VERSION OF EXCEL

XP has the new features of item properties and Online Analytical Processing (OLAP).
These topics are beyond the scope of this book.

10.7 ICONS FOR PIVOTING

The icons shown in the right half of the next figure will be useful for creating,
modifying, and managing a Pivot Report. You can customize the set of icons shown
on the toolbars at the top of the screen. This can save time by enabling you to place
the often–used buttons onto the toolbar.

Figure 161: Icons for Pivot Reports

Please refer to Volume 3: Excel– Beyond The Basics to learn how and why to
customize toolbars and the icons shown in them.

119
“If-then” Analysis: Scenarios & Goal Seek

CHAPTER 11

““IIFF--TTH
HEEN
N”” A
ANNA
ALLYYSSIISS:: SSC
CEEN
NAARRIIO
OSS A
ANND
DGGO
OAALL SSEEEEKK

This chapter discusses the following topics:

— SETTING THE DESIRED VALUE FOR THE “TARGET” CELL (THE ONE WITH THE FORMULA
THAT REFERENCES THE “SOLUTION” CELL)

— CHOOSING THE “SOLUTION” CELL

— RUNNING THE UTILITY

11.1 SCENARIOS (FOR “IF THIS ASSUMPTION-THEN THIS RESULT”)

The sample data for this section is in the file “Scenarios.xls.”

The data in columns “C,” “D” and “E” is the size of the labor force in years “1995,”
“2000” and “2010,” respectively, for specific age groups defined in column “A” and for
countries defined in column “B.” The cell “H3” holds the assumption of the
“cumulative or total” growth rate of the labor force from the year 2010 to 2020.

This rate is assumed equal for all age groups and countries. Column “F” is calculated
by multiplying the corresponding cell in column “E” with “100% plus the growth rate
of 40% in cell H3.” Therefore, column “F” values are 40% higher than the values in
column “E.” The formulas in the cells in column “G” directly reference cell “H3.”

The cells “H6,” “H7,” and “H8” provide statistical parameters for the year 2020 for
the country Algeria (that is, for the cells “F2” to “F14”).

These formulas indirectly reference cell “H3” through the formulas in the cells “F2” to
“F14.”

121
Managing & Tabulating Data in Excel

Figure 162: The sample data and formula cells

11.1.A DEFINING THE SCENARIOS

Go to the menu option TOOLS/SCENARIOS. The relevant dialog is shown in the


next figure.

Figure 163: The dialog for TOOLS/SCENARIOS before any scenarios are defined. Click on the button
“Add” to define a scenario.

Click on “Add” and define the first scenario. The scenario is the next figure
illustrates. The first scenario is named “40.” It assumes that the value of cell “H3” is
40% or 0.40.

You can make assumptions of several cells, including non-adjacent cells and cells
across sheets.

122
“If-then” Analysis: Scenarios & Goal Seek

Figure 164: The first scenario

A comment has been added to explain the scenario. All the other options are the
defaults — I recommend sticking with them.

After the first scenario is defined, click on the button “Add” and define the second
scenario. This scenario is named “50” and works on changing the cell “H3.”

Figure 165: The second scenario is named “50” and works on changing the cell “H3”

The second scenario assumes that the value of cell “H3” is 50% or 0.50.

Figure 166: The second scenario assumes that the value of cell “H3” is 50% or 0.50

123
Managing & Tabulating Data in Excel

The two scenarios are defined. The dialog shows the two scenarios. The dialog is
reproduced in the next figure.

Figure 167: The two scenarios are defined

You can define more scenarios.

Using the Scenarios

Viewing the result of a scenario


Click on the scenario name “40,” followed by the button “Show.” The cell “H3” will
take on the value assumed in the scenario (40% or 0.40). All the cells whose formula
references the “assumption cell H3” will change.

In this example, these cells are those in the column “G” (direct reference to the
assumption cell) and the values of the formulas for the mean, median and maximum
of column “G” (indirect reference to the “assumption cell H3”).

124
“If-then” Analysis: Scenarios & Goal Seek

Figure 168: Result of the first scenario

Switching over to the view of the result of another scenario


Click on the scenario name “50,” followed by the button “Show.” The cell “H3” will
take on the value assumed in the scenario (50% or 0.50). All the cells whose formula
references the “assumption cell H3” will change.

In this example, these cells are those in the column “G” (direct reference to the
assumption cell) and the values of the formulas for the mean, median and maximum
of column “G” (indirect reference to the “assumption cell H3”).

Figure 169: Result of second scenario

Scenario summary
At this stage, the use of scenarios is not very useful because you can only see the
results of one scenario at one time. You may wonder if a better option is to copy the
worksheet and use 40% in cell “H3” of 1 worksheet and 50% in cell “H3” of the other
worksheet.

125
Managing & Tabulating Data in Excel

Figure 170: Obtaining a “Scenario Summary”

The real power of Scenarios comes from its ability to create a comparative summary
table from the different scenarios. Click on the button “Summary.” Choose the
option “Scenario summary” and the cells whose values you want to compare across
the scenarios. I have chosen the cells that contain the mean, median and maximum
of column “G.”

The “Scenario Summary” is created and displayed on a new worksheet. Note that the
columns compare across scenarios, while the rows display the formula results you
wish to compare.

Making the output easily interpretable


You can type in “Assumed Growth Rate,” “Mean,” “Median” and “Maximum” into
cells “C6,” “C8,” “C9,” and “C10,” respectively.

Figure 171: The “Scenario Summary” is created and displayed on a new worksheet

Using the “Group and Outline” tool


Note that Excel has automatically inserted the “plus and minus” signs, grouping
range outlines, and grouping levels (“1” and “2”) to the Scenario Summary table.

126
“If-then” Analysis: Scenarios & Goal Seek

Experiment with using these indicators to learn more about “Grouping and
Outlining,” a skill taught in Volume 1: Excel For Beginners.

Figure 172: Collapsing the grouped Scenario columns “D” –”F” by clicking on the grouping indicator
“minus” at the top. (The indicator can be seen in the previous figure. The indicator changes to a “plus.”)

Figure 173: Expand the columns so that all the columns can be seen. Now contract the group of row “4” and
the group of row “6” by clicking on the “minus” signs for both of them. (The indicators can be seen in the
previous figure. The indicators change to a “plus.”)

127
Managing & Tabulating Data in Excel

Figure 174: Re-expand the rows by clicking on the two “plus” indicators for the rows

Scenario-based Pivot Tables


Go to the dialog (user-input form) for TOOLS/SCENARIOS after the scenarios have
been defined.

Click on the button “Summary.”

Choose the option “Scenario Pivot” and the cells whose values you want use in the
data region of the Pivot.

Figure 175: Obtaining a “Scenario Pivot”

The Pivot is created on a new worksheet. This Pivot is simple and small because we
have defined only one “assumption cell,” two scenarios within this assumption cell,
and three “result cells.”

• The number of data rows in the Pivot equals the number of scenarios.

128
“If-then” Analysis: Scenarios & Goal Seek

• The number of data columns equals the number of result cells.

• The number of “pages” in the Pivot is defined by the number of users who
have defined assumption cells.

Figure 176: The Pivot is created on a new worksheet

See Error! Reference source not found. to learn how to


collaborate and work simultaneously on one file. If you click on the “Merge” button
in the main Scenarios dialog, then you can merge the scenarios defined by different
users. Choose a different page — if you have more than one user — by clicking on its
name in the list that opens when you press the arrow on the right of cell “B1.”

You can create a separate worksheet and a separate chart for each page using
methods taught in Volume 4: Managing & Tabulating Data in Excel and Volume 2:
Charting in Excel.

The users who have defined scenarios will be listed. All lists all the scenarios defined
by all users. Use the “Merge” button to merge scenarios by different users.

Figure 177: The users who have defined scenarios will be listed

129
Managing & Tabulating Data in Excel

11.2 GOAL SEEK (“IF I WANT THIS CELL TO HAVE A CERTAIN RESULT, WHAT
VALUE SHOULD THAT CELL TAKE)

Type this formula into cell F4 of the sample data file ““Advanced File2.xls.” —

This formula will add the values in cells B2, B3… B8 and then add this sum to the
value in cell D4 multiplied by 1.23. Note that the formula references the cell D4 and
the cells B2 to B8.

I will show how Excel permits you to find a value for D4 such that F4 equals a
desired “target” value. Assume you want to find the value in cell D4 that will make
the value of the formula in F4 equal to 10,000,000,000.

11.2.A SETTING THE DESIRED VALUE FOR THE “TARGET” CELL (THE ONE WITH THE FORMULA THAT
REFERENCES THE “SOLUTION” CELL)

Click on the cell “F4”— that is, the cell for which a desired value is “sought.” Then
choose the menu option TOOLS/GOAL SEEK. The relevant dialog is shown in
Figure 178.

Enter the desired/target value into the box “to value” as shown in Figure 179.

Figure 178: The “Goal Seek” dialog

11.2.B CHOOSING THE “SOLUTION” CELL

You want F4 to achieve the given value by changing the value in cell D4. So enter D4

130
“If-then” Analysis: Scenarios & Goal Seek

in the box “By changing cell” as shown in Figure 17923.

Figure 179: Choosing the “solution” cell

Running the utility


Execute the dialog by clicking on the button OK. You will be told if a solution was
found. Go and look at cell D4. The value in there is the desired one— the value that
makes F4 = “target or desired value.”

23 Alternatively, click on the box marked by the arrow and then choose the cell from
the sheet.

131
Linking to a Database

CHAPTER 12

LLIIN
NKKIIN
NGG TTO
OAAD
DAATTA
ABBA
ASSEE

This chapter teaches the following topics:

— IMPORTANT DEFINITION: “QUERY“

— UNDERSTANDING THE STRUCTURE OF A DATABASE FILE

— ANALOGY BETWEEN THE STRUCTURES OF A DATABASE FILE AND AN EXCEL FILE

— LINKING TO DATA FROM A DATABASE (OR, “CREATING AND EXECUTING A DATA QUERY“)

— STEP 1: CHOOSING THE DATABASE FILE FROM WHICH DATA WILL BE IMPORTED

— STEP 2: CHOOSING THE COLUMNS/FIELDS/VARIABLES TO IMPORT

— SELECTING FIELDS FOR IMPORT INTO EXCEL

— STEP 3: (PRE–) FILTERING THE DATA TO BE IMPORTED

— STEP 4: PRE–SORTING THE DATA TO BE IMPORTED

— STEP 5: SAVING THE QUERY (THAT IS, SAVING STEPS 1— 4)

— STEP 6: WRAPPING IT UP— GETTING THE DATA INTO EXCEL

— REFRESHING THE LINK BETWEEN THE EXCEL RANGE AND DATA IN THE DATABASE FILE

— EDITING AN EXISTING QUERY

— USING “EXTERNAL DATA SOURCE” TO CREATE A PIVOT REPORT

— ICONS RELEVANT TO EXTERNAL DATA

Excel has a simple yet powerful tool for obtaining and linking to data from databases.
A range of cells on an Excel worksheet is linked to the “source” data from the
database. The source data is not just raw data; instead, it is the raw data
rearranged, filtered, and sorted as per the instructions of the user.

In 12.2 you learn all the steps for linking an Excel range to data from a database.
The first four steps involve the definition of a data import protocol, also called a
“query.” The last step is the execution of the query— that is, the actual import of the
data.

Important definition: “Query”


A “Query” defines a protocol for reading in data from a database. Intuitively, one is
“Querying” (that is, “asking a question of”) the database for obtaining data that
satisfies criteria that make up the definition of the query. It is much easier than it
sounds!

By “refreshing” this “link,” one makes sure that the linked cells in Excel contain the
latest data in the source database. Any chart that is made from data in the linked

133
Managing & Tabulating Data in Excel

cells will automatically be updated24— 12.3 on page 148 illustrates the ease of
refreshing the data link (also called “updating the query.”)

You may want to change the data import specifications that you defined in a query
you created earlier. The easiest way to do this is to open the old query and make
modifications to it. On page 149, 12.4 introduces editing a pre–defined query.

“Source” Database (on network drive, web, etc) Æ Query that Filters, Sorts and
arranges data Æ “Linked cells” on Excel worksheet Æ Tables, formulas, Pivot
Reports and charts (in Excel, Word, etc) that reference the data in the “linked cells”

12.1 UNDERSTANDING THE STRUCTURE OF A DATABASE FILE

A database file typically has several tables. Each table has several fields/columns.
Intuitively, think of an Excel workbook (or file) as a database. Perceive each
worksheet in the workbook as analogous to a table and each column in a worksheet
as a field/column in a database. A simple schematic chart of a database structure is
shown in Figure 180.

Figure 180: The structure of a database file

Table1 Table1.Field1

Table1.Field2

Database1 Table2
Table1.Field3

Table3 Table1.Field4

24 Once you learn to read data from external sources, you will feel comfortable with
using database linkages in other contexts and programs. (For example, for doing a
“Mail Merge” to create mass-mailing letters in Word, or for reading data from
database formats into SPSS, Lotus, etc.)

134
Linking to a Database

Analogy between the structures of a database file and an Excel file


I use Table 10 on page 135 to illustrate the analogy between Excel and database
structures. The row numbered 1 contains the largest “object.” The row numbered 2
contains a smaller “object” which in itself is a part of the object in row 1. The row
numbered 3 contains an even smaller “object” which in itself is a part of the object in
row 225.

Table 10: Analogy between a database file and an Excel file

Database Excel

1 Database file like “Bookstor.mdb” Excel workbook or file

Tables like the table “All Titles” shown


2 An individual worksheet
in Figure 184.

A field like “Au_ID” shown in Figure A column in the worksheet (like


3
185 column “A,” “B,” etc)

Click on a field name and click on the button “Preview Now.” You will see a sample
of the data in that field (as shown in Figure 186 below the label “preview of data in
selected column”).

12.2 LINKING TO DATA FROM A DATABASE (OR, “CREATING AND


EXECUTING A DATA QUERY”)

Open a new Excel file. Follow the six steps described in the rest of this section.

12.2.A STEP 1: CHOOSING THE DATABASE FILE FROM WHICH DATA WILL BE IMPORTED

Access the feature through the menu path DATA/GET EXTERNAL DATA/CREATE
NEW QUERY as shown in Figure 181.

25 Therefore, in Excel, the object “workbook” contains “worksheets” which contain


“columns.” In addition, in a database file format, the object “database” contains
“tables” which contain “fields.”

135
Managing & Tabulating Data in Excel

Figure 181: Accessing the menu option for creating a new query for linking with a database

Excel will first ask for the source of the data (that is, the format in which the source
data is stored)— for an illustration of this, see Figure 182. In the figure, five possible
sources are shown26.

You may have more or less show up on your computer. The formats that show up are
a function of the “drivers” (a program that, in this context, allows a program to read a
file in the format associated with the specific “driver.” You can buy/download drivers
for different database formats.

Figure 182: Step one of the Query wizard— choosing the data source

Check the option “Use the Query Wizard.” The database file you will use in this
example is an Access database. So, choose the database format “Microsoft Access
97.”

Click on the button Browse. In The relevant dialog (shown in Figure 183), browse

26 Note that Excel and Text Files are not, strictly speaking, database formats.
Nevertheless, the same protocol can be used to read files form these sources also. In
a way, an Excel file is like a database. More on this later in the chapter — see Table
96 on page 135

136
Linking to a Database

through the network of drives and choose the Access file that has the source data27.
(The file — “Bookstor.mdb”— is included in the zipped file you downloaded.) Execute
the dialog by clicking on the button OK. The query wizard is launched— it is shown
in Figure 184.

Figure 183: Step one of the Query wizard— choosing the path and name of the database file

12.2.B STEP 2: CHOOSING THE COLUMNS/FIELDS/VARIABLES TO IMPORT

After you click on “OK” in the dialog shown in Figure 183, the “Query Wizard” will be
launched. The first dialog within this wizard is shown in Figure 184.

The left half of this dialog shows the names of all the tables in the database file.
Notice the “plus” signs to the left of each table name.

If you click on the sign, then the fields in that table can be viewed (as shown in
Figure 185 for the table “Authors”).

27 Database files typically have certain security features. For example, you may have
permission to read data from the database but not to write data to it. If that is the
case, then check the box “Read Only.” In addition, the database may be on a network
path that is not shown in the list of drives in the drop-box “Drives.” You will have to
click on the button “Network” and choose the appropriate drive and path. Usually
you will need a password to access the drive and / or the database file. Consult the
“techies” in your office / school for more information.

137
Managing & Tabulating Data in Excel

Figure 184: Step two of the Query wizard (choosing the data series to import)— 1

Note that each field (which corresponds to a column in Excel) must be fetched from
inside a table; the table itself needs to be accessed through the database file.

Figure 185: Step two of the Query wizard (choosing the data series to import)— 2

Click on a field name and then click on the button “Preview Now.” You will see a
sample of the data in the selected field.

The next figure illustrates this.

138
Linking to a Database

Figure 186: Step two of the Query wizard (choosing the data series to import)— 3

Selecting fields for import into Excel


How does one select the field/column one wants to import into Excel? For an entire
table, click on the table's name on the left half and click the “right” arrow button.
(This button is marked by the arrow in Figure 187.)

For a specific field or column, first click on the “plus” sign (click on a specific
field/column name, and then click on the right arrow button. (The right arrow button
is marked by the arrow in Figure 187.)

Note that each field you choose will be imported as a column onto the Excel
worksheet. So, if you choose X number of columns/fields, you will import X columns
in Excel.

139
Managing & Tabulating Data in Excel

Figure 187: Step two of the Query wizard (choosing the data series to import)— 4

After choosing all fields/columns from the table “Authors,” I clicked on the table
name “Title Author” and chose all the fields in that table except for “Au_ID” (because
the field is common to the two tables I have accessed the fields from— “Authors” and
“Title Author” — I only need to select it from one of the tables. (For an illustration of
this, see Figure 188.)

You may follow my example, or select any other fields/columns.

Figure 188: Step two of the Query wizard (choosing the data series to import)— 5

The fields are selected. Move to step three by clicking on the button Next.

140
Linking to a Database

12.2.C STEP 3: (PRE–) FILTERING THE DATA TO BE IMPORTED

Once you choose all the fields you need, this step of the wizard is complete. Move on
to the next step/dialog by clicking on the button Next.

The “Filter” dialog— shown in Figure 189— opens. This dialog allows you to “Filter”
data; to “Filter in” data you desire to import and “Filter out” cases you do not want to
import. “Filtering” implies the selection of a subset of the fields (that you selected in
the dialog shown in the previous figure) based on criteria defined by you.

You are “Querying” the database—


“Go get me only the fields I selected, in the tables I selected and only for those
cases/rows that match my criteria for selection.”

Figure 189: Step three of the Query wizard (setting the criteria for selecting the observations to be
imported)— 1

Assume the first criterion is the selection of only those cases/rows in which the
“Au_ID” is field/column is not empty (null).

141
Managing & Tabulating Data in Excel

Figure 190: Step three of the Query wizard (setting the criteria for selecting the observations to be
imported)— 2

Click on the field name “Au_ID.' on the right side of the dialog, click on the
downward arrow (for an illustration of this, see Figure 190), and choose the option “is
Not Null” (for an illustration of this, see Figure 191).

Figure 191: Step three of the Query wizard (setting the criteria for selecting the observations to be
imported)— 3

The first criterion has been defined.

Assume that the second criterion is “only cases/row where the field/column “Year
Born” is between 1945 and 1954.” On the left half of the dialog, click on the
field/column label “Year Born” (for an illustration of this, see Figure 192).

Enter the criteria in the right half of the dialog. First, click on the downward arrow.

142
Linking to a Database

Figure 192: Step three of the Query wizard (setting the criteria for selecting the observations to be
imported)— 4

You will notice a list of possible operators. Choose the operator “greater than or
equal to” (for an illustration of this, see Figure 193). On the right of the operator list,
you will view another downward arrow. Click on that— you will see all the values
inside the field/column “Year Born. Choose the value “1945” (or type in the value).

Even though you are in Excel, you have picked up information from the database file!
Excel is already “Querying” the database and has picked up information like the type
of data in each field— numeric or string/text, the range of values, etc.

Therefore, although you are in Excel, and remain in Excel throughout the process of
querying, Excel has managed to enter into the database file and obtain the table
definitions, field definitions, etc.

Figure 193: Step three of the Query wizard (setting the criteria for selecting the observations to be
imported)— 5

Figure 194 shows the first half of the criterion “is greater than or equal to 1945.” I
also want only those values where “Year Born” is “less than or equal to 1954.”

143
Managing & Tabulating Data in Excel

Because it is an additive criteria (that is, I want both criteria to be obeyed), choose
the option “and” as shown in Figure 194. Click on the downward arrow in the second
row for criteria and choose the criterion in a similar fashion as done for the first
criteria.

You may follow my example, or set your own filter.

Figure 194: Step three of the Query wizard (setting the criteria for selecting the observations to be
imported)— 6

Now only those rows/cases will be selected which fit the criteria “Au_ID is not empty
(null) and the Year Born is between 1945 and 1954, end points inclusive.” (For an
illustration of this, see Figure 195.)

144
Linking to a Database

Figure 195: Step three of the Query wizard (setting the criteria for selecting the observations to be
imported)— 7

This step of the wizard has been completed. Move to the next step/dialog by clicking
on the button Next.

12.2.D STEP 4: PRE–SORTING THE DATA TO BE IMPORTED

The next dialog (shown in the next figure) in the wizard allows you to Sort the data
(as it is read into Excel) by the fields of your choice. I have chosen to Sort [a] first by
ascending values of the field “Year Born” and [b] second by ascending values of the
field “Author.” You may follow my example, or set your own sorting rules.

145
Managing & Tabulating Data in Excel

Figure 196: Step four of the Query wizard (pre–Sorting the data to be imported)

You have completed step four of the process. Move to step five by clicking on the
button Next.

12.2.E STEP 5: SAVING THE QUERY (THAT IS, SAVING STEPS 1–4)

The “Query” is defined! You may want to use the query again, edit (change) it,
extend it, or check its structure later. In order to make these processes possible, click
on the button “Save Query” (for an illustration of this, see Figure 197) and save the
query (for an illustration of this, see Figure 198).

Figure 197: Step five of the Query wizard (saving the query)— 1

146
Linking to a Database

Figure 198: Step five of the Query wizard (saving the query)— 2

When you click on the button “Save,” you will be taken back to the query wizard’s
last dialog (shown in Figure 197).

12.2.F STEP 6: WRAPPING IT UP— GETTING THE DATA INTO EXCEL

Click on the option “Return Data to Excel” and click on the button Finish. (For an
illustration of this, see Figure 199.)

Figure 199: Step six of the Query wizard (getting the data into Excel)— 1

Choose where you want the data to be read int. I advise choosing the option “New
Worksheet.” (For an illustration of this, see Figure 200.)

147
Managing & Tabulating Data in Excel

Figure 200: Step six of the Query wizard (getting the data into Excel)— 2

The data is read into Excel as shown in Figure 201.

Figure 201: The imported data

Save the Excel file in a folder that has access to the database file.

12.3 REFRESHING THE LINK BETWEEN THE EXCEL RANGE AND DATA IN THE
DATABASE FILE

The data is a “live link.” This Excel worksheet has automatically been linked to the
query you created. Whenever you want to replace the data in the worksheet with the
latest data in the database, open the Excel file, and click on this worksheet. Select
the option DATA/REFRESH DATA! You have a live link to a database. This is
extremely useful if you want to add dynamism to your Excel file and/or if your source
data is of a kind that is regularly updated.

148
Linking to a Database

Figure 202: Menu on a worksheet that contains imported data

Note that all charts, tables, and formulas that reference the data in the linked cells
will also be automatically updated when you refresh the link. When making a Pivot
Report, you can link directly to the source database by choosing the option “external
data source” in the first dialog of the Pivot Report wizard. This dialog is shown in
Figure 122 on page 99.

12.4 EDITING AN EXISTING QUERY

Choose the worksheet that has the downloaded data and follow the menu path
DATA/GET EXTERNAL DATA/EDIT QUERY. You will be shown the query wizard.
Use steps similar to those shown on 12.2 to edit and redefine the query.

12.5 USING “EXTERNAL DATA SOURCE” TO CREATE A PIVOT REPORT

While making a Pivot Report, one option for the “source” data is “External data
source.” In the previous chapter on Pivot Reports, I skipped over that option (for an
illustration of this, see Figure 122 on page 99 and footnote 17 on page 98). The use of
External data sources required the knowledge you got in this chapter.

Make a Pivot Report using the external data source used in this
chapter.

149
Managing & Tabulating Data in Excel

12.6 NEW IN THE XP VERSION OF EXCEL: OLAP

12.6.A DATA FROM THE INTERNET

The procedures have new features that allow data import using the latest in internet
technology. Online Analytical Processing (OLAP) is a new mode for obtaining data.

12.7 ICONS RELEVANT TO EXTERNAL DATA

You can customize the set of icons shown on the toolbars at the top of the screen.
This can save time by enabling you to place the often–used buttons onto the toolbar.
Please refer to Volume 3: Excel– Beyond The Basics to learn how and why to
customize toolbars and the icons shown in them.

The icons shown in the next figure provide easy access to refreshing linked data or to
changing the properties of the link with the external data source.

Figure 203: Icons for the Query or Import wizard

150
Managing & Tabulating Data in Excel

CHAPTER 13

RREEA
ADDIIN
NGGA
ASSC
CIIII TTEEX
XTT D
DAATTA
A

Contents of chapter:

— UNDERSTANDING ASCII TEXT DATA

— WHY IS DATA STORED AND DISTRIBUTED IN THIS FORMAT?

— WHAT IS SPECIAL ABOUT THIS FORMAT?

— FIXED–WIDTH/COLUMN

— DELIMITED/FREE-FIELD

— READING DELIMITED/FREE-FIELD ASCII TEXT DATA

— STEP 1: CHOOSING WHETHER THE FORMAT IS DELIMITED OR FIXED WIDTH

— STEP 2: CHOOSING THE CORRECT DELIMITER: TAB, COMMA, SPACE, ETC

— DETERMINING IF EXCEL/YOU HAVE CHOSEN THE WRONG DELIMITER

— STEP 3: DEFINE THE DATA FORMATS (IF NOT DONE AUTOMATICALLY/CORRECTLY BY


EXCEL)

— CONVERTING INTO AN EXCEL FILE

— READING FIXED WIDTH/COLUMN ASCII TEXT

The most difficult stage of a project should not be the reading in of data.
Unfortunately, the “ASCII Text” format (often called simply “ASCII” or “Text”
format) can make this stage extremely frustrating and time consuming.

Advice

Though I teach how to read ASCII Text data into Excel, bear in mind the following
issues:

— If the suppliers of data can provide you with data in a simpler format then request
them to do so!

— An excellent option for quickly converting data from different file formats into
Excel format is by the use of data conversion software like STATTRANSFER (web
site: www.stattransfer.com) or DBMSCOPY (web site: www.dbmscopy.com).

13.1 UNDERSTANDING ASCII TEXT DATA

Why is data stored and distributed in this format?


Most large data sets, especially those available to the public via CD–ROM or the web,

152
Reading ASCII Text Data

are in ASCII Text format because of (1) the relatively small disk space needed to
store and distribute ASCII TEXT data and (2) the conformity of ASCII with
standardization guidelines across operating systems and hardware.

What is special about this format?


As the name “Text” suggests, ASCII Text data is data written in the form of text, as
in a Note Pad, Word, or WordPerfect file. In contrast to ASCII, data is organized into
rows and columns in Excel.

When ASCII data is being entered, data–entry involves typing the data for variables
next to each other while separating different variables by a standard character28
(called a “Delimiter”) or by column positions. These concepts will become clear as I
now delve deeper into understanding the two broad types of ASCII TEXT formats.

Fixed–width/Column29
In this format, the data is identified by position. When you obtain such data, you will
need a “code book” which tells you the position each series occupies in the file.

Assume there are three variables: ID, First Name, and Last Name. The case to be
entered is “ID=009812348,” “First Name = VIJAY,” and “Last Name = GUPTA.” The
codebook states that the series “ID” is to be entered in the position 1 to 9, “first
name” in 10 to 14 and last name in “15 to 21.” The data–entry person does this.

When you read the data into Excel, you have to provide the program with
information on the positions of variables. That is, reading our sample file would
involve, at the minimum, the provision of the following information: “ID=1 to 9,”
“First Name =10 to 14” and “Last Name =15 to 21.” This is shown in the next text-
box.

Location 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

Actual data 0 0 9 8 1 2 34 8 V I J A YG U P T A

28 The standard “delimiters” are: tab, comma, or space.


29 The reading of fixed-field / column ASCII text data is beyond the scope of this book.

153
Managing & Tabulating Data in Excel

Delimited/Free-Field
In this ASCII Text format, spaces, tabs, commas, or semi–colons separate data series.
That is, after entering the data for one of the variables, the data–entry person places
a Delimiter to indicate the beginning of the next series. The next text-box shows this
for the three common Delimiters: space, tab, and comma.

• Space delimited (.prn): 00981234821 VIJAY GUPTA

• Tab delimited: (.dat): 00981234821 VIJAY GUPTA

• Comma delimited (.csv): 00981234821,VIJAY,GUPTA

ASCII files may have many other extensions. Some of the extensions I have seen are
“.asc,” “.txt,” “.hac,” etc. In addition, a “.csv” file may not always be a comma–
delimited file.

13.2 READING DELIMITED/FREE-FIELD ASCII TEXT DATA

Using the mouse, select the menu path FILE/OPEN. Choose the ASCII TEXT file —
use the file “Text format.txt” supplied in the zipped file— and click on “Open.” The
“File Open” dialog opens — this dialog is shown in Figure 204.

Figure 204: The “File Open” dialog

Irrespective of the file extension, Excel automatically recognizes the file as an ASCII
Text file, and, consequently, launches the 1st dialog of the “Text Import Wizard”
(shown in Figure 205).

154
Reading ASCII Text Data

13.2.A STEP 1: CHOOSING WHETHER THE FORMAT IS DELIMITED OR FIXED-WIDTH

The file could have either of the two broad categories of formats: delimited (also
called “free–field”), or fixed–width (also called “fixed-column”).

The Excel Wizard 'senses' that the ASCII Text file is of the delimited type.
Therefore, it selects the option “Delimited” in the area “Original data type30.”

Figure 205: Step one of the Text Import wizard

Interestingly, Excel can also read in ASCII Text data that was stored using
Macintosh, DOS, or OS/2 operating systems (for an illustration of this, see Figure
206.)

Figure 206: Choosing the “File Origin”

30 Excel may make a mistake sometimes; if it has selected the incorrect option (between
'Delimited' or 'Fixed width'), then you should make the correction manually by
choosing the correct option. (The agency that supplied the data should have supplied
you information on the specifications of the ASCII text file.)

155
Managing & Tabulating Data in Excel

Choose the options as shown in Figure 207. This step of the wizard has been
completed. Move on to the next step/dialog by clicking on the button Next.

13.2.B STEP 2: CHOOSING THE CORRECT DELIMITER: TAB, COMMA, SPACE, ETC

Now you are at step 2 of the Text Import Wizard (for an illustration of this, refer to
Figure 207). In step 2, you will choose the precise type of Delimiter. As shown in
Figure 207, Excel has 'sensed' the correct Delimiter is “Tab.” Look at the sample of
the file in the area “Data Preview.” The long vertical lines indicate the column/series
end/beginning points.

Does the sample make sense? If the answer is in the negative, you should
experiment with other types of Delimiters.

Figure 207: Step two of the Text Import wizard — 1

Determining if Excel or you have chosen the wrong Delimiter


Let us try the “Space” Delimiter. The “Data preview” area now shows how the data
will look if read in as space–delimited. The sample looks patently incorrect31. This is

31 Look at the haphazard position of the dark black vertical bands in the first row of the
data (in the “Data preview” box shown in Figure 692.

156
Reading ASCII Text Data

the good thing about the wizard— you can view samples to assist you in determining
the best Delimiter. (Note: Usually the correct Delimiter will be provided to you by
the agency that provided the data.)

Figure 208: Step two of the Text Import wizard — 2

Therefore, select the correct Delimiter— “Tab.”

Figure 209: Step two of the Text Import wizard — 3

You have finished the second dialog in the wizard. Click on the button Next.

13.2.C STEP 3: DEFINE THE DATA FORMATS (IF NOT DONE AUTOMATICALLY/CORRECTLY BY EXCEL)

In this step (step 3 of the wizard), you can define the data formats for each
series/column or to skip the import of a certain column. I find these two issues dealt
better in Excel— outside of the “Text Import Wizard32.” Therefore, just click on the

32 Using the menu option FORMAT / CELLS and the key DELETE.

157
Managing & Tabulating Data in Excel

button Finish.

Figure 210: Step three of the Text Import wizard

The data is read in and is shown in Figure 211.

Figure 211: The data is imported into Excel

13.2.D CONVERTING INTO AN EXCEL FILE

Choose the menu option “FILE/SAVE AS“ and save the file as an Excel workbook so
that, in the future, you do not have to use the “Import Text Wizard” to read the same
ASCII Text file.

Has Excel read in all the cases? Please check. The ASCII Text
file may be much larger than the holding capacity of an Excel worksheet (depending
on your version of Excel and the size of the ASCII TEXT file). Excel may not give a

158
Reading ASCII Text Data

message like “Failed to read in all the data.” I would suggest scrolling down to the
end of the Excel worksheet. If the last row and/or column are filled then it is highly
probable that some of the data was not read.

You should check if the data formats are correct for the purpose of your use of the
data. In the situation of errors id formats, choose the column(s) reformat the data
type using the menu option FORMAT/CELL/NUMBER.

Perform this procedure separately for each data type. (The F4 key — whose use is
taught in Volume 1: Excel For Beginners— makes such work much easier. Do the
formatting for one column. After that, choose other columns to which you want to
apply the same formatting and then press the F4 key.)

13.3 READING FIXED-WIDTH ASCII TEXT

Select the option FILE/OPEN. Choose the ASCII Text file. Irrespective of the file
extension, Excel automatically recognizes the file as an ASCII TEXT file, and,
consequently, launches the 1st dialog of the “Text Import Wizard” shown in the next
figure.

The Excel Wizard 'senses' that the ASCII Text file is of the Fixed-width type.
Therefore, it selects the option “Fixed-width” in the area “Original data type33.”

33 Excel may make a mistake sometimes; if it has selected the incorrect option (between
'Delimited' or 'Fixed width'), then you should make the correction manually by
choosing the correct option. (The agency that supplied the data should have supplied
you information on the specifications of the ASCII text file.)

159
Managing & Tabulating Data in Excel

Figure 212: Step one of the Text Import wizard for Fixed-width Text data

Click on the button Next. The second dialog of the wizard opens. Excel “senses” the
column widths and places demarcation lines. (The demarcating lines are called
“Break Lines.”)

Figure 213: Step two of the Text Import wizard for Fixed-width data — 1

160
Reading ASCII Text Data

Excel often makes errors in picking the demarcation points. Use the mouse to set the
correct column widths.

Figure 214: Step two of the Text Import wizard for Fixed-width Text data — 2

Click on the button Next. In this dialog (step 3 of the wizard), you can define the
data formats for each series/column or to skip the import of a certain column.

I find these two issues dealt better in Excel— outside of the “Text Import Wizard34.”
So, just click on the button Finish and the data are imported into Excel.

34 Using the menu option FORMAT / CELLS and the key DELETE.

161
Managing & Tabulating Data in Excel

Figure 215: Step three of the Text Import wizard for Fixed-width Text data

Figure 216: The data is imported into Excel

Choose the menu option “FILE/SAVE AS save the file as an Excel workbook. This
ensures that, in the future, you do not have to use the “Import Text Wizard” to read
the same ASCII Text file.

162
Managing & Tabulating Data in Excel

CHAPTER 14

PPA
ASSTTEE SSPPEEC
CIIA
ALL

This chapter teaches the following topics:

— PASTING THE RESULT OF A FORMULA, BUT NOT THE FORMULA

— OTHER SELECTIVE PASTING OPTIONS

— PASTING ONLY THE FORMULA (BUT NOT THE FORMATTING AND COMMENTS)

— PASTING ONLY FORMATS

— PASTING DATA VALIDATION SCHEMES

— PASTING ALL BUT THE BORDERS

— PASTING COMMENTS ONLY

— PERFORMING AN ALGEBRAIC “OPERATION” WHEN PASTING ONE COLUMN/ROW/RANGE


ON TO ANOTHER

— MULTIPLYING/DIVIDING/SUBTRACTING/ADDING ALL CELLS IN A RANGE BY A NUMBER

— MULTIPLYING/DIVIDING THE CELL VALUES IN CELLS IN SEVERAL “PASTED ON” COLUMNS


WITH THE VALUES OF THE COPIED RANGE

— SWITCHING ROWS TO COLUMNS

This less known feature of Excel has some great options that save time and reduce
annoyances in copying and pasting.

14.1 PASTING THE RESULT OF A FORMULA, BUT NOT THE FORMULA

Sometimes one wants the ability to copy a formula (for example, “=C223 + D223)”)
but paste only the resulting value. (The example that follows will make this clear.)

Select the range “F223:F235” on worksheet ““main.”

Choose the menu option FILE/NEW and open a new file. Go to any cell in this new
file and choose the menu option EDIT/PASTE SPECIAL.

In the area “Paste,” choose the option “Values” as shown in Figure 217.

164
Paste Special

Figure 217: The PASTE SPECIAL dialog in Excel versions prior to Excel XP

In Excel XP, the “Paste Special”


Figure 218: “Paste Special” dialog In Excel XP
dialog has three additional
options:

• Paste Formulas and


number formats (and not
other cell formatting like
font, background color,
borders, etc)

• Paste Values and


number formats (and not
other cell formatting like
font, background color,
borders, etc)

• Paste only “Column


widths.”

In Excel XP, the “Paste” icon


provides quick access to some
types of “Paste Special.” The Figure 219: The pasting options can be accessed by clicking on
the arrow to the right of the “Paste” icon
options are shown in the next
figure.

165
Managing & Tabulating Data in Excel

In Excel XP, the “Paste Special”


dialog has three additional Figure 218: “Paste Special” dialog In Excel XP

options:

• Paste Formulas and


number formats (and not
other cell formatting like
font, background color,
borders, etc)

• Paste Values and


number formats (and not
other cell formatting like
font, background color,
borders, etc)

• Paste only “Column


widths.”

The calculated values in the


“copied” cells are pasted. The
formula is not pasted. Try the
same experiment using
EDIT/PASTE instead of
EDIT/PASTE SPECIAL. The
usefulness of the former will be
apparent.

14.2 OTHER SELECTIVE PASTING OPTIONS

14.2.A PASTING ONLY THE FORMULA (BUT NOT THE FORMATTING AND COMMENTS)

Choose the option “Formulas” in the area “Paste” of the dialog (user-input form)
associated with the menu “EDIT/PASTE SPECIAL.” This feature makes the pasted
values free from all cell references. The “pasted on” range will only contain pure
numbers.

The biggest advantage of this option is that it enables the collating of formula results
in different ranges/sheets/workbooks onto one worksheet without the bother of
maintaining all the referenced cells in the same workbook/sheet as the collated
results.

166
Paste Special

Figure 220: Pasting formulas only

14.2.B PASTING ONLY FORMATS

Choose the option “Formats” in the area “Paste” of the dialog associated with the
menu “EDIT/PASTE SPECIAL use the “Format Painter” icon. I prefer using the
icon.

Refer to Volume 1: Excel for Beginners for a discussion on the format painter.

14.2.C PASTING DATA VALIDATION SCHEMES

Pick the option “Validation” in the area “Paste” of the dialog associated with the
menu “EDIT/PASTE SPECIAL.” Data validation schemes are discussed in Volume 4:
Managing & Tabulating Data in Excel. This option can be very useful in
standardizing data entry standards and rules across an institution.

14.2.D PASTING ALL BUT THE BORDERS

Choose the option “All except borders” in the area “Paste” of the dialog associated
with the menu “EDIT/PASTE SPECIAL.” All other formatting features, formulae,
and data are pasted. This option is rarely used.

14.2.E PASTING COMMENTS ONLY

Pick the option “Comments” in the area “Paste” of the dialog associated with the
menu “EDIT/PASTE SPECIAL.” Only the comments are pasted. The comments are
pasted onto the equivalently located cell. For example, a comment on the cell that is
in the third row and second column that is copied will be pasted onto the cell that is
in the third row and second column of the “pasted on” range. This option is rarely
used.

167
Managing & Tabulating Data in Excel

14.3 PERFORMING AN ALGEBRAIC “OPERATION” WHEN PASTING ONE


COLUMN/ROW/RANGE ON TO ANOTHER

14.3.A MULTIPLYING/DIVIDING/SUBTRACTING/ADDING ALL CELLS IN A RANGE BY A NUMBER

Assume your data is expressed in millions. You need to change the units to billions—
that is, divide all values in the range by 1000. The complex way to do this would be
to create a new range with each cell in the new range containing the formula “cell in
old range/1000.” A much simpler way is to use PASTE SPECIAL.

On any cell in the worksheet, write the number 1000. Click on that cell and copy the
number. Choose the range whose cells need a rescaling of units. Go to the menu
option EDIT/PASTE SPECIAL and choose “Divide” in the area Options. The range
will be replaced with a number obtained by dividing each cell by the copied cells
value!

The same method can be used to multiply, subtract or add a number to all cells in a
range

Figure 221: You can multiply (or add/subtract/divide) all cells in the “pasted on” range by (to/by/from) the
value of the copied cell

14.3.B MULTIPLYING/DIVIDING THE CELL VALUES IN CELLS IN SEVERAL “PASTED ON” COLUMNS
WITH THE VALUES OF THE COPIED RANGE

You can use the same method to add/subtract/multiply/divide one column’s (or row’s)
values to the corresponding cells in one or several “pasted on” columns (or rows).

Try This: Copy the cells in column E and paste special onto the cells in columns
C and D choosing the option “Add” in the area “Operation” of the paste special
dialog. (You can use EDIT/UNDO to restore the file to its old state.)

14.4 SWITCHING ROWS TO COLUMNS

Choose any option in the “Paste” and “Operations” areas and choose the option
“Transpose.” If pasting a range with many columns and rows you may prefer to
paste onto one cell to avoid getting the error “Copy and Paste areas are in different
shapes.”

168
Managing & Tabulating Data in Excel

CHAPTER 15

SSA
AVVIIN
NGGO ORR TTRRA
ANNSSFFO
ORRMMIIN
NGG TTO
O SSPPEEC
CIIA
ALL W
WEEBB A
ANND
D
DDO
OC CUUMMEEN
NTT FFOORRM
MA ATTSS

This chapter shows how to save/convert Excel files to the following formats:

— PDF

— WEB (HTML, WEB ARCHIVE)

— XML

15.1 CONVERTING TO A PDF (ADOBE ACROBAT) FILE

The PDF format has become popular for distributing reports, especially over the
Internet. The format has some advantages over an Excel/Word file format:

— The PDF file has better security measures — you can create a file that
cannot be printed, copied, or from which material cannot be extracted.

— The file looks the same on all computers, and

— Users are less hesitant to download PDF files (compared to Microsoft


Office files) because of the lower risk of downloading a virus.

Adobe offers several tools for converting to PDF format. Check out their web site
adobe.com.

15.1.A CREATING A PDF (ADOBE ACROBAT) FILE FROM THE PRINTOUT

I now discuss one of the tools you can use to convert to PDF. The tool is a PDF
“Printer Driver.” With this tool, you print your file into a PDF file.

You will see the option “Acrobat PDF Writer” as one of the printers in the area
“Name” as shown at the top of the next figure.

Note: The PDF Printer Driver is sold at Adobe.com and third-part vendors.

170
Index

Figure 222: PDF Writer

Choose the “Acrobat PDF Writer” printer option, and the options you desire in the
areas “Print range” and “Print what” of the “Print” dialog which is reproduced above.
Execute the dialog by clicking on the button OK. The “Save PDF File As” dialog
shown in the next figure opens. Choose a location for the PDF file and write in a file
name. Execute the dialog by clicking on the button OK. The Excel file will be
“printed” out as a PDF file.

Selecting the check-box “View PDF File” will follow the printing task with a display
of the file within the Adobe Acrobat Reader.

Figure 223: “Save PDF As” dialog

171
Managing & Tabulating Data in Excel

15.1.B OTHER TOOLS FOR CONVERTING ONE OR MULTIPLE FILES INTO PDF

Adobe offers several tools for converting to PDF format. Check out their web site
adobe.com.

15.2 SAVING AS AN HTML FILE

An Excel worksheet, chart, or the entire workbook can be saved as an HTML file.
This file can be placed on the web. It opens in any web browser like Internet
Explorer, Netscape, Opera, or AOL.

Figure 224: Saving as a web page

Access the feature through the menu path FILE/SAVE AS WEB PAGE. Choose what
you want to include in the HTML file. Click on the button “Save.”

15.2.A INTERACTIVITY WHEN SAVING A WORKSHEET

If you want visitors to the web site to be able to work on Excel data while inside a
browser application, then click on the option “Add interactivity.” This option only
works if you are choosing to save one Excel worksheet or chart as an HTML file— see
the next figure.
Note: Inquire whether FP extensions or Microsoft Office extensions are needed
for this. (Not all web hosts support this functionality.) This remarkable feature
adds Excel–like functionality to data displayed on a web page!

172
Index

Figure 225: Adding Interactivity

In the area “Viewing options,” choose what kind of interactivity you desire —
“Spreadsheet” or “Pivot Report.” If the current worksheet is not a Pivot Report then
you should choose “Spreadsheet Functionality”

Refer to the next section to learn how to use this interactivity after opening the file in
a web browser.

Figure 226: The two modes of Interactivity

At this stage, you will be prompted to write a web page title. Type a title and execute
the dialog by clicking on the button OK.

Excel will prompt you to enter information about the specific range of data you need
on the HTML file. This is shown in the figure below — see the area “Choose” at the
top of the dialog.

Figure 227: Setting a title for the web page

173
Managing & Tabulating Data in Excel

Figure 228: Choose the range of cells to publish as a web page

Click on the option “Publish” to complete the process of creating the HTML file.

15.2.B INTERACTIVITY WHEN SAVING A CHART

Assume you are saving a chart as an HTML file. Choose the chart and choose the
menu option FILE/SAVE AS WEB PAGE. Choose the option “Add interactivity,”
type in a name for the HTML file, choose a path for saving the file, and then click on
“Save.”

Figure 229: Saving a Chart with Interactivity

In the dialog that opens (shown in the next figure), choose the options as shown.
Click on the option “Publish” to complete the process of creating the HTML file.

174
Index

Figure 230: The “Publish as Web Page” dialog for a chart

The option “Open published web page in browser” will launch the default Internet
Browser on your computer and display the file you just saved as a web file.

15.3 NEW IN THE XP VERSION OF EXCEL: WEB ARCHIVE FORMAT AND XML

The Web Archive format allows the saving of an entire file as on web file.
AutoRepublish facilitates easy updating of Excel files on the web. In addition, in the
XP version of Excel, you can save in XML format.

175
Managing & Tabulating Data in Excel

15.3.A WEB ARCHIVE


Figure 231: Saving as a Web Archive

I recommend selecting “Add interactivity.” The file may be opened in a web browser.
(For optimal compatibility, use Internet Explorer.) An example is shown in the next
illustration. The example is from the sample file “DateTime.mhtml.”

176
Index

Figure 232: The file viewed in a web browser

The file has several sheets. Focus on the downward arrow at the bottom left of the
previous figure. On clicking the arrow at the bottom-left, you will see all the sheets
in the file.

The next figure illustrates this feature.

Figure 233: Viewing the sheets in the file.


Clicking on the name of a sheet opens that sheet in the web browser.

At the top of the file, you will see a short toolbar that provides access to interactivity
features. The toolbar is reproduced in the next figure.

Figure 234: The toolbar for interactivity

177
Managing & Tabulating Data in Excel

The toolbar icons provide access to the following features (from left to right):

• Undo

• Cut

• Copy

• Paste

• AutoSum

• Sort Ascending

• Sort Descending

• Filter

• Refresh All

• Export to Excel

• Commands & Options

• Help

The second-from-right icon (“Commands & Options”) provides access to many


features of the file. On selecting this icon, the dialog shown in the next figure opens.

The options in the tab “Workbook” provide access to features of the entire workbook.
The order of the sheets can be changed using the up and down arrows to the right of
the box that displays the sheet names.

A sheet can be deleted by selecting it in the box and then clicking on the “Delete”
button.

178
Index

Figure 235: Workbook Commands & Options

Similarly, a new sheet can be inserted before an existing sheet by clicking on the
button “Insert.” In the area “Show/Hide,” you can decide whether to view the arrow
that permits the selection of a sheet.

The options in the tab “Sheet” (reproduced in the next figure), provide:
• Access to a “Find” utility
• Options for viewing the sheet in reverse order (right to left)
• Options for hiding row/column headers & Gridlines.

Figure 236: Sheet Commands & Options

The “Formula” tab provides access to formula editing. The area “Names” maps each
cell to a “Location” on the file.

179
Managing & Tabulating Data in Excel

The formulas may reference these names instead of ranges. See Volume 1: Excel For
Beginners for more on “Named Ranges.”

Figure 237: Formula Commands & Options

The “Format” tab provides access to the Undo command, and basic text and cell
formatting.

The dialog is reproduced in the next figure.

Figure 238: Formatting Commands & Options

180
Index

15.3.B XML

An Excel workbook can also be saved as an “eXtended Markup Language” (XML) file.

Figure 239: Saving as an XML Spreadsheet

This format may gain in popularity because many other software companies are seeking to
make XML compatibility a central feature of their products.

Detailed discussion of this topic is beyond the scope of this book.

181
Managing & Tabulating Data in Excel

INDEX
ERROR ALERT.......................................................... 40
A
EXTERNAL DATA.................................... 17, 174, 175
A1 95
ACCESS ...................................................................... 23 F
ADD-INS..................................................................... 16 F1 42
AND ........................23, 40, 97, 126, 127, 174, 198, 215 FILE......12, 23, 24, 25, 29, 30, 174, 198, 201, 208, 209,
ASCII.........198, 199, 200, 201, 202, 203, 208, 209, 213 213, 216, 227, 229
ASCII TEXT DATA ................................................. 198 FILL.................13, 59, 60, 61, 63, 64, 66, 68, 72, 73, 76
AUDITING ................................................................. 16 FILL IN NUMBERS AND DATES ........................... 59
AUTOCORRECT ................................................. 16, 57 FILLING FORMATS ................................................. 59
AUTOFILL ................................................................. 68 FILTER ................................... 17, 97, 98, 100, 102, 104
AUTOFILTER .................................... 98, 100, 102, 104 FIND............................................................................ 13
AUTOFORMAT ......................................................... 15 FIXED ....................................................................... 198
AVERAGE ................................................................ 119 FIXED WIDTH/COLUMN ASCII TEXT ....... 158, 198
FORM.................................................. 17, 33, 34, 38, 56
C FORM BASED DATA ENTRY................................. 33
CELL ......................................................... 159, 208, 215 FORMAT ................ 15, 80, 87, 112, 198, 207, 208, 212
CELLS ............................... 14, 15, 40, 80, 207, 212, 215 FORMULA ................................. 14, 119, 126, 159, 215
CLEAR ........................................................................ 13 FORMULA BAR ........................................................ 14
COLUMN.............................. 15, 97, 127, 132, 198, 215 FOXPRO ..................................................................... 23
COLUMNS ................................................. 14, 174, 215 FREEZE PANES......................................................... 17
COMMA.................................................................... 198 FUNCTION................................................... 14, 15, 126
COMMENT................................................................. 15 FUNCTION / FINANCIAL........................................ 14
COMMENTS ...................................................... 14, 215 FUNCTION / INFORMATION ................................. 15
CONDITIONAL FORMATTING ..... 16, 80, 81, 84, 87, FUNCTION / LOGICAL............................................ 14
112
FUNCTION / LOOKUP ............................................. 15
CONSOLIDATION ............................................ 17, 124
FUNCTION / MATH & TRIG ................................... 15
CONSTANT GROWTH RATE ................................. 59
FUNCTION / STATISTICAL .................................... 14
COPY ...................................................... 13, 56, 76, 101
FUNCTION / TEXT ................................................... 14
COPYING AND PASTING ................................. 40, 97
CRITERIA....................................................... 40, 80, 97 G
CRITERION................................................................ 97 GET EXTERNAL DATA................................. 178, 194
CUSTOM LIST..................................................... 59, 68 GO TO .........13, 109, 110, 113, 114, 115, 116, 117, 118
CUSTOMIZE ........................................................ 16, 77 GOAL SEEK....................................................... 16, 171
CUT ............................................................................. 13 GROUP AND OUTLINE ........................................... 17

D H
DATA ENTRY............................................................ 59 HEADER..................................................................... 14
DATA VALIDATION................................................ 40 HEADER AND FOOTER .......................................... 14
DAY ............................................................................ 23 HELP ........................................................................... 18
DBASE ........................................................................ 23 HIDE............................................................................ 17
DELETE SHEET ........................................................ 13 HTML.................................. 28, 226, 227, 228, 229, 230
DELIMITED / FREE-FIELD ASCII TEXT DATA 198 HYPERLINK .............................................................. 15
DELIMITER ............................................................. 198
I
E IF 198
EDIT .......12, 56, 60, 61, 63, 64, 66, 68, 72, 73, 76, 101, IMPORT.................................................................... 174
109, 113, 114, 115, 116, 117, 194, 216, 217, 218, INSERT ....................................................................... 14
219, 220, 221
EDITING AN EXISTING QUERY ......................... 174

182
Index

L R
LINKS.......................................................................... 13 REDO........................................................................... 12
LOTUS 1– 2– 3............................................................ 23 REFRESH DATA...................................................... 193
REPLACE.................................................................... 13
M
RIGHT ......................................................................... 59
MACROS..................................................................... 16
ROW ............................................15, 126, 127, 132, 215
MISSING VALUES .................................................... 59
ROWS ....................................................14, 97, 119, 215
MODE.......................................................................... 23
ROWS TO COLUMNS............................................. 215
MONTHS..................................................................... 59
MOVE OR COPY SHEET.......................................... 13 S
MS SQL SERVER....................................................... 23 SAS ..............................................23, 24, 25, 26, 28, 127
MULTIPLYING/DIVIDING/SUBTRACTING/ADDIN SAVE .........................12, 24, 25, 29, 208, 213, 227, 229
G ALL CELLS IN A RANGE BY A NUMBER215 SAVE AS.................................12, 24, 25, 208, 227, 229
N SAVE AS WEB PAGE ...............................12, 227, 229
NA 15 SAVE WORKSPACE ........................................... 12, 29
NEW QUERY............................................................178 SCENARIOS .......................................16, 160, 161, 168
NOT ...................................................................198, 215 SEARCH...................................................................... 12
SHARE WORKBOOK................................................ 16
O SHEET ......................................................................... 15
OBJECT.................................................................13, 15 SORT .......................................................17, 90, 93, 120
OFFICE ASSISTANT ................................................. 18 SORTING BY ROWS................................................. 89
OFFICE CLIPBOARD................................................ 13 SORTING RANGES THAT DO NOT COVER
ONLINE COLLABORATION ................................... 16 ENTIRE COLUMNS OR ROWS ......................... 89
OPEN ...................................12, 23, 24, 25, 30, 201, 209 SPEECH................................................................. 16, 78
OPTIONS.........................................17, 68, 69, 126, 215 SPELLING................................................................... 16
OR 33, 174, 198 SPLIT........................................................................... 17
ORACLE...................................................................... 23 SPSS.............................3, 5, 23, 24, 25, 26, 28, 127, 175
STATA.........................................................5, 23, 24, 28
P
STATUS BAR ............................................................. 14
PAGE BREAK ......................................................13, 14
STYLE ......................................................................... 16
PAGE BREAK PREVIEW ......................................... 13
SUBTOTAL............................................................... 120
PAGE SETUP.............................................................. 12
SUBTOTALS ..............................................17, 119, 123
PARADOX .................................................................. 23
SUM........................................................................... 119
PASTE .................. 13, 56, 101, 216, 217, 218, 219, 220
PASTE SPECIAL ......... 13, 56, 216, 217, 218, 219, 220 T
PASTING ALL BUT THE BORDERS ....................215 T 20, 23, 201
PASTING COMMENTS...........................................215 TAB............................................................................ 198
PASTING DATA VALIDATION ............................215 TABLE......................................................................... 17
PASTING ONLY FORMATS ..................................215 TEXT ..................................................................... 23, 40
PASTING ONLY THE FORMULA.........................215 Text Files ................................................................... 178
PDF ..............................................28, 223, 224, 225, 226 TIME............................................................................ 23
PIVOT REPORT ........ 17, 126, 127, 128, 141, 152, 174 TOOLBAR................................................................... 59
PIVOT REPORT WIZARD ......................................126 TOOLBARS ..................................................13, 77, 141
PIVOT REPORTS .....................................................128 TOOLS.......................16, 68, 69, 78, 160, 161, 168, 171
PRINT AREA .............................................................. 12 TYPE............................................................................ 33
PRINT PREVIEW ....................................................... 12
U
PROPERTIES .............................................................. 12
UNDO .................................................................. 12, 221
PROTECTION............................................................. 16
V
Q
VALIDATION ..................17, 40, 41, 42, 46, 52, 55, 56
QUATTROPRO........................................................... 23
VALUE ................................................................ 97, 159
QUERY..............................................................174, 194
VIEW .......................................................13, 77, 86, 141

183
Managing & Tabulating Data in Excel

W Y
WEB ............................................................................ 16 YEAR .......................................................................... 59
WINDOW.................................................................... 17
Z
WORKSHEETS .......................................................... 14
ZOOM ............................................................. 14, 86, 87
WORKSPACE ............................................................ 23

184

You might also like