0% found this document useful (0 votes)
87 views224 pages

EXC365.3 1.1.1 Advanced Microsoft Excel 365 Training - Sample

Uploaded by

Niladri Sen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
87 views224 pages

EXC365.3 1.1.1 Advanced Microsoft Excel 365 Training - Sample

Uploaded by

Niladri Sen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 224

Advanced Microsoft

Excel 365 Training

with examples and


hands-on exercises

WEBUCATOR
Copyright © 2024 by Webucator. All rights reserved.

No part of this manual may be reproduced or used in any manner without written permission of the
copyright owner.

Version: 1.1.1

The Authors

Tracy Berry

Tracy has been a senior graphic designer/programmer, instructor, and consultant since 1993 and has
developed hundreds of logos, marketing materials, websites, and multimedia solutions for customers
worldwide, including involvement in large corporate software rollouts. She has helped many organizations
optimize and streamline data solutions. She teaches both onsite and online courses and has her CTT
(Certified Technical Trainer) certification. Tracy specializes in teaching graphics, desktop publishing,
web design, reporting/productivity applications, as well as the creation of online courses with software
from leading vendors.

Dave Dunn

Dave Dunn was the CEO of Webucator for over 10 years and is now on Webucator's board. He initially
joined Webucator in 2009 after serving as a CFO and COO for numerous small and medium-sized
companies, including Summit Software Company, Insight Research Group, Avalon Consulting, and
HealthcareOne. Dave received his Bachelor of Arts from Hamilton College and his MBA from Syracuse
University. He has served as Chairman of the Board of the Montessori School of Syracuse since 2001.

Nat Dunn (Editor)

Nat Dunn is the founder of Webucator (www.webucator.com), a company that has provided training
for tens of thousands of students from thousands of organizations. Nat started the company in 2003
to combine his passion for technical training with his business expertise, and to help companies benefit
from both. His previous experience was in sales, business and technical training, and management. Nat
has an MBA from Harvard Business School and a BA in International Relations from Pomona College.

Follow Nat on Twitter at @natdunn and Webucator at @webucator.

Margaux Judge (Editor)

Margaux Judge has worked as an e-learning editor and instructional designer for over ten years, writing
and editing a wide variety of courses, from technical topics to soft skills. She has a Bachelor's degree
in English and Textual Studies from Syracuse University and a Master's degree in Television Writing
from Boston University.

Class Files

Download the class files used in this manual at


https://static.webucator.com/media/public/materials/classfiles/EXC365.3-1.1.1-advanced-microsoft-excel-365-training.zip.
Errata

Corrections to errors in the manual can be found at https://www.webucator.com/books/errata/.


Table of Contents
LESSON 1. Using PivotTables.........................................................................................................1
How PivotTables Work..............................................................................................................2
Timeline Filters.......................................................................................................................21
Inserting Slicers......................................................................................................................23
Grouping Data........................................................................................................................31
Calculated Fields.....................................................................................................................34
PivotCharts.............................................................................................................................36
Exercise 1: Working with PivotTables...........................................................................41
LESSON 2. Advanced Functions....................................................................................................47
Function Syntax......................................................................................................................47
ROWS, COLUMNS, INDEX, and XMATCH.................................................................................50
Arrays and Array Formulas.....................................................................................................53
Exercise 2: Getting Unique Values...............................................................................60
SORT, FILTER, and SORTBY......................................................................................................62
Lookup Functions...................................................................................................................67
Exercise 3: Using the XLOOKUP Function.....................................................................72
The LET Function....................................................................................................................75
The TRANSPOSE Function.......................................................................................................78
LESSON 3. Auditing Workbooks...................................................................................................81
Inspecting a Workbook...........................................................................................................82
Tracing Precedents and Dependents......................................................................................90
Exercise 4: Tracing Precedents and Dependents Practice.............................................96
Watch Window.....................................................................................................................101
Evaluating Formulas.............................................................................................................104
Error Checking......................................................................................................................109

Table of Contents | i
LESSON 4. Data Tools................................................................................................................113
Importing Data from Online Source.....................................................................................113
Converting Text to Columns.................................................................................................114
Exercise 5: Converting Text to Columns......................................................................119
Importing Files......................................................................................................................121
Exercise 6: Importing Text Files..................................................................................128
Linking to External Data........................................................................................................130
Controlling Calculation Options............................................................................................132
Data Validation.....................................................................................................................134
Exercise 7: Using Data Validation...............................................................................140
Consolidating Data...............................................................................................................148
Exercise 8: Consolidating Data...................................................................................150
What-If Analysis....................................................................................................................155
Exercise 9: Using Goal Seek.......................................................................................160
LESSON 5. Recording and Using Macros....................................................................................165
Recording Macros.................................................................................................................165
Exercise 10: Recording a Macro.................................................................................171
Running Macros....................................................................................................................180
Editing Macros......................................................................................................................181
Adding Macros to the Quick Access Toolbar........................................................................184
Exercise 11: Adding a Macro to the Quick Access Toolbar..........................................191
LESSON 6. Working with Others................................................................................................195
Comments and Notes...........................................................................................................195
Protecting Worksheets and Workbooks...............................................................................200
Exercise 12: Password Protecting a Workbook...........................................................208
Marking a Workbook as Final...............................................................................................215
Other Sharing Concerns.......................................................................................................217

ii | Table of Contents
LESSON 1
Using PivotTables
EVALUATION COPY: Not to be used in class.

Topics Covered

Analyzing data with PivotTables.

Editing PivotTables.

Formatting PivotTables.

Inserting PivotCharts.

Using Slicers.

Introduction
A PivotTable is an interactive table that can be used to analyze, organize, and summarize large amounts
of data. PivotTables make it easy to rearrange data, quickly displaying it in different ways.

Examine the following data:

And consider the following questions:

1. What is the average house price in each town?


2. How many houses are for sale in each town?
3. How many houses of each color are there in the different towns?
4. How many houses of each color are there in total?

LESSON 1: Using PivotTables | 1


EVALUATION COPY: Not to be used in class.
5. How many houses are there with three or more bathrooms?

In this lesson, we will explore how PivotTables can help us quickly answer these and similar questions.

IMPORTANT

This lesson contains a lot of follow-along demos using the PivotTables.xlsx workbook from
the excel365-pivottables/Demos folder. You should follow along with all of the demos and
save your work as you go, as it’s important that your workbook stays up to date with the demos.

EVALUATION COPY: Not to be used in class.

1.1. How PivotTables Work


PivotTables are incredibly powerful, but they can be a little overwhelming to learn. In this section, we
are going to create a PivotTable in little steps, so that you get a good understanding of all the different
moving parts.

1.1.1. Preparing Your Data


Before inserting a PivotTable, make sure the data you want to analyze is organized correctly:

1. It should have a header row. Make sure your data includes a header row because the top row
of your table will serve as the field names in your PivotTable.
2. It should not have any empty rows or columns. If your data includes empty rows or columns,
Excel will not treat all your data as one table.
3. It should not have any subtotals. Remove all subtotals before creating your PivotTable.

1.1.2. Inserting a PivotTable


Let’s get right to it and insert a PivotTable:

1. Open PivotTables.xlsx from the excel365-pivottables/Demos folder. This contains


data on houses for sale in six communities.

2 | LESSON 1: Using PivotTables


EVALUATION COPY: Not to be used in class.
2. Select any cell in the data list.
3. On the Insert tab, in the Tables group, click the PivotTable command:

4. In the PivotTable from table or range dialog:

A. Verify that Excel has selected the correct range in the Table/Range field. You will
also see a dashed green border around the data Excel selected.
B. Select where you want the PivotTable to show up (you will almost always want to
select New Worksheet).
C. Click OK.
This will open a new worksheet with the tools to create a PivotTable from our data:

LESSON 1: Using PivotTables | 3


EVALUATION COPY: Not to be used in class.
Let’s take a look at the PivotTable Fields pane that opens to the right of the worksheet. To make it
easier to see the complete list of fields, select Fields Section and Areas Section Side-By-Side from the
gear icon on the upper right of the pane:

The pane should now look like this:

4 | LESSON 1: Using PivotTables


EVALUATION COPY: Not to be used in class.
Showing the PivotTable Fields Pane

If you’re PivotTable Fields pane doesn’t show up when you need it, it’s probably been hidden.
To re-show it, click the Field List button in the Show group of the PivotTable Analyze tool
tab:

LESSON 1: Using PivotTables | 5


EVALUATION COPY: Not to be used in class.
Now, let’s take a step back and remind ourselves why we’re creating a PivotTable in the first place.
We’re hoping it will help us answer some questions we asked in the beginning of this lesson:

1. What is the average house price in each town?


2. How many houses are for sale in each town?
3. How many houses of each color are there in the different towns?
4. How many houses of each color are there in total?
5. How many houses are there with three or more bathrooms?

To answer those questions, we need data from the following fields:

1. Town
2. Listing Price
3. House Color
4. Bathrooms

Let’s start by just checking Town and Listing Price in the PivotTable Fields pane. That creates the
following PivotTable, which shows the sum of the values in the Listing Price field:

This isn’t what we want (we want the averages), but it was pretty clever of Excel to figure out that we
wanted to do a calculation here. It has recognized from the data that Town is a category into which
the Listing Price data fits, and it determined that we want to aggregate that Listing Price data in some
way. Notice that Town was put in the Rows section and Sum of Listing Price was put in the Values
section:

6 | LESSON 1: Using PivotTables


EVALUATION COPY: Not to be used in class.
By default, it will always sum numeric data. Let’s change that:

1. Click the drop-down arrow to the right of Sum of Listing Price and select Value Field
Settings…:

2. The Value Field Settings dialog will open:

LESSON 1: Using PivotTables | 7


EVALUATION COPY: Not to be used in class.
A. Select Average under Summarize value field by.
B. The Custom Name will change to Average of Listing Price. You can modify
that name if you like.
C. Before applying the change, let’s format the average listing prices as currencies:
i. Click the Number Format button.
ii. In the Format Cells dialog, select Currency for the Category, enter 0 for
the Decimal places, and click OK.

8 | LESSON 1: Using PivotTables


EVALUATION COPY: Not to be used in class.
D. Click OK in the Value Field Settings dialog to apply the changes.

And now we have a PivotTable that answers our first question: What is the average house price in each
town?

It also gives us a bonus: the Grand Total, which is the average house price in all the towns.

LESSON 1: Using PivotTables | 9


EVALUATION COPY: Not to be used in class.
Let’s now tackle the second question: How many houses are for sale in each town? To do this, we need
to count the number of houses. We will use the COUNT function for this, and we could use it with any
of the fields as each column in our data has the same number of rows; however, it seems most intuitive
to use the House field. After all, we are counting houses.

If you check the checkbox next to the House field, House will get added to the Rows area, which is
not what we want. We could always drag it from the Rows area to the Values area, but let’s save a step
and drag House directly from the fields list to the Values area:

Notice the green line that shows up when the field is droppable.

Because House values are text, Excel default to using the COUNT function, giving us exactly what we
want: the number of houses per town:

10 | LESSON 1: Using PivotTables


EVALUATION COPY: Not to be used in class.
What if the Data Changes?
PivotTables don’t automatically refresh (i.e., update) when the source data changes. Instead, you have
to manually update them by right-clicking anywhere in the PivotTable and selecting Refresh:

To see how this works:

1. Switch to the Data tab and change cell B5 from “Dewitt” to “Cicero”.
2. Switch back to the Sheet1 tab. Notice that it still says that there are 22 houses in Cicero and
22 houses in Dewitt.
3. Right-click anywhere in the PivotTable and select Refresh.
4. It should now indicate that there are 23 houses in Cicero and 21 houses in Dewitt.

By default, PivotTables don’t even automatically refresh when you close and re-open a workbook;
however, you can change that by doing the following:

1. In the PivotTable group on the PivotTable Analyze tool tab, click Options:

2. Check Refresh data when opening the file on the Data tab and click OK:

LESSON 1: Using PivotTables | 11


EVALUATION COPY: Not to be used in class.
Adding Rows
Let’s get to our next question: How many houses of each color are there in the different towns?

All we need to do to get that answer is check the House Color checkbox in the PivotTable fields. Excel
recognizes that this is a text field and treats it (correctly) as a subcategory of Town, so it adds new rows
for the colors:

12 | LESSON 1: Using PivotTables


EVALUATION COPY: Not to be used in class.
We can now see that of the 22 houses in Camillus, 9 of them are blue, 3 are brown, 4 are green, 1 is
red, 4 are white, and 1 is yellow.

Next question: How many houses of each color are there in total? Notice that House Color is currently
a subcategory of Town. This allows us to see how many total houses and how many of each color are
for sale in each town:

To change this so that Town is a subcategory of House Color, we change the order of the Rows using
drag and drop:

LESSON 1: Using PivotTables | 13


EVALUATION COPY: Not to be used in class.
We now see Town as a subcategory of House Color and can see how many houses there are of each
color in total:

Removing Fields from a PivotTable

There are several ways to remove a field from a PivotTable:

1. Uncheck the field in the Field List.


2. Click the drop-down arrow next to the field and select Remove Field:

3. Drag the field out of its area and into the Field List:

14 | LESSON 1: Using PivotTables


EVALUATION COPY: Not to be used in class.
Standard Filters
You can filter and sort PivotTables in the same way that you filter and sort regular Excel tables, using
the Filter button next the Row Labels heading. For example, to just show houses from Manlius and
Fayetteville, you can filter by town:

1. Click the Filter button next the Row Labels heading.


2. Select Town from the Select field dropdown.
3. Check just Fayetteville and Manlius in the list of towns.
4. Click OK.

The PivotTable should appear as follows:

LESSON 1: Using PivotTables | 15


EVALUATION COPY: Not to be used in class.
Before moving on, remove the filter by clicking the Filter button again, selecting Town from the Select
field dropdown, checking Select All in the list of towns, and clicking OK.

PivotTable Filters
PivotTables provide another way of filtering, which brings us to our final question: How many houses
are there with three or more bathrooms?

To answer this question, create a Bathrooms filter by dragging Bathrooms from the PivotTable Fields
to the Filters area:

16 | LESSON 1: Using PivotTables


EVALUATION COPY: Not to be used in class.
A Bathrooms filter will now appear above the PivotTable. We can use that to just show houses with
3 or 4 bathrooms:

1. Click the drop-down arrow to the right of the Bathrooms filter.


2. Check the Select Multiple Items checkbox.
3. Uncheck 1 and 2.
4. Click OK to apply the filter.

LESSON 1: Using PivotTables | 17


EVALUATION COPY: Not to be used in class.
This will apply the filter, so that the numbers shown are only for houses that have 3 or 4 bathrooms,
but it is a little busy with the house colors all separated out. Remove House Color by unchecking it
in the PivotTables Fields area. That leaves the PivotTable looking like this, making it easy to see how
many houses there are with three or more bathrooms:

We encourage you to play around some more. PivotTables can be incredibly helpful, but they can also
get messy. It takes some practice to figure out which features to use when.

1.1.3. What if the Data Range Changes?


As we have already discussed, PivotTables will not automatically update when the source data changes.
Further, if the actual range of the source data changes, the PivotTable won’t know about the added or
removed data, even after a refresh. To illustrate:

1. Switch to the Data tab of PivotTables.xlsx.


2. Select cells A133:J133.
3. Using the Fill Handle, drag to add a new row:

4. Change the data in new row as follows:


A. House: House133
B. Town: Cicero
C. Listing Price: $150,000
D. Square Feet: 2,000

18 | LESSON 1: Using PivotTables


EVALUATION COPY: Not to be used in class.
E. Price per SFT: Leave to formula.
F. Bedrooms: 3
G. Bathrooms: 3
H. House Color: Blue
I. Year Built: 2000
J. Date Listed: 10/11/2023

5. Save and return to Sheet1.


6. Notice the average listing price in Cicero. If you still have the Bathrooms filter set to show
just houses with 3 or 4 bathrooms, the price will be $170,982. If it’s something different,
that’s fine. Just note the value.
7. Right-click the PivotTable and choose Refresh.
8. Notice that the average listing price in Cicero did not change to reflect the new data.

Now that you understand the problem, let’s discuss how we deal with it. There are a couple of different
ways:

