0% found this document useful (0 votes)
123 views

Excel Core 2016 Lesson 09

Uploaded by

abraham mora
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
123 views

Excel Core 2016 Lesson 09

Uploaded by

abraham mora
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 115

Microsoft Excel 2016

Lesson 9
Working with Data and Macros

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 1
Objectives

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 2
Software Orientation
• Most of the exercises in this lesson use the Data tab on the
ribbon.
• It’s often convenient to store records and perform calculations in
the same program.
• Excel makes it easy to import existing data from other sources.
• You can arrange and manage that data properly once you bring
it into a workbook.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 3
Importing Data
• When you use a workbook that requires a large amount of
data, it is helpful if some of the data already exists in some
form and that you don’t have to type it manually.
• If the data you need for a workbook is from a source outside
of Excel, Excel needs to import that data in such a way that it
can make sense of the data.
• Simple text files where values are separated (delimited) by
commas can be imported.
• Complex relational databases are comprised of multiple
tables, and thus can’t be imported directly.
• You have to open a connection to the database and stream
the specific tables you need into Excel, in a manner that Excel
can readily parse (interpret character-by-character).
© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 4
Opening Non-Native Files Directly in Excel
• Excel has two main data formats:
• An older one that was owned and operated by Microsoft and whose files end
with the .XLS extension
• A newer, XML-based .XLSX format whose specifications have been shared
publicly.
• Because the newer format is public, there are more programs and services
now that publish data to a format that Excel accepts.
• Some services provide data in a basic XML format that Excel can import;
however, there’s no guarantee that the columns will all be aligned properly
or that the headings will be in the place Excel expects them to be for a table.
• .TXT or .CSV file can be imported and use certain characters, such as
commas and quotation marks, as delimiters (characters that separate data
entries from one another) and that Excel will not interpret as part of a cell
entry..

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 5
Step by Step: Open a Non-Native File
Directly in Excel
• Before you begin these steps, LAUNCH Microsoft Excel and OPEN a
blank workbook.
1. Click the Data tab, and then in the Get External Data group, click
From Text.
2. In the Import Text File dialog box, locate and click 09 NA-POP-EST-
01.csv. Click Import.
3. In Step 1 of the Text Import Wizard, notice the preview at the
bottom (see the figure on the next screen). This is Excel’s best
guess, for the moment, as to how the data should be formatted.
There are population figures rendered in “quotation marks” with
commas between each figure. Each comma acts as the delimiter.
It’s difficult to judge whether each figure between the commas will
be the same length. Under Choose the file type that best describes
your data, choose Delimited and then select My data has
headers.
© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 6
Step by Step: Open a Non-Native File
Directly in Excel
4. The preview shows the headers
starting on row 3. Thus, for the
Set import at row option,
choose 3. Click Next.
5. In Step 2 of the wizard uncheck
Tab because the preview does
not indicate long spaces
between the figures. Check
Comma. Set Text qualifier to “
(quotation mark). Scroll down
the Data preview pane, and
notice now that Excel has
found the column separations
between figures. Click Next.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 7
Step by Step: Open a Non-Native File
Directly in Excel
6. Step 3 of the wizard lets you establish the data type for each
discovered column. Click the first column in the Data
preview pane. Then, under Column data format, click Date.
Click Finish.
7. In the Import Data dialog box that
appears next (see right), leave
Where do you want to put the
data? set to Existing worksheet.
Click OK.
8. Change the width of column
A to 16.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 8
Step by Step: Open a Non-Native File
Directly in Excel
9. The worksheet that Excel has generated, shown in the figure on the next
slide, shows United States population estimates for each month from April
2010 to December 2012. Excel could not make sense of the dates in column
A, so it left the data type set to General for most of the cells. However, it did
make an error in attempting to convert the year in cell A25. To correct it,
begin by selecting and deleting rows 2, 12, and 25 (be sure to select all
three rows at the same time before deleting them).
10. Click cell A2, type April 2010, and then press Enter.
11. Drag the fill handle from cell A2 down to cell A34. Excel changes the entries
in column A to proper months.
12. Delete rows 35 through 40.
13.SAVE the workbook in the Excel Lesson 9 folder as 09 Monthly Census
Data Solution.
• SAVE the workbook and LEAVE it open for the next exercise.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 9
Step by Step: Open a Non-Native File
Directly in Excel

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 10
Getting External Data
• In the world of computers, there are data files and databases.
A data file stores a series of records in a relatively simple
format, and Excel uses data files in this manner.
• A database is a comparatively complex system that can store
a large amount of related data, which requires a program to
be able to assess and render that data.
• When Excel imports data from a database as opposed to a
data file, it actually launches a program, begins a
communications process with that program, and instructs the
program to stream the data it requires.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 11
Step by Step: Get External Data
• LAUNCH Excel if it is not already running and open a blank
workbook.
1. Click the Data tab, and then in the Get External Data group,
click From Access.
2. In the Select Data Source dialog box, locate the 09 Customer
Contacts.accdb
database file. Select it
and click Open.
3. In the Select Table
dialog box (see right),
click Customers and
then click OK.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 12
Step by Step: Get External Data
4. In the Import Data dialog box, click Table. Under Where do
you want to put the data, click Existing Worksheet and
ensure the text box reads =!$A$1.
5. Click OK. Excel displays a formatted table (see the figure on
the next slide), complete with AutoFilter buttons in the
column headers, which you learn more about later in this
lesson in “Using AutoFilter.”
6. SAVE the workbook in the Excel Lesson 9 folder as 09
Customers Solution.
• SAVE the workbook and LEAVE it open for the next exercise.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 13
Step by Step: Get External Data

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 14
Step by Step: Append Data to a Worksheet
• In most situations, you’ll import data from other sources into
an existing worksheet.
• OPEN the 09 Owners.xls workbook for this lesson.
1. Click cell A21.
2. Click the Data tab, and then in the Get External Data group,
click From Other Sources and then click From XML Data
Import.
3. In the Select Data Source dialog box, locate and select the 09
Owners Import.xml data file. Click Open. A dialog box
named Error In XML might appear at this point. If so, click OK
to dismiss the dialog box and proceed.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 15
Step by Step: Append Data to a Worksheet
4. In the Import Data dialog box, click Existing worksheet and
then click OK. Although a list of customers is appended to
the end of the worksheet, the columns don’t line up, as
shown here. This is typical of appended data.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 16
Step by Step: Append Data to a Worksheet
5. To correct the problem, begin by moving the first names from cell range
E23:E75 to B23:B75. Overwrite the existing contents in column B.
6. Move the last names from cell range H23:H75 to A23:A75. Overwrite the
existing contents in column A.
7. Repeat the process for the states in column J that should be in column E,
the ZIP codes in column K that should be in column F, and the phone
numbers in column I that should be in column G.
8. Delete columns H through L.
9. Delete rows 21 and 22.
10. Replace all 11 instances of Dell City in column D with Del City.
11. Adjust the column widths to fit the data.
• SAVE the workbook in the Excel Lesson 9 folder as 09 Owners
Solution.xlsx.
• SAVE the workbook and LEAVE it open for the next exercise.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 17
Ensuring Your Data’s Integrity
• Validation helps to ensure that data gets entered correctly,
before it gets processed incorrectly.
• Excel’s data validation tools can help you set up rules that
keep you or anyone else from entering invalid or unusable
data, or from failing to enter data when it’s required.
• For example, you can set up a rule in Excel that pings the user
whenever he or she types a two- or four-digit area code
instead of the required three-digit code.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 18
Step by Step: Restrict Cell Entries to Certain
Data Types
• OPEN the 09 Vet Clinic Patients workbook for this lesson.
1. Click the File tab and select Save As. SAVE the workbook in
the Excel Lesson 9 folder as 09 Vet Clinic Patients Solution.
2. Freeze rows 1 through 4 in both worksheets in the workbook.
3. In the Client List worksheet, select column L (Area Code).
4. Click the Data tab, and then in the Data Tools group, click
Data Validation. The Data Validation dialog box opens.
5. Click the Settings tab.
6. In the Allow list box, choose Text length. This is the first step
in the creation of a rule governing how many characters each
new entry should contain.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 19
Step by Step: Restrict Cell Entries to Certain
Data Types
7. In the Data list box, choose equal to.
8. Click the Length box and type 3 (see below).
9. Click the Input Message tab.
This tab displays a message
when you select a cell in the
validation range.
10. Click the Title box and type
Rule:.
11. Click the Input message box
and type Please enter a
three-digit area code.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 20
Step by Step: Restrict Cell Entries to Certain
Data Types
12. Click the Error Alert tab. Excel can display an error alert
message when a user attempts to enter data that is invalid.
13. Click the Title box and type Data Entry Error.
14. Click the Error message box
and type Only three-digit
area codes are recognized.
This message is displayed in
a dialog box whenever an
invalid entry is made in column
L. The dialog box should now
appear as shown here.
15. Click OK.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 21
Step by Step: Restrict Cell Entries to Certain
Data Types
16. To test the new validation rule, click cell L57. You should see the
notification message you typed into the Input Message tab.
17. Type 40 and then press Enter. Excel displays an alert dialog box with the
message you created (see below).
18. Click Cancel. The partial entry in cell L57 is erased.
• SAVE the workbook and LEAVE it open for the next exercise.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 22
Allowing Only Specific Values to Be
Entered in Cells
• A typical piece of information you’ll find in a database is often
a single letter that represents a characteristic
• In data entry, it’s easy for someone to slip and enter an invalid
character.
• You can preempt this by building a rule that restricts entry to
a handful of valid characters.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 23
Step by Step: Allow Only Specific Values to
Be Entered in Cells
• USE the workbook from the previous exercise.
1. Click the File tab and select Save As. SAVE the workbook in
the Excel Lesson 9 folder as 09 Vet Clinic Patients Solution
2.
2. Click the Patient List tab.
3. Select column D.
4. On the Data tab, in the Data Tools group, click Data
Validation.
5. In the Data Validation dialog box, click the Settings tab.
6. In the Allow list box, choose List. The Source box appears at
the bottom of the dialog box.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 24
Step by Step: Allow Only Specific Values to
Be Entered in Cells
7. Click the Source box. Type M,F,N (being careful to include
the commas).
8. Uncheck the Ignore blank box.
9. Click the Input Message tab. Click in the Input message box
and type Male, Female, or Neutered.
10. Click OK. Now anyone entering a new patient into the
database must specify the animal’s gender from a drop-down
list in the cell.
11. Select column E (Owner #).
12. In the Data Tools group, click Data Validation.
13. Click the Settings tab. In the Allow list box, click List.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 25
Step by Step: Allow Only Specific Values to
Be Entered in Cells
14. On the right side of the Source box, click the Collapse Dialog
button.
15. With the Data Validation dialog box collapsed, click the
Client List worksheet tab.
16. Select column A (Client #).
17. At the end of the Source box, click the Expand Dialog
button. The full dialog box returns, and the Source box
should now read =’Client list’!$A:$A.
18. Unselect the Ignore blank and In-cell dropdown boxes.
19. Click the Error Alert tab. Choose Warning in the Style box.
20. In the Error message box, type Owner must be the number
for a pre-existing client.
© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 26
Step by Step: Allow Only Specific Values to
Be Entered in Cells
21. Click OK. Now the Owner # column may contain only
numbers for clients who appear in the Client # column of the
Client List worksheet.
22. To make sure your new validation rules are working, in the
Patient List worksheet, at the bottom of the list, click cell A57
and attempt to type the following data:
Murdock Dog RottweilerB 61
23. After you attempt to enter B into column D, respond to the
error dialog box by clicking Retry and by typing M.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 27
Step by Step: Allow Only Specific Values to
Be Entered in Cells
24. After you attempt to enter 61 into column E, respond to the
error dialog box shown in Figure 9-11 by clicking No and
typing 31.
• SAVE the workbook and LEAVE it open to use in the next
exercise.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 28
Removing Duplicate Rows from a
Worksheet
• In many databases, it’s important that each record (each row
of an Excel database table) is unique.
• If an entry appears twice, Excel might treat the records as
separate entries even if they contain identical information.
• The difficulty then comes when you try to reconcile any other
records or subsequent data that might refer to either of these
duplicate entries.
• You can have Excel search for duplicate entries and purge
them.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 29
Step by Step: Remove Duplicate Rows from
a Worksheet
• USE the workbook from the previous exercise.
1. SAVE the current workbook as 09 Vet Clinic Patients Solution 3.
2. Click the Client List worksheet tab.
3. Click cell A57 and in row 57, type the following data in the
appropriate columns:

4. Select the cell range A4:N57.


5. On the Data tab, in the Data Tools group, click Remove
Duplicates. The Remove Duplicates dialog box appears.
6. In the Columns list, remove the check beside Client #. If duplicate
names and addresses appear in the list, it’s likely their client index
numbers were not duplicated.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 30
Step by Step: Remove Duplicate Rows from
a Worksheet
7. Leave the My data has headers box checked (see Figure 9-12).
This way, Excel won’t treat row 4 as though it contains data.
8. Click OK. Excel responds with a dialog box stating one duplicate
value set (the one you just entered) was removed.
9. Click OK to dismiss the
dialog box. Note the
second (lowermost)
instance of the duplicate
entry was removed,
from row 57.
• SAVE the
workbook and LEAVE it
open to use in the next
exercise.
© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 31
Sorting Data
• Sorting a data range in Excel helps you to locate the precise
data you need.
• It can also help Excel to look up certain data for inputs into
formulas.
• Sorting is mostly for your benefit. For example, sorting
customers in a table by their last name rather than an arbitrary
customer number.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 32
Sorting Data on a Single Criterion
• You’ve probably heard the word “criteria” more often than its
singular form, criterion.
• Both words relate to elements that are referred to in the
course of executing a function.
• For instance, the White Pages has three sort criterion:
• Last name
• First name
• Middle initial
• When individuals in a database are indexed by number and
that number is guaranteed to be unique, it forms a single
criterion for a common sort operation.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 33
Step by Step: Sort Data on a Single
Criterion
• USE the workbook from the previous exercise.
1. SAVE the current workbook as 09 Vet Clinic Patients Solution 4.
2. In the Patient List worksheet, click cell E5. Note this is the first cell in the
Owner # column and its entries are all numerical.
3. On the Data tab, in the Sort & Filter group, click the Sort Smallest to
Largest button (with A on top of Z, and an arrow pointing down). The list is
now sorted in ascending numerical order by Order #, which was the
column you clicked in before performing the sort.
4. Click cell A5.
5. Click the Sort A to Z button. This time, the list is sorted by Patient Name,
and again, the first column you clicked in before performing the sort.
Murdock the Rottweiler, which you previously added to row 57, now
appears in row 44.
• SAVE the workbook and LEAVE it open for the next exercise.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 34
Sorting Data on Multiple Criteria
• A proper database containing records of people divides each
element of their names into, at the very least, last and first
names, and might also include optional elements such as
middle initials, prefixes, and suffixes.
• For this reason, any time you sort a database, range, or table
by names, you want to sort by multiple criteria.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 35
Step by Step: Sort Data on Multiple Criteria
• USE the workbook from the previous exercise.
1. Click the Client List worksheet tab.
2. Select the range A4:N56.
3. Name the range Clients.
4. On the Data tab, in the Sort & Filter group, click Sort. The Sort
dialog box appears.
5. In the Sort by list box, under Column, choose Last Name.
6. Click Add Level.
7. In the Then by list box that appears, choose First Name.
8. Click Add Level.
9. In the next Then by list box, choose MI (middle initial).
10. Click Add Level again.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 36
Step by Step: Sort Data on Multiple Criteria
11. In the next Then by list box, choose Suffix. The dialog box should
now appear as depicted in the figure below.
12. Leave My data has headers checked, so that Excel won’t treat the
headers row as part of the range to sort.
13. Click OK. The clients list is now sorted alphabetically, with people
sharing the same last name sorted alphabetically by first name.
Although the client numbers appear all out of sort, the data is
unchanged and the
database itself retains
its full integrity.
• SAVE the
workbook and
LEAVE it open for
the next exercise.
© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 37
Sorting Data Using Cell Attributes
• Excel can sort records based on the conditional formatting
that is applied to its cells.
• Excel does not have a “conditional sort” feature, where you
create a rule or a formula that Excel evaluates to group or
arrange rows.
• Rather, you create rules that apply specific formats or graphics
to cells based on their contents. Then Excel can sort and
group those records whose cells have these special formats
applied to them.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 38
Step by Step: Sort Data Using Cell
Attributes
• USE the workbook from the previous exercise.
1. On the Patient List worksheet, which should still be sorted in
ascending order on column A, select column E.
2. Right-click the column and then click Insert in the shortcut
menu.
3. With column E selected, on the Data tab, in the Data Tools
group, click Data Validation.
4. In the Data Validation dialog box, click Clear All. Click OK.
5. Click cell E4 and type Spayed/Neutered. Change the width
of column E to 17.
6. In column E, type S for the following row numbers: 6, 15, 19,
21, 22, 25, 34, 37, 46, 50, and 56.
© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 39
Step by Step: Sort Data Using Cell
Attributes
7. In column E, type N for row numbers 5, 7, 8, 9, 10, 13, 16, 17, 20, 24,
27, 30, 31, 32, 36, 40, 41, 43, 47, 48, 52, 54, and 57.
8. Select column E.
9. On the Data tab, in the Data Tools group, click Data Validation.
10. In the Data Validation dialog box, click the Settings tab. Under
Allow, choose List.
11. In the Source box, type N,S.
12. Click the Input Message tab. In the Input message box, type S =
Spayed, N = Neutered. Click OK.
13. Select the range E5:E100. Click the Home tab, and then in the
Styles group, click Conditional Formatting. Click New Rule.
14. In the New Formatting Rule dialog box, choose Format only
cells that contain in the Select a Rule Type list.
© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 40
Step by Step: Sort Data Using Cell
Attributes
15. In the list box, under Format only cells with, choose No
Blanks.
16. Click Format.
17. In the Format Cells dialog box, click the Fill tab. Choose the
sixth color swatch from the left in the third row. Click OK.
18. Click OK. Now both spayed and neutered animals should
appear shaded.
19. Select the range A4:F57. Name the range Patients.
20. in the Sort & Filter group, click Sort.
21. In the Sort dialog box, in the Sort by list, choose
Spayed/Neutered.
22. In the Sort On list, choose Cell Color.
© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 41
Step by Step: Sort Data Using Cell
Attributes
23. Click the down arrow next to No Cell Color. As the figure
below shows, the list box that appears shows only those
colors that are actually in use for conditional formatting—in
this case, only one swatch. Click the color swatch.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 42
Step by Step: Sort Data Using Cell
Attributes
24. Click OK. The sorted worksheet should now appear as shown
here. All the “N” and “S” animals are grouped together at the
top, with the two types
mingling among each
other. All the non-
operated-on animals
are bunched toward
the bottom.
• SAVE the
workbook and
LEAVE it open for
the next exercise.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 43
Filtering Data
• With any database, when you make a request or a query for
just the records that meet particular criteria, you expect to see
only the relevant data, and for irrelevant or non-matching
data to be filtered out.
• With Excel, you can formally specify the boundaries of your
database table—to say, “This part of my worksheet is to be
treated like a database”—and to then have Excel filter out just
those rows that don’t pertain to what you’re searching for.
• This does not change the database, and you don’t delete any
rows with a filter. You just hide them temporarily.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 44
Using AutoFilter
• An AutoFilter is the quickest means for you to set up a table
so that it displays only rows that meet simple criteria.
• Using AutoFilter to set up your search is fairly easy if the
criteria for your search involves information that is readily
assessable through a simple read of the existing data in the
cells.
• There are ways for you to set up more complex, advanced
filters that replicate data to a separate location (often a new
worksheet) using advanced criteria based on formulas.
• AutoFilter converts the headings row of your table into a set
of controls, which you then use to choose your criteria and
then select the data you want to see.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 45
Step by Step: Use AutoFilter
• USE the workbook from the previous exercise.
1. SAVE the current workbook as 09 Vet Clinic Patients
Solution 5.
2. Click the Client List worksheet tab. In the Name box, type
Clients and then press Enter. Excel highlights the data range
for the Clients table.
3. On the Data tab, in the Sort & Filter group, click Filter. Excel
adds down arrow buttons to the field names in all of the
columns in the list. Scroll up and click cell A5 to deselect the
range.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 46
Step by Step: Use AutoFilter
4. Click the down arrow
beside the Client #
heading in column A.
Excel displays the
AutoFilter menu shown
here.
5. To sort the table by client

number, click Sort


Smallest to Largest. This
gives you a shortcut for
sorting.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 47
Step by Step: Use AutoFilter
6. To show just the clients with addresses in Ohio, click the down
arrow beside State. In the AutoFilter menu that appears,
uncheck the
(Select All)
box to clear
all check
boxes and
then check
OH as shown
here. Click OK.
• SAVE
the workbook
and LEAVE it
open for the
next exercise.
© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 48
Step by Step: Use AutoFilter
• When an AutoFilter is active, Excel applies special notation to the AutoFilter
buttons and to the row numbers. As shown here, the button for the column
used in the sort now contains an up arrow, whereas the button for the
column used in the filter contains a funnel symbol.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 49
Creating a Custom AutoFilter
• A custom AutoFilter uses a rule that you create, instructing
Excel how to evaluate the entries in each row.
• The result determines whether rows are displayed or filtered
out.
• With a simple AutoFilter, Excel looks for contents based on
actual samples from the column.
• With a custom AutoFilter, you can devise a rule instructing the
worksheet to display only records whose values in one given
column are above or below a certain amount.
• The custom AutoFilter is among Excel’s most powerful tools.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 50
Step by Step: Create a Custom AutoFilter
• USE the workbook from the previous exercise.
1. Switch to the Patient List worksheet, and insert a new column
between the existing columns D and E.
2. Clear the validation rules from the new column E.
3. Add the title Hepatitis Inoculation to cell E4 and widen the
column as necessary to display the heading on two lines.
4. Type the following dates into the cells shown:

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 51
Step by Step: Create a Custom AutoFilter
5. Select the Patients data range. The range should
automatically include the new column.
6. On the Data tab, in the Sort & Filter group, click Filter.
7. Click the down arrow beside Hepatitis Inoculation. In the
menu, point to Date Filters and then click Custom Filter. The
Custom AutoFilter dialog box opens.
8. In the first list box just below Hepatitis Inoculation, choose is
before. In the box to the right, type 1/1/2016.
9. Click the Or button between the two rows of list boxes.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 52
Step by Step: Create a Custom AutoFilter
10. In the second list box below Or, choose equals. Leave the list
box blank (literally meaning “blank” or “nothing”). The dialog
box should now appear as shown below.
11. Click OK. After the dialog box disappears, Excel filters out all
entries in the patient list where the patient is known to have
had a hepatitis inoculation in 2016 or later. What remains are
both the animals known
to have been inoculated
in 2015 or earlier, or whose
inoculation dates are not
known.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 53
Step by Step: Create a Custom AutoFilter
12. Click the filter button beside Hepatitis Inoculation again. In the menu, point
to Date Filters and then click Custom Filter.
13. In the second list box that currently reads equals, choose the blank entry at
the top of the list. The box should now be empty.
14. Click OK. The list should now show only the five animals known to have
been inoculated in 2015 or earlier, as shown below.
15. Click the filter button beside Hepatitis Inoculation again. In the menu,
choose Clear Filter from “Hepatitis Inoculation”.
• SAVE the workbook and LEAVE it open for the next exercise.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 54
Filtering Data Using Cell Attributes
• When conditional formatting is applied to a column of cells,
that formatting is something that Excel can recognize when
filtering data.
• You can easily have a filter hide rows where cells in a column
don’t have a particular format, such as a shaded background
or a font color.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 55
Step by Step: Filter Data Using Cell
Attributes
• USE the workbook from the previous exercise.
1. In the Patient List worksheet, click the Spayed/Neutered
button down arrow.
2. In the menu, click Filter by Color.
3. In the popup menu, choose the pink swatch. Excel now
shows only those animals that have been spayed or neutered.
• SAVE the workbook and LEAVE it open for the next exercise.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 56
Outlining and Subtotaling Data
• Worksheets also serve as lists of values and their related
descriptions.
• Descriptive categories help subdivide data into groups.
• Excel can then collapse those groups into single-row
headings called outlines.
• Excel uses outlines to generate reports that provide you with
meaningful data about the items in each group collectively.
• The most important of these reports shows you subtotals for
the values that are grouped together.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 57
Grouping and Ungrouping Data
• The simplest form of data grouping involves taking a row of
cells that have one related attribute, clustering them together,
and then collapsing the cluster like a folder that can be
reopened later.
• This reduces the size of long reports to make them easier to
read.
• Grouping data is best reserved for final reports and not for
active databases where new data might be entered later.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 58
Grouping and Ungrouping Data
• Whenever you group rows together or perform an operation (such
as auto-outlining or auto-subtotaling) in which groups are
automatically created, Excel adds controls next to the row and
column headings. Excel calls these controls outline symbols.
• Boxes marked with minus and plus symbols are placed to the left of
grouped rows or above grouped columns.
• These symbols can collapse or expand the group’s contents.
• In the upper-left corner are number buttons that let you show or
hide all of the group contents for a particular level.
• When you have two groups that are beside each another, you have
two levels: the collapsed view and the expanded one. But you can
have groups within groups, and for each grouping level you create,
Excel adds another number to this bank of outline symbols.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 59
Step by Step: Group and Ungroup Data
• USE the workbook from the previous exercise.
1. SAVE the current workbook as 09 Vet Clinic Patients
Solution 6.
2. With the Patient List worksheet active, on the Data tab, in the
Sort & Filter group, click Clear.
3. Next to Cat or Dog?, click the down arrow button. In the
menu, click Sort A to Z. Now, all the cats are clustered
together at the top, and dogs at the bottom.
4. Right-click the heading for row 29, the row where the first
dog appears. Click Insert in the shortcut menu.
5. Select cell H29. Type Number of cats.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 60
Step by Step: Group and Ungroup Data
6. Select cell G29. Click the Home tab, and then in the Font
group, click the Bold button to emphasize the number that
will appear in this cell.
7. On the Home tab, in the Editing group, click the AutoSum
down arrow. In the menu, click Count Numbers and then
press Enter. Excel inserts a function into the cell that counts
the number of contiguous cells in the column just above it
that contains numbers—in this case, the owner numbers for
clients.
8. Add a similar COUNT function for counting the number of
dogs to row 59. (Be sure to count only rows for dogs.) Apply
Bold to cell G59 and type Number of dogs in cell H59.
9. Select rows 5 through 28 (all the cats).
© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 61
Step by Step: Group and Ungroup Data
10. Click the Data tab, and then in the Outline group, click
the Group button. A group indicator line is added to the
left of the row markers and an outline symbol displays
on the row just below the end of the group (see below).

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 62
Step by Step: Group and Ungroup Data
11. Repeat the process in Steps 9 and 10 for the dogs in rows 30
through 58.
12. To collapse the cats group, click the minus box (see below) beside
row 29, which contains the cats count. The control becomes a plus
box. When you click on it, it expands to show hidden rows.
13. Collapse the dogs group with the minus box in row 59. The
worksheet now appears fully collapsed.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 63
Step by Step: Group and Ungroup Data
14. Click the Select All button (refer to Figure 9-22). On the Data
tab, in the Outline group, click Show Detail (the icon with the
green + sign to the right of the Group icon).
15. Select columns B through F.
16. In the Outline group, click the Group button. A new column
group is created.
17. Click the minus box over column G to collapse the column
group. Click the plus box that takes its place to expand it.
18. Select columns B through G.
19. In the Outline group, click the Ungroup button. The
columnar group disappears.
• SAVE and CLOSE the workbook. LEAVE Excel open.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 64
Auto-Outlining Data
• For a complex report, such as a balance sheet with assets and
liabilities broken down into departments and sub-
departments, grouping data can be tedious.
• Suppose you inserted total value cells along the bottom rows
of related cells, or along the right column beside related cells
—or perhaps both.
• You probably need to do this anyway for a formal balance
sheet, or for a table with names of salespeople in rows and
sales for days of the week in columns.
• Excel can detect when and why you set up your worksheet like
this, so when you auto-outline a table or a worksheet full of
tables, it creates the groups automatically.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 65
Step by Step: Auto-Outline Data
• OPEN the 09 Critical Care Expenses workbook for this
lesson.
1. SAVE the workbook in the Excel Lesson 9 folder as 09
Critical Care Expenses Solution.
2. Select cell H14. On the Home tab, in the Font group, click the
Bold button. Then, in the Editing group, click the AutoSum
button and press Enter. The grand total appears as bold in
the cell.
3. Repeat the grand total process for cell H24 and apply Bold
to the cell.
4. Select the cell range B6:H24, covering both groups of
expenses in their entirety.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 66
Step by Step: Auto-Outline Data
5. Click the Data tab, and then in the Outline group, click the
down arrow next to Group. In the menu, click Auto Outline.
As shown in the figure on the next slide, Excel automatically
groups rows 8 through 13 and rows 18 through 23, having
spotted the Total Expenses row along the bottom of each
cluster. Excel also groups together the columns for March 20
through 24 in columns C through G, having spotted the
weekly totals column along the right.
• SAVE the workbook and LEAVE it open for the next exercise.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 67
Step by Step: Auto-Outline Data

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 68
Step by Step: Collapse Groups of Data in an
Outline
• USE the workbook from the previous exercise.
1. Click all three minus boxes to collapse their respective groups. The
worksheet should now appear shrunken to just the grand totals
cells you created with the appropriate labels (see below).
2. Click any of the plus boxes
(which replaced the minus boxes)
to expand the group to which
it’s attached.
3. To remove the outline entirely,
on the Data tab, in the Outline
group, click the Ungroup
button arrow. In the menu,
click Clear Outline.
• SAVE and CLOSE the workbook. LEAVE Excel open`.
© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 69
Subtotaling Data in Outlines
• Suppose a worksheet serves as a report of certain activity that
takes place on given days with respect to specific divisions of
the company in particular regions of the country.
• These three categories represent levels of information.
• When you sort a worksheet so that these levels are in a
precise order, Excel can accept each of these levels as tiers in
an outline.
• An outline gives you the complete summary while hiding the
details until you request them.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 70
Step by Step: Subtotal Data in Outlines
• OPEN the 09 Server Usage Stats workbook for this lesson.
1. SAVE the workbook in the Excel Lesson 9 folder as 09 Server
Usage Stats Solution.
2. Select the range A6:G141.
3. Click the Data tab, and then in the Sort & Filter group, click
Sort.
4. In the Sort dialog box, in the Sort by line, choose Date,
Oldest to Newest. Click OK.
5. On the Data tab, in the Outline group, click Subtotal. The
Subtotal dialog box appears.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 71
Step by Step: Subtotal Data in Outlines
6. In the At each change in list box, click Department.
7. If necessary, in the Use function list box, choose Sum.
8. In the list of columns marked Add
subtotal to, select the boxes for
Avg. Bandwidth, Data In, Data Out,
and Transactions.
9. Check the Summary below data and
Replace current subtotals check
boxes, if necessary. Compare your
dialog box settings to the one on
the right.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 72
Step by Step: Subtotal Data in Outlines
10. Click OK. Excel inserts subtotal rows for each company
division, grouping together data consumption values for all
three corporate regions. It places each of these division row
clusters into groups. It then creates a broader group for the
entire range and adds a grand total row at the bottom. The
result is a subtotal-endowed worksheet with a three-tier
outline (see the figure on the next slide).
• SAVE and CLOSE the workbook. LEAVE Excel open for the
next exercise.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 73
Step by Step: Subtotal Data in Outlines

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 74
Setting Up Data in a Table Format
• Excel has a special relevance for a class of data that it formally
calls a table.
• When you format a single, rectangular range with a row of
headers along the top, and columns of data beneath the
headers, converting that range to a table enables Excel to
treat it like a database.
• Processing a table’s data is faster, including for sorting. And
Excel can apply an elaborate quick format that makes the
table look sleek and professional.
• When you compose formulas, formal tables let you refer to
field names explicitly (for example, “Price” and “Markup”)
rather than by their cell reference (for example, B7 and D7).

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 75
Step by Step: Format a Table with a Quick
Style
• OPEN the 09 Pet Pharma Sales
workbook for this lesson.
1. SAVE the workbook in the Excel
Lesson 9 folder as 09 Pet
Pharma Sales August
Solution.
2. In the August Sales worksheet,
select the data range A6:K93.
3. On the Home tab, in the Styles
group, click Format as Table.
Excel brings up a colorful menu
full of sample layouts, as shown
in Figure 9-27.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 76
Step by Step: Format a Table with a Quick
Style
4. Click the sample in row 4, column 2 (Table Style Medium 2). The
Format As Table dialog box appears.
5. Because the cell reference under Where is the data for your table?
is accurate, don’t make any changes and then click OK. Excel
converts the data range into a formal table and applies the style
you chose, which includes automatically banded rows that maintain
their banding even when rows become sorted. AutoFilter controls
are also added to the field names row.
6. To automatically boldface the rightmost column in the table (Total
Sales), click any cell inside the table. On the Design tab, in the Table
Style Options group, click Last Column.
• SAVE the workbook and LEAVE it open for the next exercise.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 77
Step by Step: Remove Styles from a Table
• USE the workbook from the previous exercise.
1. SAVE the workbook in the Excel Lesson 9 folder as 09 Pet Pharma Sales
August Solution 2.
2. In the August Sales worksheet, click anywhere inside the table.
3. On the Design tab, in the Table Styles group, click the More down arrow
button. (Or if you see only the Quick Styles button, click that instead.)
4. In the menu, click Clear. The automatic formatting is removed.
5. To change the table style to something that contrasts against the others in
this series, click the More down arrow button again (or bring up the Quick
Styles menu), and this time, choose Table Style Light 17.
6. To automatically apply boldface to the rightmost column, in the Table Style
Options group, ensure Last Column is checked. To do the same for the
leftmost column, check First Column.
• SAVE the workbook and LEAVE it open for the next exercise.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 78
Defining a Title for a Table
• The one big difference between tables and ordinary data
ranges is that a table can be given a title, so that it and its
columns can be referred to by name instead of by reference
location.
• When you write formulas that refer to parts of the table, you
don’t have to know where they’re located, just what they’re
called.
• Once a table is given a title, all the names of its columns can
be used in place of cell references in a formula. So instead of
an absolute cell reference such as $B$2:$B$55, you can use a
reference such as Inventory[Sale Price].

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 79
Defining a Title for a Table
• Excel already knows not to treat the first row as values, and
whenever records are added to the table, the results of the
formula are adjusted without the formula itself even having to
change.
• The syntax of a reference to fields in an Excel table is as
follows:
TableName[FieldName]

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 80
Defining a Title for a Table
• Excel recognizes four constants that refer to the same general
area of a table, which you may use here when applicable to
replace the field name:

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 81
Defining a Title for a Table
• When you type a table-style reference inside a formula, Excel
gives you a shortcut.
• After you begin typing the table or field name, Excel displays a
list of names you can add to the formula (including named
ranges), as shown in this figure
• Instead of typing in the rest
of the name, you can use the
arrow keys on the keyboard
to navigate this menu until
the name you want is highlighted and then press Tab.
• The entire name is entered into the formula.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 82
Defining a Title for a Table
• With the table name entered, when it’s time to refer to a field
name in the table, you can start with the left square bracket ( [
). Excel displays a list of all the field names already in the table.
You use the arrow keys to highlight the one you’re looking for
and then press Tab. Then type the right square bracket ( ] ) to
complete the reference.
• Similarly, whenever you want to use one of the four constants
(#All, #Data, #Headers, or #Totals), you start with the pound
sign #. Excel displays the list, and then you highlight the one
you want and press Tab.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 83
Step by Step: Define a Title for a Table
• USE the workbook from the previous exercise.
1. SAVE the workbook in the Excel Lesson 9 folder as 09 Pet Pharma
Sales August Solution 3.
2. In the August Sales worksheet, click anywhere inside the table.
3. On the Design tab, in the Properties group, click the text box under
Table Name.
4. Type DrugSales (all one word) and press Enter. You have given a
name to the table. Now you can replace the strange-looking
formulas at the bottom of the August Sales worksheet with
formulas that are easier to read, yet yield the same results.
5. Select cell D97 (Total Sales).
6. Type =sum(Dr
7. When DrugSales appears in the list, press Tab.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 84
Step by Step: Define a Title for a Table
8. Type [ (left square bracket).
9. Use the arrow keys to select Total Sales from the list and
then press Tab.
10. Type ] (right square bracket), followed by ) (right parenthesis)
and Enter. If you enter the formula properly, the result
should be identical to what was there before.
11. Replace the formula in cell D98 with the following:
=SUMIF(DrugSales[To treat],”Dog”,DrugSales[Total
Sales])
12. Replace the formula in cell D99 with one based on the
formula in D98, but searching for Cat instead of Dog.
• SAVE the workbook and LEAVE it open for the next exercise.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 85
Step by Step: Use the Total Row Command
in a Table
• USE the workbook from the previous exercise.
1. Select any cell in the table. Excel adds the Design tab to the
ribbon.
2. With the August Sales worksheet active, on the Design tab, in
the Table Style Options group, select the Total Row box.
Excel adds a total row to the bottom with a label in the
leftmost column and the grand total in the rightmost column.
Widen the Total Sales column to display the data, if
necessary.
3. To add other subtotals or formulas to the Total Row, you can
choose one from a drop-down menu. Click the cell in the
total row at the bottom of the Item Price column.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 86
Step by Step: Use the Total Row Command
in a Table
4. Click the down arrow that appears
to the right of the blank cell. In the
popup menu (see right), click
Average. Excel calculates the
average price per sales item.
5. Repeat the process to find the
maximum number of items sold in
one order by choosing the Max
function for the No. Sold column.
• SAVE the workbook and LEAVE it
open for the next exercise.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 87
Adding and Removing Rows or Columns in
a Table
• With a formal table, the range for the table stays named
properly, and when you insert rows (as well as delete them)
the named range covered by the table is adjusted to fit
automatically.
• Therefore, any formulas you use inside each of the rows in the
table are copied and adjusted to the new rows you add.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 88
Step by Step: Add and Remove Rows and
Columns in a Table
• USE the workbook from the previous exercise.
1. SAVE the workbook in the Excel Lesson 9 folder as 09 Pet
Pharma Sales August Solution 4.
2. In the August Sales worksheet, select cell A88 (in the Drug
column).
3. On the Home tab, in the Cells group, click the Insert down
arrow. In the menu, click Insert Table Rows Above.
4. Type the following values into cells A88:F88:

5. Note that the value in the Items on Hand column is


automatically updated, because Excel copied the formula into
the new row.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 89
Step by Step: Add and Remove Rows and
Columns in a Table
6. Select cell H88 (in the Items Remaining column) and type the value
41. Cell I88 is updated.
7. Select cell J88 (in the Item Price column) and type the value 25.95.
Cell K88 is updated.
8. Select any cell in row 32.
9. On the Home tab, in the Cells group, click the Delete down arrow.
In the menu, click Delete Table Rows. Row 32 is deleted, and the
table shrinks to fit.
10. Select any cell in column I (No. Sold).
11. On the Home tab, in the Cells group, click the Delete down arrow
and then click Delete Table Columns. Column I is removed, and
for the time being, #REF! errors are generated throughout the Total
Sales column, which contain formulas that referred to No. Sold.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 90
Step by Step: Add and Remove Rows and
Columns in a Table
12. With a cell in column I still selected, click the down arrow next to Insert in
the Cells group, and in the menu, click Insert Table Columns to the Left.
13. Change the header in cell I6 to read No. Sold.
14. Click cell I7 and enter the formula =[Items on Hand]-[Items Remaining].
Use the menus that display when you type each left bracket [ to expedite
your entry. Notice when you press Enter that Excel automatically copies
the formula down the remainder of the column. You normally don’t have to
do this manually for a table.
15. Click cell K7 and enter the formula =[No. Sold]*[Item Price]. This time
when you press Enter, Excel does not fill the formula down the column,
because it will not autofill over nonblank cells.
16. Fill the new Total Sales formula down to row 93, making sure to stop short
of the total row. The grand total formula in cell K94 is now fixed.
17. Click cell L7, outside the table.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 91
Step by Step: Add and Remove Rows and
Columns in a Table
18. Enter the formula =[Total Sales]/AVERAGE([Total Sales]). Notice
that you don’t see menus display this time, because the active cell
is not inside the table. After you press Enter, Excel not only creates
the formula but extends the table one column to the right, and
copies the formula down the entire column L. For now, Excel gives
the new column the temporary name Column1 (see below).

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 92
Step by Step: Add and Remove Rows and
Columns in a Table
19. Rename the new column % of Avg.
20. Select cell range L7:L93 and give the range a percent style.
Excel does not automatically copy custom cell styles down a
column, so you must select the range manually first. Note
how Excel has moved the last table column’s boldfaced
format from Total Sales to % of Avg.
21. Click any cell in % of Avg. and then click the down arrow
next to Delete. Click Delete Table Columns. As the
appended column disappears, the boldfacing is returned to
the Total Sales column.
• SAVE the workbook and LEAVE it open for the next exercise.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 93
Step by Step: Filter Records in a Table
• USE the workbook from the previous exercise.
1. In the August Sales worksheet, click the Total Sales down
arrow.
2. In the menu, point to Number Filters and then click Top 10.
The Top 10 AutoFilter dialog box appears.
3. Leave the choices set at Top 10 items and then click OK. The
table is filtered down to the 10 items with the highest sales,
as shown in the figure on the next slide.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 94
Step by Step: Filter Records in a Table

• SAVE and CLOSE the workbook and LEAVE Excel open for the
next exercise.
© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 95
Step by Step: Sort Data on Multiple
Columns in a Table
• RE-OPEN the 09 Owners Solution workbook from earlier in
this lesson.
1. SAVE the workbook in the Excel Lesson 9 folder as 09
Owners Solution 2.
2. Select the range A1:G73.
3. On the Home tab, in the Styles group, click Format as Table.
In the menu, click Table Style Medium 14.
4. In the Format As Table dialog box, click OK.
5. Because this range contains data appended from an outside
source (see the “Appending Data to a Worksheet” section
earlier in this lesson), the query data related to that outside
source is still attached to the range. Click Yes in the dialog
box to have Excel remove those connections.
© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 96
Step by Step: Sort Data on Multiple
Columns in a Table
6. With the table still selected, click in the Name box and rename the
table Owners.
7. Change the font for the entire table to Cambria, 11 pt. Resize
columns as necessary to fit the data.
8. Left-justify column G.
9. With any cell in the Owners table selected, click the Data tab, and
then in the Sort & Filter group, click Sort. The Sort dialog box
appears.
10. In the Sort by list box under Column, choose Last Name.
11. Click Add Level.
12. In the Then by list box that appears under Column, choose First
Name. Click OK.
• SAVE the workbook and LEAVE it open for the next exercise.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 97
Step by Step: Change Sort Order in a Table
• Once you set the sort order for a table, you can change it in two
ways. First, any sorting choice you make with the AutoFilter buttons
overrides the current sort order. Second, in the Sort dialog box,
delete the existing order and enter a new one.
• USE the workbook from the previous exercise.
1. With the active cell in the Owners table, on the Data tab, in the Sort
& Filter group, click Sort.
2. In the Sort dialog box, click Delete Level and then click Delete
Level again, to remove the existing sort order.
3. Click Add Level.
4. In the Sort by list box that appears, click ZIP. Click OK.
• SAVE the workbook and LEAVE it open for the next exercise.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 98
Step by Step: Remove Duplicates in a Table
• USE the workbook from the previous exercise.
1. Click any cell inside the table.
2. On the Design tab, in the Tools group, click Remove Duplicates.
3. The Remove Duplicates dialog box lets you determine how much of
a record needs to be duplicated before it qualifies as a duplicate.
For instance, two or more customers might have the same name,
though they probably don’t share the same address or phone
number. In the Columns list, uncheck City, State, and ZIP.
4. Click OK. Excel shows a dialog box reporting how many duplicate
entries were removed. Click OK to dismiss.
• SAVE and CLOSE the workbook and LEAVE Excel open for the next
exercise.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 99
Using a Slicer to View Table Data
• There are two ways to filter a table so that it shows only a specified
subset of records. One way is through the AutoFilter.
• Another feature makes the table more easily accessible to a novice
user. It’s called the slicer, and it’s a selection panel that floats above
a worksheet (the way a chart does).
• This panel includes buttons labeled with each of the contents of one
of the columns in the table.
• When you click a button, the table is filtered to show only rows that
match the selection.
• When designing the worksheet, each slicer is like a window with a
title bar.
• You can relocate a slicer by dragging it by its title bar. Each slicer
also has white handles along its edges, which you drag to resize the
slicer in the direction you’re dragging.
© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 100
Step by Step: Use a Slicer to View Table
Data
• RE-OPEN the 09 Pet Pharma Sales August Solution 4
workbook for this lesson.
1. SAVE the workbook in the Excel Lesson 9 folder as 09 Pet
Pharma Sales August Solution 5.
2. Click any cell inside the table. Click the Data tab, and then in
the Sort & Filter group, click Clear.
3. Click the Design tab, and then in the Tools group, click the
Insert Slicer button.
4. The Insert Slicers dialog box contains empty check boxes for
each of the fields for which you can create buttons. Click For
use on and To treat.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 101
Step by Step: Use a Slicer to View Table
Data
5. Click OK. The two slicer tools appear as graphic objects in the
center of the worksheet. They’re not actually inside the table.
6. Relocate the For use on slicer by dragging its title bar toward
the upper right of the worksheet. As you drag toward the
edge of the window, the worksheet automatically scrolls to
reveal space where you can drop the slicer. Drop the slicer
when it’s to the right of the table, just beneath the headers
row.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 102
Step by Step: Use a Slicer to View Table
Data
8. Repeat the process with
the To treat slicer,
dragging it below the
For use on slicer (see
figure at right). To see
just the treatments that
apply to dogs only, click
Dog on the To treat
slicer. Note that the
AutoFilter button for the
To treat column shows a
filter has been applied.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 103
Step by Step: Use a Slicer to View Table
Data
9. To show just the treatments that apply to the endocrine
system, click Endocrine on the For use on slicer. Note that
the filters from both slicers apply simultaneously, so you
should see endocrine system treatments for dogs only. The
slicer highlights only the criterion in use for the current filter.
10. To clear the filters using the slicers, click the Clear Filter
button in the upper-right corner of each slicer.
• SAVE and CLOSE the workbook and LEAVE Excel open for the
next exercise.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 104
Converting a Table into a Range
• To append more data to a table from an outside source, it
might be convenient for you to remove the “table-ness” from
the table, and reapply it once the new data is imported and
the data is cleaned up.
• Before you export a workbook file to a new format, you might
need to convert tables to ranges, because Excel treats data
stored in tables differently than data stored in ordinary
worksheets.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 105
Step by Step: Convert a Table to a Range
• RE-OPEN the 09 Customers Solution workbook for this lesson.
1. Near the top of the Excel window, if necessary, respond to the
security warning by clicking Enable Content.
2. SAVE the workbook in the Excel Lesson 9 folder as 09 Customers
Solution 2.
3. Click any cell inside the table.
4. On the Design tab, in the Tools group, click Convert to Range.
5. Excel opens a dialog box to verify this conversion is what you want.
Click OK. The AutoFilter buttons are removed from the header row
and entries are sorted as they were. Subtotals and total rows
remain (if applicable), and formatting is left as it was. The Design
tab is no longer displayed.
• SAVE and CLOSE the workbook and LEAVE Excel open.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 106
Saving Work with Macros
• A basic macro is a recording of a sequence of commands and
typed entries that you can then replay elsewhere in the
worksheet.
• Macros can be replayed on whatever cell is the active cell.
• A recorded macro is a series of steps that can be repeated
and that you might want to repeat frequently to save time.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 107
Step by Step: Record a Basic Macro
• OPEN the 09 4Strong Tour Revenues workbook for this lesson.
1. Click the File tab and then click Options.
2. In the Excel Options dialog box, click Customize Ribbon.
3. In the Main Tabs list on the right, check the Developer box if it is not
already checked. This adds the Developer tab to the Excel ribbon, enabling
you to more easily record macros. Click OK.
4. The macro that you record creates a custom subtotal row at the place you
define, rather than at some place Excel determines. The rule you follow is
that the user (you) must select the cell where you want the subtotal to
appear and then run the macro. So to prepare for recording, click cell D21.
5. Clock the Developer tab, and then in the Code group, find Use Relative
References. If it is not highlighted, click to select it. You want relative
references for this macro.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 108
Step by Step: Record a Basic Macro
6. In the Code group, click Record Macro.
7. In the Record Macro dialog box, click the Macro name box
and then type CustomSubtotals.
8. In the Shortcut key box beside Ctrl +, type the capital S. This
changes the shortcut key to Ctrl+Shift+S. Leave Store macro
in set to This Workbook.
The Record Macro dialog box
should now appear as shown
here.
9. Click OK. You are now
recording a macro.
10. Press Shift+Down Arrow.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 109
Step by Step: Record a Basic Macro
11. Click the Home tab, and then in the Cells group, click the
Insert arrow. In the menu, click Insert Sheet Rows.
12. Press Shift+Up Arrow.
13. In the Editing group, click AutoSum. Do not press Enter yet.
14. In the Clipboard group, click Copy.
15. Press Tab.
16. Type the partial formula =max(
17. In the Clipboard group, click Paste.
18. Type ) (end parenthesis) and press Tab.
19. Press Left Arrow.
20. Click $ (Accounting Number Format) in the Number group.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 110
Step by Step: Record a Basic Macro
21. Click the Developer tab, and
then in the Code group, click
Stop Recording.
22. Now that you’re not recording,
adjust the width of column E to
fit its contents. As Figure 9-34
shows, the macro generates a
total for the bottom of the
arbitrary cluster of records, and
also tabulates the highest value
in that cluster in the cell
adjacent to the subtotal.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 111
Step by Step: Record a Basic Macro
23. Click the File tab and then click Save As.
24. In Backstage, locate and select the Excel Lesson 9 folder.
25. In the Save As dialog box, under Save as type, choose Excel Macro-
Enabled Workbook (*.xlsm). Save the workbook as 09 4Strong Tour
Revenues Solution.xlsm. Click OK if you see a message box displayed
after you save the file.
• SAVE the workbook and LEAVE it open for the next exercise.
• For security reasons, Excel no longer saves macros in its regular .XLS
and .XLSX file formats.
• The only way to save a macro-enabled workbook is to give it the
special .XLSM file type.
• This way, companies that want to avoid any possibility of spreading malware
can enforce policies preventing .XLSM files from being attached to or
received within e-mails.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 112
Managing Macro Security
• Because of the proliferation of malicious software, you cannot
execute macros from a file you open until you read the
notification and then click Enable Content.
• If you never plan to run macros or if you’re skeptical about
your office colleagues, you can turn off macros completely.
• You can also turn off the notifications and enable all macros, if
you:
• Work in an office where macros are in use constantly
• You trust the source of the Excel workbooks

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 113
Step by Step: Manage Macro Security
• USE the workbook from the previous exercise.
1. On the Developer tab, in the Code group, click Macro
Security.
2. In the Trust Center dialog box, click Disable all macros with
notification to have Excel warn you whenever an opened
workbook contains macros, enabling you to turn those
macros on or off based on your decision.
3. Click OK.
• CLOSE the workbook. CLOSE Excel.

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 114
Skill Summary

© 2016, John Wiley & Sons, Inc. Microsoft Official Academic Course, Microsoft Excel Core 2016 115

You might also like