Excel Tips
Excel Tips
Excel Tips
Excel 2013
®
ADVANCED
Excel 2013:
Advanced
Student Manual
Excel 2013: Advanced
Chief Executive Officer, Axzo Press: Ken Wasnock
Series Designer and COO: Adam A. Wilcox
Vice President, Operations: Josh Pincus
Director of Publishing Systems Development: Dan Quackenbush
Writer: Micky Markert
Keytester: Cliff Coryea
Trademarks
ILT Series is a trademark of Axzo Press.
Some of the product names and company names used in this book have been used for identification purposes only and
may be trademarks or registered trademarks of their respective manufacturers and sellers.
Disclaimer
We reserve the right to revise this publication and make changes from time to time in its content without notice.
ISBN 10: 1-4260-3610-8
ISBN 13: 978-1-4260-3610-1
Printed in the United States of America
1 2 3 4 5 GL 06 05 04 03
Contents
Introduction iii
Topic A: About the manual............................................................................... iv
Topic B: Setting your expectations ...................................................................vii
Topic C: Re-keying the course ......................................................................... xi
Glossary G-1
Index I-1
iii
Introduction
Manual components
The manuals contain these major components:
• Table of contents
• Introduction
• Units
• Course summary
• Glossary
• Index
Each element is described below.
Table of contents
The table of contents acts as a learning roadmap.
Introduction
The introduction contains information about our training philosophy and our manual
components, features, and conventions. It contains target student, prerequisite,
objective, and setup information for the specific course.
Units
Units are the largest structural component of the course content. A unit begins with a
title page that lists objectives for each major subdivision, or topic, within the unit.
Within each topic, conceptual and explanatory information alternates with hands-on
activities. Units conclude with a summary comprising one paragraph for each topic, and
an independent practice activity that gives you an opportunity to practice the skills
you’ve learned.
The conceptual information takes the form of text paragraphs, exhibits, lists, and tables.
The activities are structured in two columns, one telling you what to do, the other
providing explanations, descriptions, and graphics.
Introduction v
Course summary
This section provides a text summary of the entire course. It is useful for providing
closure at the end of the course. The course summary also indicates the next course in
this series, if there is one, and lists additional resources you might find useful as you
continue to learn about the software.
Glossary
The glossary provides definitions for all of the key terms used in this course.
Index
The index at the end of this manual makes it easy for you to find information about a
particular software component, feature, or concept.
Manual conventions
We’ve tried to keep the number of elements and the types of formatting to a minimum
in the manuals. This aids in clarity and makes the manuals more classically elegant
looking. But there are some conventions and icons you should know about.
Item Description
Longer strings of ► In the hands-on activities, any code that’s too long to fit
code will look ► on a single line is divided into segments by one or more
like this. continuation characters (►). This code should be
entered as a continuous string of text.
Select bold item In the left column of hands-on activities, bold sans-serif
text indicates an explicit item that you select, choose,
or type.
Hands-on activities
The hands-on activities are the most important parts of our manuals. They are divided
into two primary columns. The “Here’s how” column gives short instructions to you
about what to do. The “Here’s why” column provides explanations, graphics, and
clarifications. Here’s a sample:
For these activities, we have provided a collection of data files designed to help you
learn each skill in a real-world business context. As you work through the activities, you
will modify and update these files. Of course, you might make a mistake and therefore
want to re-key the activity starting from scratch. To make it easy to start over, you will
rename each data file at the end of the first activity in which the file is modified. Our
convention for renaming files is to add the word “My” to the beginning of the file name.
In the above activity, for example, a file called “Sales” is being used for the first time.
At the end of this activity, you would save the file as “My sales,” thus leaving the
“Sales” file unchanged. If you make a mistake, you can start over using the original
“Sales” file.
In some activities, however, it might not be practical to rename the data file. If you want
to retry one of these activities, ask your instructor for a fresh copy of the original data
file.
Introduction vii
Course prerequisites
Before taking this course, you should be familiar with personal computers and the use
of a keyboard and a mouse. Furthermore, this course assumes that you’ve completed the
following courses or have equivalent experience:
• Windows 7: Basic, Windows Vista: Basic, or Windows XP: Basic
• Excel 2013: Basic
• Excel 2013: Intermediate
Target student
Before taking this course, you should be comfortable using a personal computer and
Microsoft Windows (preferably, Windows 7). You should have some experience with
Excel 2013 and should be familiar with intermediate-level tasks, such as sorting data,
linking worksheets, and outlining and consolidating data. You will get the most out of
this course if their goal is to become proficient in performing advanced tasks, such as
using logical, statistical, financial, and date functions, working with data tables,
validating cell entries and using advanced filters, creating advanced charts, working
with PivotTables and PivotCharts, exporting and importing data, performing what-if
analyses, and recording macros.
viii Excel 2013: Advanced
Course objectives
These overall course objectives will give you an idea about what to expect from the
course. It is also possible that they will help you see that this course is not the right one
for you. If you think you either lack the prerequisite knowledge or already know most of
the subject matter to be covered, you should let your instructor know that you think you
are misplaced in the class.
After completing this course, you will know how to:
• Use the IF and IFERROR functions to calculate a value based on specified
criteria; use conditional functions to summarize data; use the PMT function to
calculate periodic payments for a loan; use text functions to extract data strings;
use date functions to calculate duration in years, months, and days; create array
formulas to perform multiple calculations on multiple sets of data at one time;
and change calculation options and iteration limits.
• Use the VLOOKUP and HLOOKUP functions to find values in worksheet data;
use the MATCH function to find the relative position of a value in a range; use
the INDEX function to find the value of a cell at a given position in a range; and
use data tables to project values.
• Use the Data Validation feature to validate data entered in cells; and use
advanced filter options to display the data you specify.
• Format data points in charts; create combination charts and trendlines; insert
sparklines; use chart templates; and add and modify drawing objects and shapes.
• Create a PivotTable for analyzing and comparing large amounts of data; modify
the PivotTable view by using slicers to filter data and by rearranging fields;
improve the appearance of a PivotTable by changing its field settings and
applying a style; and create a PivotChart to graphically display data from a
PivotTable.
• Export data from Excel to other formats, and import data from a text file into an
Excel workbook; and use Microsoft Query and the Web query feature to import
data from external databases.
• Use the Goal Seek utility to meet a target output for a formula by adjusting the
values in the input cells; and create scenarios to save various sets of input values
that produce different results.
• Run a macro to perform tasks automatically; record macros; assign a macro to a
button in the worksheet; edit a macro by editing VBA code.
Introduction ix
Skills inventory
Use the following form to gauge your skill level entering the class. For each skill listed,
rate your familiarity from 1 to 5, with five being the most familiar. This is not a test.
Rather, it is intended to provide you with an idea of where you’re starting from at the
beginning of class. If you’re wholly unfamiliar with all the skills, you might not be
ready for the class. If you think you already understand all of the skills, you might need
to move on to the next course in the series. In either case, you should let your instructor
know as soon as possible.
Skill 1 2 3 4 5
Validating data
Inserting sparklines
Creating PivotCharts
Skill 1 2 3 4 5
Creating scenarios
Hardware requirements
Your personal computer should have:
• 1 GHz or faster 32- or 64-bit processor
• At least 1 GB of RAM
• 2 GB of hard-disk space after operating system install
• Video adapter card compatible with DirectX 9 or newer, with at least 64 MB
video memory
• A keyboard and a mouse
• A monitor with at least 1024 × 768 resolution
• Printer (useful but not required)
• DVD drive if you’ll be installing via disc
Software requirements
You will also need the following software:
• Windows 7 Professional or Ultimate. (You can also use Windows XP or
Windows Vista, but the screen shots in this course were taken in Windows 7, so
your screens might look somewhat different.)
• Microsoft Office Professional Plus 2013
• A printer driver (An actual printer is not required, but you will not be able to get
an exact preview in Print Preview without a printer driver installed.)
Network requirements
The following network components and connectivity are also required for re-keying this
course:
• Internet access, for the following purposes:
– Updating the Windows operating system and Microsoft Office 2013
xii Excel 2013: Advanced
Unit 1
Advanced functions and formulas
Unit time: 60 minutes
The IF function
The IF function evaluates a condition, or logical test. If the condition is true, the
function returns a specific value. Otherwise, it returns another value. The syntax of the
IF function is:
IF(logical_test,value_if_true,value_if_false)
In this syntax, logical_test is the criterion you want the function to evaluate,
value_if_true is the value to be returned if the condition is true, and
value_if_false is the value to be returned if the condition is false.
2 Select D7
2 Select B29 You’ll sum up the sales for the East region for
the prior year.
Press e The value of the East region’s total sales for the
prior year, $43,685.00, appears in B29.
4 In B30, display the East region’s (Use the name of the range D8:D22,
total sales for the current year Sales_current, in the SUMIF function.) The
value $56,320.00 appears.
5 In E29, display the North region’s (Specify North as the evaluation criterion.) The
total sales for the prior year value $65,040.00 appears.
7 Fill in the current and prior years’ Compare your results to Exhibit 1-2.
sales information for the South
and West regions
SUMIFS
The syntax for the SUMIFS function is:
SUMIFS(sum_range,criteria_range1,criteria1,criteria_range2,
criteria2)
Sum_range is the cell or range you want to sum. Criteria_range1 and
criteria_range2 are the ranges in which the function evaluates the related criteria;
criteria1 and criteria2 are the actual criteria. Note that in the SUMIFS function,
the sum_range argument appears first (rather than last, as in SUMIF).
COUNTIFS
The syntax for the COUNTIFS function is:
COUNTIFS(range1,criteria1,range2,criteria2)
Range1 and range2 are the ranges where the related criteria are evaluated.
Criteria1 and criteria2 are the criteria by which the cells or ranges are evaluated.
AVERAGEIFS
The syntax for the AVERAGEIFS function is:
AVERAGEIFS(average_range,criteria_range1,criteria1,
criteria_range2,criteria2)
Average_range is the range of cells you want to average. Criteria_range1 and
criteria_range2 are the ranges where the function evaluates the related criteria.
Criteria1 and criteria2 are the criteria by which the specified cells will be
evaluated.
Advanced functions and formulas 1–11
4 Calculate the increase in sales Compare your results to the relevant cells in
above the target goal for the Exhibit 1-4.
remaining regions
1–12 Excel 2013: Advanced
Calculate the number of stores Compare your results to the relevant cells in
exceeding the target sales goal in Exhibit 1-4.
each of the remaining regions
Type Region,”East”, To specify the first criteria range and the first
criterion.
11 Calculate the average increase in Compare your Summary section to Exhibit 1-4.
sales for the remaining regions
Argument Description
rate The interest rate per period. For example, if you get a loan at 10% annual
interest and you make monthly payments, the first argument will be 10%/12.
nper The number of payments that have to be made to repay the loan. For
example, if you have four years to pay back the loan, and you make monthly
payments, the second argument will be 48 (4*12).
pv The present value or the principal amount of the loan. This argument can
also have a negative value. For example, if you give a loan of $12,000, the
present value will be -12000. However, if you take a loan of $12,000, the
present value will be 12000.
fv (Optional) The future value of the loan—that is, its value after the last
payment is made. If you omit the future value, it’s assumed to be zero.
type (Optional) Indicates when payments are due. This argument can have either
of two values: 0 if payments are due at the end of the period, or 1 if
payments are due at the beginning of the period. If you omit this argument,
it’s assumed to be zero.
1–14 Excel 2013: Advanced
Type C6,B6)
“C6” refers to the cell containing the period of
repayment, and “B6” refers to the cell
containing the present value of the loan.
3 Copy the formula in E6 to E7:E8 To calculate the monthly payments for the
and E10:E11 remaining banks.
4 Change the value in C6 to 24 When the number of payments goes down, the
monthly payment amount increases.
5 Fill the remaining employee Use the AutoFill handle to copy the function.
number values in the C column
6 Enter
=RIGHT(B2,(LEN(B2)-FIND(“ “,B2)))
TODAY
You use the TODAY function to enter the current date in the selected cell. The syntax
is:
=TODAY()
YEAR
Use the YEAR function to return the year in the specified date serial number. Apply the
General or Number format to the resulting value. The syntax for the YEAR function is:
=YEAR(serial_number)
You can also use this function to calculate the number of years between two dates. The
formula would be:
=YEAR(serial_number)-YEAR(serial_number)
DAYS360
To calculate the number of days between a start date and an end date, use the DAYS360
function. This function is based on a 360-day year. The syntax for the DAYS360
function is:
=DAYS360(start_date,end_date)
To calculate the number of years between two dates, you can divide by 365 to get a
more accurate result in years. If the resulting value is not a full year, then format the cell
as Number to display the exact number of years with a decimal point. The syntax using
the DAYS360 function would be:
=DAYS360(start_date,end_date)/365
1–20 Excel 2013: Advanced
NETWORKDAYS
You can use the NETWORKDAYS function to calculate the number of work days
between the start date and the end date, excluding weekends. The Holidays argument is
optional. The syntax is:
=NETWORKDAYS(start_date,end_date,[holidays])
Apply the General format to E5 To display the number of years of Davis Lee’s
employment.
9 Click the Training phases tab This worksheet contains dates for training that
occurs in three phases. You want to calculate the
number of workdays being spent on training.
2 Select D7:D19 You will create an array that calculates the total
sales for each product (Unit price*Units sold).
The first step is to select the destination range.
3 Type =B7:B19*C7:C19 To multiply the unit prices by the units sold for
each product. You can type or select the ranges
B7:B19 and C7:C19.
4 Press c + s + e
3 Press c + s + e
5 In D20, click To verify that the result is the same as the result
in B21. Even though the range D7:D19 contains
the array formula, the AutoSum function uses
the values in its calculation.
2 Click the More products tab This sheet contains eight additional products
with unit price and units sold information that
you want to include on the Inventory tab.
Change C19 to C27 The additional rows are included in the array
arguments.
7 Press c + s + e
8 Select D7:D27 You must select the entire array to modify the
array formula.
Activate Edit mode and change Press F2, and edit the cell references in the
the cell references to B27 and formula bar.
C27
9 Press c + s + e
5 In C2, enter a function to separate the product name from the text string in A2.
Copy the function to C3:C12. (Hint: Use the RIGHT, LEN, and FIND functions.
Scroll down to A64 to see the correct formula.)
6 Update and close the workbook.
Review questions
1 What is the syntax of the IF function?
IF(condition,value_if_true,value_if_false)
2 What date function inserts the current date?
TODAY()
3 What function inserts the current date and time?
NOW()
4 How can you distinguish an array formula from a regular formula?
An array formula is surrounded by braces { }.
5 How do you enter an array formula?
Like all Excel formulas, you start with an equal sign (=), but you must press Ctrl+Shift+Enter to
enclose the formula in braces.
1–30 Excel 2013: Advanced
2–1
Unit 2
Lookups and data tables
Unit time: 50 minutes
5 Select C6
Enter
=VLOOKUP(A6,Emp_info,6,FALSE)
2 In E6, enter
=VLOOKUP(A6,Emp_info,4,FALSE)
Enter
=VLOOKUP(A6,Discount_table,2,TRUE)
3 In A6, enter 2500 The discount for a $2000 purchase is 10%, and
the discount for a $3500 purchase is 12%. The
largest amount in the lookup table below your
entry of $2500 is $2000, so the discount should
be 10%. Because the VLOOKUP function is
looking for an approximate match, it determines
this and returns a discount value of 10%.
3 Click the drop-down arrow and Corresponding data is displayed in C5. The list
select Qtr2 ensures that you enter valid data.
4 Select C5
5 Select D5
Enter
=HLOOKUP(B5,total_sales,9,FALSE)
6 Select E5
2 Select C4
Enter
=HLOOKUP(B4,base_salary,2,TRUE)
3 Select B4
Enter an amount between 60,000 You don’t need to enter the comma or dollar
and 80,000 sign. The function finds the largest value that is
less than or equal to the entered value and
returns the corresponding name.
2 Observe the Match and Index The data appears in ascending order of earnings.
sheet You’ll use the MATCH function to find the
relative position of a value in the selected range.
The ranges A4:B7 and E4:F6 contain search
boxes.
Observe the Earnings column It doesn’t contain the value $100,000. However,
MATCH still displays a relative position in F6.
This occurs because MATCH returns the
relative position of the largest value that’s less
than or equal to $100,000.
Exhibit 2-1: The INDEX function used with the MATCH function
Lookups and data tables 2–11
3 Select B7
Edit the formula to read As shown in Exhibit 2-1, the value $65,000
=INDEX(Emp_info,B6,6) appears in B7. Because B6 contains the value 4
(the row number for Sandy Stewart), the value
in column 6 that the INDEX function returns is
her salary.
2 Click the 1v data table sheet (If necessary.) You’ll create a one-variable data
table to analyze payments. D6:E21 will form the
data table. The range D7:D21 contains the input
values you’ll use while creating the data table.
4 Select D6:E21
Select B6 (In the worksheet.) This is the cell where the list
of column input values from the data table will
be substituted.
2–14 Excel 2013: Advanced
7 Click OK
In B6, enter 10 The value in E6 (at the top of the data table)
changes to -10,464.04, but the rest of the table
values remain.
3 Select B7:I22
Open the Data Table dialog box (Click What-If Analysis arrow and choose Data
Table.) The insertion point is in the Row input
cell box.
4 Select B4
Select B5
6 In B6, enter 250000 The data table now shows payments based on a
loan amount of $250,000.
Review questions
1 True or false? The VLOOKUP function is a vertical lookup function that finds
values in a lookup table that has row labels in the leftmost column.
False. VLOOKUP is a vertical lookup function that finds values in a lookup table that has column
labels in the topmost row.
2 What is the syntax of the VLOOKUP function?
VLOOKUP(lookup_value,table_array,col_index_num,range_lookup)
3 List three important points to remember about using the VLOOKUP function.
• The lookup value must always be located in the first column of the lookup table.
• If the range_lookup argument is TRUE, the values in the first column of the lookup range
must be in ascending order.
• Uppercase text and lowercase text are equivalent.
4 What is the purpose of the MATCH function?
You can use the MATCH function to determine the relative position of a value in a range.
5 What is a data table?
A data table is a range that displays the results of changing certain values in one or more
formulas.
2–18 Excel 2013: Advanced
Unit 3
Advanced data management
Unit time: 45 minutes
5 Enter E1234
7 In C7, enter tomorrow’s date (In mm/dd/yy format.) This date is not permitted
because the date-of-hire value cannot be greater
than today’s date value. The “Invalid date of
hire” message box appears.
Click Cancel
Click Cancel To close the message box and clear the cell
contents.
3 In the Data Tools group, click (On the Data tab.) To open the Data Validation
Data Validation dialog box, shown in Exhibit 3-1. By default, the
Settings tab is active.
From the Data list, select To specify the comparison operator. The Length
equal to box replaces the Minimum and Maximum
boxes.
5 Click the Input Message tab You’ll specify the message that will appear
when users select a cell in the Emp_Id column.
In the Title box, enter Emp_Id This text will appear as a title in the input
message.
In the Title box, enter This will be the title of the error message box.
Invalid Emp_Id
In the Error message box, enter This is the error message that will appear when
The employee ID number the user enters an invalid employee
you’ve entered is not identification number.
permitted. Please enter
another value.
Close the Style list To leave the error alert style as Stop.
Enter E103
Advanced data management 3–7
Select B6:B20
Open the Data Validation dialog Click Data Validation in the Data Tools group.
box
Enter a valid date of hire A date earlier than or equal to today’s date.
Select Marketing
In Exhibit 3-2, Department is the column on which the data will be filtered. The first
criterion states that the department must be Sales; the second criterion states that the
department must be Marketing. The two criteria are joined by the Or operator, meaning
that rows will be included in the filtered data if they meet either criterion. When you use
the And operator, the rows must meet both criteria. The criteria shown in Exhibit 3-2
would yield all employees who work in either the Sales or Marketing departments.
To filter data by using the Custom AutoFilter dialog box:
1 Turn on AutoFilter.
2 Display the drop-down menu for the column for which you want to create
criteria. Then choose Text Filters, Custom Filter to open the Custom AutoFilter
dialog box.
3 Select the first comparison operator and its associated criterion.
4 Select And or Or. By selecting And, you’ll decrease the number of rows that
meet the criteria. By selecting Or, you’ll increase the number of matching rows.
5 Select the second comparison operator and its associated criterion.
6 Click OK.
Advanced data management 3–11
2 Click Filter
To enable filtering.
Click the AutoFilter arrow next to To display the sorting and filtering criteria.
Department You’ll display the records of those employees
who belong to either the Sales department or the
Marketing department.
4 From the lower-left list, select To specify the second comparison operator.
equals
From the lower-right list, select To specify the second comparison criterion. The
Marketing Custom AutoFilter dialog box should look like
Exhibit 3-2.
5 In the Sort & Filter group, click The data is no longer filtered by these two
Clear criteria. AutoFilter remains active.
3–12 Excel 2013: Advanced
Operator Meaning
= Equal to
Exhibit 3-3: The data with an advanced filter consisting of two criteria
In I3, enter Earning ($) To specify the second criterion label. Be sure to
include the space between Earning and ($).
(You can copy and paste the heading from F3.)
In I5, enter >=80000 The second row of the criteria range will display
values in the West region with earnings greater
than or equal to $80,000. Adding rows to a
criteria range amounts to using an Or operator,
so rows will be included if they meet either of
these conditions.
3–14 Excel 2013: Advanced
4 Select any cell in the original data (In the range A4:F43.) You’ll enter the entire
range data range automatically when you choose the
Advanced Filter command.
In the Sort & Filter group, click To open the Advanced Filter dialog box. “Filter
Advanced the list, in-place” is selected by default. This
means that the filtered data will be displayed in
the same worksheet. The entire data range
appears selected in the worksheet.
5 Collapse the Criteria range box (Click the Collapse Dialog button.) The
Advanced Filter - Criteria range: dialog box
appears.
Select H3:I5
6 Expand the Criteria range box The Advanced Filter dialog box expands.
7 Display the unfiltered data Click Clear in the Sort & Filter group.
2 Open the Advanced Filter dialog (Click Advanced in the Sort & Filter group.)
box The list and criteria ranges that were previously
entered in the dialog box are still there.
Select H10 This cell will be the starting point for the
filtered result. The dialog box should look like
Exhibit 3-4.
Review questions
1 What’s the purpose of validating data?
Validating data ensures that the entered data matches a specified format.
2 List the steps you would use to set data validation rules.
a Select the cells for which you want to create a validation rule.
b On the Data tab, click Data Validation to open the Data Validation dialog box.
c Click the Settings tab.
d From the Allow list, select a data validation option.
e From the Data list, select the desired operator. Then complete the remaining entries.
f Click OK.
3 What is a criteria range?
A range containing a set of search conditions. It consists of one row of criteria labels and at least
one row that defines the search conditions.
4 List the steps you would use to keep an original range of data intact and place a
copy of the filtered data somewhere else in the same worksheet.
a Select the “Copy to another location” option in the Advanced Filter dialog box.
b Specify a starting cell for the copied list.
Advanced data management 3–17
Unit 4
Advanced charting
Unit time: 30 minutes
Exhibit 4-1: The Format Axis task pane, showing options for the vertical value axis
Advanced charting 4–3
The following table describes some of the options on the Axis Options pane:
Option Specifies
Major unit The intervals for major tick marks and major gridlines on the value axis.
Minor unit The intervals for minor tick marks and minor gridlines on the value axis.
2 Verify that the Scale worksheet is It contains the quarterly bonus sales report for
active five Outlander Spices salespeople.
6 In the task pane, under Bounds, Excel might reformat the values here with a
edit the Maximum box to read single decimal place. The value you enter might
10000 appear as 10000.0.
7 Close the Format Axis task pane To apply the new scale settings.
Exhibit 4-2: Label options in the Format Data Label task pane
2 Select the slice representing (Click the pie and then click the largest slice.)
cinnamon sales You’ll add a label to this data point using the
Chart Elements button.
To open a submenu.
From the submenu, choose To open the Format Data Label task pane.
More Options…
4 Click as shown
5 Under Label Contains, clear You’ll label the slice representing cinnamon
Value sales as a percentage of the total.
Under Label Position, select To place the data label just outside the slice.
Outside End
6 Expand Number
8 Click anywhere in the chart To deselect the slice and data label.
Point to the cinnamon slice A ScreenTip appears, showing the total value of
cinnamon sales and the percentage of total
product sales it represents.
9 Select the slice representing You’ll make other changes to the slice.
cinnamon sales
11 In the Current Selection group, To open the Format Data Point dialog box.
click Format Selection Series Options is selected by default.
Set the Point Explosion value to To pull out the slice representing cinnamon sales
approximately 20% so that it is separate from the rest of the pie chart
and the data point stands out from the others.
13 Click as shown
14 In the Effects list, expand You’ll give the slice some depth.
3-D Format
Verify that Combination is the This sheet displays profit trends for four months.
active sheet
6 Click Format Selection To open the Format Data Series task pane.
Series Options is selected by default.
7 Under Plot Series On, select To insert a secondary axis on the right side of
Secondary Axis the chart.
Close the task pane The secondary axis appears on the right side of
the chart. The chart columns for the Profit data
series overlap the other columns.
9 In the Type group, click To open the Change Chart Type dialog box.
Change Chart Type You’ll assign a separate chart type to the Profit
data series so that it will be represented as a line.
Click the Recommended Charts Excel will recommend a combination chart type
tab based on the values in the chart and the
formatting options you’ve chosen.
Adding trendlines
Explanation You can create a trendline in a chart to emphasize the pattern of change in your data.
Trendlines are graphical representations of drifts or variations in a data series.
Trendlines can highlight important variations, as shown in Exhibit 4-4, and make your
charts easier to understand, and they can facilitate forecasting and decision making.
To add a trendline to a chart:
1 Select the chart or data series to which you want to add a trendline.
2 Click the Chart Elements button.
3 From the Trendlines style list, choose a trendline style.
Sparklines
Explanation In Excel, you can add sparklines to worksheets. A sparkline is a small chart that is
inserted into a single cell to illustrate a pattern or trend in data. There are three types of
sparklines: line, column, and win/loss. A sparkline chart resides in the background of a
cell, so you can enter text on top of it.
Inserting sparkline
Sparklines can be inserted anywhere in a worksheet. However, it’s recommended that
they be adjacent to the data they are representing.
To insert a sparkline:
1 Select the cell(s) where you want to insert the sparkline.
2 Click the Insert tab.
3 In the Sparklines group, click the desired Sparkline button (Line, Column, or
Win/Loss) to open the Create Sparklines dialog box, shown in Exhibit 4-5.
4 In the Data Range box, enter the range to be charted. Use the Collapse dialog
box button, if necessary. Note: You can select multiple rows of data to create
multiple sparklines at once.
5 In the Location Range box, verify that the destination is correct.
6 Click OK.
4–14 Excel 2013: Advanced
Modifying sparklines
To modify a sparkline chart, use the buttons on the Sparkline Tools | Design tab. As
with any other Excel chart, you can modify a sparkline by changing its type, applying a
different style, changing the color or line weight, or showing data points and markers.
Click the Insert tab The Sparklines group provides three types of
sparklines: Line, Column, and Win/Loss. The
type you use depends on what you are trying to
illustrate.
5 In the Data Range box, enter If necessary, collapse the dialog box to select the
B4:E4 range in the worksheet. You can also type
directly in the Data Range box.
7 Select F4 If necessary.
8 Select F4 and observe the formula The formula bar is empty, because sparklines
bar reside in the background of the cell
In the Style gallery, explore the You can change the style of the sparkline, if you
various styles wish.
10 In the Type group, click Column To change the sparkline chart type to Column.
Change the sparkline chart type In the Type group, click Line.
back to Line
11 In the Show group, check A marker is added to the highest point in each
High Point sparkline. You can add markers for the highest,
lowest, first, last, or negative point or for all
individual points. Use the Marker Color menu to
change the marker colors.
2 Choose Save as Template… To open the Save Chart Template dialog box.
The chart template will be saved in the
Templates/Charts folder, with the extension
.crtx.
4 Click Save To save the template and close the dialog box.
5 Click the Product sales sheet You’ll use the custom chart template in this
sheet.
6 Select A4:A8 and F4:F8 This is the data on which the chart will be based.
Open the Insert Chart dialog box Click the dialog box launcher in the Charts
group on the Insert tab.
In the Chart Type list, select To open the Templates folder. My chart
Templates template is selected because it’s the only
template in the folder.
8 Position the chart so that the cell Angelica Root is the biggest seller at 36% of
data is visible total sales, as shown in Exhibit 4-8.
2 Select the chart You’ll add some graphical objects to the chart.
5 Click in the text box and type You’ll emphasize the steep rise in sales in the
Sales hike third quarter.
10 Point to the upper-right corner of The foot of the arrow will be here.
the text in the text box
Drag as shown
Click outside the chart area To observe the text box and arrow. You’ll
format the objects in the next activity.
Exhibit 4-9: The Shadow gallery accessed from the Shape Effects menu
4–22 Excel 2013: Advanced
Activate the
Drawing Tools | Format tab
Point to the various effect options To see a Live Preview of the effects.
Click as shown
5 Apply an automatic border around Select the text box, then open the Shape Outline
the text box menu and choose Automatic.
6 Click outside the chart To see the formatting changes you made.
Review questions
1 How can you change the scale of a chart?
Open the Format Axis task pane for the value axis. Then, change the Bounds value.
2 What is a leader line?
A line extending from the data label to its associated data point.
3 What is a combination chart?
A single chart that contains two or more chart types.
4 What is a trendline?
A graphical representation of drifts (trends) or variations in a data series.
5 Which of the following best describes a sparkline?
A A graphical representation of trends in data
B A small chart in a single cell that shows patterns in data
C An animated SmartArt graphic
D A line connecting data labels to their respective data points
4–24 Excel 2013: Advanced
Unit 5
PivotTables and PivotCharts
Unit time: 50 minutes
Field Description
Filters Filters the summarized data in the PivotTable. If you select an item in the report
filter, the view of the PivotTable changes to display only the summarized data
associated with that item. For example, if Region is a report filter, you can
display the summarized data for the North region, the West region, or all regions.
Rows Displays the items in a field as row labels. For example, in Exhibit 5-1, the row
labels are values in the Quarter field, which means that the table shows one row
for each quarter.
Columns Displays the items in a field as column labels. For example, in Exhibit 5-1, the
column labels are values in the Product field, which means that the table shows
one column for each product.
Σ Values Contains the summarized data. These fields usually contain numeric data, such as
sales and inventory figures. The area where the data itself appears is called the
data area.
3 Select any cell in the data range You’ll create a PivotTable based on this range.
If you select a cell within the range of the source
data, you won’t have to specify the range later.
5 In the Tables group, click To open the Create PivotTable dialog box. It
PivotTable prompts you to select the location of the data
you want to analyze. You can use an external
data source or an Excel worksheet. The default
is the range that Excel automatically determines
from the selected cell, as shown in Exhibit 5-2.
You can create the PivotTable in a new or
existing worksheet. The default selection is New
Worksheet.
6 Edit the Sheet1 tab name to read Double-click the name, type the new one, and
PivotTable press Enter.
Add fields
Explanation You add fields to a PivotTable to specify the data you want to display. The fields of the
source data appear in the PivotTable Field List pane, shown in Exhibit 5-3.
To add fields, drag a field from the top of the PivotTable Fields task pane to one of the
four areas at the bottom of the pane, as shown in Exhibit 5-3. You can add more than
one field to an area, and you don’t need to add all fields to the table. To display data and
not just headings, you need to place at least one field in the Σ Values area.
Observe the PivotTable Fields (The entire pane is shown in Exhibit 5-3.) It
task pane displays the column headings of the source data
in the PivotTable worksheet.
4 In the pane, drag Item to the To add Item as a column heading field.
Columns area
5 Drag Total Sale to the Σ Values To add Total Sale as the Σ Values field. The
area PivotTable shows the sum of total sales of items
per customer.
7 Click the arrow for Row Labels To display the list of customers.
Filter the list so that only the Clear Select All, check BlazerFire, and click
information for BlazerFire will be OK. The PivotTable data is now filtered to show
displayed only the Gadget sales for BlazerFire.
8 Clear the filters from the Item and (Click the arrows for both fields and choose
Customer fields Clear File from “<fieldname>”.) To display all
items and customers.
Inserting slicers
Explanation As shown in Exhibit 5-4, the filter icon in cell B1 indicates that the PivotTable is
displaying the sales figures for only the Central region. However, when you apply more
than one filter, the filter is often labeled as “Multiple items.” This designation is not
particularly helpful. In Excel, you can insert a slicer to easily show the current filtered
state of the data. You can create a slicer for each field in the PivotTable.
Slicers are visual controls you can use to quickly filter your data by selecting values
from a list. Slicers are both “live”—they reflect data changes in the underlying
PivotTable—and interactive—you can select filter fields on the fly. Slicers appear as
separate objects on the worksheet and can be moved around and resized.
To insert a slicer:
1 Select any cell in the PivotTable.
2 Click the PivotTable Tools | Analyze tab. In the Filter group, click Insert Slicer.
The Insert Slicers dialog box appears with a list of the PivotTable fields.
3 Check the fields you want to display as slicers.
4 Click OK. The slicers appear on top of the PivotTable, and the Slicer Tools |
Options tab appears on the ribbon.
Modifying slicers
Excel considers slicers to be shapes. Therefore, you can move, resize, align, and format
slicers just as you would other shapes. To move a slicer, drag the slicer header to the
desired location. Drag a slicer’s border to change the size of the slicer. Use the Slicer
Tools | Options tab to apply a slicer style and to align the slicers.
Deleting slicers
You can quickly delete a slicer by selecting it and pressing Delete. You can also right-
click the slicer and choose Remove “Slicer Name” from the shortcut menu. The slicer is
immediately removed.
2 Check Customer, Item, and To create slicers for the Customer, Item, and
Total Sale Total Sale fields.
4 Using the slicer headers, drag the You can move slicers anywhere on the
slicers so they do not overlap worksheet. They can even be moved or copied
to a separate worksheet. Notice that the Slicer
Tools | Options tab has appeared on the ribbon.
6 On the Item slicer, click Cogs To display only the Cog sales figures for the
Central and Award Sportswear customers.
Click Show All To show all slicers again. The PivotTable Fields
pane might also appear.
9 For the Item slicer, click The slicer remains listed in the Selection and
Visibility pane, but the “closed eye” indicates
that the slicer is hidden.
10 Observe the Customer and Total When slicers contain a lengthy list of items, you
Sale slicers can use the scrollbar to view the additional
items.
Move fields
Explanation After creating a PivotTable, you might want to display an entirely different view of the
data. You can change the data view by dragging the fields to other areas in the
PivotTable. The PivotTable provides options to show or hide the details. To change data
in the PivotTable, however, you need to refresh the table after changing the source data.
You can move a field in a PivotTable by dragging the field to a new area in the
PivotTable Field List pane. To show a columnar view of the data, as shown in
Exhibit 5-5, drag a report or row field to the Column Labels box in the pane. When you
want to arrange data in row fields, drag a report or column field to the Row Labels box
in the pane.
Exhibit 5-5: A PivotTable with fields rearranged and records grouped by date
5–12 Excel 2013: Advanced
From the shortcut menu, choose To remove the Customer field from the
Remove Field PivotTable layout. You want to view only the
item sales totals.
3 Drag Item to the Rows area Each item is now a row label in the PivotTable.
4 Drag Date to the Columns area To add the Date field to the PivotTable.
8 Observe the PivotTable again The data is now organized so that quarterly sales
totals for the items are displayed, as shown in
Exhibit 5-5.
Type 2
2 Click the Sales Data sheet This sheet contains the source data for the
PivotTable. To change the data in the
PivotTable, you have to change the values in the
source data.
4 Click the PivotTable sheet Notice that E6 still shows the old value.
6 In the Data group, click Refresh (The top half of the Refresh button.) To update
the PivotTable with the latest data. E6 now
shows the adjusted value of 26045.5.
2 Remove the Total Sale field from (Click the arrow on the field and choose
the PivotTable layout Remove Field.) You’ll replace this field with a
new, calculated field.
3 In the Calculations group, click You’ll insert a field that will calculate an
Fields, Items, & Sets estimation of profit on the Total Sale data.
6 Click OK To close the dialog box and insert the new field.
7 Observe the PivotTable The field values all show the result of the
formula, and the field Est.Profit has been added
to the Σ Values area of the layout.
Using styles
To display formatting options that affect the entire PivotTable, click the PivotTable
Tools | Design tab. Some of the styles are specifically designed for PivotTables. Exhibit
5-6 shows a sample PivotTable style.
2 Select any cell within the To activate the PivotTable Tools tabs.
PivotTable
3 In the Active Field group, click To open the Value Field Settings dialog box,
Field Settings shown in Exhibit 5-7.
4 Click Number Format To open the Format Cells dialog box, with the
Number tab active.
From the Category list, select To display the formatting options under
Currency Currency. The $ option is selected in the Symbol
list. You’ll add this prefix symbol to the sales
values.
PivotChart styles
As with PivotTables, you can apply built-in styles to your PivotChart. To do so:
1 Select the PivotChart.
2 On the Design tab, in the Chart Styles group, select the desired chart style.
3 Alternatively, click the Chart Styles button to the right of the selected chart, and
choose a style from the gallery.
5–20 Excel 2013: Advanced
Click anywhere within the (If necessary.) To indicate which data to use for
PivotTable the PivotChart.
In the Tools group, click To open the Insert Chart dialog box. You’ll
PivotChart create the default Column chart.
Observe the PivotChart As shown in Exhibit 5-8, the total sales for the five
regions appear in columns, and each column is
divided into quarters. You can use the Product,
Region, and Quarter buttons to change the data
displayed in the PivotChart.
Select Basil Leaf To show only the Basil Leaf data in the
PivotChart.
Click OK
Review questions
1 What is a PivotTable?
A PivotTable is an interactive table that summarizes, organizes, and compares large amounts of
worksheet data.
2 How do you start creating a PivotTable?
Click the Insert tab, and click PivotTable in the Tables group.
3 Can you directly change the data in a PivotTable? If not, how do you change the
data?
No, you cannot directly change the data in a PivotTable because it’s based on source data.
Therefore, you must first change the source data and then refresh the PivotTable to reflect the
changes.
4 Which PivotTable feature is used to easily identify the current filters applied to the
data?
A Row labels
B PivotChart
C Slicers
D Field list
5 Why would you use a PivotChart?
You can use a PivotChart to graphically display data from a PivotTable.
6 How do you create a PivotChart?
You can use either of the following methods:
• Select any cell in a PivotTable, and click PivotChart in the Tools group on the Options tab.
• Select a cell in the source data, click the Insert tab, click the PivotTable button’s arrow, and
choose PivotChart from the menu.
PivotTables and PivotCharts 5–23
Unit 6
Exporting and importing data
Unit time: 50 minutes
Text (tab delimited) – Saves text and values as they appear in the worksheet
– Saves formulas as text
– Uses tab characters to separate columns of data
– Uses paragraph marks to separate rows
– Loses any formatting, graphics, and objects in the worksheet
– Can be a useful way to fix a corrupted file
2 Open the Save As dialog box The File name box contains “Regional sales.”
From the Save as type list, select This option will save the active sheet as a tab-
Text (Tab delimited) (*.txt) delimited text file.
Importing data
Explanation By using the Open command in Excel, you can open a file created in a program other
than Excel. After importing the data, you can save the file either in its original format or
as an Excel workbook.
To import a file into an Excel workbook, you open the Open dialog box, specify the
type of file you want to import, select the file, and click Open.
If you’re importing a text file, Excel displays the Text Import Wizard, shown in Exhibit
6-1. The wizard guides you through the process of converting the text data into an Excel
worksheet. As necessary, you can specify delimiters (the characters that determine when
a new column should begin) and formatting for specific columns. After importing, you
can separate text into columns, if necessary, by clicking Text to Columns in the Data
Tools group on the Data tab.
Open the Employee List text file You’ll import data from this text file into Excel.
This file contains details for employees, with
columns separated by tab characters.
Observe the date format in the last The person who entered this data used the
column European day/month/year format, not the
American month/day/year format.
2 Close Notepad
Click Next In Step 2 of the Text Import Wizard, you can set
the delimiter and see a preview of the data.
Here, Tab is the default delimiter.
Under Data preview, observe the This box shows you how the data will look in
box Excel. Data in a few columns is misaligned with
the headings because of the consecutive tabs.
7 Select the last column (Scroll to the right as necessary.) You must
indicate that the values are currently in DMY
(day/month/year) format for Excel to be able to
change the formatting to the American MDY
format.
Double-click the dividing line To automatically fit the width to the column
between any two selected column contents.
headings
11 Observe the Date of Hire column Excel converted the dates to the MDY format.
data
12 Open the Save As dialog box The File name box contains “Employee list.txt,”
and the Save as type list displays “Text (Tab
delimited) (*.txt)”
From the Save as type list, select (You might have to scroll up the list.) To save
Excel Workbook (*.xlsx) the data as an Excel workbook.
13 Click Save
Exporting and importing data 6–7
2 Select column B This is the Name column in the data you just
imported from a text file.
3 On the Data tab, in the Data Tools To start the Convert Text to Columns Wizard.
group, click Text to Columns This is like a mini version of the Text Import
Wizard.
4 Click Next
6 Verify that General is selected Note that the column heading Name appears in
as the column data format the first-name column. You’ll change the
heading after the conversion.
7 Click Finish To close the wizard and return to the table. First
and last names are now split into two columns.
If you hadn’t inserted a new column, Excel
would have asked if you wanted to replace the
existing data.
Removing duplicates
Explanation Sometimes, especially when you import data from one or more external sources, you
can end up with duplicate records. Using the Remove Duplicates dialog box, shown in
Exhibit 6-3, you can remove duplicate records based on values in one or more fields.
For instance, if you imported customer data from several sources because you want to
compile e-mail addresses for a mailing, you can remove duplicates based on the E-mail
field.
3 On the Data tab, in the Data Tools To open the Remove Duplicates dialog box.
group, click
Remove Duplicates
5 Check SSN
Microsoft Query
You can use Microsoft Query to retrieve data that meets certain conditions in one or
more tables of a database. For example, from an Employee table, you can retrieve the
records of all people who work in the Marketing department.
To retrieve data by using Microsoft Query:
1 Click the Data tab.
2 In the Get External Data group, click From Other Sources and choose From
Microsoft Query to start the Microsoft Query program and to open the Choose
Data Source dialog box, shown in Exhibit 6-4.
3 On the Databases tab, select <New Data Source> and click OK to open the
Create New Data Source dialog box. Specify the name of the data source and
select a driver for the database. Click Connect to open the ODBC Microsoft
Access Setup dialog box.
4 Under Database, click Select to open the Select Database dialog box. Select the
source database, and then return to the Choose Data Source dialog box.
5 Select the data source, and click OK to open the Choose Columns page of the
Query Wizard. Add the tables and fields you want to include in your result set.
Click Next to open the Filter Data page of the Query Wizard.
6 Specify the conditions you want the data to meet. Click Next to open the Sort
Order page of the Query Wizard.
7 Specify the sort order for the data. Click Next to open the Finish page of the
Query Wizard.
8 Select Return Data to Microsoft Office Excel. Click Finish to close the wizard
and to open the Import Data dialog box.
9 Specify whether you want to place the data in the existing worksheet or in a new
worksheet.
10 Click OK to import the data.
5 Verify that
<New Data Source>
is selected
9 Under Database, click Select To open the Select Database dialog box.
From the Directories list, navigate (If necessary.) To specify the folder that
to the current topic folder contains the database.
Click
From the first list under Dept To specify the comparison operator for the
code, select equals query.
From the Sort by list, select This will sort data by Region. By default,
Region Ascending is selected.
18 Click OK To close the dialog box and import the data. The
records of all employees in the Marketing
department appear in the worksheet.
Do it! B-2: Using a Web query to get data from the Web
The files for this activity are in Student Data folder Unit 6\Topic B.
Here’s how Here’s why
1 Click the WebQ sheet You’ll use the Web query program to retrieve
data from a Web page.
2 In the Get External Data group, To open the New Web Query dialog box.
click From Web
Click OK
Click OK
Review questions
1 True or false? An Excel workbook that’s saved in a different file format will retain
its original formatting.
False. An Excel workbook that’s saved in a different file format might not retain its original
formatting.
2 When exporting Excel data to a text format, row data will be separated by
A Commas.
B Paragraph marks.
C Tabs.
D Spaces.
3 Which of the following file types will preserve all the formatting of an Excel
workbook? (Choose all that apply.)
A XML Paper Specification (XPS).
B Portable Document Format (PDF).
C Text (tab delimited).
D Open Document Spreadsheet (ODS).
4 Which Excel feature will help you easily divide text fields into two or more
columns?.
The Text to Columns feature
5 What is Microsoft Query?
Microsoft Query is a feature that helps you retrieve data that meets certain conditions in one or
more tables of a database.
7–1
Unit 7
Analytical tools
Unit time: 50 minutes
In the Data Tools group, click To open the What-If Analysis menu.
What-If Analysis
4 In the To value box, enter This is the result you want the formula in E6 to
-10000 return.
In the “By changing cell” box, This is the cell containing the loan amount: the
enter B6 value that will be adjusted.
5 Click OK
7 Find the loan amount that you can (Use Goal Seek.) You’ll get $487,820 as the
obtain from the NewCiti bank if loan amount.
you pay $15,000 per month for 42
months
Topic B: Scenarios
Creating a scenario
Explanation Scenarios are sets of input values that produce different results. For example, in a
budget projection worksheet, you can have one scenario that includes conservative sales
figures, and another scenario that includes more aggressive sales figures. Instead of
creating new scenarios every time, you can modify existing scenarios. In a worksheet
containing multiple scenarios, you can switch among them to view the results for
different input values. In addition, you can merge scenarios from other worksheets.
You can use the Scenario Manager dialog box to create a scenario. Here’s how:
1 Click the Data tab.
2 From the What-If Analysis menu in the Data Tools group, choose Scenario
Manager to open the Scenario Manager dialog box.
3 Click the Add button to open the Add Scenario dialog box.
4 In the Scenario name box, enter a name for the scenario.
5 In the Changing cells box, specify the cells that contain the values you want to
change. Click OK.
6 In the Scenario Values dialog box, specify values for the changing cells, and
click OK.
After creating the scenario, you can modify it by editing values for the changing cells.
To edit values:
1 Open the Scenario Manager dialog box and select the scenario you want to
change.
2 Click Edit to open the Edit Scenario dialog box.
3 Click OK to open the Scenario Values dialog box.
4 Specify values for the changing cells and click OK.
2 Click the Scenarios sheet (If necessary.) You’ll create scenarios to see
how different Cost-of-sales values will affect the
Gross profit, Net profit, and Profit %.
From the What-If Analysis menu, To open the Scenario Manager dialog box.
choose Scenario Manager… Currently, no scenarios are defined.
4 In the Scenario name box, enter This is the name of the scenario that will
Original profit preserve the original values. The Changing cells
box displays the references of the selected cells.
Click OK
6 In the Scenario name box, enter This is the name of the scenario you are about to
Decreased cost of sales create.
Click Close The values for Cost of sales, Gross profit, Net
profit, and Profit % have changed.
Choose More Commands… To open the Excel Options dialog box, with the
Quick Access Toolbar page active.
3 From the “Choose commands The Scenario Manager is on the Data tab.
from” list, select Data tab
4 In the list of commands, select The commands are listed in alphabetical order.
Scenario Manager…
In the Customize Quick Access To ensure that the button you’ll add is available
Toolbar list, verify that For all in all documents, not just the active one.
documents (default)
is selected
Click Close
Select Decreased cost of You can use this list to switch among scenarios.
sales
Merging scenarios
Explanation You can merge scenarios from different worksheets so that all scenarios in a source
worksheet are copied to the active worksheet. The changing cells in the active
worksheet correspond to those in the source worksheet. This ensures that the changes
made in the source worksheet are reflected in the active worksheet.
To merge scenarios:
1 Click the worksheet where you want to merge scenarios.
2 Open the Scenario Manager dialog box.
3 Click Merge.
4 From the Sheet list, select the worksheet that contains the scenarios you want to
merge.
5 Click OK.
2 Open the Scenario Manager (Click the Scenario Manager button on the
dialog box Quick Access toolbar.) There are no scenarios in
the Scenarios 2 worksheet.
3 Click Merge
6 Click Summary
Hold c and select C9 To add it to the Result cells list. The values in
these cells changed when you applied the
“Decreased cost of sales” scenario.
Review questions
1 Describe a what-if analysis.
A what-if analysis involves changing the values in a worksheet and observing how these changes
affect the results of the formulas in the worksheet
2 True or false? Goal Seek is used when you want to solve a problem with more than
one variable.
False
3 What is a scenario?
A scenario is a set of input values that produce different results.
4 List the steps you would use to change a scenario.
a Open the Scenario Manager dialog box and select the scenario you want to change.
b Click Edit.
c Click OK to open the Scenario Values dialog box.
d Specify values for the changing cells and click OK.
5 Describe how you can switch between scenarios.
• Open the Scenario Manager, click the scenario you want to view, and click Show
• Alternatively, you can add scenarios to the Quick Access toolbar
8–1
Unit 8
Macros and Visual Basic
Unit time: 30 minutes
Enabling macros
Macros can contain viruses that can harm your computer. To combat this problem,
Excel requires you to enable macros after opening a file that contains them. To enable
macros, click Enable Content in the Security Warning bar that appears.
If Windows is set to display file-name extensions, you can use them to distinguish an
Excel file that contains macros from an Excel file without macros. A standard Excel
2013 file uses the extension .xlsx; an Excel 2013 file with macro code uses the
extension .xlsm.
Macros and Visual Basic 8–3
Observe that Excel Macro- Excel 2013 files with macros are saved as a
Enabled Workbook is selected in different file type, with the extension .xlsm
the Save as type list instead of .xlsx.
4 Open the Excel Options dialog (Click the File tab.) You need to display the
box Developer tab on the ribbon in order to work
with macros.
On the Developer tab, in the Code To open the Macro dialog box. It lists the names
group, click Macros of available macros, as shown in Exhibit 8-1.
Click Run To run the macro. Notice that the text in the
cells is wrapped to multiple lines as necessary,
bottom-aligned, and bold.
Run the Monthly_deduction (Use the Macro dialog box.) The monthly
macro deduction amount appears in E5.
8 Select E5
9 Select E6
Recording macros
Explanation To create a macro, you can write the Visual Basic code for it, or you can have Excel
record actions as you perform them. Recording is simpler, but creates more lines of
code; this can be less efficient if you want to edit the macro later.
To record a macro:
1 In the status bar, click the Record Macro button to open the Record Macro
dialog box.
2 Specify a macro name and a shortcut key. Macro names can include letters,
numbers, and underscores. Names must begin with a letter and cannot contain
spaces.
3 Click OK to start recording the macro.
4 Perform the actions you want to include in the macro. As you work, Excel
records the sequence of steps.
5 When you’re finished, click the Stop Recording button in the status bar.
Exhibit 8-2: The Column_titles macro in the Record Macro dialog box
In the status bar, click To open the Record Macro dialog box.
Press s + C
In the “Store macro in” list, verify To specify that the macro will be stored in only
that This Workbook is selected the active workbook. This means it will not be
available in other workbooks.
In the Alignment group, click To make the text wrap to multiple lines.
In the Font group, click To apply bold formatting. You’ve completed all
of the steps you want the macro to perform.
Macros and Visual Basic 8–7
8 Save the workbook as A message box appears, warning you that you
My recorded macros can’t save a file with a macro in a standard
workbook file.
9 From the Save as type list, select To save the file as a workbook with code.
Excel Macro-Enabled
Workbook (*.xlsm)
Click Save To save the workbook and close the dialog box.
2 Click
Button (Form Control),
as shown
Release the mouse pointer The Assign Macro dialog box appears.
4 From the Macro Name list, select To assign this macro to the newly drawn button.
Column_titles
5 Right-click the button and choose You’ll change the button text to be more
Edit Text descriptive.
6 Right-click the button and choose You can use the settings on these seven tabs to
Format Control… control the appearance of the button.
Click Cancel
7 Select D4
Click the Format Column To format the column title “No. of monthly
Titles button payments” in D4.
Item Description
Keywords Special VBA terms that, by default, appear in blue. For example, the Sub
keyword marks the beginning of a sub procedure, and the End Sub keyword
marks the end of a sub procedure.
Variables Used to store values. For example, you can use variables to store the results
of a formula.
Operators Used just as they are in a worksheet. Operators can be arithmetic (+, -, /, *) or
comparison (=, >, <).
Procedure call A statement that calls a procedure from another procedure. You can do this
by inserting the name of the procedure you’re calling into the procedure you
are calling it from.
2 Open the Macro dialog box (On the Developer tab, in the Code group, click
Macros.) By default, Column_titles is selected
in the Macro name list.
Observe the Code window This window displays the code for the
Column_titles macro.
Observe the indented statement Each group of lines between the With
lines between the first set of Selection and End With statements
With Selection and applies to the selected cells. Sophisticated
End With lines macros can select cells other than the ones
originally selected when the macro was created.
Observe the repeats of the Each time you clicked a button in the Alignment
With Selection/End With group, the macro recorded all of the alignment
blocks settings. This isn’t an efficient use of code
because many of the lines are repeated.
8–12 Excel 2013: Advanced
.HorizontalAlignment = xlLeft
Choose File, Close and To close the Microsoft Visual Basic window.
Return to Microsoft Excel
Exhibit 8-5: The edited VBA code for the Display_lower_cost_of_sales macro
Review questions
1 What is a macro?
A macro is a series of instructions that are executed automatically with a single command.
2 Describe how you would change the macro security settings.
Click Macro Security in the Code group on the Developer tab. In the Trust Center dialog box,
select the desired security setting, and click OK.
3 List two ways to create a macro.
• You can write a macro from scratch, like writing program code.
• You can have Excel record the actions you perform.
4 In what type of code, or language, does Excel save macros? Where can you view
and edit this code?
Excel saves macros as Visual Basic for Applications (VBA) code. You can view and edit the code
for a macro with the Visual Basic Editor, also referred to as the Microsoft Visual Basic window.
5 Where is VBA code stored?
In a special sheet called a module.
6 True or false? A comment is an executable line of VBA code.
False
8–16 Excel 2013: Advanced
S–1
Course summary
Unit summaries
Unit 1
In this unit, you used the logical functions IF, and IFERROR to evaluate a condition
and return a value based on whether that condition is true or false. Next, you used the
math and statistical functions SUMIF, SUMIFS, COUNTIF, COUNTIFS,
AVERAGEIF, and AVERAGEIFS to conditionally summarize, count, and average
data. You used the PMT function to calculate the periodic payment for a loan. Then,
they used text functions to separate data strings. They used date functions to calculate
the difference between two dates. Finally, they created an array formula that
performed multiple calculations on multiple sets to obtain multiple results, and created
an array formula using a SUM function.
Unit 2
In this unit, you used the VLOOKUP and HLOOKUP functions to find a specific
value in a worksheet. They used the MATCH function to find the relative position of a
value in a range. They also used the INDEX function to find a value in a range by
specifying a row number and column number. Finally, you created one-variable and
two-variable data tables to project values.
Unit 3
In this unit, you created data validation rules to control data entered in cells. Next, they
used the Custom AutoFilter dialog box to specify multiple conditions, using
comparison criteria and comparison operators. Then, you created a criteria range to
specify complex search conditions based on multiple column headings, and copied
filtered data to a new location.
Unit 4
In this unit, you adjusted the scale of a chart. They formatted data points and exploded
slices in a pie chart to highlight data. Then, they created a combination chart by using
two value axes. You also added a trendline to a chart and inserted sparklines in a
worksheet. They also created a custom chart template. Then, you added, formatted,
and moved drawing objects and shapes in a chart.
Unit 5
In this unit, you created a PivotTable. They added fields, changed views, and created
slicers for the PivotTable. Then, you formatted PivotTable data by applying a style and
changing field settings. Finally, they created PivotCharts to graphically display the
PivotTable data.
Unit 6
In this unit, you learned how to export data from Excel to other formats. You also
imported data from a text file. Finally, they used Microsoft Query to retrieve data
from an Access database, and they used the Web query feature to get data from a Web
page.
Course summary S–3
Unit 7
In this unit, you used Goal Seek to meet a target output for a formula by adjusting the
values in the input cells. Next, you created scenarios to save various sets of values in a
worksheet.
Unit 8
In this unit, you ran a macro that automatically performed tasks. You recorded a macro
and assigned the macro to a button inserted into the worksheet. Next, they edited the
VBA code for a macro.
S–4 Excel 2013: Advanced
Other resources
For more information on this and other topics, go to www.Crisp360.com.
Crisp360 is an online community where you can expand your knowledge base, connect
with other professionals, and purchase individual training solutions.
G–1
Glossary
Array Macro
A collection of rows or columns that is usually A series of instructions that are executed
defined as a cell address. However, arrays can also be automatically with a single command.
defined as raw data or values, otherwise known as
array constants. Microsoft Query
A program used to retrieve data that meets certain
Array formula conditions in one or more tables of a database.
A formula that performs multiple calculations on
one or more sets of values, and then returns either a Modules
single result or multiple results. You must press The special sheets in which VBA code is stored.
Ctrl+Shift+Enter to create an array formula, which is
enclosed in braces { }. Nested function
A function that serves as an argument of another
Arguments function.
The values that a function uses for calculations.
ODS (Open Document Spreadsheet)
Circular reference A file format that maintains some formatting, but
An error created when a formula refers to the cell not all, when Excel data is exported to it. ODS files can
containing the formula. be opened in other spreadsheet applications, such as
Google Docs.
Comments
Non-executable lines of text used to describe OLAP (Online Analytical Processing)
sections of macro code. A type of database that stores data to be analyzed.
In an OLAP database, the relationships and hierarchies
Data table are stored in OLAP cubes, which provide a multi-
A range that displays the results of changing dimensional way to look at data.
certain values in one or more formulas.
PDF (Portable Document Format)
Date functions A file format that preserves formatting and enables
Functions used to insert the dates or to calculate file sharing. PDF provides a standard format for use by
length of time in terms of years, months, or days. commercial printers. Adobe Reader is available as a
free download.
Field
A category of data in a PivotTable. PivotChart
A chart created from PivotTable data. The row
Goal Seek utility fields of the PivotTable become the categories, and the
A tool used to solve a formula based on the value column fields become the series. Click the field buttons
that you want the formula to return. in the PivotChart to change what the chart displays.
HLOOKUP PivotTable
A horizontal lookup function used to find values in An interactive table that summarizes, organizes,
a table that has column labels. and compares large amounts of data in a worksheet.
You can rotate the rows and columns in a PivotTable to
Input cell obtain different views of the same data.
The location where various values are substituted
from a data table. Quick Style buttons
Buttons located on the Format tab and used to
Iteration apply several formatting properties at once to a selected
The repeated recalculation of worksheet formulas graphic.
until the maximum number of calculations is reached.
Record
Leader line A row of data in a database.
A line used in a chart to connect a data label to its
associated data point. Scenario
A set of input values that produce different results.
G–2 Excel 2013: Advanced
Slicer VLOOKUP
A PivotTable feature that is used to filter data. A vertical lookup function used to find values in a table
that has row labels.
Source data
The data on which a PivotTable is based. What-if analysis
The process of changing the values in a worksheet
Sparkline and observing how these changes affect the results of
A small chart that is inserted into a single cell to formulas.
illustrate a pattern or trend in data.
XML (Extensible Markup Language)
Sub procedure A set of rules for structuring and designing data
A procedure containing the code which, when formats that are exchanged between applications.
executed, performs a sequence of steps.
XPS (XML Paper Specification
Trendline A file format that preserves formatting and
A graphical representation of drifts or variations in graphics when Excel data is exported to it. XPS Viewer
a data series. is installed by default.
Index
C G
Charts Goal Seek, 7-2
Adding shapes to, 4-19 Graphical objects
Adding trendlines to, 4-12 Adding to charts, 4-19
Changing the scale of, 4-2 Formatting, 4-21
Combination, 4-9
Labeling data points in, 4-5 H
Saving as templates, 4-17 HLOOKUP function, 2-2, 2-6, 2-7
COUNTIF function, 1-8 HTML vs. XML, 6-15
COUNTIFS function, 1-10
Criteria ranges, 3-12
Custom AutoFilter, 3-10
I
IF function, 1-2
D IFERROR function, 1-5
INDEX function, 2-10
Data
Exporting as text file, 6-2
Filtering with Custom AutoFilter, 3-10
L
Importing text files, 6-4 Leader lines, 4-5
Refreshing in PivotTables, 5-13 Lookup functions, 2-2
Retrieving from Web pages, 6-15
Data points, formatting and labeling, 4-5 M
Data series, changing chart type for, 4-9
Data tables Macros
Defined, 2-12 Assigning to worksheet buttons, 8-7
One-variable, 2-12 Editing, 8-12
Two-variable, 2-15 Enabling, 8-2
Data validation, 3-2 Recording, 8-5
Rules, creating, 3-4 Running, 8-2
With date and list criteria, 3-7 Saving, 8-5
DAYS360 function, 1-19 Setting security levels for, 8-3
Duplicate records, removing, 6-9 MATCH function, 2-8
Microsoft Query, 6-11
F
N
Fields
Adding to PivotTables, 5-5 Nested functions, 1-17
Changing settings of, 5-17 NETWORKDAYS function, 1-20
I–2 Excel 2013: Advanced
O
Shapes gallery, 4-19
Slicers, 5-7
ODS file format, 6-2 Source data, 5-2
Sparklines, 4-13
P Styles, applying to PivotTables, 5-15
Sub procedures, 8-10
PDF file format, 6-2 SUM function, 1-24
Pie charts, 4-5 SUMIF function, 1-6
PivotCharts, creating, 5-19 SUMIFS function, 1-10
PivotTables
Adding fields to, 5-5
Changing field settings for, 5-17
T
Creating, 5-3 Text file format, 6-2
Defined, 5-2 Text files, importing, 6-4
Formatting, 5-15 TODAY function, 1-19
Moving fields in, 5-11 Trendlines, 4-12
Refreshing data in, 5-13 Trust Center, 8-3
Using slicers to filter data in, 5-7
PMT function, 1-13 V
Procedure calls, 8-10
VBA code
Q
Editing, 8-12
Modules, 8-10
Querying external databases Statements vs. comments, 8-10
With Microsoft Query, 6-11 VLOOKUP function, 2-2, 2-4, 2-5
With Web query, 6-15
Quick Access toolbar, adding buttons to, 7-7 W
R
Web queries, 6-15
What-if analysis, 7-2
Report Filter fields, 5-2 Workbooks, setting macro security levels for, 8-3
S X
Scenarios XML vs. HTML, 6-15
Creating, 7-4 XPS file format, 6-2
Creating a summary report for, 7-9
Merging, 7-9 Y
Switching among, 7-7
YEAR function, 1-19
Secondary value axis, creating, 4-10
AX1426036108