1. Change the data source of the PivotTable when the range changes.
2. Make the data source a table.

Changing the PivotTable Data Source


To change the data source:

1. Make a note of the average listing price in Cicero.


2. Select a cell within the PivotTable.
3. In the Data group on the PivotTable Analyze tab, select Change Data Source > Change
Data Source…:

LESSON 1: Using PivotTables | 19


EVALUATION COPY: Not to be used in class.
4. You will be switched to the Data sheet, the Change PivotTable Data Source dialog will
open, and the current data source will be pre-selected and have a green dashed outline:

Notice that the new row you just inserted is not included in the current data source.
5. Change the data source to include the new row either by changing it to Data!$A$1:$J$134
in the Table/Range field or by selecting the whole data range with your mouse.
6. Click OK.
7. Compare the average listing price in Cicero to the value it was before. It should have updated.

Making the Data Source a Table


The downside of the method we just showed you is that you have to go through those steps each time
the size of the source data changes. An easier way is to make the source data a table. The PivotTable
will then stay in sync with the table as it grows or shrinks. You will still need to refresh it, but you
won’t need to update the data source. Let’s give it a try:

1. Switch to the Data tab.


2. Select the whole range of data by pressing Ctrl + A.
3. On the Home tab in the Styles group, select Format as Table and choose any style you like.
4. The Create Table dialog will open. Click OK.
5. On the Table Design tool tab in the Properties group, change the Table Name to Houses:

20 | LESSON 1: Using PivotTables


EVALUATION COPY: Not to be used in class.
6. Return to Sheet1.
7. In the Data group on the PivotTable Analyze tab, select Change Data Source > Change
Data Source…
8. You will be switched to the Data sheet. In the Change PivotTable Data Source dialog,
change the value of the Table/Range field to Houses:

Click OK.
9. Switch to the Data tab again.
10. Delete the last row of the table, which you just added.
11. Switch to the Sheet1 tab.
12. Right-click anywhere on the PivotTable and select Refresh. Notice the data updates.

The takeaway here is that PivotTables will be easier to maintain if you use a table (rather than a range)
as the source data.

EVALUATION COPY: Not to be used in class.

1.2. Timeline Filters


PivotTable Timeline filters allow you to show data filters by time period.

To add a Timeline Filter to your PivotTable:

LESSON 1: Using PivotTables | 21


EVALUATION COPY: Not to be used in class.
1. Click anywhere in the PivotTable.
2. From the PivotTable Analyze tool tab, in the Filter group, select Insert Timeline:

3. In the Insert Timeline dialog, check the checkbox of the date fields you want in the timeline.
We only have one date field in our data: Date Listed. Check that and click OK:

4. The timeline is displayed. Click any period to see the data for that period:

5. To see multiple periods, click and drag the timeline handles:

22 | LESSON 1: Using PivotTables


EVALUATION COPY: Not to be used in class.
6. To change the period segment, click the drop-down arrow in the upper right of the filter:

7. Click the Clear Filter button to clear the timeline filter:

EVALUATION COPY: Not to be used in class.

1.3. Inserting Slicers


In this section we will learn about another type of filter called a slicer. Unlike traditional filters that are
applied directly to columns, slicers provide a user-friendly interface showing all the available filtering
options, so that you can select one or more values to filter your data by.

LESSON 1: Using PivotTables | 23


EVALUATION COPY: Not to be used in class.
But before we get to slicers, let’s do some clean up:

1. Open the Bathrooms filter, select (All), and click OK so that we are not filtering by the
number of bathrooms:

We are about to remove this filter, but if we leave the filter on before we remove it, the data will
remain filtered.
2. Clear the Date Listed filter by clicking the Clear Filter icon in its upper right:

3. In the Filters area of the PivotTable Fields pane, remove the Bathrooms filter by clicking
the drop-down arrow next to the filter and selecting Remove Field:

24 | LESSON 1: Using PivotTables


EVALUATION COPY: Not to be used in class.
4. Hover over the top of the Date Listed filter until the cursor becomes a four-headed arrow.
Then, click and drag the filter to the right of the PivotTable.

Your sheet should look like this:

To add slicers to a PivotTable:

1. Select any cell in the PivotTable.


2. On the PivotTable Analyze tab, in the Filter group, click the Insert Slicer command:

LESSON 1: Using PivotTables | 25


EVALUATION COPY: Not to be used in class.
3. In the Insert Slicers dialog, check the field(s) for which you would like to add slicer filters.
Let’s select Bedrooms, Bathrooms, House Color, and Year Built. Then, click OK:

Your slicers will appear on the worksheet stacked on top of each other. Before using them, let’s first
align and style them so the sheet looks nice:

1. Drag each slicer by its top to lay them out relatively nicely below the PivotTable and the
DateListed filter. Don’t worry about getting it exact. In fact, if you leave them aligned a little
poorly, you’ll appreciate what we’re about to do even more:

26 | LESSON 1: Using PivotTables


EVALUATION COPY: Not to be used in class.
2. Ctrl + click the top of each of the slicers to select them all. Then, on the Slicer tool tab in
the Arrange group, click Align > Align Top:

3. With the slicers still selected, click Align > Distribute Horizontally:

LESSON 1: Using PivotTables | 27


EVALUATION COPY: Not to be used in class.
4. Finally, apply a style to each slicer from the Slicer Styles group on the Slicer tool tab:

28 | LESSON 1: Using PivotTables


EVALUATION COPY: Not to be used in class.
Now that we have the sheet looking pretty, let’s see how these slicers work:

To show the number of blue houses in each town that have 2 or 3 bedrooms and 3 or 4 bathrooms:

1. On the Bedrooms slicer, click 2 and then hold down the Ctrl key and click 3. Notice that
some of the values in the other slicers get faded and moved to the bottom of the slicer. That
indicates that there are no houses that match those values with the current filters that are
applied. For example, there are no houses that have 2 or 3 bedrooms that also have 4
bathrooms:

LESSON 1: Using PivotTables | 29


EVALUATION COPY: Not to be used in class.
2. On the Bathrooms slicer, click 3.
3. On the House Color slicer, click Blue.

Here’s the result with all of these slicers applied:

Selecting Multiple Values from Slicers

You already selected multiple values from a slicer by holding down the Ctrl key while clicking
the values. You can also turn on multi-select by clicking the Multi-Select button at the top of
the slicer:

30 | LESSON 1: Using PivotTables


EVALUATION COPY: Not to be used in class.
When multi-select is turned on, you don’t have to hold down the Ctrl key to select multiple
values.

Feel free to play around with these slicers some more.

EVALUATION COPY: Not to be used in class.

1.4. Grouping Data


You can split data in a PivotTable into groups. For example, let’s group the three towns that have lower
average listing prices into one group, and the three towns that have higher average listing prices into a
second group:

1. In the PivotTable, select the first three towns, right-click, and select Group…:

LESSON 1: Using PivotTables | 31


EVALUATION COPY: Not to be used in class.
The towns will be grouped under a Group1 heading:

Notice that the ungrouped towns have been placed into their own “groups” of one. Let’s fix
that.
2. Select the other three towns, right-click, and select Group…:

32 | LESSON 1: Using PivotTables


EVALUATION COPY: Not to be used in class.
3. Now, we have both groups, which you can expand and collapse by clicking the +/- button to
the left of the group headings:

To remove a group, right-click it and select Ungroup…

EVALUATION COPY: Not to be used in class.

LESSON 1: Using PivotTables | 33


EVALUATION COPY: Not to be used in class.
1.5. Calculated Fields
Sometimes your source data has everything you need for your PivotTables, but other times it doesn’t.
What if, for example, we wanted to show the average price per square foot of houses in the different
towns. Because our source data has a column for that, it’s easy to do. We just add Price per SFT to
the Values area and change the aggregate function from SUM to AVERAGE:

Now, consider what you would do if you wanted to show the price per square foot if the data didn’t
have that field. You would use a calculated field in the PivotTable:

1. Click anywhere in the PivotTable.


2. From the PivotTable Analyze tool tab in the Calculations group, select Fields, Items, &
Sets > Calculated Field…:

34 | LESSON 1: Using PivotTables


EVALUATION COPY: Not to be used in class.
3. Enter Price per SQFT for the Name. (We use “SQFT” instead of “SFT” to distinguish it
from the field in the source data.)
4. For the Formula, enter ='Listing Price'/'Square Feet'. You can either type that
directly or:
A. Delete the 0, so that just the = remains.
B. Double-click Listing Price in the Fields.
C. Enter / after ='Listing Price'
D. Double-click Square Feet in the Fields.
The dialog should look like this:

5. Click OK to insert the calculated field.


6. Excel will add the column, but it will use SUM for the aggregate function. Fix this by clicking
the drop-down arrow to the right of Sum of Price per SQFT in the Values area and selecting
Value Field Settings…:

LESSON 1: Using PivotTables | 35


EVALUATION COPY: Not to be used in class.
7. In the Value Field Settings dialog, click Average under Summarize value field by.
8. Click the Number Format button and format the number as a currency with 0 decimal places.
Then, click OK.
9. Click OK in the Value Field Settings dialog to apply the changes.

Calculations are Slightly Different

For our purposes, this detail doesn’t matter. We just want you to learn how to add calculated
fields, but for those of you who are math folks, you might have noticed that the two calculations
are slightly different, which is why the SFT and SQFT averages don’t exactly match:

1. The values from the data source calculate the price per square foot for each house and
then get the average for all the houses. Imagine if there were only two houses: a
$1,000,000 house that was 5,000 square feet and a $100,000 house that was 1,200
square feet. The big house’s price per square foot would be $200 and the little house’s
would be $100 for an average of $150 per square foot.
2. The values from the PivotTable add up all the available square feet and divide it by the
total of all the house prices. Using the same two houses from our previous example,
that would give us $1,100,000 / 6,200, which would be about $180 per square foot.

EVALUATION COPY: Not to be used in class.

1.6. PivotCharts
PivotCharts are simply charts that use the data in your PivotTable. PivotCharts make it easy to visualize
your data.

Let’s insert a clustered column chart showing the number of houses by house color in each town. First,
we need to prepare the PivotTable:

1. Select any cell in the PivotTable.


2. Clear all the filters.
3. In the PivotTable Fields, check only House, Town, and House Color.

36 | LESSON 1: Using PivotTables


EVALUATION COPY: Not to be used in class.
4. Drag House from the Rows area to the Values area, so that it shows up as an aggregate
column.
5. The Rows area should include Town and House Color in that order.
6. Drag any of the filters that are blocking the data over to the right.

The sheet should look like this:

Now, we’re ready to add the PivotChart.

1. Select any cell in the PivotTable.


2. On the PivotTable Analyze tool tab, in the Tools group, click the PivotChart command:

3. The Insert Chart dialog will open. With the Clustered Column chart selected, click OK:

LESSON 1: Using PivotTables | 37


EVALUATION COPY: Not to be used in class.
4. Organize and resize elements so that your worksheet looks something like this:

38 | LESSON 1: Using PivotTables


EVALUATION COPY: Not to be used in class.
You can format and manipulate PivotCharts using the same tools used for formatting and manipulating
regular charts. In addition, PivotCharts have filters built into them:

LESSON 1: Using PivotTables | 39


EVALUATION COPY: Not to be used in class.
Try these filters out and notice that changes you make to them are reflected in the other filters and in
the PivotTable itself.

Starting with the PivotChart

It is possible to insert a PivotChart directly from the source data. To do so, select any cell within
the source data and click PivotChart on the Charts group of the Insert tab.

40 | LESSON 1: Using PivotTables


EVALUATION COPY: Not to be used in class.
Exercise 1: Working with PivotTables
15 to 25 minutes
In this exercise, you will practice using PivotTables, PivotCharts, and Slicers. Open PivotTables.xlsx
from your excel365-pivottables/Exercises folder.

1. Insert a PivotTable in a new worksheet showing total sales by company. Format the numbers
as currency and show zero decimal places. The PivotTable should look like the following image:

2. Insert a PivotChart that looks like this:

LESSON 1: Using PivotTables | 41


EVALUATION COPY: Not to be used in class.
3. Insert a PivotTable in a new worksheet showing total sales in each calendar year by industry.
Format the numbers as currency and show zero decimal places. The PivotTable should look
like the following image:

4. Insert Slicers to analyze sales by salesperson and product in addition to industry. Style each slicer
a little differently:

42 | LESSON 1: Using PivotTables


EVALUATION COPY: Not to be used in class.
5. Try filtering using the slicers.

LESSON 1: Using PivotTables | 43


EVALUATION COPY: Not to be used in class.
Solution
1. To insert a PivotTable showing total sales by company and to format the numbers as currency
and show zero decimal places:
A. Select any cell in the list on the Data sheet.
B. On the Insert tab, in the Tables group, click the PivotTable command.
C. In the Create PivotTable dialog, verify that Excel has selected the correct range,
select where you want the PivotTable to show up (select New Worksheet), and then
click OK.
D. In the PivotTable Field List, check Company and Sale Amount.
E. Click Sum of Sale Amount and select Value Field Settings.
F. In the Value Field Settings dialog, click Number Format, click Currency, and
change the number of decimal places to 0. Then, click OK.
G. Back in the Value Field Settings dialog, click OK.
Your PivotTable Fields should look like this:

2. To insert the PivotChart showing total sales by company:

44 | LESSON 1: Using PivotTables


EVALUATION COPY: Not to be used in class.
A. Select any cell in the PivotTable.
B. On the PivotTable Analyze tool tab, in the Tools group, click the PivotChart
command.
C. In the Insert Chart dialog, select Pie charts, select the first pie chart, and then click
OK.

3. To insert a PivotTable showing total sales in each calendar year by industry and to format the
numbers as currency and show zero decimal places:
A. Select any cell in the list on the Data sheet.
B. On the Insert tab, in the Tables group, click the PivotTable command. In the
Create PivotTable dialog, verify that Excel has selected the correct range, select
where you want the PivotTable to show up (select New Worksheet), and click OK.
C. In the PivotTable Field List, drag and drop:
i. Industry into the Rows area.
ii. Calendar Year into the Columns area.
iii. Sale Amount into the Values area.

D. Click Sum of Sale Amount and select Value Field Settings.


E. In the Value Field Settings dialog, click Number Format, click Currency, and
change the number of decimal places to 0. Then, click OK.
F. Back in the Value Field Settings dialog, click OK.
Your PivotTable Fields should look like this:

LESSON 1: Using PivotTables | 45


EVALUATION COPY: Not to be used in class.
4. To insert Slicers to analyze sales by salesperson and product in addition to industry:
A. Select any cell in the PivotTable.
B. On the PivotTable Analyze tool tab, in the Filter group, click the Insert Slicer
command.
C. In the Insert Slicers dialog, check the Product and Salesperson checkboxes and
click OK.
D. Select styles for your slicers from the Slicer Styles group on the Slicer tool tab.
E. Select any of the fields in either Slicer to filter your data by that field.

Conclusion
In this lesson, you learned to use PivotTables to analyze data, to edit PivotTables, to format PivotTables,
to insert PivotCharts, and to use Slicers.

46 | LESSON 1: Using PivotTables


EVALUATION COPY: Not to be used in class.
LESSON 2
Advanced Functions
EVALUATION COPY: Not to be used in class.

Topics Covered

The ROWS, COLUMNS, INDEX, and XMATCH functions.

Array Functions.

The UNIQUE function.

The RANDARRAY, SEQUENCE, and RANDBETWEEN functions.

The SORT, SORTBY, and FILTER functions.

Lookup functions.

The LET function.

Introduction
In this lesson, we will introduce you to some advanced functions used in Microsoft Excel. Some of
these functions are quite complex. If you don’t understand one at first, read through the explanation
again slowly while playing with the function in Excel.

EVALUATION COPY: Not to be used in class.

2.1. Function Syntax


Excel’s documentation on functions tends to be very good. It often includes short videos and
downloadable examples. When you are entering a formula in the formula bar, the function syntax
shows up below the bar, and the function name in the syntax is a link to the help documentation:

LESSON 2: Advanced Functions | 47


EVALUATION COPY: Not to be used in class.
Understanding how the syntax is written makes it easier to understand the function more quickly. For
example, the syntax for the PMT function is:

PMT(rate, nper, pv, [fv], [type])

This shows that the function can take five arguments, but that the last two ([fv] and [type]) are
optional as indicated by the square brackets.

When an argument is optional, it either has a default value or is simply not required. The fv and type
arguments both have default values of 0.

When writing a function, you have to include arguments in the correct order. So, what if you want to
include the default value for an optional argument that comes before an argument you want to assign
a different value to? For example, say we wanted to calculate the payment for a 24-month $3,000 loan
with 9% interest, assuming the loan is to be completely paid off and payments are made at the beginning
of each period. Let’s break that out:

1. Length of loan: 24 months.


2. Amount of loan: $3,000.
3. Interest rate: 9%.
4. Future value: $0.00 (meaning we’re paying it all off). This is the default.
5. Type: 1 (meaning we’re making payments at the beginning of each period). This is NOT the
default.

48 | LESSON 2: Advanced Functions


EVALUATION COPY: Not to be used in class.
You have two options here:

1. You can include the future value argument, even though you’re using the default:

=PMT(0.09/12,24,3000,0,1)

2. You can skip the future value argument by just leaving a blank between the commas:

=PMT(0.09/12,24,3000,,1)

We prefer the first option as it makes the formula clearer, but both work equally well.

2.1.1. Paired Arguments


Some functions have paired arguments, meaning that two arguments relate to each other in some way,
and therefore, if one is included, the other must be included as well. Consider the IFS function syntax:

IFS(logical_test1, value_if_true1, [logical_test2, value_if_true2], [logical_test3,


value_if_true3],…)

The first two arguments are required. The optional arguments that follow the first two come in pairs:

[logical_test2, value_if_true2]

If you include a second logical test, you need to include a corresponding value to output if that logical
test is true. In the syntax, the whole pair is enclosed in square brackets, indicating that it’s optional,
but if included, both parts of the pair must be included.

The Ellipsis

The ellipsis (…) at the end of the IFS function syntax indicates that you can continue to add these pairs.
There generally is a limit to the number you can add (127 in this case), but you’re unlikely to reach it.

It’s worth getting familiar with the syntax functions and with Excel’s help documentation in general,
as it will make learning about new functions (or functions new to you) a lot easier.

LESSON 2: Advanced Functions | 49


EVALUATION COPY: Not to be used in class.
EVALUATION COPY: Not to be used in class.

2.2. ROWS, COLUMNS, INDEX, and XMATCH

2.2.1. ROWS and COLUMNS


The ROWS and COLUMNS functions take a range for an argument and return the number of rows and
columns, respectively.

Enter the following formulas in any cell in any worksheet:

=ROWS(A1:D5)

=COLUMNS(A1:D5)

The first will return 5 and the second will return 4.

2.2.2. INDEX, MATCH, and XMATCH


Follow Along

If you would like to follow along with the examples in this section, which we recommend doing,
open the INDEX & MATCH tab of excel365-functions-advanced/Demos/AdvancedFunc
tions.xlsx.

The INDEX function returns the value within a table or range. It takes the following arguments:

1. The range to search.


2. The row number.
3. The column number.

To see how the INDEX function works:

50 | LESSON 2: Advanced Functions


EVALUATION COPY: Not to be used in class.
1. The list in the top left of the worksheet shows the house points earned by Harry, Ron,
Hermione, and Neville in each of three months.
2. Select cell G2, which contains the following formula:

=INDEX(A3:A6,3)

This returns the third value in the range A3:A6, which is Ron.
3. Select cell G3, which contains the following formula:

=INDEX(B3:D6,3,2)

This returns the value in the third row and second column in the range B3:D6, which is -59:

2.2.3. XMATCH
The XMATCH function searches for an item in a range and returns the item’s index position. It takes
two required arguments:

1. The value to look up.


2. The range to look in.

To see how the XMATCH function works:

1. Select cell J2, which has the following formula:

=XMATCH(J2,A3:A6)

This returns the first value it finds in range A3:A6 that matches the value in J2. The value in
J2 is Hermione, which is the second value in the range A3:A6, so it returns 2.

LESSON 2: Advanced Functions | 51


EVALUATION COPY: Not to be used in class.
2.2.4. Using INDEX and XMATCH Together
You can use INDEX and XMATCH together to create a lookup form. To see how this works, take a look
at range L2:M5:

The formula in cell M4 is:

=INDEX(B3:D6,XMATCH(M3,A3:A6),XMATCH(M2,B2:D2))

Remember that formulas work from the inside out, so the XMATCH functions get evaluated first.

1. The first XMATCH function looks through the student names in range A3:A6 for a value that
matches the value in cell M3 (Neville). Neville is found in the fourth cell in that range,
so this function return 4.
2. The second XMATCH function looks through the months in range B2:D2 for a value that
matches the value in cell M2 (Feb). Feb is found in the second cell in that range, so this
function return 2.
3. Substituting those values returned from the XMATCH functions, we can rewrite our formula
like this:

=INDEX(B3:D6,4,2)

This will return the value found in row 4 and column 2 of range B3:D6:

4. Try changing the month and/or student values to see how the results change.

52 | LESSON 2: Advanced Functions


EVALUATION COPY: Not to be used in class.
The MATCH Function

The XMATCH function is new in Excel 365 and 2021. There is a similar function called MATCH,
which is also supported in older versions. It works almost the same, but instead of looking for
an exact match by default, as XMATCH does, the default behavior of MATCH is to return the largest
value that is less than or equal to the look up value. To see the difference, enter Her in both cells
J2 and J6. XMATCH will return #N/A, indicating there is no match. But MATCH will return 1,
because Harry is the largest value that is less than or equal to Her and the index position of
Harry is 1.

EVALUATION COPY: Not to be used in class.

2.3. Arrays and Array Formulas


Excel 365 includes dynamic array formulas, which return a set of values. That set of values can be
one-dimensional, like a column or a row, or two-dimensional, like a table. In either case, the set of
values is called an array. In a way, arrays are like ranges; however, ranges refer to locations on a worksheet,
whereas, arrays refer to actual values.

When dynamic array formulas return arrays, those arrays spill into the neighboring cells. Let’s take a
look at a few of these: SEQUENCE, RANDARRAY, and UNIQUE

Follow Along

If you would like to follow along with the examples in this section, which we recommend doing,
open the Arrays tab of excel365-functions-advanced/Demos/AdvancedFunctions.xlsx.

2.3.1. SEQUENCE
The SEQUENCE function creates a sequence of values that spills into a range. It takes the following
arguments, only the first of which is required:

1. rows – the number of rows to return.

LESSON 2: Advanced Functions | 53


EVALUATION COPY: Not to be used in class.
2. cols – the number of columns to return. The default is 1.
3. start – the first number in the sequence. The default is 1.
4. step – the amount to increment between numbers. The default is 1.

Here is a very basic example:

=SEQUENCE(10)

This will generate an array of numbers 1 through 10 and spill them down a single column:

Let’s examine this:

1. Select cell A1 on the Arrays sheet and look at its formula in the formula bar.
2. Now, select cell A2 and look at its formula in the formula bar. Notice that it is grayed out:

It’s grayed out because you cannot change it here. The values in A2:A10 were spilled in from
the formula in A1.
3. Type X into cell A2 and press Enter. Notice that cell A1 now has an error: #SPILL!:

54 | LESSON 2: Advanced Functions


EVALUATION COPY: Not to be used in class.
The error is telling you that the SEQUENCE function cannot spill into the required range of
cells because the range is not empty.
4. Delete the X and notice that the cells repopulate.

Let’s take a look at a sequence that spans rows and columns:

1. Select cell C2. It contains the following formula:

=SEQUENCE(3,6,10,5)

This will create a sequence of 3 rows and 6 columns, starting with 10 and incrementing by 5
on each step:

2. To see how the spilling works, select cell J2 and enter the same formula:

=SEQUENCE(3,6,10,5)

RANDBETWEEN

The RANDBETWEEN function return an integer between two values. It takes two arguments: the bottom
value and the top value, which are both included in the possible return values. For example, the following
function will return an integer between 1 and 10:

=RANDBETWEEN(1,10)

This function can be used with SEQUENCE to generate a sequence with a random starting point and
incrementing by a random number. To see an example of this, select cell C7, which has the following
formula:

LESSON 2: Advanced Functions | 55


EVALUATION COPY: Not to be used in class.
=SEQUENCE(3,6,RANDBETWEEN(1,100),RANDBETWEEN(1,10))

Remember that formulas work from the inside out, so the RANDBETWEEN functions get evaluated first.
If they return 70 for the starting number and 8 for the step, the result will look like this:

Again, to get practice with this and to see how the spilling works, select cell J7 and enter the same
formula:

=SEQUENCE(3,6,RANDBETWEEN(1,100),RANDBETWEEN(1,10))

2.3.2. RANDARRAY
The RANDARRAY function creates an array of random values that spills into a range. It takes the following
arguments, all of which are optional:

1. rows – the number of rows to be returned. The default is 1.


2. cols – the number of columns to be returned. The default is 1.
3. min – the minimum number to be returned. The default is 0.
4. max – the maximum number to be returned. The default is 1.
5. whole_number – if TRUE, it will only return whole numbers. The default is FALSE.

Let’s see how it works:

1. Select cell C12. It contains the following formula:

=RANDARRAY(3,6,1,10)

This will create a range of 3 rows and 6 columns, with random numbers between 1 and 10:

56 | LESSON 2: Advanced Functions


EVALUATION COPY: Not to be used in class.
2. Select cell C17. It contains the following formula:

=RANDARRAY(3,6,1,10,TRUE)

This will create a range of 3 rows and 6 columns, with random whole numbers between 1 and
10:

3. Try entering the two formulas above in cells J12 and J17. Feel free to experiment with different
numbers.

2.3.3. UNIQUE
The UNIQUE function creates an array from a list of unique values found in a given range. It takes the
following arguments, only the first of which is required:

1. range – the range from which to return unique rows or columns.


2. by_col – if TRUE, it will compare the data’s columns. By default, it compares the data’s rows.

3. exactly_once – if TRUE, it will only return rows or columns that appear exactly one time
in the range.

Let’s see how it works:

1. Notice cells Q2:T5 contain color names. We’ve used conditional formatting to color code
the cells. Notice that the second and fourth rows are the same as are the first and last columns:

LESSON 2: Advanced Functions | 57


EVALUATION COPY: Not to be used in class.
2. Select cell Q8. It contains the following formula:

=UNIQUE(Q2:T5)

This returns the three unique rows:

3. Select cell Q14. It contains the following formula:

=UNIQUE(Q2:T5,TRUE)

This returns the three unique columns, because the second argument is TRUE indicating that
it should compare values by column:

4. Select cell Q20. It contains the following formula:

=UNIQUE(Q2:T5, FALSE, TRUE)

This returns the two rows that show up just a single time. In other words, it excludes rows
that appear more than once. That’s because the third argument is TRUE indicating that it
should only return rows that appear exactly once:

58 | LESSON 2: Advanced Functions


EVALUATION COPY: Not to be used in class.
LESSON 2: Advanced Functions | 59
EVALUATION COPY: Not to be used in class.
Exercise 2: Getting Unique Values
5 to 10 minutes
In this exercise, you will find all the tennis players who have won major tournaments during the careers
of Serena Williams and Roger Federer, from the first year they each won a major tournament (1999
for Williams and 2003 for Federer) to the year they both retired (2022).

1. Open Unique.xlsx from excel365-functions-advanced/Exercises.


2. Write a formula in cell F3 that returns all the champions of the Women’s tournaments. The
values should spill into the cells below F3.
3. Write a formula in cell G3 that returns all the champions of the Men’s tournaments. The
values should spill into the cells below G3.

60 | LESSON 2: Advanced Functions


EVALUATION COPY: Not to be used in class.
LESSON 2: Advanced Functions | 61
EVALUATION COPY: Not to be used in class.
Solution
1. The formula for getting the unique female champions is:

=UNIQUE(C2:C96)

2. The formula for getting the unique male champions is:

=UNIQUE(D18:D96)

EVALUATION COPY: Not to be used in class.

2.4. SORT, FILTER, and SORTBY


The SORT, FILTER, and SORTBY functions all return dynamic arrays that spill into the neighboring
cells. They are used to get dynamically updating views of a range of data.

Follow Along

If you would like to follow along with the examples in this section, which we recommend doing,
open the SORT & FILTER tab of excel365-functions-advanced/Demos/AdvancedFunc
tions.xlsx.

You can sort and filter data ranges and tables using the Sort and Filter commands in the Sort & Filter
group on the Data tab:

62 | LESSON 2: Advanced Functions


EVALUATION COPY: Not to be used in class.
When you use those commands, the data gets sorted in place. In some cases, you may want to leave
the source data as is, but show different views of the data, sorted and/or filtered in a different way.
Examine the following worksheet, which shows U.S. household income by state:

2.4.1. SORT
The SORT function is used to sort a range in new cells without affecting the original range. It takes the
following arguments (only the first is required):

1. The range to sort.


2. The sort index. 1 to sort on the first column in the array, 2 to sort on the second column in
the array, etc.
3. The sort order. 1 for ascending (the default). -1 for descending.
4. by_col. This is an optional argument. Use FALSE (the default) to sort by row and TRUE to
sort by column.

To see how SORT works:

1. Go to the SORT & FILTER tab of the AdvancedFunctions.xlsx workbook.


2. Select cell D3. It contains the following formula:

=SORT(A3:A52)

This simply sorts the states in ascending order.


3. Select cell D4 and notice that the formula is grayed out. The same is true for all the cells below
it. These cells are populated by the formula in D3, which spills values into them.

LESSON 2: Advanced Functions | 63


EVALUATION COPY: Not to be used in class.
4. Type X into cell D4 and press Enter. Notice that cell D3 now has an error: #SPILL!:

The error is telling you that the SORT function cannot spill into the required range of cells
because the range is not empty.
5. Delete the X and notice that the cells repopulate.
6. Select cell E3. It contains the following formula:

=SORT(A3:A52,1,-1)

This simply sorts the states in descending order. The second argument (1) indicates that we
want to sort by the first column in the data range. We include this even though there’s only
one column, because, we want to add a third argument: -1, which tells the function to sort
in descending order. Because there is only one column, we could leave a blank for the second
argument, like this:

=SORT(A3:A52,,-1)

But that isn’t as easy to understand.


7. Select cell G3. It contains the following formula:

=SORT(A3:B52,2,-1)

This sorts the State and Household Income data (A3:B52) by the second column (2, which
is Household Income) in descending order (-1).

2.4.2. FILTER
The FILTER function is used to filter a range in new cells without affecting the original range. It takes
the following arguments:

1. The range to filter.

64 | LESSON 2: Advanced Functions


EVALUATION COPY: Not to be used in class.
2. A Boolean array with the same length as the range to filter. Boolean array sounds scary, but
it’s usually just a logical comparison between a range and a value. For example:

B3:B52 > 70000

This checks each cell in the range one at a time against the condition, like so:
A. If B3 > 700000, include that row’s data in the output.
B. If B4 > 700000, include that row’s data in the output.
C. If B5 > 700000, include that row’s data in the output.
D. And so on…

3. An optional if_empty argument with a value to output if the filter returns no matches.

To see how FILTER works:

1. Notice that cell K1 contains the value $70,000. We will use FILTER to create a data range
of states where the average household income is greater than that number.
2. Select cell J3. It contains the following formula:

=FILTER(A3:B52,B3:B52>K1)

This filters the State and Household Income data (A3:B52) by including only those states
where the household income (B3:B52) is greater than the value in K1 ($70,000).
3. Select cell M3 to see how to use SORT and FILTER together to sort the filtered results. It
contains the following formula:

=SORT(FILTER(A3:B52,B3:B52>K1),2,-1)

Remember that formulas work from the inside out, so FILTER(A3:B52,B3:B52>K1) gets
evaluated first. It returns a range of filtered data, which then gets passed to SORT.

2.4.3. SORTBY
The SORTBY function is similar to SORT, but it can also be used to:

1. Sort on multiple fields.


2. Sort on fields that are not included in the output.

SORTBY takes the following arguments:

LESSON 2: Advanced Functions | 65


EVALUATION COPY: Not to be used in class.
1. The range to sort.
2. The data to sort the range on.
3. The sort order. 1 for ascending (the default). -1 for descending.

The last two arguments can be repeated to sort on multiple sets of values.

To see how SORTBY works:

1. Switch to the SORTBY tab of the AdvancedFunctions.xlsx workbook.


2. Cells A1:D1 contain data on classroom grades.
3. Select cell F2. It contains the following formula:

=SORTBY(A2:D11,B2:B11,1,C2:C11,-1)

Let’s break that across lines:

=SORTBY(
A2:D11,
B2:B11,1,
C2:C11,-1
)

This sorts:
A. range A2:D11…
B. by the values in range B2:B11 (the subject) in ascending order,…
C. and then by the values in range C2:C11 (the number of students) in descending
order.

Practice entering the formula yourself:

1. Select cell F13.


2. Enter =SORTBY(

3. Select cells A2:D11 (or type A2:D11). This is the data you are sorting. Add a comma.

66 | LESSON 2: Advanced Functions


EVALUATION COPY: Not to be used in class.
4. Select cells B2:B11 (or type B2:B11). This is the first array you are sorting by: the subjects.
Add a comma.
5. Type 1 to sort in ascending order, and add a comma.
6. Select cells C2:C11 (or type C2:C11). This is the second array you are sorting by: the number
of students. Add a comma.
7. Type -1 to sort in descending order.
8. Press Enter or Tab to finish the formula. The values should spill out into the range.

EVALUATION COPY: Not to be used in class.

2.5. Lookup Functions


Excel 365 includes four lookup functions, including the new XLOOKUP, which is the only one you need
to know as it does everything you need. We will cover that one here and point you to references on
the other three in case you need to make your workbooks compatible with older versions of Excel.

2.5.1. XLOOKUP
The XLOOKUP function searches a range of cells for a value and then returns an item in another range
corresponding to the first match it finds. It takes the following required arguments:

1. The value to search.


2. The range to search in.
3. The range to return.

It also can take three additional optional arguments:

1. A value to return if no match is found. If this is left blank, it will return #N/A if no match is
found.
2. A match mode:
0 – Exact match. This is the default.
-1 – Exact match or nearest smaller item.
1 – Exact match or nearest larger item.

LESSON 2: Advanced Functions | 67


EVALUATION COPY: Not to be used in class.
-1 – A wildcard match1.

3. A search mode:
1 – Search from first to last. This is the default.
-1 – Search from last to first.
2 – A binary search2 that relies on data being in ascending order.
-2 – A binary search3 that relies on data being in descending order.

The easiest way to understand how the XLOOKUP function works is through examples:

1. Open the XLOOKUP tab of excel365-functions-advanced/Demos/AdvancedFunc


tions.xlsx. The list on the left shows the names, houses, and favorite subjects of students
at Hogwarts. The yellow boxes contain “forms” with our lookup values. You can change these
values to get different results.
2. Cell F3 uses XLOOKUP to return the house of a student. It contains the following formula:

=XLOOKUP(F2,A2:A37,B2:B37,"No match")

Cell F2 contains the value Su Li. The function searches range A2:A37 for that value and
then returns the corresponding value in range B2:B37. If it does not find a match, it returns
"No match":

3. Cell F8 is similar, but it looks left instead of right for the value to return:

1. https://support.microsoft.com/en-us/office/using-wildcard-characters-in-searches-ef94362e-9999-4350-ad74-4d2371110adb
2. https://en.wikipedia.org/wiki/Binary_search_algorithm
3. https://en.wikipedia.org/wiki/Binary_search_algorithm

68 | LESSON 2: Advanced Functions


EVALUATION COPY: Not to be used in class.
It searches range B2:B37 for a value matching the value in cell F7 (Gryffindor) and then
returns the corresponding value in range A2:A37. If it does not find a match, it returns "No
match".

=XLOOKUP(F7,B2:B37,A2:A37,"No match")

Note that XLOOKUP returns the first match it finds. So, although there are many students in
the list from Gryffindor, it just returns the first one it finds: Lavender Brown.
4. Compare the previous example to the formula in F12, which uses the FILTER function:

=FILTER(A2:A37,B2:B37=F7)

This filters range A2:A37 using the condition that the corresponding rows in column B match
the value in F7. It finds all the Gryffindor students and spills them into the cells below:

5. XLOOKUP can return a one-dimensional range. Select cell I3, which contains the following
function:

=XLOOKUP(H3,A2:A37,B2:C37,"No match")

Notice that the third argument, B2:C37, is a range spanning two columns (B and C). XLOOKUP
will return a row from this range that corresponds to the match found in A2:A37. The second
value (Defence Against the Dark Arts) will spill over int J3:

LESSON 2: Advanced Functions | 69


EVALUATION COPY: Not to be used in class.
6. Cell I8 is similar to the example above but it looks left instead of right for the values to return.
7. Finally, you can use XLOOKUP to find both a horizontal and vertical match:

You do this by nesting one XLOOKUP within another. Here’s the formula in cell I15, which
finds a value with the given column heading (House) and a given row label (Trevor Boot):

=XLOOKUP(I13,A2:A37,XLOOKUP(I12,A1:C1,A2:C37))

Remember that formulas work from the inside out, so the inside XLOOKUP function gets
evaluated first. It returns all the values from A2:C37 in the column in which the value in
A1:C1 is the same as the value in I13 (House).
To see how that inner XLOOKUP function works enter it cell J14:

=XLOOKUP(I12,A1:C1,A2:C37)

You should see the house names spill down below the cell:

This is the range that the outer XLOOKUP will return from.

70 | LESSON 2: Advanced Functions


EVALUATION COPY: Not to be used in class.
The outer XLOOKUP function looks in cells A2:A37 (the student names) for a value matching
the value in cell I12 (Trevor Boot), and returns the corresponding value in the range returned
by the inner XLOOKUP function.

2.5.2. VLOOKUP, HLOOKUP, and LOOKUP


If you are working on Excel 2019 or earlier, then you will need to use one of the older lookup functions:

1. VLOOKUP – Identifies a row in a range based on the row’s first value and returns the value in
a specified column (by index number) of that row. Microsoft documentation4.
2. HLOOKUP – Identifies a column in a range based on the column’s first value and returns the
value in a specified row (by index number) of that column. Microsoft documentation5.
3. LOOKUP – If this is used at all, it should be used to search a row or column for a value and
return the value of the corresponding cell in the next row or column. Microsoft
documentation6.

Interested in a Challenge?

If you’d like a fun exercise to practice working with some of the functions you’ve learned so far,
check out our Use Excel 365 to create a Sorting Hat and House Point Scoreboard7 challenge.

4. https://support.microsoft.com/en-us/office/vlookup-function-0bbc8083-26fe-4963-8ab8-93a18ad188a1
5. https://support.microsoft.com/en-us/office/hlookup-function-a3034eec-b719-4ba3-bb65-e1ad662ed95f
6. https://support.microsoft.com/en-us/office/lookup-function-446d94af-663b-451d-8251-369d5e3864cb
7. https://www.webucator.com/article/using-excel-to-create-a-sorting-hat/

LESSON 2: Advanced Functions | 71


EVALUATION COPY: Not to be used in class.
Exercise 3: Using the XLOOKUP Function
15 to 25 minutes
In this exercise, you will use the XLOOKUP function to create an invoice on which the description and
price of items will autofill when the item number is entered.

1. Open XLOOKUP.xlsx from your excel365-functions-advanced/Exercises folder and


go to the sheet Invoice sheet.
2. Use the XLOOKUP function to query the Description and Price for the three items based on
their item number shown in column A of the invoice. The ranges you will be looking in and
returning from are on the Table sheet.
A. Hint: Including absolute references when referencing the ranges will enable the
formulas to be copied to other cells within the column (e.g., using the Fill Handle).

When you’re done, your invoice should look like this:

72 | LESSON 2: Advanced Functions


EVALUATION COPY: Not to be used in class.
LESSON 2: Advanced Functions | 73
EVALUATION COPY: Not to be used in class.
Solution
To query the Description from the table located in the Table sheet:

1. In the Invoice sheet, select cell B7.


2. Type =XLOOKUP(
3. Click cell A7. This is the value you will be searching for.
4. Type a comma.
5. Switch to the Table sheet and select cells A2:A9. This is the range you will be searching in.
6. Press the F4 key to make that range absolute so that you can easily copy the formula to other
cells.
7. Type a comma.
8. Select cells B2:B9 in the Table sheet. This is the range from you will return the value
corresponding to the match found.
9. Press the F4 key to make that range absolute so that you can easily copy the formula to other
cells.
10. Type ,"") to finish the formula. The last argument is the value to return if no match is found.
We want to return an empty value.
11. The complete formula looks like this:

=XLOOKUP(A7,Table!$A$2:$A$9,Table!$B$2:$B$9,"")

12. Grab the Fill Handle on the bottom right of cell B7 and drag it down to cell B15.

To query the Price from the table located in the Table sheet:

1. In the Invoice sheet, select cell D7.


2. Type =XLOOKUP(
3. Click cell A7. This is the value you will be searching for.
4. Type a comma.
5. Switch to the Table sheet and select cells A2:A9. This is the range you will be searching in.
6. Press the F4 key to make that range absolute so that you can easily copy the formula to other
cells.
7. Type a comma.

74 | LESSON 2: Advanced Functions


EVALUATION COPY: Not to be used in class.
8. Select cells C2:C9 in the Table sheet. This is the range from you will return the value
corresponding to the match found.
9. Press the F4 key to make that range absolute so that you can easily copy the formula to other
cells.
10. Type ,"") to finish the formula. Again, the last argument is the value to return if no match
is found. We want to return an empty value.
11. The complete formula looks like this:

=XLOOKUP(A7,Table!$A$2:$A$9,Table!$C$2:$C$9,"")

12. Grab the Fill Handle on the bottom right of cell B7 and drag it down to cell B15.

EVALUATION COPY: Not to be used in class.

2.6. The LET Function


The LET function, which is new in Excel 365 and 2021, allows you to create variables to hold values.
It is most useful when parts of your function are repeated, but let’s start with a very simple example:

=LET(x,3,y,5,x*y)

The best way to understand the LET function is to start with the last argument, which is the formula
that uses the variables. In this case, that’s x*y. This multiplies two variables, x and y, together. Those
variables are defined by the preceding arguments of the LET function: x,3,y,5. Those are variable-value
pairs.

Here is the formula broken across lines and keeping the variable-value pairs together:

=LET(
x,3,
y,5,
x*y
)

LESSON 2: Advanced Functions | 75


EVALUATION COPY: Not to be used in class.
While the preceding example works, it doesn’t make much sense as there is no need for a variable. You
could just write:

=3*5

Again, the LET function is useful when parts of the function are repeated. Consider Heron’s Formula
for calculating the area of a triangle from the lengths of three sides:

That is a pretty scary looking formula. But notice that the portions in red are repeated. If we could
assign that to a simple variable, it would make the formula look a lot simpler:

Now, let’s take it one step further and assign values to the sides:

76 | LESSON 2: Advanced Functions


EVALUATION COPY: Not to be used in class.
And let’s see what that looks like in Excel, first broken across lines:

=LET(
a,3,
b,4,
c,5,
p,(a+b+c)/2,
SQRT(p*(p-a)*(p-b)*(p-c))
)

And now one line:

=LET(a,3,b,4,c,5,p,(a+b+c)/2, SQRT(p*(p-a)*(p-b)*(p-c)))

One final piece: in Excel, you would typically hold the values of those sides in cells. If the lengths of
the sides are stored in cells B2, C2, and D2, then we will reference those cells for the a, b, and c
variables:

=LET(a,B2,b,C2,c,D2,p,(a+b+c)/2, SQRT(p*(p-a)*(p-b)*(p-c)))

To see this in Excel, open the LET worksheet of the AdvancedFunctions.xlsx workbook in the
excel365-functions-advanced/Demos folder.

LESSON 2: Advanced Functions | 77


EVALUATION COPY: Not to be used in class.
EVALUATION COPY: Not to be used in class.

2.7. The TRANSPOSE Function


If you want to rotate the axes of a data range so that the columns become rows and the rows become
columns, you can copy the data range, right-click, and select the Transpose paste option:

However, this creates a copy of the data that does not refer back to the original data. If you want to
keep both views of the data up to date, you will need to make changes in both places.

The TRANSPOSE function is a dynamic array function that can be used to create a new “view” on the
same data. It does the same thing as the Transpose paste option, but it keeps a reference to the original
data, so that changes there are reflected in the transposed data. The TRANSPOSE function takes a single
argument: the data range you want to transpose:

78 | LESSON 2: Advanced Functions


EVALUATION COPY: Not to be used in class.
Notice the function in cell A8 is:

=TRANSPOSE(A2:D6)

To see the data update dynamically when you change the original data, open the TRANSPOSE sheet
of excel365-functions-advanced/Demos/AdvancedFunctions.xlsx and make any change to
the cells in A2:D6.

Older Versions of Excel

If you are working on Excel 2019 or earlier, then the TRANSPOSE function will work a little
differently. See the Microsoft documentation8 for details.

Conclusion
In this lesson, you have learned to use some of Excel’s more advanced functions.

8. https://support.microsoft.com/en-au/office/transpose-function-ed039415-ed8a-4a81-93e9-4b6dfac76027

LESSON 2: Advanced Functions | 79


EVALUATION COPY: Not to be used in class.
80 | LESSON 2: Advanced Functions
EVALUATION COPY: Not to be used in class.
LESSON 3
Auditing Workbooks
EVALUATION COPY: Not to be used in class.

Topics Covered

Inspecting workbooks.

Tracing precedents and dependents.

Watching formulas.

Evaluating formulas.

Error checking.

Introduction
In this lesson, you will learn to inspect workbooks before finalizing or sharing them to make sure that
they don’t contain personal information that you don’t want shared, that they are accessible to people
with disabilities, and that they are compatible with older versions of Excel.

You will also learn to identify potential issues with formulas by tracing precedent and dependent cells
to find out which cells rely on each other. In addition, you will learn to use the Watch Window to
keep an eye on formulas as you work.

Finally, you will learn to evaluate formulas using the Evaluate Formula dialog, which allows you to
walk through a formula seeing how each step is evaluated, and to use error checking to find and fix
potentially problematic formulas.

EVALUATION COPY: Not to be used in class.

LESSON 3: Auditing Workbooks | 81


EVALUATION COPY: Not to be used in class.
3.1. Inspecting a Workbook
Excel offers three useful inspection tools on the Info tab in Backstage view under the Check for Issues…
button:

The best way to see how these tools work is to try them out. Open excel365-auditing/Demos/Tri
angles.xlsx. This workbook has two sheets:

82 | LESSON 3: Auditing Workbooks


EVALUATION COPY: Not to be used in class.
1. The Sides sheet lists the side lengths of ten triangles and has columns indicating whether the
triangles are right or equilateral triangles. It also includes a chart, which uses the following
data: =Sides!$A$1:$F$11. Note that columns E and F aren’t used in the chart, so we could
have just selected =Sides!$A$1:$D$11 for the data, but when you create a chart from a list,
Excel’s default behavior is to include the whole list.
2. The Formulas sheet has formulas calculating the area and perimeter of each triangle. These
formulas rely on data from the Sides sheet:

Area Formula
=LET(a,Sides!B2,b,Sides!C2,c,Sides!D2,p,(a+b+c)/2, SQRT(p*(p-a)*(p-b)*(p-c)))

Perimeter Formula
=Sides!B2+Sides!C2+Sides!D2

The formula to calculate the area of the triangle uses the LET function, which was introduced
in Excel 2021 and 365. That makes this workbook incompatible with older versions of Excel.

Let’s see how the inspection tools can help us identify potential issues with this workbook.

LESSON 3: Auditing Workbooks | 83


EVALUATION COPY: Not to be used in class.
3.1.1. Inspect Document
The Inspect Document tool checks the workbook for hidden properties and personal information
that you may not want to remove before sharing the workbook.

1. Click File to enter Backstage view.


2. On the Info tab, click Check for Issues > Inspect Document. If you get a prompt suggesting
that you save your changes, click Yes to save them.
3. The Document Inspector dialog will open with a list of options to check:

Generally, you can accept all the defaults and click Inspect.
4. The inspector found two potential issues:

84 | LESSON 3: Auditing Workbooks


EVALUATION COPY: Not to be used in class.
A. Some document properties and personal information were found. If that’s information
you would prefer not to share, you can click Remove All to remove it.
B. Some invisible content was found. That’s the part of the data that we included when
we created the chart, but didn’t actually display in the chart. Click Remove All to
fix that. The data range for the chart will change from =Sides!$A$1:$F$11 to
=Sides!$A$1:$D$11.

5. Click Close when you’re done inspecting.

For more information on hidden information and personal data, see the Microsoft documentation9.

3.1.2. Check Accessibility


The Check Accessibility tool checks the workbook for content that people with disabilities might have
difficulty seeing.

1. Click File to enter Backstage view.

9. https://support.microsoft.com/en-us/office/help-protect-your-privacy-252a47ec-1b31-4fd0-8450-e66d6c2de950

LESSON 3: Auditing Workbooks | 85


EVALUATION COPY: Not to be used in class.
2. On the Info tab, click Check for Issues > Check Accessibility.
3. You will be taken back to a worksheet with the Accessibility pane open showing any errors
and/or warnings. The inspection revealed one error and one warning. Click the drop-down
arrows to the left of the messages for more information:

4. Charts (like all shapes and images) should have alternative text providing a description of what
they show or they should be marked decorative if they are there just for aesthetic purposes.
In this case, we should add a description, which you can do by clicking the drop-down arrow
to the right of Chart 1 (Sides) and selecting Add a description:

86 | LESSON 3: Auditing Workbooks


EVALUATION COPY: Not to be used in class.
That will bring up the Alt Text pane with a textarea for adding the description. Add a
description and close the pane:

5. That will bring you back to the Accessibility pane, which still has a warning about hard-to-read
text contrast on both slides. Click the drop-down arrow next to the identified cells and either
click the recommended actions to accept them or click the > to the right of the action for
more options:

LESSON 3: Auditing Workbooks | 87


EVALUATION COPY: Not to be used in class.
Note that, if the recommended action doesn’t fix the issue, you may need to try a different
color. When you’re done, you should see a message in the Accessibility pane saying that no
accessibility issues were found:

3.1.3. Check Compatibility


The Check Compatibility tool checks for features of your workbook that aren’t supported in earlier
versions of Excel.

1. Click File to enter Backstage view.


2. On the Info tab, click Check for Issues > Check Compatibility.
3. The Compatibility Checker dialog will open listing any compatibility issues:

88 | LESSON 3: Auditing Workbooks


EVALUATION COPY: Not to be used in class.
4. Click the Select versions to show dropdown to change which versions of Excel to check for
compatibility issues.
5. Check the Check compatibility when saving this workbook. checkbox if you want
compatibility checked as you make and save changes. This is a good idea if you know you’re
sharing the workbook with people who have older versions of Excel.

It is worth noting that you may not wish to fix compatibility issues in cases where doing so would make
the workbook less useful.

LESSON 3: Auditing Workbooks | 89


EVALUATION COPY: Not to be used in class.
EVALUATION COPY: Not to be used in class.

3.2. Tracing Precedents and Dependents


Cells that are referenced in a formula in another cell are called precedents.

Cells that have formulas that reference other cells are called dependents:

Let’s start with a couple of simple examples. First to trace precedents:

1. Open the Sides sheet of excel365-auditing/Demos/Triangles.xlsx.


2. Select cell F3 and notice the formula relies on B3, C3, and D3:

=AND(B3=C3,C3=D3)

3. On the Formulas tab, in the Formula Auditing group, click Trace Precedents:

The blue dots on the arrow indicate the precedent cells:

90 | LESSON 3: Auditing Workbooks


EVALUATION COPY: Not to be used in class.
4. Remove the arrows by clicking Remove Arrows in the Formula Auditing group on the
Formulas tab:

Now, let’s trace dependents:

1. Select cell B4.


2. On the Formulas tab, in the Formula Auditing group, click Trace Dependents:

The blue arrow heads indicate the dependent cells in the same sheet and the black arrow head
on the dashed line that points to a worksheet icon indicates that there is a dependent cell on
another sheet:

3. Double-click the dashed arrow (you may find zooming in makes that easier). This will bring
up the Go To dialog:

LESSON 3: Auditing Workbooks | 91


EVALUATION COPY: Not to be used in class.
Double-click any of the references to go to that cell.
4. Remove the arrows by clicking Remove Arrows in the Formula Auditing group on the
Formulas tab:

Now, let’s see how we can use tracing in a practical way. Go to the Formulas sheet and select cell D9.
Notice it has a value of 0.0 for the height of the triangle. The height of a triangle cannot be 0.0. Let’s
dig into that.

1. On the Formulas tab, in the Formula Auditing group, click Trace Precedents. Notice that
B9 is a precedent and its value is also 0.0:

92 | LESSON 3: Auditing Workbooks


EVALUATION COPY: Not to be used in class.
The area of a triangle cannot be 0.0. Let’s dig further.
2. Without changing the selection, click Trace Precedents again. That takes you to the next
level of precedents, which shows that the cell calculating the area has a precedent in another
worksheet.

3. Double-click the dashed arrow to bring up the Go To dialog:

LESSON 3: Auditing Workbooks | 93


EVALUATION COPY: Not to be used in class.
Notice that the cells referenced are B9, C9, and D9 in the Sides sheet.
4. Double-click the first reference (the one to B9) to go to that cell:

Notice the values of B9, C9, and D9 are 13, 2, and 11. It turns out a triangle cannot be made
from sides with those values:

5. Fix this by changing the value of C9 to 5.


6. Return to the Formulas sheet and notice that the values of B9 and C9 are no longer 0.0.
7. Remove the arrows by clicking Remove Arrows in the Formula Auditing group on the
Formulas tab:

Note that when you trace precedents of an aggregate function, the referenced cell range will get a solid
blue outline:

94 | LESSON 3: Auditing Workbooks


EVALUATION COPY: Not to be used in class.
Precedents and Dependents in Different Workbooks

Formulas can reference cells in other workbooks. You can trace precedents and dependents to
those workbooks, but to do so, you must first open those workbooks.

LESSON 3: Auditing Workbooks | 95


EVALUATION COPY: Not to be used in class.
Exercise 4: Tracing Precedents and
Dependents Practice
5 to 15 minutes
In this exercise, you will work in the Net Income sheet of LemonadeStand_AuditingFormulas.xlsx
from your excel-365-auditing/Exercises folder to practice tracing precedents and dependents.

1. Find the first-level precedents for cell B5.


2. Find the second-level precedents for cell B5.
3. Find the first-level precedents for cell B11.
4. Find the second-level precedents for cell B11.
5. Find the first-level dependents for cell B4.
6. Find the second-level dependents for cell B4.

96 | LESSON 3: Auditing Workbooks


EVALUATION COPY: Not to be used in class.
LESSON 3: Auditing Workbooks | 97
EVALUATION COPY: Not to be used in class.
Solution
1. The first-level precedents for cell B5 are cells B3:B4. To figure this out:
A. Select cell B5.
B. On the Formulas tab, in the Formula Auditing group, click the Trace Precedents
command.
C. The precedent cells are indicated by the blue outline surrounding the cell range:

2. The second-level precedents for cell B5 are cells B12 and B13 in the Revenue sheet. To figure
this out:
A. Click Trace Precedents again.
B. Double-click one of the dashed lines leading to the sheet icons to open the Go To
dialog showing the sheet and cell:

C. Double-click the other line to show the other precedent cell.


Remove the arrows showing the precedents for cell B5 by clicking Remove Arrows in the
Formula Auditing group on the Formulas tab.

98 | LESSON 3: Auditing Workbooks


EVALUATION COPY: Not to be used in class.
3. The first-level precedents for cell B11 are cells B5 and B10. To figure this out:
A. Select cell B11.
B. On the Formulas tab, in the Formula Auditing group, click the Trace Precedents
command.
C. The precedent cells are indicated by the blue dots on the arrow:

4. The second-level precedents for cell B11 are cells B3:B4 and cells B7:B9. To figure this out:
A. Click Trace Precedents again.
B. The precedent cells are indicated by the blue outlines surrounding the cell ranges:

Remove the arrows showing the precedents for cell B11 by clicking Remove Arrows in the
Formula Auditing group on the Formulas tab.

LESSON 3: Auditing Workbooks | 99


EVALUATION COPY: Not to be used in class.
5. The first-level dependent for cell B4 is cell B5. To figure this out:
A. Select cell B4.
B. On the Formulas tab, in the Formula Auditing group, click the Trace Dependents
command.
C. The dependent cell is indicated by the blue arrow head:

6. The second-level dependents for cell B4 are cells B8, B9, B11, C8, D8, and E8. To figure
this out:
A. Click Trace Dependents again.
B. The dependent cells are indicated by the blue arrow heads:

Remove the arrows by clicking Remove Arrows.

100 | LESSON 3: Auditing Workbooks


EVALUATION COPY: Not to be used in class.
EVALUATION COPY: Not to be used in class.

3.3. Watch Window


The Watch Window is a feature that allows you to keep formulas that you need to view in sight, so
that you don’t have to jump around a workbook to check on them. For example, remember the “triangle”
we tried to make earlier in this lesson with sides of 11, 2, and 13. Again, a triangle cannot be made
from sides with those values:

We fixed that one, but what’s to prevent another such “triangle” from sneaking into our workbook.
After all, we enter the side lengths in one worksheet, but the formulas calculating the height and area
are in another. If a change we make results in a triangle with a height and area of 0.0, we could easily
miss it. The Watch Window can help us keep an eye on those formulas and their results.

To use the Watch Window:

1. Open the Formulas sheet of excel365-auditing/Demos/Triangles.xlsx.


2. Select cells B2:B11, which are the cells with the formula calculating the areas of the triangles:

3. Click Watch Window on the Formula Auditing group on the Formulas tab:

LESSON 3: Auditing Workbooks | 101


EVALUATION COPY: Not to be used in class.
4. Click the Add Watch button in the Watch Window:

5. Verify that Excel chose the right cells to watch and then click Add:

Your watches will be added to the Watch Window.


6. You can dock the Watch Window top, left, bottom, or right of the sheet by dragging it slowly
over one of those edges:

102 | LESSON 3: Auditing Workbooks


EVALUATION COPY: Not to be used in class.
Here we have docked ours on the bottom and sorted by Value, by double-clicking the Value
header:

Notice the Watch Window shows the Book, Sheet, Name (if there is one), Cell, Value, and
Formula for each watch.
7. Now, go to the Sides sheet. Notice the Watch Window remains open, so you can continue
to watch those formulas.

LESSON 3: Auditing Workbooks | 103


EVALUATION COPY: Not to be used in class.
8. Change the value of cell C9 back to 2 and notice that one of the values in the Watch Window
changes to 0.0:

9. Depending on how big your window is and how many formulas you’re watching, you may
need to scroll to look for issues. Or, in our case, since we’re specifically looking for 0.0 values,
we can just re-sort the Watch Window by Value to make any 0.0 values rise to the top.

If you want to watch more cells, just click the Add Watch… button in the Watch Window.

When you have watches in an open workbook, all other open workbooks will show those watches too.
This can be useful when the workbooks are linked in some way, but it can be distracting if you’re
working on two unrelated workbooks. If you don’t want to see watches from a different workbook,
you can either close the Watch Window or close the workbook with the watches.

EVALUATION COPY: Not to be used in class.

3.4. Evaluating Formulas


The Evaluate Formula dialog shows you step-by-step how a formula will be evaluated.

To see how it works:

104 | LESSON 3: Auditing Workbooks


EVALUATION COPY: Not to be used in class.
1. Open a new workbook.
2. In cell A1, enter the following formula: =7+3*5
3. In cell A2, enter the following formula: =(7+3)*5
4. Select cell A1.
5. On the Formulas tab, in the Formula Auditing group, click Evaluate Formula:

6. The Evaluate Formula dialog will open:

Notice that 3*5 is underlined. That indicates that that is the next part of the formula that
will be evaluated.
7. Click the Evaluate button to evaluate the underlined part of the formula. The formula will
change to 7+15:

Notice that the 15 is italicized. That indicates that that is the part of the formula that was just
evaluated.
8. Click Evaluate again and the formula will change to 22, which is the final value. To run
through the evaluation again, click the Restart button.

LESSON 3: Auditing Workbooks | 105


EVALUATION COPY: Not to be used in class.
9. Let’s run through it again with the next formula. Close the dialog.
10. Select cell A2.
11. On the Formulas tab, in the Formula Auditing group, click Evaluate Formula.
12. The Evaluate Formula dialog will open:

Notice that 7+3 is underlined. That indicates that that is the next part of the formula that
will be evaluated.
13. Click the Evaluate button to evaluate the underlined part of the formula. The formula will
change to (10)*5:

Notice that the 10 is italicized and (10) is underlined. That indicates that 10 is the part of
the formula that was just evaluated and (10) is the next part of the formula that will be
evaluated.
14. Click Evaluate again and the formula will change to 10*5.
15. Click Evaluate again and the formula will change to 50, which is the final value.

Now that you have seen the basic functionality, let’s look at a more complex formula, one that references
other cells.

1. Open the Sides sheet of excel365-auditing/Demos/Triangles.xlsx.


2. Select cell F2, which contains this formula: =AND(B2=C2,C2=D2).
3. On the Formulas tab, in the Formula Auditing group, click Evaluate Formula.
4. The Evaluate Formula dialog will open:

Notice that B2 is underlined. That indicates that that is the next part of the formula that will
be evaluated. But don’t evaluate it yet…

106 | LESSON 3: Auditing Workbooks


EVALUATION COPY: Not to be used in class.
5. Instead of clicking the Evaluate button as you’ve done before, click the Step In button. This
gives you a preview of what the referenced cell contains:

6. Click Step Out to get back to the formula.


7. Continue evaluating using whatever combination of Evaluate and stepping in and out that
you like. This formula will evaluate as follows:
AND(B2=C2,C2=D2)

AND(4=C2,C2=D2)

AND(4=3,C2=D2)

AND(FALSE,C2=D2)

AND(FALSE,3=D2)

AND(FALSE,3=5)

AND(FALSE,FALSE)

FALSE

The Evaluate Formula dialog can be incredibly helpful when trying to figure out how a formula works
or why it doesn’t work as you think it should.

Another trick, which we have shown you before, that makes a formula easier to read is to copy and
paste a complex formula into a text editor and then break it across lines, like this:

=AND(B2=C2,C2=D2)

LESSON 3: Auditing Workbooks | 107


EVALUATION COPY: Not to be used in class.
=AND(
B2=C2,
C2=D2
)

Here’s another example with the more complex formula we use to calculate if a triangle is a right
triangle:

=IFS(MAX(B2:D2)=B2,B2=SQRT(C2^2+D2^2),MAX(B2:D2)=C2,C2=SQRT(B2^2+D2^2),MAX(B2:D2)=D2,D2=SQRT(C2^2+B2^2))

=IFS(
MAX(B2:D2)=B2,
B2=SQRT(C2^2+D2^2),
MAX(B2:D2)=C2,
C2=SQRT(B2^2+D2^2),
MAX(B2:D2)=D2,
D2=SQRT(C2^2+B2^2)
)

And here is the formula used to calculate the area of the triangles:

=LET(a,Sides!B2,b,Sides!C2,c,Sides!D2,p,(a+b+c)/2,SQRT(p*(p-a)*(p-b)*(p-c)))

=LET(
a,Sides!B2,
b,Sides!C2,
c,Sides!D2,
p,(a+b+c)/2,
SQRT(p*(p-a)*(p-b)*(p-c))
)

Note that we didn’t say this trick makes those formulas easy to read; we just said it makes them easier
to read.

EVALUATION COPY: Not to be used in class.

108 | LESSON 3: Auditing Workbooks


EVALUATION COPY: Not to be used in class.
3.5. Error Checking
Excel tries to help you identify problems with formulas as they occur. Let’s look at some examples:

3.5.1. Typos
1. Open a new workbook.
2. In cell A1, enter 1.
3. In cell B1, enter 2.
4. In cell C1, enter =1A+1B. Note that the formula should be =A1+B1, but we want you to
intentionally enter it wrong.
5. When you press Tab or Enter, Excel will pop up a dialog letting you know it found a typo
and suggesting a correction:

6. To accept the correction, click Yes.


7. If you reject it, Excel will pop up another dialog telling you that the formula has problems
and providing a little coaching. When you close that dialog, focus will be placed back on the
formula.

3.5.2. Inconsistencies
1. Continue in the same workbook.
2. In cell A2, enter 2.
3. In cell B2, enter 3.

LESSON 3: Auditing Workbooks | 109


EVALUATION COPY: Not to be used in class.
4. In cell C2, enter =A2+B2.
5. Select cells A1:C2, click the square handle on the bottom right of the selection and drag down
to row 10:

6. Select cell C5 and change the formula to =A5-B5.


7. Excel recognizes that this formula is inconsistent with the other formulas in the column. To
call attention to this, it put a small green triangle in the upper left of the cell. When you select
the cell, you get a warning button, which you can click to get options for addressing the issue:

8. Click Help on this Error. This will open the Help pane with troubleshooting steps:

110 | LESSON 3: Auditing Workbooks


EVALUATION COPY: Not to be used in class.
These steps aren’t new to you (we have covered some of them in this lesson), but having them
all listed there as a troubleshooting guide is pretty handy!

Often you can catch errors as they arise, but you may find yourself with the need to audit a large
workbook. Rather than going sheet by sheet looking for the green arrows on the cells, you can run
through all the errors using Excel’s Error Checking dialog. To open that, click Error Checking in the
Formula Auditing group of the Formulas tab:

LESSON 3: Auditing Workbooks | 111


EVALUATION COPY: Not to be used in class.
You can then advance through correcting one error at a time using the Previous and Next buttons:

Conclusion
In this lesson, you learned to inspect workbooks for compatibility and accessibility issues, to audit
formulas, to trace precedents and dependents to determine how cells depend on each other, to use the
Watch Window to keep and eye on formulas, to evaluate formulas, and to check a workbook for errors.

112 | LESSON 3: Auditing Workbooks


EVALUATION COPY: Not to be used in class.
LESSON 4
Data Tools
EVALUATION COPY: Not to be used in class.

Topics Covered

Importing Data from online source.

Converting text to columns.

Data validation.

Consolidating data from different ranges.

Goal Seek.

Introduction
Data Tools in Microsoft Excel are simply tools that make it easy to manipulate data. Some of them
are intended to save you time by extracting or joining data and others perform complex calculations.
This lesson covers the most commonly used Data Tools.

EVALUATION COPY: Not to be used in class.

4.1. Importing Data from Online Source


When data you need is stored online, you can import that data using the features built in to Excel 365:
Data > Get Data > From Online Services:

LESSON 4: Data Tools | 113


EVALUATION COPY: Not to be used in class.
EVALUATION COPY: Not to be used in class.

4.2. Converting Text to Columns


If you have a list of data in which all the information appears in one column, you can use the Text to
Columns command to convert the data to multiple columns. This is generally much easier than retyping
the data!

114 | LESSON 4: Data Tools


EVALUATION COPY: Not to be used in class.
Follow Along

If you would like to follow along with the examples in this section, which we recommend doing,
open the TextToColumns tab of excel365-data-tools/Demos/Data.xlsx.

You may see the following warning below the toolbar:

That’s because the Home Runs tab is using external data. You can safely click Enable Content
or just ignore the warning.

To convert text to columns:

1. Select the column that holds the text you want to convert into multiple columns.
2. On the Data tab, in the Data Tools group, click the Text to Columns command:

3. In the Convert Text to Columns Wizard - Step 1 of 3 dialog, select either Delimited (if
your data is separated by commas, tabs, spaces, or some common character) or Fixed Width
(if your data contains a certain number of characters in each field). You will almost always
select Delimited in this step. Click Next:

LESSON 4: Data Tools | 115


EVALUATION COPY: Not to be used in class.
4. In the Convert Text to Columns Wizard - Step 2 of 3 dialog, select the Delimiters (assuming
you selected Delimited in the prior step). If you aren’t sure what to select, you can select and
deselect the options and see the results in the Data preview. Note that you split on multiple
delimiters and you can add your own delimiter in the Other field. After making your
selection(s), click Next:

116 | LESSON 4: Data Tools


EVALUATION COPY: Not to be used in class.
A. Check the Treat consecutive delimiters as one if you don’t want to create extra
columns when two or more delimiters are next to each other. Whether this is what
you want will depend on the data. Sometimes comma- or tab-delimited text will
have two delimiters in a row to indicate that a blank value should be placed between
them. For example, consider the text we are converting:

Wilson,Phillips,Hold On
Roxette,,It Must Have Been Love
Sinéad,O'Connor,Nothing Compares 2 U
Madonna,,Vogue
Mariah,Carey,Vision of Love

Roxette and Madonna don’t have last names. If the consecutive commas were treated
as one, then their songs would go in the last name column. So, we don’t want to
treat them as one. In other cases, you’ll have data that has one or more spaces between
each column, but the multiple spaces don’t indicate a separation of content. In those
cases, you will want to treat the consecutive delimiters as one.

5. In the Convert Text to Columns Wizard - Step 3 of 3 dialog, you can select the data format
for each column or you can elect not to import a column. Simply select the column under

LESSON 4: Data Tools | 117


EVALUATION COPY: Not to be used in class.
Data preview and then select the Column data format above. In this step, you also specify
where you want the data to show up (its Destination). After you make your selections, click
Finish:

The result (after adjusting the width of the columns):

118 | LESSON 4: Data Tools


EVALUATION COPY: Not to be used in class.
Exercise 5: Converting Text to Columns
10 to 20 minutes
In this exercise, you will practice converting text to columns.

1. Open TextToColumns.xlsx from your excel365-data-tools/Exercises folder.


2. In the Presidents sheet, convert the text in column A to three columns: first name, last name,
dates in office.
3. In the Capitols sheet, convert the text in column A to two columns: city and state. Put the
converted data into columns C and D.
4. In the Contact Information sheet, convert the text in column A to five columns: name,
address, city, state, and zip code. (Hint: You will need to do this in two steps.)
5. In the Phone Numbers sheet, separate the area codes by converting the text in column A to
three columns.

LESSON 4: Data Tools | 119


EVALUATION COPY: Not to be used in class.
Solution
The first three steps for each of these are the same:

1. Select the data to split.


2. On the Data tab, in the Data Tools group, click the Text to Columns command.
3. In the Convert Text to Columns Wizard - Step 1 of 3 dialog, select Delimited and click
Next.

Presidents Sheet
1. In step 2 of the Convert Text to Columns Wizard dialog, check Space for the delimiter,
click Next.
2. In step 3, click Finish.

Capitols Sheet
1. In step 2 of the Convert Text to Columns Wizard dialog, check Comma for the delimiter,
click Next.
2. In step 3, set the Destination to cell C1 and click Finish.

Contact Information Sheet


1. In step 2 of the Convert Text to Columns Wizard dialog, check Comma for the delimiter,
click Next.
2. In step 3, click Finish.
3. Select column D and click the Text to Columns command.
4. In step 1 of the Convert Text to Columns Wizard dialog, select Delimited and click Next.
5. In step 2 of the Convert Text to Columns Wizard dialog, check Space for the delimiter,
click Next.
6. In step 3, click Finish.

Note that this will create an extra blank cell between the city and the state abbreviation. When we split
the text on commas, the final cell had a leading space before the state abbreviation. Excel treats that
leading space as a delimiter, so it adds an empty cell before it. You can just delete the empty column.

120 | LESSON 4: Data Tools


EVALUATION COPY: Not to be used in class.
Phone Numbers Sheet

1. In step 2 of the Convert Text to Columns Wizard dialog, check Other, enter a dash (-).
2. In step 3, click Finish.

EVALUATION COPY: Not to be used in class.

4.3. Importing Files


You may need to import data from other applications. Data can be imported from other spreadsheet
applications and from database applications, but most of the time when you need to import data into
Excel, it will be from a delimited text file. When you do need to import data from another application,
it is usually easiest to first convert it from the other application to a text file and then import it into
Excel as a text file.

The process of importing text files is similar to the process of converting text to columns. To import
a text file into Microsoft Excel:

1. Select File, then Open, then Browse:

LESSON 4: Data Tools | 121


EVALUATION COPY: Not to be used in class.
2. Navigate to the location of the file and in the Open dialog, in the file type drop-down box,
select Text Files:

122 | LESSON 4: Data Tools


EVALUATION COPY: Not to be used in class.
3. Select the text file you want to import and click Open:

LESSON 4: Data Tools | 123


EVALUATION COPY: Not to be used in class.
4. In step 1 of the Text Import Wizard:
A. Select either Delimited (if your data is separated by commas, tabs, spaces, or some
common character) or Fixed Width (if your data contains a certain number of
characters in each field). You will usually select Delimited in this step.
B. Check My data has headers if it does.
Click Next:

124 | LESSON 4: Data Tools


EVALUATION COPY: Not to be used in class.
5. In step 2 of the Text Import Wizard, select the Delimiters (assuming you selected Delimited
in the prior step). If you aren’t sure what to select, you can select and deselect the options and
see the results in the Data preview. After making your selection(s), click Next:

LESSON 4: Data Tools | 125


EVALUATION COPY: Not to be used in class.
6. In step 3 of the Text Import Wizard, select the data format for each column or you can elect
not to import a column. Simply select the column under Data preview and then select the
Column data format above. When you are done, click Finish:

126 | LESSON 4: Data Tools


EVALUATION COPY: Not to be used in class.
LESSON 4: Data Tools | 127
EVALUATION COPY: Not to be used in class.
Exercise 6: Importing Text Files
5 to 15 minutes
In this exercise, you will practice importing text files into a Microsoft Excel workbook.

1. Use Microsoft Excel to import ContactInformation.txt from your excel365-data-


tools/Exercises folder.

2. Use Microsoft Excel to import Capitals.txt from your excel365-data-tools/Exercises


folder.

128 | LESSON 4: Data Tools


EVALUATION COPY: Not to be used in class.
LESSON 4: Data Tools | 129
EVALUATION COPY: Not to be used in class.
Solution

1. To import ContactInformation.txt from your excel365-data-tools/Exercises


folder:
A. Open Microsoft Excel.
B. Select File, then Open, then Browse.
C. In the Open dialog, navigate to your excel365-data-tools/Exercises folder
and in the file type drop-down box, select Text Files.
D. Select ContactInformation.txt and click Open.
E. In step 1 of the Text Import Wizard, select Delimited and click Next.
F. In step 2 of the Text Import Wizard, select Tab and click Next.
G. In step 3 of the Text Import Wizard, click Finish.

2. To import Capitals.txt from your excel365-data-tools/Exercises folder:


A. Select File, then Open, then Browse.
B. In the Open dialog, navigate to your excel365-data-tools/Exercises folder
and in the file type drop-down box, select Text Files.
C. Select Capitals.txt and click Open.
D. In step 1 of the Text Import Wizard, select Delimited and click Next.
E. In step 2 of the Text Import Wizard, select Comma and click Next.
F. In step 3 of the Text Import Wizard, click Finish.

EVALUATION COPY: Not to be used in class.

4.4. Linking to External Data


In Excel, you can use the options in the Get External Data group of the Data tab to link to data in
different sources, such as text files, databases, and pages on the Internet. This is incredibly powerful
and beyond the scope of this course, but to get a feel for what’s possible:

1. Open a new workbook.


2. On the Data tab in the Get & Transform Data group, click From Web:

130 | LESSON 4: Data Tools


EVALUATION COPY: Not to be used in class.
3. Enter https://static.webucator.com/media/public/documents/hrleaders.html
in the From Web dialog:

Click OK.
4. In the Navigator dialog, select Table 0. Notice the table preview in the area on the right:

Click Load
5. A table will be created from the data. You can refresh this table in the Queries & Connections
pane by right-clicking the table name and selecting Refresh:

LESSON 4: Data Tools | 131


EVALUATION COPY: Not to be used in class.
This will make Excel return to the web page and pull down the data again.

Again, this just gives a you a feel for what is possible. See Microsoft’s documentation on Power
Query in Excel (https://support.microsoft.com/en-us/office/about-power-query-
in-excel-7104fbee-9e62-4cb9-a02e-5bfb1a6c536a) to learn more.

EVALUATION COPY: Not to be used in class.

4.5. Controlling Calculation Options


By default, Excel updates calculations automatically. This is generally the behavior you will want, but
if you are working on huge workbooks with interconnected data, automatic calculations could slow
your workbook down.

To change your settings so that all calculations must always be manually run:

1. On the File menu tab, select Options.


2. In the Excel Options dialog, select Formulas on the left.
3. Under Calculation options, select Manual:

132 | LESSON 4: Data Tools


EVALUATION COPY: Not to be used in class.
Click OK to save the changes.

Updating Calculations
After doing this, you will need to manually update calculations using the options in the Calculation
group of the Formulas tab:

To update calculations for the entire workbook, click Calculate Now or press F9.
To update calculations for just the current worksheet, click Calculate Sheet or press Shift+F9.

Again, we don’t recommend you change this setting unless you find your workbook is not responding
quickly. In that case, we recommend you try changing the setting on just that workbook.

To turn off automatic calculations for the current workbook, select Calculation Options > Manual
from the Calculation group on the Formulas tab:

LESSON 4: Data Tools | 133


EVALUATION COPY: Not to be used in class.
EVALUATION COPY: Not to be used in class.

4.6. Data Validation


To protect against incorrect data entry, you can use data validation to restrict the type of data that can
be entered into a cell. You can choose to allow only certain types of data, such as whole numbers or
dates, or you can allow only items from a specified list.

To apply data entry restrictions:

1. Select the cells for which to verify data.


2. On the Data tab, in the Data Tools group, click the Data Validation command:

3. In the Data Validation dialog:

134 | LESSON 4: Data Tools


EVALUATION COPY: Not to be used in class.
A. On the Settings tab, choose which types of values to allow:

B. Note that when you select a type of value to allow, the Data options change
accordingly. Set the criteria (e.g., between, greater or less than, equal to, Source,
etc.) for those values:

LESSON 4: Data Tools | 135


EVALUATION COPY: Not to be used in class.
You can type the criteria or select cells in a worksheet.
If you are only allowing values from a list, you must indicate the range from
which to get the list:

136 | LESSON 4: Data Tools


EVALUATION COPY: Not to be used in class.
When entering the data, users will get a drop-down list with options to
select:

C. If you want to, you can enter a message telling the person entering the data what the
restrictions are. They will see this message when selecting any of the cells for which
the restriction has been set. To enter this message, select the Input Message tab,
make sure that Show input message when cell is selected is checked, and enter the
Title and Input message:

LESSON 4: Data Tools | 137


EVALUATION COPY: Not to be used in class.
The message will appear like this when the user selects the cell:

D. You also have the option of entering an error alert that pops up when invalid data
is entered. To enter an error alert, select the Error Alert tab, make sure that Show
error alert after invalid data is entered is checked, and enter the Style (choose to
stop the person from entering the data, warn them that this data does not meet the
criteria, or simply let them know), Title, and Error message:

138 | LESSON 4: Data Tools


EVALUATION COPY: Not to be used in class.
If the user enters bad data, the error will pop up in a modal dialog:

E. Click OK when you’re finished creating the validation rules.

LESSON 4: Data Tools | 139


EVALUATION COPY: Not to be used in class.
Exercise 7: Using Data Validation
15 to 25 minutes
In this exercise, you will practice using Data Validation to restrict the data that can be entered in
specific cells in a worksheet.

1. Open DataValidation.xlsx from your excel365-data-tools/Exercises folder.


2. Use the Data Validation command to restrict the data that can be entered into cells C2:C17
to the list of salespeople on the Salespeople sheet.
3. Use Data Validation to restrict the data that can be entered into cells D2:D17 to a date in
2023.
4. Use Data Validation to restrict the data that can be entered into cells E2:E17 to the list of
territories on the Territories sheet. Enter an Input Message and an Error Alert to help the
person entering data.

140 | LESSON 4: Data Tools


EVALUATION COPY: Not to be used in class.
LESSON 4: Data Tools | 141
EVALUATION COPY: Not to be used in class.
Solution
The first two steps for each of these are the same:

1. Select the cells for which to set the validation rule.


2. On the Data tab, in the Data Tools group, click the Data Validation command:

To restrict the data that can be entered into cells C2:C17 to the list of salespeople on the Salespeople
sheet:

1. In the Data Validation dialog, on the Settings tab, under Allow, select List:

142 | LESSON 4: Data Tools


EVALUATION COPY: Not to be used in class.
2. Click the up arrow to the right of the Source data entry box to collapse the Data Validation
dialog. Navigate to the sheet named Salespeople, select cells A2:A6, and then click the down
arrow at the right of the collapsed Data Validation dialog to restore it:

3. Back in the main Data Validation dialog, click OK.


4. Note that selecting any of cells C2:C17 in the Sales sheet opens a drop-down list from which
you can select one of the allowed entries:

LESSON 4: Data Tools | 143


EVALUATION COPY: Not to be used in class.
To restrict the data that can be entered into cells D2:D17 to a date in 2023:

1. In the Data Validation dialog, on the Settings tab, under Allow, select Date. Under Data,
select between. Under Start date, enter 1/1/2023 and under End date, enter 12/31/2023.
Click OK:

2. Only dates in 2023 are allowed in cells D2:D17 now. Entering another date will result in an
error message:

144 | LESSON 4: Data Tools


EVALUATION COPY: Not to be used in class.
To restrict the data that can be entered into cells E2:E17 to the list of territories on the Territories
sheet, and to enter an Input Message and an Error Alert:

1. In the Data Validation dialog, on the Settings tab, under Allow, select List:

LESSON 4: Data Tools | 145


EVALUATION COPY: Not to be used in class.
2. Click the up arrow to the right of the Source data entry box to collapse the Data Validation
dialog. Navigate to the sheet named Territories, select cells A2:A6, and then click the down
arrow at the right of the collapsed Data Validation dialog to restore it:

3. Select the Input Message tab and enter a Title and an Input message:

4. Select the Error Alert tab, enter a Title and an Error message, and then click OK:

146 | LESSON 4: Data Tools


EVALUATION COPY: Not to be used in class.
5. Note that selecting any of the cells E2:E17 in the Sales sheet opens a drop-down list from
which you can select one of the allowed entries. In addition, your Input Message is displayed
and entering an invalid entry results in your Error Message popping up:

LESSON 4: Data Tools | 147


EVALUATION COPY: Not to be used in class.
EVALUATION COPY: Not to be used in class.

4.7. Consolidating Data


Use the Consolidate command to join values from a number of different ranges into one new range.
You can use Consolidate to sum the values in other ranges, to get an average of the values, to find the
min or max value, and more.

To consolidate data from different ranges:

1. On the Data tab, in the Data Tools group, click the Consolidate command:

Note that, if your Excel window is smaller, you may only see the icon:

2. In the Consolidate dialog:


A. Select the Function to use.
B. Select the first series of cells you want to consolidate.
C. Click Add to add the series of cells to the All references box.
D. Repeat the previous two steps until you have selected all series of cells that you want
to consolidate.
E. Click OK:

148 | LESSON 4: Data Tools


EVALUATION COPY: Not to be used in class.
LESSON 4: Data Tools | 149
EVALUATION COPY: Not to be used in class.
Exercise 8: Consolidating Data
15 to 25 minutes
In this exercise, you will consolidate students’ grades on four different exams to show their average,
lowest, and highest grades on a summary sheet:

1. Open Consolidate.xlsx from your excel365-data-tools/Exercises folder.


2. Students’ grades on four exams are stored on the first four sheets in this workbook. Use the
Consolidate command to show the average, lowest, and highest grade for each student on
the sheet named Consolidate.

150 | LESSON 4: Data Tools


EVALUATION COPY: Not to be used in class.
LESSON 4: Data Tools | 151
EVALUATION COPY: Not to be used in class.
Solution
The first two steps for each of these are the same:

1. On the Consolidate sheet, select the specified cells.


2. On the Data tab, in the Data Tools group, click the Consolidate command:

To show the average grade for each student:

1. In the Consolidate dialog, set the Function to Average.


2. Click in the References field and go to the Exam 1 sheet and select cells B2:B11. Then, click
Add:

Don’t close the dialog!


3. Click the Exam 2 sheet. Cells B2:B11 should already be selected, but if they’re not, select
them and repeat the same steps as you did for Exam 1.
4. Repeat the same steps for Exam 3 and Exam 4.

152 | LESSON 4: Data Tools


EVALUATION COPY: Not to be used in class.
5. Now that all four series of data have been added to the All references box, click OK:

To show the lowest grade for each student:

1. In the Consolidate dialog, set the Function to Min. Note that the series of data from the
prior exercise already appears in the All references box. Were we using different data, you
could delete these references and add others. As we are using the same data in this exercise,
simply click OK:

LESSON 4: Data Tools | 153


EVALUATION COPY: Not to be used in class.
To show the highest grade for each student:

1. In the Consolidate dialog, set the Function to Max. Once again, as we are using the same
data as in the prior exercises and it already appears in the All references box, simply click OK:

154 | LESSON 4: Data Tools


EVALUATION COPY: Not to be used in class.
EVALUATION COPY: Not to be used in class.

4.8. What-If Analysis


Goal Seek and Scenario Manager are two tools that help you see what must happen for something
else to happen or what will happen under certain conditions. Both tools are found on the Data tab, in
the Forecast group, under What-If Analysis:

4.8.1. Goal Seek


If you know the result of a formula but not the value of a specific variable on which the formula depends,
you can use Goal Seek to adjust the variable to display the desired value. Goal Seek can only adjust
one variable in a formula, so if a formula depends on more than one variable, you will need to decide
which variable to adjust.

To use Goal Seek:

1. On the Data tab, in the Forecast group, click the What-If-Analysis command and select
Goal Seek.
2. In the Goal Seek dialog:
A. In the Set cell box, enter the cell for which you know the result (if you selected this
cell before clicking Goal Seek, then it is already filled in).
B. In the To value box, enter the value for the cell above.
C. In the By changing cell box, enter the cell to adjust in order to obtain the value.
(Remember, this cell must be related via a formula to the cell above or else changing
one won’t impact the other.)

LESSON 4: Data Tools | 155


EVALUATION COPY: Not to be used in class.
D. Click OK:

3. In the Goal Seek Status dialog, after the calculation has completed, click OK to accept the
change or Cancel to reject it:

4.8.2. The Scenario Manager


To manage what-if models so you can quickly access them, you can use the Scenario Manager.

To use the Scenario Manager:

1. On the Data tab, in the Forecast group, click the What-If-Analysis command and select
Scenario Manager.
2. In the Scenario Manager dialog, click Add. Type a name for the scenario in the Scenario
name text box, and in the Changing cells text box, type the names of the cells you want to
change and click OK:

156 | LESSON 4: Data Tools


EVALUATION COPY: Not to be used in class.
3. In the Scenario Values dialog that appears, type the values for the changing cells (or select
the cells in the worksheet):

LESSON 4: Data Tools | 157


EVALUATION COPY: Not to be used in class.
4. Click Add to add more scenarios and click OK when you are done.

After adding multiple scenarios, you can open the Scenario Manager and try different ones by
double-clicking them:

158 | LESSON 4: Data Tools


EVALUATION COPY: Not to be used in class.
LESSON 4: Data Tools | 159
EVALUATION COPY: Not to be used in class.
Exercise 9: Using Goal Seek
15 to 25 minutes
In this exercise, you will practice using Goal Seek to adjust the number of periods it will take to pay
off a loan based on varied payments and to figure out what grade a student needs on their final exam
to achieve a target grade for a course.

1. Open GoalSeek.xlsx from your excel365-data-tools/Exercises folder.


2. The Loans worksheet contains information on four loans. The Payment is calculated via the
PMT formula. Use Goal Seek to determine:

A. How many months (periods) it will take to pay off your boat if you can only pay
$100 per month.
B. How many months (periods) it will take to pay off your first car if you can only pay
$250 per month.
C. How many months (periods) it will take to pay off your second car if you can pay
$200 per month.
D. How many months (periods) it will take to pay off your house if you can pay $1,000
per month.

3. The Grades worksheet contains scores for a number of students on four exams, an empty
column where the score for the fifth exam will go, and a column showing the average score
on all exams. Use Goal Seek to figure out:
A. What grade Babe Ruth needs to get on the last exam to raise his final grade to 90.
B. What grade Barry Bonds needs to get on the last exam to achieve a passing grade
(65).
C. What the lowest grade Cal Ripken can get on the last exam to finish with a final
grade of 90.

160 | LESSON 4: Data Tools


EVALUATION COPY: Not to be used in class.
LESSON 4: Data Tools | 161
EVALUATION COPY: Not to be used in class.
Solution
Each of the solutions starts by selecting What-If-Analysis > Goal Seek in the Forecast group on the
Data tab:

To determine how many months it will take to pay off your boat if you can only pay $100 per month:

1. In the Goal Seek dialog:


A. In the Set cell box, enter cell B2.
B. In the To value box, enter -100.
C. In the By changing cell box, enter D2:
D. Click OK.

2. In the Goal Seek Status dialog, after the calculation has completed, click OK to accept the
change:
3. The correct result is 63 months.

To determine how many months it will take to pay off your first car if you can only pay $250 per
month:

1. In the Goal Seek dialog:


A. In the Set cell box, enter cell B3.
B. In the To value box, enter -250.
C. In the By changing cell box, enter D3:
D. Click OK.

2. In the Goal Seek Status dialog, after the calculation has completed, click OK to accept the
change:
3. The correct result is 148 months.

162 | LESSON 4: Data Tools


EVALUATION COPY: Not to be used in class.
To determine how many months it will take to pay off your second car if you can pay $200 per month:

1. In the Goal Seek dialog:


A. In the Set cell box, enter cell B4.
B. In the To value box, enter -200.
C. In the By changing cell box, enter D4:
D. Click OK.

2. In the Goal Seek Status dialog, after the calculation has completed, click OK to accept the
change:
3. The correct result is 42 months.

To determine how many months it will take to pay off your house if you can pay $1,000 per month:

1. In the Goal Seek dialog:


A. In the Set cell box, enter cell B5.
B. In the To value box, enter -1000.
C. In the By changing cell box, enter D5:
D. Click OK.

2. In the Goal Seek Status dialog, after the calculation has completed, click OK to accept the
change:
3. The correct result is 252 months.

To figure out what grade Babe Ruth needs to get to raise his final grade to 90, go to the Grades sheet
and then:

1. In the Goal Seek dialog:


A. In the Set cell box, enter cell G2.
B. In the To value box, enter 90.
C. In the By changing cell box, enter F2:
D. Click OK.

2. In the Goal Seek Status dialog, after the calculation has completed, click OK to accept the
change:
3. Babe Ruth needs a 100 on the final exam to raise his average to 90.

To figure out what grade Barry Bonds needs to get on the last exam to achieve a passing grade (65):

LESSON 4: Data Tools | 163


EVALUATION COPY: Not to be used in class.
1. On the Data tab, in the Forecast group, click the What-If-Analysis command and then click
Goal Seek:
2. In the Goal Seek dialog:
A. In the Set cell box, enter cell G8.
B. In the To value box, enter 65.
C. In the By changing cell box, enter F8:
D. Click OK.

3. In the Goal Seek Status dialog, after the calculation has completed, click OK to accept the
change:
4. Barry Bonds needs a 133 on the final exam to achieve a passing grade. Poor Barry Bonds.

To figure out the lowest grade Cal Ripken can get on the last exam to finish with a final grade of 90:

1. On the Data tab, in the Forecast group, click the What-If-Analysis command and then click
Goal Seek:
2. In the Goal Seek dialog:
A. In the Set cell box, enter cell G9.
B. In the To value box, enter 90.
C. In the By changing cell box, enter F9:
D. Click OK.

3. In the Goal Seek Status dialog, after the calculation has completed, click OK to accept the
change:
4. Cal Ripken needs at least a 79 on the final exam to finish with a final grade of 90.

Conclusion
In this lesson, you learned the possibility to import data from an online source, to convert text to
columns, to use Data Validation to restrict the type of data that can be entered into a cell, to consolidate
data from a number of different ranges into one new range, and to use Goal Seek to figure out the
value to input to obtain a specific result.

164 | LESSON 4: Data Tools


EVALUATION COPY: Not to be used in class.
LESSON 5
Recording and Using Macros
EVALUATION COPY: Not to be used in class.

Topics Covered

Recording macros.

Running macros.

Editing macros (kind of).

Adding macros to the Quick Access Toolbar.

Introduction
A macro is a set of recorded actions. As you work with Excel, you may find that you repeat certain
operations frequently. Instead of performing each step of the operation every time, you can create a
macro that stores these steps. You can then run the macro to auto-run the steps for you, saving you
both time and effort.

EVALUATION COPY: Not to be used in class.

5.1. Recording Macros


To record a macro:

1. On the View tab, in the Macros group, click the Macros command:

LESSON 5: Recording and Using Macros | 165


EVALUATION COPY: Not to be used in class.
2. Click Record Macro:

3. In the Record Macro dialog:


A. Enter a Macro name. Choose a name that clearly identifies the macro. You cannot
use spaces.
B. Enter a Shortcut key. You will be able to run the macro using this shortcut key.
C. Choose where to store the macro. You will normally accept the default (This
Workbook).
D. Enter a Description. Briefly explain what the macro does.
E. Click OK:

166 | LESSON 5: Recording and Using Macros


EVALUATION COPY: Not to be used in class.
4. After clicking OK, every keystroke is recorded.
5. To stop recording, on the View tab, in the Macros group, click the Macros command and
then click Stop Recording:

5.1.1. Copy a Macro from Workbook to Workbook


You can copy macros to different workbooks. First, you need to ensure the Developer tab is active on
the Ribbon. To add it:

LESSON 5: Recording and Using Macros | 167


EVALUATION COPY: Not to be used in class.
1. Right-click the Ribbon and select Customize the Ribbon to bring up the Customize Ribbon
tab of the Excel Options dialog:

2. On the right, check the Developer checkbox and click OK:

Now you need to enable and copy the macros:

1. Select the Developer tab, and select Macro Security from the Code group:

168 | LESSON 5: Recording and Using Macros


EVALUATION COPY: Not to be used in class.
2. Under Macro Settings, select Enable all macros and click OK:

3. Open both the source and destination workbook.


4. Select the Developer tab, and select Visual Basic from the Code group:

LESSON 5: Recording and Using Macros | 169


EVALUATION COPY: Not to be used in class.
5. Note that in the Project Explorer there is one VBAProject for each open Excel workbook. In
the first VBAProject (the one in which you recorded the macro - "Book1" in the image below),
there is a Modules folder. Press Ctrl and drag the module from the source ("VBAProject
(Book1)" in the image below) to the destination workbook ("VBAProject (Book2)" in the
image below):

6. Close the Visual Basic window and save the workbook.

170 | LESSON 5: Recording and Using Macros


EVALUATION COPY: Not to be used in class.
Exercise 10: Recording a Macro
10 to 20 minutes
In this exercise, you will record a macro that adds a custom header and footer to a Microsoft Excel
workbook.

1. Open Macros.xlsx from your excel365-macros/Exercises folder.


2. Record a macro named CustomHF to add a custom header and footer to your workbook.
Specifically, the macro should:
A. Add the word “CONFIDENTIAL” in the center of the header.
B. Add the date on the right side of the header.
C. Add the page number to the center of the footer.

LESSON 5: Recording and Using Macros | 171


EVALUATION COPY: Not to be used in class.
Solution
1. On the View tab, in the Macros group, click the Macros command:

2. Click Record Macro:

3. In the Record Macro dialog:


A. Enter the Macro name of “CustomHF”.
B. Enter a Shortcut key.
C. Accept the default to store the macro in this workbook.
D. Enter a Description such as “Custom header and footer.”
E. Click OK:

172 | LESSON 5: Recording and Using Macros


EVALUATION COPY: Not to be used in class.
4. After clicking OK, every keystroke is recorded. Following are specific instructions:
A. Click File, then Print, and then Page Setup:

LESSON 5: Recording and Using Macros | 173


EVALUATION COPY: Not to be used in class.
B. Select the Header/Footer tab and then click Custom Header:

174 | LESSON 5: Recording and Using Macros


EVALUATION COPY: Not to be used in class.
C. Tab to or click in the Center section and type “CONFIDENTIAL”. Then tab to
or click in the Right section, click the Insert Date icon, and then click OK:

LESSON 5: Recording and Using Macros | 175


EVALUATION COPY: Not to be used in class.
D. Click Custom Footer:

176 | LESSON 5: Recording and Using Macros


EVALUATION COPY: Not to be used in class.
E. Tab to or click in the Center section, click the Insert Page Number icon, and then
click OK:

LESSON 5: Recording and Using Macros | 177


EVALUATION COPY: Not to be used in class.
F. You are now back in the Page Setup dialog. Click OK:

178 | LESSON 5: Recording and Using Macros


EVALUATION COPY: Not to be used in class.
G. On the View tab, in the Macros group, click the Macros command and then click
Stop Recording:

LESSON 5: Recording and Using Macros | 179


EVALUATION COPY: Not to be used in class.
EVALUATION COPY: Not to be used in class.

5.2. Running Macros


To run a macro:

1. On the View tab, in the Macros group, click the Macros command:

2. Click View Macros:

3. In the Macro dialog, choose the macro you want to run and click Run:

180 | LESSON 5: Recording and Using Macros


EVALUATION COPY: Not to be used in class.
Unless they are very large, macros run very fast, meaning that almost immediately after clicking Run
the macro will finish executing. If the macro doesn’t change anything that is readily visible, it may
seem as if nothing has happened.

Try this out in the Macros.xlsx spreadsheet in which you just created a macro. The Employees sheet
does not currently have a header or footer. Follow the instructions above to add a header and footer
using the macro you created in the last exercise.

Depending on your security settings, you may need to enable Macros. File > Options > Trust Center
> Macro Settings Note these settings are often configured by your organization as security policies are
often strict for good reason. See below.

EVALUATION COPY: Not to be used in class.

5.3. Editing Macros


If you need to make simple changes to a macro, you can do so using Microsoft Visual Basic for
Applications (VBA). For most Excel users, however, it is easier to record a new macro than to edit an

LESSON 5: Recording and Using Macros | 181


EVALUATION COPY: Not to be used in class.
existing macro when logic changes. To learn how to write and edit complicated macros, you should
take a course on VBA. If you make a minor typo or change your mind about a value that should have
been typed in - the process of editing (sort of) is a good one. Example: if you are creating column labels
and you make a typo "Mnoday" you can find in the code where "Mnoday" is and change it to "Monday".
The steps below briefly describe how to do this.

Using the VBA editor you may copy code from one macro script to another. This is helpful if you wish
to share your logic or need to add functionality form one macro to another.

To edit a macro:

1. On the View tab, in the Macros group, click the Macros command:

2. Click View Macros:

3. In the Macro dialog, choose the macro you want to change and click Edit to open the macro
in the Microsoft Visual Basic for Applications window:

182 | LESSON 5: Recording and Using Macros


EVALUATION COPY: Not to be used in class.
4. You can see and edit your code in the Microsoft Visual Basic for Applications window:

LESSON 5: Recording and Using Macros | 183


EVALUATION COPY: Not to be used in class.
Microsoft Visual Basic for Applications is a powerful programming language that can be used to make
major customizations to Microsoft Excel and other Microsoft Office applications. Editing code is far
beyond the scope of this class, but it’s fun to think about just how powerful Microsoft Excel is.

EVALUATION COPY: Not to be used in class.

5.4. Adding Macros to the Quick Access Toolbar


The reason to create a macro is to make it easier to complete a set of operations that you regularly
perform. Given this, it is likely that you need to run the macro frequently. To make it easy to do so,
you can add the macro to the Quick Access Toolbar.

To add a macro to the Quick Access Toolbar:

1. Click the Customize Quick Access Toolbar drop-down arrow:

2. Select More Commands:

184 | LESSON 5: Recording and Using Macros


EVALUATION COPY: Not to be used in class.
3. In the Excel Options dialog on the Quick Access Toolbar tab, from the Choose commands
from drop-down list, select Macros:

LESSON 5: Recording and Using Macros | 185


EVALUATION COPY: Not to be used in class.
4. Select the macro you want to add to the Quick Access Toolbar and click Add and then OK:

5. You can now see and run the macro on the Quick Access Toolbar:

186 | LESSON 5: Recording and Using Macros


EVALUATION COPY: Not to be used in class.
5.4.1. Managing Macro Security
When working with macros, it is important to maintain security, that is, ensure that no dangerous
code is going to be run.

To enable security when working with macros in Excel 365:

1. Enter Backstage view by selecting File > Options:

2. In the Excel Options dialog, select Customize Ribbon:

LESSON 5: Recording and Using Macros | 187


EVALUATION COPY: Not to be used in class.
3. Under Customize Ribbon, on the right, check the Developer check box and then click OK:

188 | LESSON 5: Recording and Using Macros


EVALUATION COPY: Not to be used in class.
4. Now, on the Developer tab, in the Code group, select Macro Security:

5. Use the options in the Trust Center dialog to set security options:

LESSON 5: Recording and Using Macros | 189


EVALUATION COPY: Not to be used in class.
190 | LESSON 5: Recording and Using Macros
EVALUATION COPY: Not to be used in class.
Exercise 11: Adding a Macro to the Quick
Access Toolbar
5 to 10 minutes
In this exercise, you will add a macro to the Quick Access Toolbar.

1. Open AddMacrosToQAT.xlsm from your excel365-macros/Exercises folder.


2. Add the macro named CustomHF to the Quick Access Toolbar.

LESSON 5: Recording and Using Macros | 191


EVALUATION COPY: Not to be used in class.
Solution
1. Click the Customize Quick Access Toolbar drop-down arrow:

2. Select More Commands:

3. In the Excel Options dialog on the Quick Access Toolbar tab, from the Choose commands
from drop-down list, select Macros:

192 | LESSON 5: Recording and Using Macros


EVALUATION COPY: Not to be used in class.
4. Select the macro named “CustomHF” to add it to the Quick Access Toolbar and click Add
and then OK:

5. You can now see and run the macro on the Quick Access Toolbar:

LESSON 5: Recording and Using Macros | 193


EVALUATION COPY: Not to be used in class.
Conclusion
In this lesson, you learned to record and run macros and how to add a macro to the Quick Access
Toolbar.

194 | LESSON 5: Recording and Using Macros


EVALUATION COPY: Not to be used in class.
LESSON 6
Working with Others
EVALUATION COPY: Not to be used in class.

Topics Covered

Comments and notes.

Password protection.

Marking a workbook final.

Introduction
In this lesson, you will learn to add comments and notes, to password protect a workbook, a worksheet,
and specific ranges in a worksheet, and to mark a workbook final.

EVALUATION COPY: Not to be used in class.

6.1. Comments and Notes


Follow Along

If you would like to follow along with the examples in this lesson, which we recommend doing,
open excel365-working-with-others/Demos/Collaborating.xlsx.

Comments are used to have threaded discussions with other people working on your workbook. Notes
are used to add a simple note to a cell. Other people collaborating with you on the workbook can
respond to your comments, but not to your notes.

LESSON 6: Working with Others | 195


EVALUATION COPY: Not to be used in class.
6.1.1. Comments
You can add comments to worksheets and manage them in Excel using the Comments group on the
Review tab of the Ribbon.

To add a comment in Excel:

1. Select the cell in which you want to add the comment.


2. From the Review tab, in the Comments group, select New Comment:

3. Type your comment:

Click the green paper airplane icon to post the comment.


4. You will notice that Excel alerts you to the fact that there is an inserted comment with a
magenta callout icon, which you can hover over to see and respond to the comment:

196 | LESSON 6: Working with Others


EVALUATION COPY: Not to be used in class.
5. The replies will show up in a thread:

In the upper right of the comment box, you have the cell reference (E1), a pencil icon for
editing the comment (if its your comment), and an ellipsis button (three dots) that opens up
two other options: one for deleting the thread and another for resolving it. A resolved thread
can no longer be replied to, but can be reopened:

LESSON 6: Working with Others | 197


EVALUATION COPY: Not to be used in class.
Comments Pane
You can delete and navigate through comments using the commands in the Comments group:

But it’s generally easier to use the Comments pane, which you open and close with the Show Comments
command:

198 | LESSON 6: Working with Others


EVALUATION COPY: Not to be used in class.
Selecting a comment in this pane will take you to the cell in the workbook where the comment was
made.

6.1.2. Notes
Notes are for providing information only. They cannot be replied to. Excel alerts you to the fact that
there is a note with a red triangle icon. When you select the cell, the note will pop up:

You can review and manage notes from the Notes command on the Review tab:

While you cannot include a note and a comment on the same cell, you can convert all notes to comments
using the Notes > Convert to Comments command shown in the preceding screenshot.

Older Versions of Office

Notes are new in Office 365. In older versions of Excel, comments behaved like notes. They
were not threaded as they are in 365.

LESSON 6: Working with Others | 199


EVALUATION COPY: Not to be used in class.
EVALUATION COPY: Not to be used in class.

6.2. Protecting Worksheets and Workbooks


By default, any person who can access a workbook can open and edit it. Excel offers numerous levels
of protection for workbooks and worksheets. The three most common ways to protect data in Excel
are:

1. Password protect a workbook. You can protect your workbook with a password, thereby
preventing people who do not know the password from opening or modifying (your choice)
the workbook.
2. Password protect a worksheet. You can protect individual worksheets with a password.
Others can view the sheet, but you determine what, if any, changes they can make without a
password.
3. Password protect ranges in a worksheet. If you want to allow people to edit some cells in a
worksheet, but not others, you can protect the worksheet but leave those cells you want people
to edit “unlocked” and, therefore, editable.

6.2.1. Password Protecting a Workbook


To protect your workbook with a password to prevent people who do not know the password from
opening or modifying it:

1. Click File > Save As:

200 | LESSON 6: Working with Others


EVALUATION COPY: Not to be used in class.
2. Click the More options… link to open the Save As dialog:

3. By default, it will save over the existing file (after giving you a warning). If you want to save
the file with a different name or in a new location, select where you want to save the file. Once
you have the name and location set, click Tools > General Options:

LESSON 6: Working with Others | 201


EVALUATION COPY: Not to be used in class.
4. Add passwords to open and/or modify the workbook and click OK:

202 | LESSON 6: Working with Others


EVALUATION COPY: Not to be used in class.
If you check the Read-only recommended checkbox, users who can open the workbook will
be prompted to choose whether to open the document as read-only or not:

5. Read the Confirm Password dialog (the messages for opening and confirming are different),
reenter the password, and click OK:

6. Back in the Save As dialog, click Save:

LESSON 6: Working with Others | 203


EVALUATION COPY: Not to be used in class.
6.2.2. Password Protecting a Worksheet
To password protect an individual worksheet:

1. Click Protect Sheet in the Protect group on the Review tab, add a password, and click OK:

204 | LESSON 6: Working with Others


EVALUATION COPY: Not to be used in class.
Note there are options for fine-tuning what users can do without a password. The default
options only allow them to select the cells.
2. In the Confirm Password dialog, confirm the password and click OK.

Users who try to edit protected worksheets will get the following prompt:

LESSON 6: Working with Others | 205


EVALUATION COPY: Not to be used in class.
They can unprotect the worksheet by clicking the Unprotect Sheet command in the Protect group
of the Review tab, and then entering the password.

6.2.3. Password Protecting a Range


To password protect a range in the worksheet:

1. If the worksheet is protected, you must first unprotect it by clicking the Unprotect Sheet
command in the Protect group of the Review tab, and then entering the password.
2. Select the range you want to protect and click the Allow Edit Ranges command in the Protect
group on the Review tab:

3. In the Allow Users to Edit Ranges dialog, click New:

206 | LESSON 6: Working with Others


EVALUATION COPY: Not to be used in class.
4. In the New Range dialog, enter a title, confirm the range in the Refer to cells field, enter a
password, and click OK:

5. Confirm the password and click OK.


6. Back in the Allow Users to Edit Ranges, you can click OK to just password protect that
range or you can click Protect Sheet… to add protection to the rest of the worksheet.

LESSON 6: Working with Others | 207


EVALUATION COPY: Not to be used in class.
Exercise 12: Password Protecting a
Workbook
5 to 10 minutes
In this exercise, your job is to password protect PasswordProtect.xlsx from your excel365-
working-with-others/Exercises folder on three levels:

1. Require the following password to open the workbook: OpenMe!


2. Once the workbook is opened, users should be able to edit the Fruit sheet without a password,
but they should need the following password to edit the Passwords sheet: EditPWs!
3. Require a different password (EditMe!) to make any other edits (e.g, add more rows or change
usernames) to the sheet.

208 | LESSON 6: Working with Others


EVALUATION COPY: Not to be used in class.
LESSON 6: Working with Others | 209
EVALUATION COPY: Not to be used in class.
Solution
To require the following password to open the workbook:

1. Click File > Save As:

2. Click the More options… link to open the Save As dialog:

3. In the Save As dialog, click Tools > General Options:

210 | LESSON 6: Working with Others


EVALUATION COPY: Not to be used in class.
4. Since the purpose of the password is to prevent others from opening the workbook, enter
OpenMe! for the password in the Password to open box and click OK:

5. In the Confirm Password dialog, reenter the password and click OK:

6. Back in the Save As dialog, click Save.


7. In the Confirm Save As dialog, click Yes:

LESSON 6: Working with Others | 211


EVALUATION COPY: Not to be used in class.
To password-protect the passwords column in worksheet:

1. With the Passwords sheet open, select column C, and click the Allow Edit Ranges command
in the Protect group on the Review tab:

2. In the Allow Users to Edit Ranges dialog, click New:

212 | LESSON 6: Working with Others


EVALUATION COPY: Not to be used in class.
3. In the New Range dialog, enter a title, confirm the range in the Refer to cells field, enter
EditPWs! for the password, and click OK:

4. Confirm the password and click OK.


5. Don’t close the Allow Users to Edit Ranges dialog.

To require a different password to make other edits to the sheet:

1. We want to protect the rest of the worksheet with a different password, so with the Allow
Users to Edit Ranges dialog still open, click Protect Sheet…:

LESSON 6: Working with Others | 213


EVALUATION COPY: Not to be used in class.
If you closed this dialog already by clicking OK, you can click the Protect Sheet command
to protect the sheet.
2. In the Protect Sheet dialog, enter the password EditMe! and click OK:

214 | LESSON 6: Working with Others


EVALUATION COPY: Not to be used in class.
3. Confirm the password and click OK.

EVALUATION COPY: Not to be used in class.

6.3. Marking a Workbook as Final


You can mark a workbook as final to discourage others from editing it.

To mark a workbook as final:

1. Select the File menu tab, and from the Info section, click Protect Workbook > Mark as
Final:

LESSON 6: Working with Others | 215


EVALUATION COPY: Not to be used in class.
2. Click OK in the dialog:

3. Click OK in the next box that appears:

216 | LESSON 6: Working with Others


EVALUATION COPY: Not to be used in class.
4. The workbook is now read-only. The following appears at the top:

EVALUATION COPY: Not to be used in class.

6.4. Other Sharing Concerns


A couple of other things on sharing that are useful to know:

6.4.1. Removing Workbook Metadata


Before you share a workbook with others, you may want to remove its metadata, which can include
sensitive information. See the Inspect Document section of the Auditing Workbooks lesson (see page
84) for information on removing document metadata.

6.4.2. Restoring Previous Versions


When working with others, you may occasionally need to restore an Excel file to a previous version. If
you have saved your workbook on OneDrive, the workbook will have a version history. Use the History
tab in Backstage view:

LESSON 6: Working with Others | 217


EVALUATION COPY: Not to be used in class.
Conclusion
In this lesson, you learned to add comments and notes, to password protect a workbook, a worksheet,
and ranges in a worksheet, and to finalize a workbook.

218 | LESSON 6: Working with Others


EVALUATION COPY: Not to be used in class.

You might also like