Advanced-Ms-Excel-For-Data-Analysis Note

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 73

2020

[ADVANCED MS-EXCEL FOR


DATA ANALYSIS]
AAT Business School
Page |1

Contents
Creating a Template ...........................................................................................................................................3
Share a workbook ...............................................................................................................................................3
Merging copies of a shared workbook ...........................................................................................................4
Compare and merge workbooks: ...................................................................................................................4
Formulas .............................................................................................................................................................5
Using Common Built-In Functions ..................................................................................................................5
Text Functions ................................................................................................................................................6
Information Functions ....................................................................................................................................6
Conditional Functions .....................................................................................................................................7
Creating Dates & Times ..................................................................................................................................8
Data Lookup Functions ...................................................................................................................................8
Basic Numeric Information .............................................................................................................................9
Statistical ........................................................................................................................................................9
Working with Named Ranges .......................................................................................................................... 10
-----------------Function Example -------------....................................................................................................... 11
Create a custom number format ..................................................................................................................... 15
Conditional Formatting ................................................................................................................................... 17
Filtering Information ....................................................................................................................................... 18
Sorting ............................................................................................................................................................. 18
Using Hyperlinks .............................................................................................................................................. 19
Importing and Exporting Data ......................................................................................................................... 19
PivotTable data analysis using a Data Model in Excel 2013 ............................................................................ 20
Create a Power View report ........................................................................................................................ 27
Optimize for Power View reporting ............................................................................................................ 27
Create calculated fields ............................................................................................................................... 28
Data table basics.............................................................................................................................................. 30
A one-variable data table ........................................................................................................................ 30
A two-variable data table ........................................................................................................................ 31
Speed up calculation on a worksheet that contains data tables ............................................................ 32
Apply data validation to cells .......................................................................................................................... 33
Use Goal Seek to find the result you want by adjusting an input value ......................................................... 38
Switch between various sets of values by using scenarios ............................................................................. 40
Scenario basics ................................................................................................................................................ 40
Insert subtotals in a list of data in a worksheet .............................................................................................. 44
Define and solve a problem by using Solver ................................................................................................... 47

Advanced Excel 2013


2|Page

Record a macro ................................................................................................................................................ 49


Create a macro by using Microsoft Visual Basic .......................................................................................... 51
Assign a macro to an object, graphic, or control ......................................................................................... 52
Create a chart from start to finish ................................................................................................................... 53
Change the layout of chart elements manually ........................................................................................... 58
Add a chart title ....................................................................................................................................... 60
Add data labels......................................................................................................................................... 61
What are sparklines? ................................................................................................................................... 65
Show or hide data markers .......................................................................................................................... 67
Handle empty cells or zero values ........................................................................................................... 69
Password protect a workbook ......................................................................................................................... 71
Protect a worksheet with or without a password ....................................................................................... 72
Page |3

Microsoft Excel inserted into a new workbook, then the data


Excel is an electronic spreadsheet program can be added. We won't have to add the
developed by Microsoft for the Windows formulas because they are already in place.
environment. A Powerful tool for analysing
and presenting information, Excel actually Once you have your spreadsheet looking the
consists of three programs in one: way you want it, click the Office button then
Spreadsheet Save In Excel 2013,click File >Save, then
Use for entering and analysing data, such under Save As, select Computer. Under the
as financial forecasting, cash flow, and Computer heading, click the Browse icon.
auditing. Excel uses the term worksheet in
place of spreadsheet. When the Save As dialogue box appears
Graphics change the Save as type area at the bottom
Use for creating charts to represent to Excel template. Type a name for your
numeric data. template:
Database
Use for compiling and sorting lists. Click the Save button to save your template.

Creating a Template Use a shared workbook to collaborate


Creating a worksheet template can really save
you a lot of time. Templates are especially You can create a shared workbook and place
useful if you find yourself having to create the it on a network location where several people
same spreadsheet over and over. For can edit the contents simultaneously. For
example, if a spreadsheet has sheets for each
month of year it becomes a bit if a chore if example, if the people in your workgroup
you have to type out the heading and formula each handle several projects and need to
for each sheet. Instead, you only need to do it know the status of each other's projects, the
once. Then you can save it as a template. If group can use a shared workbook to track the
you need a new month, you can then Insert status of the projects and update information.
your template.
create the spreadsheet you want to use as a As the owner of the shared workbook, you
template. In the image below, we've just set
up a simple spreadsheet with Week headings can manage it by controlling user access to
at the top and some labels down the left: the shared workbook and resolving conflicting
changes. When all changes have been
incorporated, you can stop sharing the
workbook.

Notice how none of the data is filled in for the


weeks. The reason there are zeros for the
Weekly Totals and the Item Totals is because
we have the formulas in place but no data for
the weeks. Once it is saved as a template and
Share a workbook

Advanced Excel 2013


4|Page

To share a workbook, create a new workbook The Compare and Merge Workbooks
or open an existing workbook that you want command is not available on the Review tab
to make available for multiuser editing. but can be added to the Quick Access
toolbar. Start here if you have not already
Review tab, in the Changes group, added the command.
click Share Workbook
1. Click the File tab.
2. Choose Options.
3. The Excel Options dialog box will appear.
Select Quick Access toolbar.

Share Workbook dialog box, on the


Editing tab, select the Allow changes by more
than one user at the same time. This also
allows workbook merging check box.

Advanced tab, select the options 4. Under Choose commands from, click the
that you want to use for tracking and drop-down menu and select All
updating changes, and then click OK. Commands.
5. Find and select the Compare and Merge
Click the File tab and then click Save . Workbooks command.
6. Click Add to add it to the Quick Access
toolbar.
Merging copies of a shared workbook

Turning on the Track Changes feature


automatically shares your workbook. When
multiple users collaborate on the same shared
workbook, you can use the Compare and
Merge Workbooks command to view all of
their changes at once and address them by
accepting or rejecting them.

Each person you collaborate with must save a 7. Click OK.


8. The Compare and Merge Workbooks
copy of the shared workbook using a unique
command will be added to the Quick
file name that differs from the original. For Access toolbar.
example, if the original file name is Agenda,
your collaborators could use the files names
Compare and merge workbooks:
Agenda—Ana's Changes or David Agenda
Feedback.
1. Open a copy of the shared workbook.
2. Click the Compare and Merge Workbooks
You can only merge copies of the same command on the Quick Access toolbar.
shared workbook. All of the copies you plan
to merge should be located in the same
folder.

To add the Compare and Merge


Workbooks command:
Page |5

3. If prompted, allow Excel to save your Using Mixed Absolute and Relative
workbook.
4. The Select Files to Merge into Current
Cell References
Workbook dialog box will appear. Cell addresses do not have to have both
5. Select another copy of the same shared absolute column and row references. You can
workbook you want to merge. To select have mixed cell references. The column
multiple copies, hold CTRL or SHIFT on reference can be absolute and the row
your keyboard while clicking the file reference relative (e.g. $E5). If a formula
names. including this reference is copied to a new
location, only the column reference ($E) is
constant, and the row reference is adjusted
for the new location.

Conversely, if you copy a formula including a


cell reference with an absolute row reference
and a relative column reference (e.g. E$5) to a
new location, Excel will adjust only the
column reference for the new location. This
adds flexibility for creating cell formulas,
which will become increasingly important as
6. Click OK.
7. The changes from each copy of the shared
your worksheets become more complex.
workbook will be merged into a single
copy. All changes and comments can now As a general rule of thumb: if you intend to
be addressed at the same time. copy the formula to other cells in the same
row and keep the column reference locked,
place the $ in front of the column letter; if
you intend to copy the formula to other cells
in the same column and keep the row
reference locked, place the $ in front of the
row number.

Displaying and Printing Formulas


To see the formula in a cell, you must select
Formulas that cell and examine the formula displayed in
the formula bar, or press F2 to see the
The Order of Operations is : ie BEDMAS formula in the cell. In some circumstances,
you may want to see all the formulas in all the
cells at the same time, especially when you
Brackets ()
are verifying the accuracy of the spreadsheet.
Exponents ^
Excel has an option available to display all
Division /
formulas at the same time. Cells that contain
Multiplication *
numeric or other values will simply display
Addition +
those data values. CTRL + ~
Subtraction -

Using Common Built-In Functions


An easy way to remember this is to use the
acronym formed from the first letter of each Excel provides over 450
word in the order of operations: built-in functions for

Advanced Excel 2013


6|Page

mathematical and data operations. Functions


accept numbers, values, and cell references 5. UPPER() Converts all characters in a
as arguments within parentheses,
supplied text string to upper case

Converting Between Characters & Numeric


Codes
=SUM Calculates the sum of the
values in the range of 6. CHAR() Returns the character that
specified cells. corresponds to a supplied numeric
=AVERAGE Calculates an average of value
the values in the specified
cells (totals the range and
divides the total by the Replacing / Substituting Parts of a Text String
number of entries).
=MIN Displays the minimum 7. REPLACE() Replaces all or part of a
value in the range of
specified cells. text string with another string (from a
user supplied position)
=MAX Displays the maximum
value in the range of
specified cells. 8. SUBSTITUTE() Substitutes all
=COUNT Counts the number of occurrences of a search text string,
values within the specified within an original text string, with the
range. supplied replacement text
Text Functions
Cutting Up & Piecing Together Text Strings
Functions to Remove Extra Characters
9. CONCATENATE() Joins together two or
1. TRIM() Removes duplicate spaces, and more text strings
spaces at the start and end of a text
string 10. LEFT() Returns a specified number of
characters from the start of a supplied
Functions to Convert Excel Data Types text string

2. VALUE() Converts a text string into a


11. MID() Returns a specified number of
numeric value
characters from the middle of a
supplied text string
Functions to Convert Between Upper & Lower
Case 12. RIGHT() Returns a specified number of
characters from the end of a supplied
3. LOWER() Converts all characters in a text string
supplied text string to lower case

4. PROPER() Converts all characters in a 13. REPT() Returns a string consisting of a


supplied text string to proper case (i.e. supplied text string, repeated a
letters that do not follow another specified number of times
letter are upper case and all other
characters are lower case) Information Functions
Page |7

14. LEN() Returns the length of a supplied in a formula requires double quotes as
text string qualifiers.
Some of the comparison operators you can
15. FIND() Returns the position of a use are:
supplied character or text string from
within a supplied text string (case- = Equal to (or the same as)
sensitive) > Greater than
< Less than
>= Greater than or equal to
16. EXACT() Tests if two supplied text <= Less than or equal to
strings are exactly the same and if so, <> Not equal to
returns TRUE; otherwise, returns
FALSE. (case-sensitive) 17. IF() Tests a user-defined condition and
returns one result if the condition is
Conditional Functions TRUE, and another result if the
The ability to perform different calculations
condition is FALSE
based on changing values is one of the most
18. IFERROR() Tests if an initial supplied
powerful and useful features of spreadsheets.
value (or expression) returns an error,
The primary function used for this is the IF
and if so the function returns a
function. This function makes an evaluation or
supplied value; otherwise the function
logical test and performs one of two different
returns the initial value.
calculations based on the result. This
automatic evaluation provides “on the fly”
worksheet calculations. Boolean Operator Functions

The format of the IF function is as follows: 19. AND() Tests a number of user-defined
conditions and returns TRUE if ALL of
=IF(logical test,value if true,value if false) the conditions evaluate to TRUE, or
FALSE otherwise
Logical Test
Specify what the IF statement will 20. OR() Tests a number of user-defined
evaluate. conditions and returns TRUE if ANY of
Value if True the conditions evaluate to TRUE, or
If the Logical Test is found to be true, FALSE otherwise
then the result of the IF function will be
whatever is in this section of the formula.
21. NOT() Returns a logical value that is
Value if False the opposite of a user supplied logical
If the Logical Test is found to be false, then value or expression
the result of the IF function will be
whatever is in this section of the formula. (ie. returns FALSE is the supplied argument is
TRUE and returns TRUE if the supplied
The Logical Test section of the function often argument is FALSE)
uses comparison operators that will help you
obtain the desired result. Qualifiers are
punctuation marks used to identify or define Information function
different types of data; for example, text used

Advanced Excel 2013


8|Page

Other Data Type Functions 32. DAY() Returns the day (of the month)
from a user-supplied date
22. ISBLANK() Tests if a supplied cell is
blank (empty), and if so, returns TRUE; 33. MONTH() Returns the month from a
Otherwise, returns FALSE user-supplied date

23. ISTEXT() Tests if a supplied value is 34. YEAR() Returns the year from a user-
text, and if so, returns TRUE; supplied date
otherwise, returns FALSE
35. WEEKDAY() Returns an integer
General Information Functions representing the day of the week for a
supplied date
24. CELL() Returns information about the
contents, formatting or location of a Performing Calculations with Dates
given cell
36. WORKDAY() Returns a date that is a
Creating Dates & Times supplied number of working days
(excluding weekends & holidays)
25. DATE() Returns a date, from a user- ahead of a given start date
supplied year, month and day 37. WORKDAY.INTL() Returns a date that
is a supplied number of working days
26. TIME() Returns a time, from a user- (excluding weekends & holidays)
supplied hour, minute and second ahead of a given start date, using
supplied parameters to specify
Current Date & Time weekend days

38. DAYS360() Calculates the number of


27. NOW() Returns the current date &
days between 2 dates, based on a 360-
time
day year (12 x 30 months)
28. TODAY() Returns today's date
39. NETWORKDAYS() Returns the number
of whole networkdays (excluding
Extracting the Components of a Time weekends & holidays), between two
supplied dates.
29. HOUR() Returns the hour part of a
user-supplied time 40. NETWORKDAYS.INTL() Returns the
number of whole networkdays
30. MINUTE() Returns the minute part of (excluding weekends & holidays),
a user-supplied time between two supplied dates, using
parameters to specify weekend days
31. SECOND() Returns the second’s part of
a user-supplied time Excel Lookup and Reference Functions

Extracting the Components of a Date Data Lookup Functions


Page |9

41. VLOOKUP() Looks up a supplied value 51. MROUND() Rounds a number up or


in the first column of a table, and down, to the nearest multiple of
returns the corresponding value from significance
another column
52. ODD() Rounds a number away from
Other zero (ie. rounds a positive number up
and a negative number down), to the
42. HYPERLINK() Creates a hyperlink to a next odd number.
document in a supplied location.
53. ROUND() Rounds a number up or
43. TRANSPOSE() Performs a transpose down, to a given number of digits
transformation on a range of cells (ie.
transforms a horizontal range of cells Exponentials & Logarithms
into a vertical range and vice versa)
54. LOG() Returns the logarithm of a given
Basic Numeric Information number, to a specified base

44. ABS Returns the absolute value (ie.


Conditional Sums
the modulus) of a supplied number

55. SUMIF() Adds the cells in a supplied


Basic Mathematical Operations
range, that satisfy a given criteria

45. SUM() Returns the sum of a supplied 56. SUMIFS Adds the cells in a supplied
list of numbers range, that satisfy multiple criteria

46. POWER() Returns the result of a given


Trigonometry Functions
number raised to a supplied power

57. PI() Returns the constant value of pi


47. SQRT() Returns the positive square
root of a given number 58. COS() Returns the Cosine of a given
angle
48. MOD() Returns the remainder from a
division between two supplied 59. SIN() Returns the Sine of a given angle
numbers
60. TAN() Returns the Tangent of a given
angle
Rounding Functions
Statistical
49. EVEN() Rounds a number away from
zero (ie. rounds a positive number up Finding the Largest & Smallest Values
and a negative number down), to the
next even number
61. MAX() Returns the largest value from
a list of supplied numbers
50. INT() Rounds a number down to the
next integer

Advanced Excel 2013


10 | P a g e

62. MIN() Returns the smallest value from 72. COUNTIF() Returns the number of
a list of supplied numbers cells (of a supplied range), that satisfy
a given criteria
Averages, Frequency & Rank
73. COUNTIFS() Returns the number of
63. AVERAGE() Returns the Average of a cells (of a supplied range), that satisfy
list of supplied numbers a set of given criteria

64. AVERAGEIF() Calculates the Average Investment Value Functions


of the cells in a supplied range, that
satisfy a single criteria 74. PMT Tea PMT function, one of Excel’s
financial function, can be used to
65. AVERAGEIFS() Calculates the Average calculate the payments for a loan or
of the cells in a supplied range, that the future value of an investment
satisfy multiple criteria
Data Lookup Functions
66. MEDIAN() Returns the Median (the
middle value) of a list of supplied 75. VLOOKUP Looks up a supplied value in
numbers the first column of a table, and returns
the corresponding value from another
67. MODE() Returns the Mode (the most column
frequently occurring value) of a list of
supplied numbers

Deviation & Variance

68. STDEV() Returns the standard Working with Named Ranges


deviation of a supplied set of values
(which represent a sample of a When developing spreadsheets, you will find
population) that they quickly become very large and it
becomes difficult to keep track of all the cells.
69. VAR() Returns the variance of a One feature in most spreadsheet programs is
supplied set of values (which the ability to create a name for a cell or range
represent a sample of a population) of cells. It is much easier to understand the
formula =Revenues-Expenses than a cryptic
Counting Cells formula such as =C7-C16.

70. COUNT() Returns the number of To define a range with a name, select the
numerical values in a supplied set of range and then use one of the following
cells or values methods:
On the Formulas tab, in the Defined Names
71. COUNTBLANK() Returns the number group, click Define Name; or
of blank cells in a supplied range click in the Name Box and type the name; or
right-click the selected range and then click
P a g e | 11

Define Name.
Once you define a name for a cell or a range Be cautious when deleting named ranges.
of cells, you can use that name when creating When you delete a named range, any formula
formulas. Excel also provides tools for that refers to this name no longer displays the
applying range names to your existing correct value. Deleting a range name may also
formulas. cause a domino effect with other formulas
You can also quickly jump to a named range that indirectly refer to this formula.
by using Go To or by selecting the named
range from the Name Box list to the left of
-----------------Function Example -------------
the Formula bar.
In addition to making spreadsheets easier to
read, range names can make the process of There are a number of date functions
entering cell data easier. Simply changing the available in Excel. Depending on your needs,
range defined by a range name updates all you can use a date function in Excel to return
formulas that use that range name; therefore, the current date, the current time, or the day
there is no need to edit every formula in the of the week. This article covers using the most
spreadsheet. commonly used date functions used in Excel:
Range names can be from 1 to 255 characters =TODAY() and =NOW()
in length. They may contain alphabetic or Like all functions in Excel, entering date
numeric characters (alphanumeric), functions is very straightforward - just type in
underscores (_), backslashes (\), periods (.) the function in the cell where you want the
and question marks (?). You cannot use date or time to appear.
spaces in range names. The first character
must be alphanumeric, an underscore or a
backslash. Computer Serial Date

There are no arguments to enter for the


=TODAY() or =NOW() functions. Both of these
date functions draw their data from the
computer's built-in clock. Computers store
the date as a number representing the
Modifying and Deleting Named number of full days since midnight January 1,
1900 plus the number of hours, minutes, and
Ranges
seconds
1=TODAY()

This function returns the current date. To


display the date in a different format than the
default:

1. Click on Format > Cells in the menus to


bring up the Format Cells dialog box.
2. Click on the Number tab.
3. Select Date in the Category window.
You can use the Name Manager to modify
4. Pick from the available formats in the
and delete range names or change the cell
Type window.
range references.

Advanced Excel 2013


12 | P a g e

2=NOW() = MONTH ( Serial_number )


In this example we want to find out the
This function returns both the current date number of months between two dates. Our
and time final formula will look like this:
3. DAY
= MONTH ( D1 ) - MONTH ( D2 )
The DAY function displays the day portion of a The DATE function, one of Excel's date and
date that has been entered into the function. time functions has several uses for adding
A typical use for the function is to subtract dates to a spreadsheet.
dates in Excel that occur in the same month.
 It can be used to combine date elements
In the example below we will find the number from different locations.
of days between two dates. Since the function  It can be used to convert dates to the
excludes the month and year portions of a computer's serial date.
date, it will not correctly calculate the number  It can be used to ensure that imported
of days between two dates that are in dates are formatted correctly in a
different months or years. spreadsheet - such as a date or a number
instead of text.
The syntax for the DAY function is:
The syntax for the DATE function is:
= DAY ( Serial_number )
5 DATE( Year, Month, Day)
Serial_number - the serial date or the cell
reference to a date to be used in the Year - enter the year as a four digit number or
calculation. the cell reference where it is located.

Month - enter the year as a two digit number


4. MONTH or the cell reference where it is located.

The MONTH function displays the month Day - enter the day as a two digit number or
portion of a date that has been entered into the cell reference where it is located.
the function. A typical use for the function is
to subtract dates in Excel that occur in the
same year.

In the example below we will find the number


of months between two dates. Since the
function excludes the year portion of a date,
it will not correctly calculate the number of
months between two dates that are in
different years.
6. NETWORKDAYS

The syntax for the MONTH function is:


P a g e | 13

The NETWORKDAYS function is used to NETWORKDAYS.INTL allows you to specify


calculate the number of whole business or which days and how many are considered
working days between the start date and end weekend days rather than automatically
date of a project. removing two days per week - Saturday and
Sunday - from the total number of days.
NETWORKDAYS automatically removes
weekend days (Saturday and Sunday) from = NETWORKDAYS.INTL ( Start_date,
the total. In addition, specific days, such as End_date, Weekend, Holidays )
statutory holidays, can be omitted as well. =DATEDIF

If you need to use weekend days other than The DATEDIF function can be used to
Saturday and Sunday and you are using Excel calculate the number of days between two
2013, try using the Excel 2013 dates in versions of Excel from 97 to 2013.
NETWORKDAYS.INTL Function
An interesting point about DATEDIF is that it is
Uses for this function include planning or an "undocumented" function which means it
writing proposals to determine the time is not listed with other functions under the
frame for an upcoming project or to back Formulas tab in Excel 2007 and 2013.
calculate the amount of time spent on a
completed one. To use the function you must type it manually
into a cell on the worksheet rather than using
= NETWORKDAYS ( Start_date , End_date ,
the dialog box method available for other
Holidays )
functions.

Start_date - (required) the start date of the


8 DATEDIF ( start_date , end_date , unit )
chosen time period. The actual start date can
be entered for this argument or the cell
reference to the location of this data in the
worksheet can be entered instead.

End_date - (required) the end date of the


chosen time period. As with the Start_date,
enter the actual end date or the cell reference
to the location of this data in the worksheet.

Holidays - (optional) one or more additional The function has three arguments that need
dates that are excluded from the total to be entered as part of the function:
number of working days. Use the cell
references to the location of the data in the  start_date - the first or starting date.
worksheet for this argument.  end_date - the second or last date.
 unit - tells the function to find the number
of days ("D"), complete months ("M"), or
7. NETWORKDAYS.INTL complete years ("Y") between the two
dates.
How the NETWORKDAYS.INTL function differs
from the NETWORKDAYS function is that
9 WORKDAY

Advanced Excel 2013


14 | P a g e

The WORKDAY function can be used to End_date - the end date of the chosen time
calculate the end date or start date of a period.
project for a given number of business days.
The number of business days cannot include Method - A Boolean value (TRUE or FALSE).
weekend days. Specific holidays can also be
omitted.
 If TRUE -- the function uses the U.S.
= WORKDAY ( Start_date , Days , Holidays ) method of calculating start and end dates.
 If FALSE -- the function uses the European
Start_date - the start date of the project or method of calculating start and end dates.
time period in question.

Days - the number of days work on the


project occurred after the Start_date.

Holidays - can be used to exclude one or more


dates from the total number of working days
(optional).

PMT

The PMT function, one of Excel's Financial


functions, can be used to calculate the
payments for a loan or the future value of an
investment.

The syntax for the PMT function is:

10. DAYS360

The DAYS360 function, one of Excel's Date


and Time functions, can be used in accounting
systems to calculate the number of days
between two dates based on a 360-day year
(twelve 30-day months).
= PMT ( rate , nper , pv , fv , type )
The syntax for the DAYS360 function is:
rate - the annual interest rate for the loan.
= DAYS360 ( Start_date , End_date , Method
) nper - the total number of payments for the
loan.
Start_date - the start date of the chosen time
period. pv - the present value or the amount
borrowed or the "principal of the loan.
P a g e | 15

fv - future value - for a loan this will be $0.00.  click the appropriate formatting option from the
For loans this argument can be omitted. Mini toolbar, if active.

Create a custom number format


type - indicates when payments are due: Excel provides many options for displaying
numbers as percentages, currency, dates, and
 "0" (or omitted) - at the end of the period so on. If these built-in formats do not meet
ie: end of the month. your needs, you can customize a built-in
 "1" - at the beginning of the period ie: number format to create your own. To learn
beginning of more about how to change number format
codes, you may want to review the guidelines
Let's look at the preceding example, step-by- for customizing a number format before you
step. get started.

You want to borrow $100,000. You want to


take 180 months to pay off the loan, and you
can afford payments of $900 per month.
Because you want to calculate the interest
rate needed to meet your goal, you use the
PMT function because it calculates a monthly
payment amount. In this example, the
monthly payment amount is the goal you
seek.

What Does Formatting Mean?


Formatting refers to changing the appearance of data
to draw attention to parts of the worksheet, or make
the numbers presented easier to read. You do not alter
any underlying values.

You can format a cell or range of cells at any time,


either before or after you enter the data. A cell Create a custom number format
remains formatted until you clear the format or
reformat the cell. When you enter new data in the cell, 1. Open the workbook in which you want to
Excel will display it in the existing format. When you
create and store a custom number
copy or fill a cell, you copy its format along with the cell
contents. format.
2. On the Home tab, click the Dialog Box
You can apply formatting using one of the following Launcher next to Number.
methods:
 On the Home tab, click the command to apply
formatting from the appropriate group; or
 on the Home tab, in the appropriate group, click
the Format Cells: Dialog box launcher; or Review guidelines for customizing a
 press + ; or number format
 right-click and then click Format Cells; or
 press the appropriate keyboard shortcut for To create a custom number format, you start
specific formatting features, such as + for bold;
or
by selecting one of the built-in number
formats as a starting point. You can then
change any one of the code sections of that

Advanced Excel 2013


16 | P a g e

format to create your own custom number The following characters are displayed
format. without the use of quotation marks.

A number format can have up to four sections $ Dollar sign


of code, separated by semicolons. These code + Plus sign
sections define the format for positive ( Left parenthesis
numbers, negative numbers, zero values, and : Colon
text, in that order. ^ Circumflex accent (caret)
' Apostrophe
<POSITIVE>;<NEGATIVE>;<ZERO>;<TEXT> { Left curly bracket
< Less-than sign
For example, you can use these code sections = Equal sign
to create the following custom format: - Minus sign
/ Slash mark
[Blue]#,##0.00_);[Red](#,##0.00);0.00;"sales ) Right parenthesis
! Exclamation point
"@
& Ampersand
~ Tilde
You do not have to include all code sections in
} Right curly bracket
your custom number format. If you specify
> Greater-than sign
only two code sections for your custom Space character
number format, the first section is used for
positive numbers and zeros, and the second  Include a section for text entry If included, a
section is used for negative numbers. If you text section is always the last section in the
specify only one code section, it is used for all number format. Include an "at" character (@)
numbers. If you want to skip a code section in the section where you want to display any
and include a code section that follows it, you text that you type in the cell. If the @
must include the ending semicolon for the character is omitted from the text section,
section that you skip. text that you type will not be displayed. If
you want to always display specific text
The following guidelines should be helpful for characters with the typed text, enclose the
additional text in double quotation marks ("
customizing any of these number format code
"). For example, "gross receipts for "@
sections.
If the format does not include a text section,
Guidelines for including text and any non-numeric value that you type in a cell
adding spacing with that format applied is not affected by the
format. In addition, the entire cell is
 Display both text and numbers To display converted to text.
both text and numbers in a cell, enclose the
text characters in double quotation marks ("  Add spaces To create a space that is the
") or precede a single character with a width of a character in a number format,
backslash (\). Include the characters in the include an underscore character (_), followed
appropriate section of the format codes. For by the character that you want to use. For
example, type the format $0.00" Surplus";$- example, when you follow an underscore
0.00" Shortage" to display a positive amount with a right parenthesis, such as _), positive
as "$125.74 Surplus" and a negative amount numbers line up correctly with negative
as "$-125.74 Shortage." Note that there is numbers that are enclosed in parentheses.
one space character before both "Surplus"
and "Shortage" in each code section.
P a g e | 17

 Repeat characters To repeat the next


character in the format to fill the column
width, include an asterisk (*) in the number
format. For example, type 0*- to include
enough dashes after a number to fill the cell,
or type *0 before any format to include
leading zeros.

Conditional Formatting
You use cell formatting to enhance the visual
appeal of a worksheet. However, highlighting
certain cells to differentiate them from the
rest of the worksheet also draws attention to
them or conveys the data they contain in a
visual manner.

Conditional formatting is a powerful tool you


can use to display the data in cells one way
for some values, but another way for others,
without the additional effort of manually
changing the formatting each time you
modify data or add new data to a worksheet.
Top/Bottom Rules
The Ribbon offers several choices for setting Use this option to activate the conditional
up conditional formats. formatting on the top or bottom ranking cells
in a range. In this example, the conditional
Highlight Cell Rules formatting is set so that Excel highlights the
Use this option to highlight cell values based top 10% of cells in red with a pink
on their relation to specific values you enter. background, and the bottom 10% in dark
In this example, you specified that Excel green with a light green background. There
should highlight cell values of greater than are 20 cells selected in the range, so 10% is 2
12000 with a green background, while cells cells each. If the
with less than 9000 would be highlighted with range comprises 50 cells, the top and bottom
a pink background, and cells with in-between 10% would be 5 cells each.
values would be in dark yellow
You can choose to highlight any percentage of
cells for conditional formatting.

Data Bars
You can use conditional formatting to embed
a bar chart into a selected range of cells,
based on the value in each cell. This type of
formatting offers a quick visual
representation of each cell value in relation to
the others.

Color Scales

Advanced Excel 2013


18 | P a g e

Use this type of conditional formatting to viewing. Filtering does not change the
show the relative value of each cell to each content of your worksheet or the sequence of
other cell using color gradients. This example the rows (like the way sorting does), only
shows the red-yellow-green option, with the what you see of your worksheet.
lowest value highlighted with dark red, dark
green for the highest value and yellow for the The quickest and easiest way to filter data in
middle values. text with a light yellow Excel is to use the AutoFilter tool. When you
background. activate this tool, Excel places AutoFilter icons
on the right side of each of the column titles.
Icon Sets Use these icons to specify the selection
You can use this type of conditional criteria that Excel uses to display the records.
formatting to highlight values using icons. In
this example, a 5-bar strength meter (similar
to the wireless network strength indicator on
laptop computers) indicates the relative value
of each cell to each other cell. The cells with
the lowest values have no bars filled, while
the highest values have all bars filled.

In all of these examples, you see the same


conditional format applied to the entire cell
range. If you change a value in any of these
cells, the conditional format is automatically
re-evaluated and the highlighting may
change.

A cell may have both a manual format and a In its simplest form, the AutoFilter finds and
conditional format. If the cell contains a value displays the rows where the value in the
that does not meet any of the specified selected column is equal to a specific value.
conditions, the cell uses the manual format.
Sorting
Formatting options include only the font
styles (regular, bold, italics or bold and italics),
font colors, borders and background fill
patterns. You may not choose different font
names or font sizes in a conditional format.

Filtering Information
Worksheets are often used to store large Sorting by Single-Level Data
amounts of data. Finding information in large The Ribbon offers the quickest method of
worksheets is often difficult because of the sorting your data, but you are limited to
sheer volume. Sorting the rows is one way of sorting by one column.
making it easier to find information; however, The Ribbon has two ready-to-use buttons for
you still have to look through many if not all this:
the rows in the worksheet. Another way to on the Home tab, in the Editing group, click
locate information quickly is to use a filter to Sort & Filter and then click Sort A to Z or Sort
hide the rows you are not interested in Z to A, or
P a g e | 19

on the Data tab, in the Sort & Filter group, By clicking a hyperlink, you can display the
click Sort A to Z or Sort Z to A. referenced document. Each hyperlink
contains a code in the form of a Uniform
Resource Locator (URL), which is the unique
address for this document or page at this
particular location on the Internet or intranet.
URLs can be stored in Excel worksheets or
workbooks and used as hyperlinks to jump to
other documents on the Internet or intranet,
other Excel workbooks or other Microsoft
Sorting by Multi-Level Data Office documents.

In many cases, you will need to sort by more To insert a hyperlink, use one of the following
than one column to handle situations with methods:
multiple rows with On the Insert tab, in the Links group, click
the same value (e.g., a list of names where Hyperlink; or
several people have the same last name). right-click on a cell and click Hyperlink; or
Excel allows you to press + .
choose the custom sort option, which displays The displayed Insert Hyperlink dialog box
the sort dialog box. allows you to insert one of four types of
hyperlinks:
This dialog box provides a comprehensive set
of options for sorting your data:

Using Hyperlinks
A hyperlink is a clickable element in an
electronic document that you can use to jump
to or open another document. The World
Wide Web consists of web pages (which are
essentially documents) containing text,
images, videos and hyperlinks to other web Importing and Exporting Data
pages. You can insert hyperlinks into Importing Data Files
workbooks to enable the same capability of Most businesses use various specialized
launching web pages from the Internet or an computer systems for their operations.
internal corporate intranet, or open Typically these systems
documents located on any computer within reside on servers, other PCs, or even
your local area network. mainframe computers. The challenge has
always been trying to move
A hyperlink can be text or a picture on a page data from one system to another without
that links you from where you are to another having to manually re-enter the data. Almost
location. This allows you to “jump” to that all of these systems
location, which may be in the same have the ability to export data into files, and
document, another document, a document or the text data file format is the most
page on another Web site or an e-mail commonly used.
address. Because Excel uses a customized binary
format for its own workbook data, it has to
Inserting Hyperlinks convert external data

Advanced Excel 2013


20 | P a g e

files by importing them. 3. Click Data > Get External Data > From
Access.
On the Data tab, in the Get External Data 4. Go to the folder that contains the
group are four icons used for importing sample data files and select
external data: ContosoSales.
5. Click Open. Because you are
connecting to a database file that
contains multiple tables, the Select
Table dialog appears so that you can
choose which tables to import.
The From Other Sources button shows a drop
down menu for the remaining options for
importing data:
These

6. In Select Table, check Enable selection


of multiple tables.
7. Choose all of the tables and click OK.
8. In Import Data, click PivotTable
Report and click OK.

Notes You might not have realized it


yet, but you’ve just created a data
model. The model is a data integration
PivotTable data analysis using a Data
layer that’s created automatically
Model in Excel 2013 when you import or work with
multiple tables simultaneously in the
In less than an hour, you can build a same PivotTable report.
PivotTable report in Excel that combines data
from multiple tables. The first part of this The model is mostly transparent in
tutorial steps you through data import and Excel, but you can view and modify it
exploration. In the second half, you’ll use the directly using the Power Pivot add-in.
Power Pivot add-in to refine the data model In Excel, the presence of a data model
that lives behind the report, learning how to is evident when you see a collection of
add calculations, hierarchies, and tables in the PivotTable Fields list.
optimizations for Power View reporting. There are several ways to create a
model. See Create a Data Model in
Let’s start by importing some data. Excel for details.
1. Open sample data (ContosoV2) for this
tutorial. Extract and save the data files
in a location that’s easily accessible. Explore data using a PivotTable
2. In Excel, open a blank workbook.
P a g e | 21

Exploring data is easy when you drag fields to Add more tables
the Values, Columns, and Rows areas on the
PivotTable field list. Learning how to set up table relationships
requires that you have some additional,
1. In the field list, scroll down until you unconnected tables to work with. In this step,
find the FactSales table. you’ll get the remaining data used in this
2. Click SalesAmount. Because this data tutorial by importing one additional database
is numeric, Excel automatically places file and pasting data from two other
SalesAmount in the Values area. workbooks.
3. In DimDate, drag CalendarYear to
Columns. Add product categories
4. In DimProductSubcategory, drag
ProductSubcategoryName to Rows. 1. In the workbook open a new sheet.
5. In DimProduct, drag BrandName to You’ll use it to store additional data.
Rows, placing it beneath subcategory. 2. Click Data > Get External Data > From
Access.
Your PivotTable should look similar to the 3. Go to the folder that contains the
following screen. sample data files and select
ProductCategories. Click Open.
4. In Import Data, select Table, and click
OK.

Add geography data

1. Insert another sheet.


2. From the sample data files, open
Geography.xlsx, place the cursor in A1,
and then press Ctrl-Shift-End to select
all of the data.
With minimal effort, you now have a basic 3. Copy the data to the clipboard.
PivotTable that includes fields from four 4. Paste the data into the empty sheet
different tables. What made this task so you just added.
simple were the pre-existing relationships 5. Click Format as Table, choosing any
among the tables. Because table relationships style. Formatting the data as a table
existed in the source, and because you lets you name it, which will come in
imported all the tables in a single operation, handy when you define relationships
Excel could recreate those relationships in the in a later step.
model.
6. In Format As Table, verify that My
table has headers is selected. Click
But what if your data originates from
OK.
different sources, or is imported at a later
7. Name the table Geography. In Table
time? Typically, you can incorporate new data
Tools > Design, type Geography in
by creating relationships based on matching
Table Name.
columns. In the next step, you’ll import
8. Close Geography.xlsx to clear it from
additional tables and learn the requirements
your workspace.
and steps for creating new relationships.
Add store data

Advanced Excel 2013


22 | P a g e

 Repeat the previous steps for the present in the Stores.xlsx file you
Stores.xlsx file, pasting its contents imported in the previous step.
into an empty sheet. Name the table 8. In Column (Foreign), choose StoreKey.
Stores. 9. In Related Table, choose Stores.
10. In Related Column (Primary), choose
You should now have four sheets. Sheet1 StoreKey.
contains the PivotTable, Sheet2 contains 11. Click OK.
ProductCategories, Sheet3 contains
Geography, and Sheet4 contains Stores. Behind the scenes, Excel is building a Data
Because you took the time to name each Model that can be used throughout the
table, the next step, creating relationships, workbook in any number of PivotTables,
will be much simpler. PivotCharts, or Power View reports.
Fundamental to this model are table
relationships that determine navigation and
Use fields from the newly imported calculation paths used in a PivotTable report.
In the next task, you’ll create relationships
tables
manually to connect the data you just
imported.
You can immediately begin using fields from
the tables you just imported. If Excel cannot
determine how to incorporate a field into the Add relationships
PivotTable report, you’ll be asked to create a
table relationship that associates the new You can systematically create table
table with one that is already part of the relationships for all new tables that you
model. import. If you’re sharing the workbook with
colleagues, having predefined relationships
1. At the top of PivotTable Fields, click All will be appreciated if they don’t know the
to view the complete list of available data as well as you do.
tables.
2. Scroll to the bottom of the list. That’s When creating relationships manually, you
where you’ll find the new tables you will work with two tables at a time. For each
just added. table, you’ll choose columns that tell Excel
3. Expand Stores. how to look up related rows in another table.
4. Drag StoreName to the Filters area.
5. Notice that Excel prompts you to
create a relationship. This notification
occurs because you’ve used fields
from a table that is unrelated to the
model.
6. Click Create to open the Create
Relationship dialog. Relate ProductSubcategory to
7. In Table, choose FactSales. In the ProductCategory
sample data you’re using, FactSales
contains detailed sales and cost 1. In Excel, click Data > Relationships >
information about Contoso’s business, New.
as well as keys to other tables, 2. In Table, choose
including store codes that are also DimProductSubcategory.
P a g e | 23

3. In Column (Foreign), choose have extra tables (DimEntity) and columns


ProductCategoryKey. (ETLLoadID) that are unrelated to Contoso’s
4. In Related Table, choose business. And, we still haven’t integrated the
Table_ProductCategory.accdb. Geography data.
5. In Related Column (Primary), choose
ProductCategoryKey. Next up: View and extend your model
6. Click OK. with Power Pivot
7. Close the Manage Relationships
dialog. In the next series of tasks, you’ll use the
Microsoft Office Power Pivot in Microsoft
Add categories to the PivotTable Excel 2013 add-in to extend the model. You’ll
find that you can create relationships more
Although the Data Model has been updated easily using the Diagram View the add-in
to include additional tables and relationships, provides. You’ll also use the add-in to create
the PivotTable isn’t using them yet. In this calculations and hierarchies, hide items that
task, you’ll add ProductCategory to the shouldn’t be appearing in the field list, and
PivotTable Fields list. optimize the data for additional reporting.

1. In PivotTable Fields, click All to show Note The Power Pivot in Microsoft Excel
tables that exist in the Data Model. 2013 add-in is available in Office Professional
2. Scroll to the bottom of the list. Plus. See Power Pivot in Microsoft Excel 2013
3. In the Rows area, remove BrandName. add-in for more information.
4. Expand
Table_DimProductCategories.accdb. Add Power Pivot to the Excel ribbon by
5. Drag ProductCategoryName to the enabling the Power Pivot add-in.
Rows area, placing it above
ProductSubcategory. 1. Go to File > Options > Add-Ins.
6. In PivotTable Fields, click Active to 2. In the Manage box, click COM Add-
verify that the tables you just used are ins> Go.
now actively used in the PivotTable. 3. Check the Microsoft Office Power
Pivot in Microsoft Excel 2013 box, and
Checkpoint: Review what you learned then click OK.

You now have a PivotTable that includes data The ribbon now has a Power Pivot tab.
from multiple tables, several of which you
imported in a subsequent step. To pull this Add a relationship using Diagram View
data together, you had to create table in Power Pivot
relationships that Excel uses to correlate the
rows. You learned that having columns that 1. In Excel, click Sheet3 to make it the
provide matching data is essential for looking active sheet. Sheet3 contains the
up related rows. In the sample data files, all of Geography table you imported earlier.
the tables include a column that can be used 2. On the ribbon, click Power Pivot > Add
for this purpose. to Data Model. This step adds the
Geography table to the model. It also
Although the PivotTable is functional, you’ve opens the Power Pivot add-in, which
probably noticed several things that could be you’ll use to perform the remaining
improved. The PivotTable Fields List seems to steps in this task.

Advanced Excel 2013


24 | P a g e

3. Notice that the Power Pivot window tables connected and available to the
shows all the tables in the model, PivotTable in Sheet1.
including Geography. Click through a
couple of tables. In the add-in, you can Tip In Diagram View, several table diagrams
view all of the data that your model are fully extended, showing columns like
contains. ETLLoadID, LoadDate, and UpdateDate. These
4. In the Power Pivot window, in the particular fields are artifacts from the original
View section, click Diagram View. Contoso data warehouse, added to support
5. Use the slide bar to resize the diagram data extraction and loading operations. You
so that you can see all objects in the don’t need them in your model. To get rid of
diagram. Notice that two tables are them, highlight and right-click the field, and
unrelated to the rest of the diagram: click Delete.
DimEntity and Geography.
6. Right-click DimEntity and click Delete. Create a calculated column
This table is an artifact from the
original database and is not needed in In Power Pivot, you can use Data Analysis
the model. Expressions (DAX) to add calculations. In this
7. Zoom in on Geography so that you can task, you’ll calculate total profit, and add
view all of its fields. You can use the calculated column that references data values
slider to make the table diagram from other tables. Later, you’ll see how to use
bigger. referenced columns to simplify your model.
8. Notice Geography has GeographyKey.
This column contains values that 1. In the Power Pivot window, switch
uniquely identify each row in the back to Data View.
Geography table. Let’s find out if other 2. Rename the Table_ProductCategories
tables in the model also use this key. If accdb table to a friendlier name. You’ll
they do, we can create a relationship be referencing this table in the
that connects Geography to the rest of following steps and a shorter name
the model. will make the calculations easier to
9. Click Find. read. Right-click the table name, click
10. In Find Metadata, type GeographyKey. Rename, type ProductCategories, and
11. Click Find Next several times. You’ll then press Enter.
notice the GeographyKey shows up in 3. Select the FactSales table.
the Geography table and in the Stores 4. Click Design > Columns > Add.
table. 5. In the formula bar above the table,
12. Reposition the Geography table so type the following formula.
that it is next to Stores. AutoComplete helps you type the fully
13. Drag the GeographyKey column in qualified names of columns and
Stores to the GeographyKey column in tables, and lists the functions that are
Geography. Power Pivot draws a line available. You can also just click the
between the two columns, indicating column and Power Pivot adds the
the relationship. column name to the formula.

In this task, you learned a new technique for = [SalesAmount] - [TotalCost] -


adding tables and creating relationships. You [ReturnAmount]
now have a fully integrated model, with all
P a g e | 25

6. When you have finished building the Rename Column. Type


formula, press Enter to accept the ProductCategory, and then press
formula. Enter.
13. Click Design > Columns > Add.
Values are populated for all the rows 14. In the formula bar above the table,
in the calculated column. If you scroll type the following formula, and then
down through the table, you will see press Enter to accept the formula.
that rows can have different values for
this column, based on the data that is = RELATED
in each row. (DimProductSubcategory[ProductSubc
ategoryName])
7. Rename the column by right-clicking
CalculatedColumn1 and selecting 15. Rename the column by right-clicking
Rename Column. Type Profit, and CalculatedColumn1 and selecting
then press Enter. Rename Column. Type
8. Now select the DimProduct table. ProductSubcategory, and then press
9. Click Design > Columns > Add. Enter.
10. In the formula bar above the table,
type the following formula. Create a hierarchy
= RELATED Most models include data that is inherently
(ProductCategories[ProductCategoryN hierarchical. Common examples include
ame]) calendar data, geographical data, and product
categories. Creating hierarchies are useful
The RELATED function returns a value because you can drag one item (the
from a related table. In this case, the hierarchy) to a report instead of having to
ProductCategories table includes the assemble and order the same fields over and
names of product categories, which over.
will be useful to have in the
DimProduct table when you build a 1. In Power Pivot, switch to Diagram
hierarchy that includes category View. Expand the DimDate table so
information. For more information that you can more easily see all of its
about this function, see RELATED fields.
Function (DAX). 2. Press and hold Ctrl and click the
CalendarYear, CalendarQuarter and
11. When you have finished building the CalendarMonth columns (you will
formula, press Enter to accept the need to scroll down the table).
formula. 3. With the three columns selected,
right-click one of them and click
Values are populated for all the rows Create Hierarchy. A parent hierarchy
in the calculated column. If you scroll node, Hierarchy 1, is created at the
down through the table, you will see bottom of the table, and the selected
that each row now has a Product columns are copied under the
Category Name. hierarchy as child nodes.
4. Type Dates as the name for your new
12. Rename the column by right-clicking hierarchy.
CalculatedColumn1 and selecting

Advanced Excel 2013


26 | P a g e

5. Add the FullDateLabel column to the immediate drill down, without having to stack
hierarchy. Right-click FullDateLabel multiple fields to get a similar effect.
and select Add to Hierarchy. Choose
Date. FullDateLabel contains a full Hide columns
date, including year, month and day.
Verify that FullDateLabel appears last Now that you’ve created a Product Categories
in the hierarchy. You now have hierarchy and placed it in DimProduct, you no
multilevel hierarchy that includes year, longer need DimProductCategory or
quarter, month, and individual DimProductSubcategory in the PivotTable
calendar days. Fields list. In this task, you’ll learn how to hide
6. Still in Diagram View, point to the extraneous tables and columns that are taking
DimProduct table, and then click the up room in the PivotTable Fields list. By hiding
Create Hierarchy button in the table the tables and columns, you improve the
header. An empty hierarchy parent reporting experience without affecting the
node appears at the bottom of the model that provides data relationships and
table. calculations.
7. Type Product Categories as the name
for your new hierarchy. You can hide individual columns, a range of
8. To create hierarchy child nodes, drag columns, or a whole table. Table and column
the ProductCategory and names are grayed out to reflect that it is
ProductSubcategory onto the hidden to reporting clients that consume the
hierarchy. model. Hidden columns are grayed out in the
9. Right-click ProductName and select model to indicate their state, but remain
Add to Hierarchy. Choose Product visible in the Data View so that you can
Categories. continue to work with them.

Now that you know a couple of different ways 1. In Power Pivot, make sure Data View is
to create a hierarchy, let’s use them in the selected.
PivotTable. 2. In the tabs at the bottom, right click
DimProductSubcategory and select
1. Go back to Excel. Hide from Client Tools.
2. In Sheet1 (the sheet that contains the 3. Repeat for ProductCategories.
PivotTable), remove the fields in the 4. Open DimProduct.
Rows area. 5. Right-click the following columns and
3. Replace them with the new Product click Hide from Client Tools:
Categories hierarchy in DimProduct. o ProductKey
4. Similarly, replace CalendarYear in the o ProductLabel
Columns area with the Dates hierarchy o ProductSubcategory
in DimDate. 6. Multi-select adjacent columns. Start
with ClassID and continue to
When you explore the data now, it’s easy to ProductSubcategory at the end. Right-
see the benefits of using hierarchies. You can click to hide them.
independently expand and close different 7. Repeat for other tables, removing IDs,
areas of the PivotTable, providing more keys, or other details that you won’t
control over how available space is used. use in this report.
Furthermore, by adding a single hierarchy to
both Rows and Columns, you get rich and
P a g e | 27

Switch back to Excel to Sheet 1 with the 1. In Excel, open a new sheet and copy
PivotTable Fields list to see the difference. these values:
The number of tables is reduced and
DimProduct includes only those items that ManufacturerURL ManufacturerID
you’re more likely to use when analyzing http://www.contoso.com Contoso, LTD
sales.
http://www.adventure- Adventure
works.com Works
Create a Power View report
http://www.fabrikam.com Fabrikam, Inc.
PivotTable reports are not the only type of
report that benefits from a Data Model. Using 1. Format the cells as a table, and then
the same model you just built, you can add a name the table URL.
Power View sheet to try out some of the 2. Create a relationship between URL
layouts it provides. and the table that contains
manufacturer names, DimProduct:
1. In Excel, click Insert > Power View. a. Click Data > Relationships. The
Create Relationship dialog
Note If this is the first time you’re appears.
using Power View on this machine, b. Click New.
you’re prompted to enable the add-in c. In Table, select DimProduct.
and install Silverlight first. d. In Column, select Manufacturer.
e. In Related Table, select URL.
2. In Power View Fields, click the arrow f. In Related Column (Primary),
next to the FactSales table, and click select ManufacturerID.
SalesAmount.
3. Expand the Geography table and click To compare before and after results, start a
RegionCountryName. new Power View report and add FactSales |
4. In the ribbon, click Map. SalesAmount, dimProduct | Manufacturer,
5. A map report appears. Drag a corner and URL | ManufacturerURL to a report.
to resize it. On the map, blue circles of Notice that the URLs show up as static text.
varying size indicate sales
performance for different countries or Rendering a URL as an active hyperlink
regions. requires categorization. To categorize a
column, you’ll use Power Pivot.
Optimize for Power View reporting
1. In Power Pivot, open URL.
Making a few small changes to your model 2. Select ManufacturerURL.
will result in more intuitive responses when 3. Click Advanced > Reporting Properties
designing a Power View report. In this task, > Data Category: Uncategorized.
you will add web site URLs for several 4. Click the down arrow.
manufacturers, and then categorize that data 5. Select Web URL.
as a Web URL so the URL address shows up as 6. In Excel, click Insert > Power View.
a link. 7. In Power View Fields, select FactSales
| SalesAmount, dimProduct |
As a first step, add URLs to your workbook. Manufacturer, and URL |
ManufacturerURL. This time, the URLs
show up as actual hyperlinks.

Advanced Excel 2013


28 | P a g e

Other Power View optimizations include As you can imagine, creating calculated fields
defining a default field set for each table and can help you analyze your data in immense
setting properties that determine whether and powerful ways, so let’s get started
rows of repeating data are aggregated or learning how to create them.
listed independently.
Creating calculated fields in Power Pivot is
Create calculated fields easy when you use AutoSum.

In the second task, Explore data using a 1. In the FactSales table, click on the
PivotTable, you clicked on the SalesAmount Profit column.
field in the PivotTable Fields list. Because 2. Click Calculations > AutoSum. Notice a
SalesAmount is a numeric column, it was new calculated field named Sum of
automatically placed into the Values area of Profit was automatically created in the
the PivotTable. Sum of SalesAmount was then cell in the Calculation Area directly
ready to calculate sales amounts for whatever beneath the Profit column.
filters are to be applied. In this case, no filters 3. In Excel, in Sheet1, in the field list, in
at first, but then CalendarYear, FactSales, click Sum of Profit.
ProductSubcategoryName, and BrandName.
That’s it! That is all it takes to create a
What you really did was create an implicit calculated field using a standard aggregation
calculated field, making it easy to analyze in Power Pivot. As you can see, in just a
sales amounts from the FactSales table couple of minutes, you created a SUM of
against other fields such as product category, Profit calculated field and added it to the
region, and dates. Implicit calculated fields PivotTable, making it easy to analyze profits
are created by Excel when you drag a field to depending on the filters applied. In this case,
the Values area or when you click on a you see Sum of Profit filtered by the Product
numeric field, like you did with SalesAmount. Category and Dates hierarchies.
Implicit calculated fields are formulas that use
standard aggregation functions such as SUM, But, what if you need to do some more
COUNT, and AVERAGE, created automatically detailed analysis, like number of sales for a
for you. particular channel, product, or category? For
that you will need to create another
There are other types of calculated fields too. calculated field that counts the number of
You can create explicit calculated fields in rows, one for each sale in the FactSales table,
Power Pivot. Unlike an implicit calculated depending on the filters applied.
field, which can only be used in the PivotTable
they were created, explicit calculated fields 1. In the FactSales table, click on the
can be used in any PivotTable in the SalesKey column.
workbook, or by any report that uses the Data 2. In Calculations, click the down arrow
Model as a data source. With explicit on AutoSum > Count.
calculated fields, created in Power Pivot, you 3. Rename the new calculated field by
can use AutoSum to automatically create clicking on Count of SalesKey in the
calculated fields using standard aggregations, calculation area and then in the
or you can create your own by using a formula bar, change Count of
formula created using Data Analysis SalesKey to just Count, and then press
Expressions (DAX). Enter. Unlike calculated columns,
P a g e | 29

calculated field names are included as computers as a percentage of total product


part of the DAX formula. sales have increased over the years.
4. In Excel, in Sheet1, in the field list, in
FactSales, click Count. Creating formulas for both calculated columns
and calculated fields will be fairly easy for you
Notice a new column, Count is added to the if you are familiar with creating Excel
PivotTable showing the number of sales formulas. Whether you are familiar with Excel
depending on the filters applied. Just like with formulas or not, a great place to learn the
the Sum of Profit calculated field, you see basics of DAX formulas is by stepping through
Count filtered by the Product Category and the lessons in QuickStart: Learn DAX Basics in
Dates hierarchies. 30 Minutes.

Let’s create another. This time, you will create Save your work
a calculated field that calculates the
percentage of total sales for a particular Save your workbook so that you can use it
context or filter. However, unlike the previous with other tutorials or further exploration.
calculated fields you created by using
AutoSum, this time you will manually enter a Next steps
formula.
Although you can easily import data from
1. In the FactSales table, in the Excel, it’s often faster and more efficient to
Calculation Area, click an empty cell. import using the Power Pivot add-in. You can
Tip: The top left cell is great place to filter the data that you’re importing,
start placing your calculated fields. It excluding columns you won’t need. You can
makes them easier to find. You can also choose whether to use a query builder or
move around any calculated field in query command to retrieve the data. As a
the Calculation Area. next step, learn about these alternate
2. In the formula bar, type and use approaches: Get data from a data feed in
IntelliSense to create the following Power Pivot and Import Data from Analysis
formula: Percentage of All Services or Power Pivot.
Products:=[Count]/CALCULATE([Count
], ALL(DimProduct)) Power View reporting is designed to work
3. Press ENTER to accept the formula. with Data Models similar to the one you just
4. In Excel, in Sheet1, in the field list, in built. Read on to learn more about the rich
FactSales, click Percentage of All data visualizations that Power View brings to
Products. Excel: Start Power View in Excel 2013 and
5. In the PivotTable, multi-select the Power View: Explore, visualize, and present
Percentage of All Products columns. your data.
6. On the Home tab, click Number >
Percentage. Use two decimal places to Try enhancing your Data Model to make
format each new column. better Power View reports by following this
Tutorial: Optimize your Data Model for Power
What this new calculated field does is View reporting
calculate the percentage of total sales for a
given filter context. In this case, our filter
context is still the Product Category and Dates Calculate multiple results by using a
hierarchies. You can see for instance, data table

Advanced Excel 2013


30 | P a g e

scenarios. Although it is limited to only one or


two variables (one for the row input cell and
A data table is a range of cells that shows how
one for the column input cell), a data table
changing one or two variables in your
can include as many different variable values
formulas will affect the results of those
as you want. A scenario can have a maximum
formulas. Data tables provide a shortcut for
of 32 different values, but you can create as
calculating multiple results in one operation
many scenarios as you want.
and a way to view and compare the results of
all the different variations together on your
For information about what-if analysis tools,
worksheet.
follow the links in the See Also section.

Overview Data table basics


Data tables are part of a suite of commands
You can create one-variable or two-variable
that are called what-if analysis tools. When
data tables, depending on the number of
you use data tables, you are doing what-if variables and formulas that you want to test.
analysis.
One-variable data tables Use a one-variable
What-if analysis is the process of changing the
data table if you want to see how different
values in cells to see how those changes will
values of one variable in one or more
affect the outcome of formulas on the
formulas will change the results of those
worksheet. For example, you can use a data
formulas. For example, you can use a one-
table to vary the interest rate and term length
variable data table to see how different
that are used in a loan to determine possible
interest rates affect a monthly mortgage
monthly payment amounts.
payment by using the PMT function. You
enter the variable values in one column or
Kinds of what-if analysis There are three
row, and the outcomes are displayed in an
kinds of what-if analysis tools in Excel:
adjacent column or row.
scenarios, data tables, and goal seek.
Scenarios and data tables take sets of input
In the following illustration, cell D2 contains
values and determine possible results. Goal
the payment formula, =PMT(B3/12,B4,-B5),
Seek works differently from scenarios and
which refers to the input cell B3.
data tables in that it takes a result and
determines possible input values that
produce that result.

Like scenarios, data tables help you explore a


set of possible outcomes. Unlike scenarios,
data tables show you all the outcomes in one
table on one worksheet. Using data tables
makes it easy to examine a range of
possibilities at a glance. Because you focus on A one-variable data table
only one or two variables, results are easy to
read and share in tabular form. Two-variable data tables Use a two-variable
data table to see how different values of two
A data table cannot accommodate more than variables in one formula will change the
two variables. If you want to analyze more results of that formula. For example, you can
than two variables, you should instead use use a two-variable data table to see how
P a g e | 31

different combinations of interest rates and and the formula is contained in cell D2.
loan terms will affect a monthly mortgage If you want to examine the effects of
payment. various values on other formulas, type the
additional formulas in cells to the right of
In the following illustration, cell C2 contains the first formula.
 If the data table is row-oriented (your
the payment formula, =PMT(B3/12,B4,-B5),
variable values are in a row), type the
which uses two input cells, B3 and B4. formula in the cell one column to the left of
the first value and one cell below the row of
values.
If you want to examine the effects of
various values on other formulas, type the
additional formulas in cells below the first
formula.

3. Select the range of cells that contains the


formulas and values that you want to
A two-variable data table substitute. Based on the first illustration in
the preceding Overview section, this range
Data table calculations Data tables are is C2:D5.
recalculated whenever a worksheet is 4. On the Data tab, in the Data Tools group,
click What-If Analysis, and then click Data
recalculated, even if they have not changed.
Table.
To speed up calculation of a worksheet that
contains a data table, you can change the 5. Do one of the following:
Calculation options to automatically
recalculate the worksheet but not the data  If the data table is column-oriented, type
tables. See the section Speed up calculation in the cell reference for the input cell in the
a worksheet that contains data tables. Column input cell box. Using the example
shown in the first illustration, the input cell
Create a one-variable data table is B3.
 If the data table is row-oriented, type the
A one-variable data table has input values cell reference for the input cell in the Row
input cell box.
that are listed either down a column (column-
oriented) or across a row (row-oriented).
Note After you create your data table, you
Formulas that are used in a one-variable data
might want to change the format of the result
table must refer to only one input cell.
cells. In the illustration, the result cells are
1. Type the list of values that you want to formatted as currency.
substitute in the input cell either down one
column or across one row. Leave a few Add a formula to a one-variable data
empty rows and columns on either side of table
the values.
2. Do one of the following: Formulas that are used in a one-variable data
table must refer to the same input cell.
 If the data table is column-oriented (your
variable values are in a column), type the
1. Do one of the following:
formula in the cell one row above and one
cell to the right of the column of values. The
 If the data table is column-oriented (your
one-variable data table illustration shown in
variable values are in a column), type the
the Overview section is column-oriented,

Advanced Excel 2013


32 | P a g e

new formula in a blank cell to the right of Type the loan terms (in months) in cells D2
an existing formula in the top row of the and E2.
data table.
 If the data table is row-oriented (your 4. Select the range of cells that contains the
variable values are in a row), type the new formula (C2), both the row and column of
formula in a blank cell below an existing values (C3:C5 and D2:E2), and the cells in
formula in the first column of the data which you want the calculated values
table. (D3:E5).

2. Select the range of cells that contains the In this case, select the range C2:E5.
data table and the new formula.
3. On the Data tab, in the Data Tools group, 5. On the Data tab, in the Data Tools group,
click What-If Analysis, and then click Data click What-If Analysis, and then click Data
Table. Table.

4. Do one of the following: 6. In the Row input cell box, enter the
reference to the input cell for the input
 If the data table is column-oriented, type values in the row.
the cell reference for the input cell in the Type cell B4 in the Row input cell box.
Column input cell box. 7. In the Column input cell box, enter the
 If the data table is row-oriented, type the reference to the input cell for the input
cell reference for the input cell in the Row values in the column.
input cell box. Type B3 in the Column input cell box.
8. Click OK.

Example A two-variable data table can show


Create a two-variable data table how different combinations of interest rates
and loan terms will affect a monthly mortgage
A two-variable data table uses a formula that payment. In the following illustration, cell C2
contains two lists of input values. The formula contains the payment formula,
must refer to two different input cells. =PMT(B3/12,B4,-B5), which uses two input
cells, B3 and B4.
1. In a cell on the worksheet, enter the formula
that refers to the two input cells.

In the following example, in which the


formula's starting values are entered in cells
B3, B4, and B5, you type the formula
=PMT(B3/12,B4,-B5) in cell C2.

2. Type one list of input values in the same


column, below the formula. Speed up calculation on a worksheet
that contains data tables
In this case, type the different interest rates in
cells C3, C4, and C5. 1. Click the Microsoft Office Button , click
Excel Options, and then click the
3. Enter the second list in the same row as the Formulas category.
formula, to its right.
P a g e | 33

2. In the Calculation options section, under For example, in a marketing workbook, you
Calculate, click Automatic except for data can set up a cell to allow only account
tables. numbers that are exactly three characters
long. When users select the cell, you can
Tip Alternatively, on the Formulas tab, in show them a message such as this one:
the Calculation group, click the arrow on
Calculation Options, and then click Automatic
Except Data Tables.

Apply data validation to cells

You use data validation to control the type of


data or the values that users enter into a cell.
For example, you may want to restrict data
entry to a certain range of dates, limit choices
by using a list, or make sure that only positive
whole numbers are entered.

This article describes how data validation


works in Excel and outlines the different data If users ignore this message and type invalid
validation techniques available to you. It does data in the cell, such as a two-digit or five-
not cover cell protection, which is a feature digit number, you can show them an actual
that lets you "lock" or hide certain cells in a error message.
worksheet so that they can't be edited or
overwritten. In a slightly more advanced scenario, you
might use data validation to calculate the
Important If you save worksheet data to maximum allowed value in a cell based on a
Excel Services and want to use data validation value elsewhere in the workbook. In the
to restrict data entry, you need to create the following example, the user has typed $4,000
data validation in Excel before you save it to in cell E7, which exceeds the maximum limit
Excel Services. Excel Services supports data specified for commissions and bonuses.
entry, but you won’t be able to create data
validation.

What is data validation?

Data validation is an Excel feature that you


can use to define restrictions on what data
can or should be entered in a cell. You can
configure data validation to prevent users
from entering data that is not valid. If you
prefer, you can allow users to enter invalid
data but warn them when they try to type it
in the cell. You can also provide messages to If the payroll budget were to increase or
define what input you expect for the cell, and decrease, the allowed maximum in E7 would
instructions to help users correct any errors. automatically increase or decrease with it.

Advanced Excel 2013


34 | P a g e

The data validation commands are located on


the Data tab, in the Data Tools group.

 Restrict numbers outside a specified


range For example, you can specify a
minimum limit of deductions to two
times the number of children in a
You configure data validation in the Data particular cell.
Validation dialog box.  Restrict dates outside a certain time
frame For example, you can specify a
time frame between today's date and
3 days from today's date.
 Restrict times outside a certain time
frame For example, you can specify
a time frame for serving breakfast
between the time when the restaurant
opens and 5 hours after the restaurant
opens.
 Limit the number of text
characters For example, you can
limit the allowed text in a cell to 10 or
fewer characters. Similarly, you can
set the specific length for a full name
field (C1) to be the current length of a
first name field (A1) and a last name
field (B1), plus 10 characters.
When is data validation useful?  Validate data based on formulas or
values in other cells For example,
Data validation is invaluable when you want you can use data validation to set a
to share a workbook with others in your maximum limit for commissions and
organization, and you want the data entered bonuses of $3,600, based on the
in the workbook to be accurate and overall projected payroll value. If users
consistent. enter more than $3,600 in the cell,
they see a validation message.
Among other things, you can use data
validation to do the following: Data validation messages
 Restrict data to predefined items in a What users see when they enter invalid data
list For example, you can limit types into a cell depends on how you have
of departments to Sales, Finance, configured the data validation. You can
R&D, and IT. Similarly, you can create choose to show an input message when the
a list of values from a range of cells user selects the cell. Input messages are
elsewhere in the worksheet. generally used to offer users guidance about
the type of data that you want entered in the
cell. This type of message appears near the
P a g e | 35

cell. You can move this message, if you want Icon Type Use to
to, and it remains until you move to another without preventing them
cell or press Esc. from entering it. This type
of error alert is the most
flexible. When an
Information alert message
appears, users can click OK
to accept the invalid value
or Cancel to reject it.

You can customize the text that users see in


an error alert message. If you choose not to
You can also choose to show an error alert do so, users see a default message.
that appears only after users enter invalid
data. Input messages and error alerts appear only
when data is typed directly into the cells.
They do not appear under the following
conditions:

 A user enters data in the cell by


copying or filling.
 A formula in the cell calculates a result
that is not valid.
 A macro enters invalid data in the cell.

You can choose from three types of error


Tips for working with data validation
alerts:
Use these tips and tricks for working with
data validation in Excel.
Icon Type Use to
Prevent users from entering  If you plan to protect the worksheet or
invalid data in a cell. A Stop workbook, protect it after you have
Stop
alert message has two finished specifying any validation
options: Retry or Cancel. settings. Make sure that you unlock any
Warn users that the data validated cells before you protect the
they entered is invalid, worksheet. Otherwise, users will not be
without preventing them able to type any data in the cells.
from entering it. When a  If you plan to share the workbook, share
Warning alert message it only after you have finished specifying
Warning
appears, users can click Yes data validation and protection settings.
to accept the invalid entry, After you share a workbook, you won't
No to edit the invalid entry, be able to change the validation settings
or Cancel to remove the unless you stop sharing. However, Excel
invalid entry. will continue to validate the cells that
Inform users that the data you have designated while the
Information workbook is being shared.
they entered is invalid,

Advanced Excel 2013


36 | P a g e

 You can apply data validation to cells data by dragging and dropping cells,
that already have data entered in them. clear the Enable fill handle and cell
However, Excel does not automatically drag-and-drop check box in the
notify you that the existing cells contain Advanced category of the Excel Options
invalid data. In this scenario, you can dialog box (File tab, Options command),
highlight invalid data by instructing and then protect the worksheet.
Excel to circle it on the worksheet. Once  Manual recalculation is turned off If
you have identified the invalid data, you manual recalculation is turned on,
can hide the circles again. If you correct uncalculated cells can prevent data
an invalid entry, the circle disappears from being validated correctly. To turn
automatically. off manual recalculation, on the
Formulas tab, in the Calculation group,
click Calculation Options, and then click
Automatic.
 Formulas are error free Make sure
that formulas in validated cells do not
 To quickly remove data validation for a
cause errors, such as #REF! or #DIV/0!.
cell, select it, and then open the Data
Excel ignores the data validation until
Validation dialog box (Data tab, Data
you correct the error.
Tools group). On the Settings tab, click
 Cells referenced in formulas are
Clear All.
correct If a referenced cell changes so
 To find the cells on the worksheet that
that a formula in a validated cell
have data validation, on the Home tab,
calculates an invalid result, the
in the Editing group, click Find & Select,
validation message for the cell won't
and then click Data Validation. After
appear.
you have found the cells that have data
validation, you can change, copy, or
remove validation settings. How to handle a data validation alert
 When creating a drop-down list, you
can use the Define Name command If you see a data validation alert when you try
(Formulas tab, Defined Names group) to enter or change data in a cell, and you're
to define a name for the range that not clear about what you can enter, contact
contains the list. After you create the the owner of the workbook.
list on another worksheet, you can hide
If you inherited the workbook, you can modify
the worksheet that contains the list and
or remove the data validation unless the
then protect the workbook so that users
worksheet is protected with a password that
won't have access to the list.
you do not know. If possible, you can contact
If data validation isn't working, make sure the previous owner to help you unprotect the
that: worksheet. You can also copy the data to
another worksheet, and then remove the
 Users are not copying or filling data validation.
data Data validation is designed to
show messages and prevent invalid Add data validation to a cell or range
entries only when users type data
directly in a cell. When data is copied or So let's add some data validation. The steps in
filled, the messages do not appear. To this section explain how to apply one type of
prevent users from copying and filling validation—restricting data entry by providing
P a g e | 37

a drop down list—and the table that follows won't be able to see the drop-down
explains how to add some of the other types arrow next to the cell.
of validation that Excel provides. 7. To specify how you want to handle
blank (null) values, select or clear the
Follow the first three steps in this section to Ignore blank check box.
add any type of data validation.
Note If your allowed values are based
1. Select one or more cells to validate. on a cell range that has a defined
2. On the Data tab, in the Data Tools name and there is a blank cell
group, click Data Validation. anywhere in that range, selecting the
Ignore blank check box allows any
value to be entered in the validated
cell. This is also true for any cells that
are referenced by validation formulas:
if any referenced cell is blank,
selecting the Ignore blank check box
allows any value to be entered in the
3. If it isn't already selected, in the Data
validated cell.
Validation dialog box, click the
Settings tab. Tip If you change the validation
4. In the Allow box, select List. settings for a cell, you can
5. Click the Source box and then type the automatically apply your changes to
list values, separated by your all other cells that have the same
Microsoft Windows list separator settings. To do so, on the Settings tab,
character (commas by default). For select the Apply these changes to all
example: other cells with the same settings
o To limit an answer to two choices check box.
("Do you have children?" for
example), type Yes, No. 8. Test the data validation to make sure
o To limit a vendor's quality that it is working correctly. Try
reputation to three ratings, type entering both valid and invalid data in
Low, Average, High. the cells to make sure that your
o You can also create the list entries settings are working as you intended
by referring to a range of cells and your messages are appearing
elsewhere in the workbook. when you expect.
Note The width of the drop-down list is Help! The Data validation command is
determined by the width of the cell unavailable.
that has the data validation. You
might need to adjust the width of  An Excel table might be linked to a
that cell to prevent truncating the SharePoint site You cannot add data
width of valid entries that are wider validation to an Excel table that is linked
than the width of the drop-down to a SharePoint site. To add data
list. validation, you must unlink the Excel
table or convert the Excel table to a
6. Make sure that the In-cell dropdown range.
check box is selected. Otherwise, you

Advanced Excel 2013


38 | P a g e

 You might currently be entering If you know the result that you want from a
data The Data Validation command is formula, but are not sure what input value
not available on the Data tab while you the formula needs to get that result, use the
are entering data in a cell. To finish Goal Seek feature. For example, suppose that
entering data, press Enter or ESC. you need to borrow some money. You know
 The worksheet might be protected or how much money you want, how long you
shared You cannot change data want to take to pay off the loan, and how
validation settings if your workbook is much you can afford to pay each month. You
shared or protected. can use Goal Seek to determine what interest
rate you will need to secure in order to meet
Display an optional input message your loan goal.

 Click the Input Message tab (Data tab > Note Goal Seek works only with one variable
Data Tools > Data Validation). input value. If you want to accept more than
 Make sure the Show input message one input value; for example, both the loan
when cell is selected check box is amount and the monthly payment amount for
selected. a loan, you use the Solver add-in. For more
 Fill in the title and text for the message. information about the Solver add-in, follow
the links in the See Also section.
Specify an optional alert or error message
when invalid data is entered. Step-by-step with an example
 Click the Error Alert tab (Data tab > Let's look at the preceding example, step-by-
Data Tools > Data Validation), and step.
make sure that the Show error alert
after invalid data is entered check box Because you want to calculate the loan
is selected. If you want to allow users to interest rate needed to meet your goal, you
type entries that are not in the list, clear use the PMT function. The PMT function
the Show error alert after invalid data is calculates a monthly payment amount. In this
entered check box instead. example, the monthly payment amount is the
 Select one of the following options for goal that you seek.
the Style box:
 To display an information message that Prepare the worksheet
does not prevent entry of invalid data,
select Information. 1. Open a new, blank worksheet.
 To display a warning message that does 2. First, add some labels in the first
not prevent entry of invalid data, select column to make it easier to read the
Warning. worksheet.
 To prevent entry of invalid data, select a. In cell A1, type Loan Amount.
Stop. b. In cell A2, type Term in Months.
 Fill in the title and text for the message c. In cell A3, type Interest Rate.
(up to 225 characters). If you don't, d. In cell A4, type Payment.
Excel displays a generic alert message. 3. Next, add the values that you know.
a. In cell B1, type 100000. This is the
Use Goal Seek to find the result you amount that you want to borrow.
want by adjusting an input value
P a g e | 39

b. In cell B2, type 180. This is the For more information about the
number of months that you want PMT function, see the See Also
to pay off the loan. section.

Note Although you know the Use Goal Seek to determine the
payment amount that you want, interest rate
you do not enter it as a value,
because the payment amount is a 1. On the Data tab, in the Data Tools
result of the formula. Instead, you group, click What-If Analysis, and then
add the formula to the worksheet click Goal Seek.
and specify the payment value at 2. In the Set cell box, enter the reference
a later step, when you use Goal for the cell that contains the formula
Seek. that you want to resolve. In the
example, this reference is cell B4.
4. Next, add the formula for which you 3. In the To value box, type the formula
have a goal. For the example, use the result that you want. In the example,
PMT function: this is -900. Note that this number is
a. In cell B4, type negative because it represents a
=PMT(B3/12,B2,B1). This formula payment.
calculates the payment amount. 4. In the By changing cell box, enter the
In this example, you want to pay reference for the cell that contains the
$900 each month. You don't enter value that you want to adjust. In the
that amount here, because you example, this reference is cell B3.
want to use Goal Seek to
determine the interest rate, and Note The cell that Goal Seek changes
Goal Seek requires that you start must be referenced by the formula in
with a formula. the cell that you specified in the Set
cell box.
The formula refers to cells B1 and
B2, which contain values that you 5. Click OK.
specified in preceding steps. The
formula also refers to cell B3, Goal Seek runs and produces a result,
which is where you will specify as shown in the following illustration.
that Goal Seek put the interest
rate. The formula divides the
value in B3 by 12 because you
specified a monthly payment, and
the PMT function assumes an
annual interest rate.

Because there is no value in cell


B3, Excel assumes a 0% interest
rate and, using the values in the
example, returns a payment of
$555.56. You can ignore that value 6. Finally, format the target cell (B3) so
for now. that it displays the result as a
percentage.

Advanced Excel 2013


40 | P a g e

a. On the Home tab, in the Number income levels and expenses, and then create
group, click Percentage. a report that lets you compare the scenarios
b. Click Increase Decimal or side-by-side.
Decrease Decimal to set the
number of decimal places. Kinds of what-if analysis There are three
kinds of what-if analysis tools in Excel:
scenarios, data tables, and goal seek.
Scenarios and data tables take sets of input
values and project forward to determine
Switch between various sets of values possible results. Goal seek differs from
by using scenarios scenarios and data tables in that it takes a
result and projects backwards to determine
A scenario is a set of values that Microsoft possible input values that produce that result.
Office Excel saves and can substitute
automatically on your worksheet. You can Like data tables, scenarios help you explore a
create and save different groups of values as set of possible outcomes. Unlike data tables,
scenarios on a worksheet and then switch scenarios from several different worksheets
between these scenarios to view the different or workbooks can be merged. Scenarios make
results. it easy to gather data about possible
outcomes from a variety of sources, and then
If several people have specific information combine the data.
that you want to use in scenarios, you can
collect the information in separate Each scenario can accommodate up to 32
workbooks, and then merge the scenarios variable values. If you want to analyze more
from the different workbooks into one. than 32 values, and the values represent only
one or two variables, you can use data tables.
After you have all the scenarios you need, you Although it is limited to only one or two
can create a scenario summary report that variables (one for the row input cell and one
incorporates information from all the for the column input cell), a data table can
scenarios. include as many different variable values as
you want. A scenario can have a maximum of
Overview 32 different values, but you can create as
many scenarios as you want.
Scenarios are part of a suite of commands
called what-if analysis tools. When you use For information about other what-if analysis
scenarios, you are doing what-if analysis. tools, see the See Also section.

What-if analysis is the process of changing the Scenario basics


values in cells to see how those changes will
affect the outcome of formulas on the Creating scenarios Suppose that you want
worksheet. You can use scenarios to create to create a budget but are uncertain of your
and save different sets of values and switch revenue. By using scenarios, you can define
between them. You can also create a scenario different possible values for the revenue and
summary report, which combines all the then switch between scenarios to perform
scenarios on one worksheet. For example, what-if analyses.
you can create several different budget
scenarios that compare various possible
P a g e | 41

Note This section explains how to use (B1) and Costs (B2)— you do not change cell
scenarios, and shows sample data and the B3 for the Best Case scenario.
results of applying scenarios that use that
data. It does not provide step-by-step After you save a scenario, it becomes
instructions. For step-by-step instructions, see available on the list of scenarios that you can
the section Create a scenario, later in this use in your what-if analyses. Given the values
article. in the preceding illustration, if you chose to
display the Best Case scenario, the values in
For example, assume that your worst case the worksheet would change to resemble the
budget scenario is Gross Revenue of $50,000 following illustration:
and Costs of Goods Sold of $13,200, leaving
$36,800 in Gross Profit. To define this set of
values as a scenario, you first enter the values
in a worksheet, as shown in the following
illustration:

1. Changing cells

2. Result cell

Merging scenarios There may be times


1. Changing cells have values that you type in. when you have all the information in one
worksheet or workbook that is required to
2. The result cell contains a formula that is create all the scenarios that you want to
based on the changing cells (in this consider. However, you may want to gather
illustration, =B1-B2). scenario information from other sources. For
example, suppose you are trying to create a
You then use the Scenario Manager dialog budget for a larger company. You might
box to save these values as a scenario, name collect scenarios from different departments,
the scenario Worst Case, and specify that cells such as Payroll, Production, Marketing, and
B1 and B2 are values that change between Legal, because each of these sources has
scenarios. different information to use in creating
scenarios.
Note Although this example contains only
two changing cells (B1 and B2), a scenario can You can gather these scenarios into one
contain up to 32 cells. worksheet by using the Merge command.
Each source can supply as many or as few
Now suppose that your best case budget changing cell values as you want. For
scenario is Gross Revenue of $150,000 and example, you might want each department to
Costs of Goods Sold of $26,000, leaving supply expenditure projections, but only need
$124,000 in Gross Profit. To define this set of revenue projections from a few.
values as a scenario, you create another
scenario, name it Best Case, and supply When you collect different scenarios from
different values for cell B1 (150,000) and cell various sources, you should use the same cell
B2 (26,000). Because Gross Profit (cell B3) is a structure in each of the workbooks. For
formula— the difference between Revenue example, Revenue might always go in cell B2
and Expenditures might always go in cell B3. If

Advanced Excel 2013


42 | P a g e

you use different structures for the scenarios Before you create a scenario, you should have
from various sources, it can be difficult to an initial set of values already on the
merge the results. worksheet. To make scenario summary
reports easier to read, you should also
Tip Consider first creating a scenario consider naming the cells that you plan to use
yourself, and then sending your colleagues a in scenarios. For Help on naming cells, see the
copy of the workbook that contains that topic Use names to clarify formulas.
scenario. This makes it easier to be sure that
all the scenarios are structured the same way. 1. On the Data tab, in the Data Tools group,
click What-If Analysis, and then click
Scenario summary reports To compare Scenario Manager.
several scenarios, you can create a report that 2. Click Add.
summarizes them on the same page. The 3. In the Scenario name box, type a name
report can list the scenarios side by side or for the scenario.
present them in a PivotTable report. A 4. In the Changing cells box, enter the
scenario summary report based on the references for the cells that you want to
preceding two example scenarios would look specify in your scenario. For example, if
something like the following: you want to see how changing the values
of cells B1 and B2 will affect the outcome
of a formula based on those cells, enter
B1,B2.

Note To preserve the initial values for


the changing cells, add a scenario that
uses those values before you create
Note By default, the summary report uses additional scenarios that use different
cell references to identify the changing cells values.
and result cells. For this example, names were
created for those cells to make the summary 5. Under Protection, select the options that
report easier to read. If you create names for you want.
the cells before you run the summary report,
the report will contain the names instead of Note These options apply only to
cell references. protected worksheets. For more
information about protected worksheets,
A note appears at the end of the summary see the See Also section.
report explaining that the Current Values
column represents the values of changing o Select Prevent Changes to prevent
cells at the time the Scenario Summary editing of the scenario when the
Report was created, and that the cells that worksheet is protected.
changed for each scenario are highlighted in o Select Hidden to prevent display of the
gray. scenario when the worksheet is
protected.
For more information about creating a 6. Click OK.
scenario summary report, see the section 7. In the Scenario Values dialog box, type
Create a scenario summary report. the values that you want to use in the
changing cells for this scenario.
Create a scenario 8. To create the scenario, click OK.
P a g e | 43

9. If you want to create additional 5. In the Sheet box, click the name of the
scenarios, repeat steps 2 through 8. After worksheet that contains scenarios that
you finish creating scenarios, click OK, you want to merge.
and then click Close in the Scenario 6. Click OK to merge the scenarios from the
Manager dialog box. selected worksheet into the current
worksheet.
Display a scenario
The Merge Scenarios dialog box closes,
When you display a scenario, you switch to and the scenarios that you merged now
the set of values that are saved as part of that appear in the Scenario Manager dialog
scenario. The scenario values are displayed in box.
the cells that change from scenario to
scenario, in addition to the results cells. For 7. Repeat the preceding four steps as
example, using the preceding scenarios, if you needed until you have merged all the
display the Best Case scenario, cell B1 displays scenarios that you want.
150000, cell B2 displays 26000, and cell B3
displays 124000. When you are finished, the scenarios that
you merged are all part of the current
1. On the Data tab, in the Data Tools group, worksheet. You can close the Scenario
click What-If Analysis, and then click Manager dialog box, or leave it open to
Scenario Manager. continue your analysis.
2. Click the name of the scenario that you
want to display. Create a scenario summary report
3. Click Show.
1. On the Data tab, in the Data Tools group,
Note After you close the Scenario click What-If Analysis, and then click
Manager dialog box, the values from the Scenario Manager.
last scenario that you displayed remain 2. Click Summary.
on the worksheet. If you saved your 3. Click Scenario summary or Scenario
initial values as a scenario, you can PivotTable report.
display those values before you close the 4. In the Result cells box, enter the
Scenario Manager dialog box. references for the cells that refer to cells
whose values are changed by the
Merge scenarios scenarios. Separate multiple references
with commas.
1. Select the worksheet in which to store
the merged scenarios results. Notes
2. On the Data tab, in the Data Tools group,
click What-If Analysis, and then click o Scenario reports do not automatically
Scenario Manager. recalculate. If you change the values of a
3. Click Merge. scenario, those changes will not show up
4. In the Merge Scenarios dialog box, click in an existing summary report, but will
the arrow next to Book and select a show up if you create a new summary
workbook that contains scenarios that report.
you want to merge in your results. o You don't need result cells to generate a
scenario summary report, but you do

Advanced Excel 2013


44 | P a g e

need them for a scenario PivotTable


report.

Insert subtotals in a list of data in a


worksheet

You can automatically calculate subtotals


and grand totals in a list for a column by
using the Subtotal command.

Important

The Subtotal command will appear


grayed out if you are working with a If the workbook is set to automatically
Microsoft Excel table. To add subtotals in calculate formulas, the Subtotal command
a table, you must first convert the table recalculates subtotal and grand total values
to a normal range of data, and then add automatically as you edit the detail data. The
the subtotal. Note that this will remove Subtotal command also outlines the list so
all table functionality from the data that you can display and hide the detail rows
except table formatting. for each subtotal.

When you insert subtotals: Insert subtotals

 Subtotals are calculated with a Note If you filter data that contains
summary function, such as Sum or subtotals, your subtotals may appear hidden.
Average, by using the SUBTOTAL To display them again, clear all filters For
function. You can display more than one more information on applying filters, see
type of summary function for each Quick start: Filter data by using an AutoFilter.
column.
 Grand totals are derived from detail 1. Make sure that each column in a range of
data, not from the values in the data for which you want to calculate
subtotals. For example, if you use the subtotals has a label in the first row,
Average summary function, the grand contains similar facts in each column, and
total row displays an average of all of the that the range does not include any blank
detail rows in the list, not an average of rows or columns.
the values in the subtotal rows. 2. Select a cell in the range.
3. Do one of the following:

Insert one level of subtotals

You can insert one level of subtotals for a


group of data as shown in the following
example.
P a g e | 45

f. If you want an automatic page break


following each subtotal, select the Page
break between groups check box.
g. To specify a summary row above the
details row, clear the Summary below
data check box. To specify a summary
row below the details row, select the
Summary below data check box. For
example, using the example above, you
would clear the check box.
h. Optionally, you can use the Subtotals
command again by repeating steps one
1. At each change in the Sport column… through seven to add more subtotals
with different summary functions. To
2. …subtotal the Sales column.
avoid overwriting the existing subtotals,
clear the Replace current subtotals check
a. To sort the column that contains the data
box.
you want to group by, select that column,
and then on the Data tab, in the Sort &
Insert nested levels of subtotals
Filter group, click Sort A to Z or Sort Z to
A. You can insert subtotals for inner, nested
b. On the Data tab, in the Outline group, groups within their corresponding outer
click Subtotal. groups as shown in the following
example.

The Subtotal dialog box is displayed.

c. In the At each change in box, click the


column to subtotal. For example, using
the example above, you would select
Sport.
d. In the Use function box, click the
summary function that you want to use
to calculate the subtotals. For example,
using the example above, you would
select Sum.
e. In the Add subtotal to box, select the
check box for each column that contains 1. At each change in the outer, Region
values that you want to subtotal. For column…
example, using the example above, you
would select Sales. 2. subtotal the Sales for that region and at
each change for the inner, Sport column.

Advanced Excel 2013


46 | P a g e

i. To sort the column that contains the data overwriting the existing subtotals, clear
you want to group by, select that column, the Replace current subtotals check box.
and then on the Data tab, in the Sort & k. Insert the nested subtotals.
Filter group, click Sort A to Z or Sort Z to
A. How to insert the nested subtotals
j. Insert the outer subtotals.
i. On the Data tab, in the Outline group,
How to insert the outer subtotals click Subtotal.

i. On the Data tab, in the Outline group,


click Subtotal.

The Subtotal dialog box is displayed.

ii. In the At each change in box, click the


The Subtotal dialog box is displayed. nested subtotal column. For example,
using the example above, you would
ii. In the At each change in box, click the select Sport.
column for the outer subtotals. For iii. In the Use function box, click the
example, using the example above, you summary function that you want to use
would click Region. to calculate the subtotals. For example,
iii. In the Use function box, click the using the example above, you would
summary function that you want to use select Sum.
to calculate the subtotals. For example,
using the example above, you would Select any other options that you want.
select Sum.
iv. In the Add subtotal to box, select the iv. Clear the Replace current subtotals
check box for each column that contains check box.
values that you want to subtotal. In the l. Repeat the previous step for more nested
example above, you would select Sales. subtotals, working from the outermost
v. If you want an automatic page break subtotals in.
following each subtotal, select the Page
break between groups check box. Tip To display a summary of just the
vi. To specify a summary row above the subtotals and grand totals, click the
details row, clear the Summary below outline symbols next to the row
data check box. To specify a summary numbers. Use the and symbols to
row below the details row, select the display or hide the detail rows for
Summary below data check box. For individual subtotals.
example, using the example above, you
would clear the check box. Remove subtotals
vii. Optionally, you can use the Subtotals
command again by repeating steps one 1. Select a cell in the range that contains
through six to add more subtotals with subtotals.
different summary functions. To avoid 2. On the Data tab, in the Outline group,
click Subtotal.
P a g e | 47

expenses, and the profit. Solver can change


the quarterly budgets for advertising (decision
variable cells B5:C5), up to a total budget
constraint of $20,000 (cell F5), until the total
profit (objective cell F7) reaches the
maximum possible amount. The values in the
3. In the Subtotal dialog box, click Remove
variable cells are used to calculate the profit
All.
for each quarter, so they are related to the
formula objective cell F7, =SUM(Q1 Profit:Q2
Define and solve a problem by using Profit).
Solver

Solver is part of a suite of commands


sometimes called what-if analysis tools. With
Solver, you can find an optimal (maximum or
minimum) value for a formula in one cell —
called the objective cell — subject to
constraints, or limits, on the values of other
formula cells on a worksheet. Solver works
with a group of cells, called decision variables 1. Variable cells
or simply variable cells, that participate in
computing the formulas in the objective and 2. Constrained cell
constraint cells. Solver adjusts the values in
the decision variable cells to satisfy the limits 3. Objective cell
on constraint cells and produce the result you
want for the objective cell. After Solver runs, the new values are as
follows.
Note Earlier versions of Solver referred to
the objective cell as the "target cell," and the
decision variable cells as "changing cells" or
"adjustable cells."

Overview
Define and solve a problem
Use Solver to determine the maximum or
minimum value of one cell by changing other 1. On the Data tab, in the Analysis group,
cells. For example, you can change the click Solver.
amount of your projected advertising budget
and see the effect on your projected profit
amount.

Example of a Solver evaluation

In the following example, the level of If the Solver command or the Analysis
advertising in each quarter affects the group is not available, you need to load
number of units sold, indirectly determining the Solver Add-in program.
the amount of sales revenue, the associated

Advanced Excel 2013


48 | P a g e

How to load the Solver Add-in program number, a cell reference or name, or a
formula.
a. Click the File tab, click Options, and then e. Do one of the following:
click the Add-Ins category.  To accept the constraint and add
b. In the Manage box, click Excel Add-ins, another, click Add.
and then click Go.  To accept the constraint and return to
c. In the Add-ins available box, select the the Solver Parameters dialog box, click
Solver Add-in check box, and then click OK.
OK.
2. In the Set Objective box, enter a cell Note You can apply the int, bin, and dif
reference or name for the objective cell. relationships only in constraints on
The objective cell must contain a formula. decision variable cells.
3. Do one of the following:
a. If you want the value of the objective cell You can change or delete an existing
to be as large as possible, click Max. constraint by doing the following:
b. If you want the value of the objective cell
to be as small as possible, click Min. f. In the Solver Parameters dialog box, click
c. If you want the objective cell to be a the constraint that you want to change or
certain value, click Value of, and then delete.
type the value in the box. g. Click Change and then make your
4. In the By Changing Variable Cells box, changes, or click Delete.
enter a name or reference for each 6. Click Solve and do one of the following:
decision variable cell range. Separate the a. To keep the solution values on the
nonadjacent references with commas. worksheet, in the Solver Results dialog
The variable cells must be related directly box, click Keep Solver Solution.
or indirectly to the objective cell. You can b. To restore the original values before you
specify up to 200 variable cells. clicked Solve, click Restore Original
5. In the Subject to the Constraints box, Values.
enter any constraints that you want to
apply by doing the following: Notes
a. In the Solver Parameters dialog box, click
Add. c. You can interrupt the solution process by
b. In the Cell Reference box, enter the cell pressing ESC. Microsoft Excel recalculates
reference or name of the cell range for the worksheet with the last values that
which you want to constrain the value. are found for the decision variable cells.
c. Click the relationship ( <=, =, >=, int, bin, d. To create a report that is based on your
or dif ) that you want between the solution after Solver finds a solution, you
referenced cell and the constraint. can click a report type in the Reports box
and then click OK. The report is created
If you click int, integer appears in the on a new worksheet in your workbook. If
Constraint box. If you click bin, binary Solver doesn't find a solution, only
appears in the Constraint box. If you click certain reports or no reports are
dif, alldifferent appears in the Constraint available.
box. e. To save your decision variable cell values
as a scenario that you can display later,
d. If you choose <=, =, or >= for the click Save Scenario in the Solver Results
relationship in the Constraint box, type a
P a g e | 49

dialog box, and then type a name for the Tip You can save the last selections
scenario in the Scenario Name box. in the Solver Parameters dialog box
with a worksheet by saving the
Step through Solver trial solutions workbook. Each worksheet in a
workbook may have its own Solver
1. After you define a problem, click Options selections, and all of them are saved.
in the Solver Parameters dialog box. You can also define more than one
2. In the Options dialog box, select the problem for a worksheet by clicking
Show Iteration Results check box to see Load/Save to save problems
the values of each trial solution, and then individually.
click OK.
3. In the Solver Parameters dialog box, click Solving methods used by Solver
Solve.
4. In the Show Trial Solution dialog box, do You can choose any of the following three
one of the following: algorithms or solving methods in the Solver
o To stop the solution process and Parameters dialog box:
display the Solver Results dialog box,
click Stop.  Generalized Reduced Gradient (GRG)
o To continue the solution process and Nonlinear Use for problems that are
display the next trial solution, click smooth nonlinear.
Continue.  LP Simplex Use for problems that are
linear.
Change how Solver finds solutions  Evolutionary Use for problems that
are non-smooth.
1. In the Solver Parameters dialog box, click
Options. Create or delete a macro
2. Choose or enter values for any of the
options on the All Methods, GRG To automate a repetitive task, you can quickly
Nonlinear, and Evolutionary tabs in the record a macro in Microsoft Office Excel. You
dialog box. can also create a macro by using the Visual
Basic Editor in Microsoft Visual Basic to write
Save or load a problem model your own macro script, or to copy all or part
of a macro to a new macro. After you create a
1. In the Solver Parameters dialog box, click macro, you can assign it to an object (such as
Load/Save. a toolbar button, graphic, or control) so that
2. Enter a cell range for the model area, and you can run it by clicking the object. If you no
click either Save or Load. longer use a macro, you can delete it.

When you save a model, enter the Record a macro


reference for the first cell of a vertical
range of empty cells in which you want to When you record a macro, the macro
place the problem model. When you load recorder records all the steps required to
a model, enter the reference for the complete the actions that you want your
entire range of cells that contains the macro to perform. Navigation on the Ribbon
problem model. is not included in the recorded steps.

Advanced Excel 2013


50 | P a g e

Note The Ribbon is a component of the name; an underscore character works well as
Microsoft Office Fluent user interface. a word separator. If you use a macro name
that is also a cell reference, you may get an
1. If the Developer tab is not available, error message that the macro name is not
do the following to display it: valid.
a. Click the Microsoft Office
Button , and then click Excel 1. To assign a CTRL combination shortcut
Options. key to run the macro, in the Shortcut
b. In the Popular category, under key box, type any lowercase letter or
Top options for working with uppercase letter that you want to use.
Excel, select the Show
Developer tab in the Ribbon Note The shortcut key will override
check box, and then click OK. any equivalent default Excel shortcut
2. To set the security level temporarily to key while the workbook that contains
enable all macros, do the following: the macro is open. For a list of CTRL
a. On the Developer tab, in the combination shortcut keys that are
Code group, click Macro already assigned in Excel, see Excel
Security. shortcut and function keys.

2. In the Store macro in list, select the


workbook where you want to store the
macro.

Tip If you want a macro to be available


whenever you use Excel, select Personal
b. Under Macro Settings, click Enable all Macro Workbook. When you select
macros (not recommended, potentially Personal Macro Workbook, Excel
dangerous code can run), and then click creates a hidden personal macro
OK. workbook (Personal.xlsb) if it does not
already exist, and saves the macro in
Note To help prevent potentially this workbook. In Windows Vista, this
dangerous code from running, we workbook is saved in the C:\Users\user
recommend that you return to any one of name\AppData\Local\Microsoft\Excel\X
the settings that disable all macros after LStart folder. In Microsoft Windows XP,
you finish working with macros. For more this workbook is saved in the
information about how to change the C:\Documents and Settings\user
settings, see Change macro security name\Application
settings in Excel. Data\Microsoft\Excel\XLStart folder.
Workbooks in the XLStart folder are
3. On the Developer tab, in the Code
opened automatically whenever Excel
group, click Record Macro.
starts. If you want a macro in the
4. In the Macro name box, enter a name
personal macro workbook to be run
for the macro.
automatically in another workbook, you
must also save that workbook in the
Note The first character of the macro name
XLStart folder so that both workbooks
must be a letter. Subsequent characters can
are opened when Excel starts.
be letters, numbers, or underscore
characters. Spaces cannot be used in a macro
P a g e | 51

3. In the Description box, type a macros after you finish working


description of the macro. with macros.
4. Click OK to start recording.
5. Perform the actions that you want to 3. On the Developer tab, in the Code
record. group, click Visual Basic.
6. On the Developer tab, in the Code 4. If needed, in the Visual Basic Editor, on
group, click Stop Recording . the Insert menu, click Module.

Tip You can also click Stop Recording Note Modules are automatically
created for all sheets in the workbook.
on the left side of the status bar.
5. In the code window of the module,
Create a macro by using Microsoft type or copy the macro code that you
Visual Basic want to use.
6. To run the macro from the module
1. If the Developer tab is not available, window, press F5.
do the following to display it: 7. In the Visual Basic Editor, on the File
a. Click the Microsoft Office menu, click Close and Return to
Button , and then click Excel Microsoft Excel when you finish
Options. writing the macro.
b. In the Popular category, under
Top options for working with Copy part of a macro to create
Excel, select the Show
another macro
Developer tab in the Ribbon
check box, and then click OK.
1. If the Developer tab is not available,
2. To set the security level temporarily to
do the following to display it:
enable all macros, do the following:
a. Click the Microsoft Office
a. On the Developer tab, in the
Button , and then click Excel
Code group, click Macro
Options.
Security.
b. In the Popular category, under
Top options for working with
Excel, select the Show
Developer tab in the Ribbon
check box, and then click OK.
2. To set the security level temporarily to
enable all macros, do the following:
b. Under Macro Settings, click a. On the Developer tab, in the
Enable all macros (not Code group, click Macro
recommended, potentially Security.
dangerous code can run), and
then click OK.

Note To help prevent


potentially dangerous code
from running, we recommend
that you return to any one of
b. Under Macro Settings, click
the settings that disable all
Enable all macros (not

Advanced Excel 2013


52 | P a g e

recommended, potentially Assign a macro to an object, graphic,


dangerous code can run), and or control
then click OK.
1. On a worksheet, right-click the object,
Note To help prevent graphic, or control to which you want
potentially dangerous code to assign an existing macro, and then
from running, we recommend click Assign Macro.
that you return to any one of 2. In the Macro name box, click the
the settings that disable all macro that you want to assign.
macros after you finish working
with macros.
Delete a macro
3. Open the workbook that contains the
1. Do one of the following:
macro that you want to copy.
o Open the workbook that contains the
4. On the Developer tab, in the Code
macro that you want to delete.
group, click Macros.
o If the macro that you want to delete is
5. In the Macro name box, click the
stored in the personal macro
name of the macro that you want to
workbook (Personal.xlsb), and this
copy.
workbook is hidden, do the following
6. Click Edit.
to unhide the workbook:
7. In the code window of the Visual Basic
i. On the View tab, in the Window
Editor, select the lines of the macro
group, click Unhide.
that you want to copy.
ii. Under Unhide workbooks, click
PERSONAL, and then click OK.
Tip To copy the whole macro, include the
2. If the Developer tab is not available, do
Sub and End Sub lines in the selection.
the following to display it:
a. Click the Microsoft Office Button , and
1. On the Edit menu, click Copy.
then click Excel Options.
Tip You can also right-click and then b. In the Popular category, under Top options
click Copy, or you can press CTRL+C. for working with Excel, select the Show
Developer tab in the Ribbon check box, and
2. In the Procedure box of the code then click OK.
window, click the module where you 3. On the Developer tab, in the Code
want to place the code. group, click Macros.
3. On the Edit menu, click Paste.

Tip You can also right-click and then


click Paste, or you can press CTRL+V.

Tip You cannot edit your Personal Macro


Workbook file (Personal.xlsb) because it is a 4. In the Macros in list, select the
hidden workbook that is always open. You workbook that contains the macro
must first unhide it by using the Unhide that you want to delete. For example,
command. You can also open it in the Visual click This Workbook.
Basic Editor by pressing ALT+F11.
P a g e | 53

5. In the Macro name box, click the 4. The horizontal (category) and vertical
name of the macro that you want to (value) axis along which the data is plotted in
delete. the chart.
6. Click Delete.
5. The legend of the chart.
Create a chart from start to finish
6. A chart and axis title that you can use in the
Microsoft Excel no longer provides the chart chart.
wizard. Instead, you can create a basic chart
by clicking the chart type that you want on 7. A data label that you can use to identify the
the Insert tab in the Charts group. To create a details of a data point in a data series.
chart that displays the details that you want,
you can then continue with the next steps of Modifying a basic chart to meet your
the following step-by-step process. needs

Getting to know the elements of a After you create a chart, you can modify any
chart one of its elements. For example, you might
want to change the way that axes are
A chart has many elements. Some of these displayed, add a chart title, move or hide the
elements are displayed by default, others can legend, or display additional chart elements.
be added as needed. You can change the
display of the chart elements by moving them To modify a chart, you can do one or more of
to other locations in the chart, resizing them, the following:
or by changing the format. You can also
remove chart elements that you do not want  Change the display of chart axes You
to display. can specify the scale of axes and
adjust the interval between the values
or categories that are displayed. To
make your chart easier to read, you
can also add tick marks to an axis, and
specify the interval at which they will
appear.
 Add titles and data labels to a
chart To help clarify the information
that appears in your chart, you can
add a chart title, axis titles, and data
labels.
 Add a legend or data table You can
show or hide a legend, change its
1. The chart area of the chart. location, or modify the legend entries.
In some charts, you can also show a
2. The plot area of the chart. data table that displays the legend
keys and the values that are presented
3. The data points of the data series that are in the chart.
plotted in the chart.  Apply special options for each chart
type Special lines (such as high-low
lines and trendlines), bars (such as up-

Advanced Excel 2013


54 | P a g e

down bars and error bars), data markers, the chart area, the plot area, and the
markers, and other options are numbers and text in titles and labels to give
available for different chart types. your chart a custom, eye-catching look. You
can apply specific shape styles and WordArt
Applying a predefined chart layout styles, and you can also format the shapes
and chart style for a professional look and text of chart elements manually.

Instead of manually adding or changing chart To add formatting, you can use one or more
elements or formatting the chart, you can of the following:
quickly apply a predefined chart layout and
chart style to your chart. Excel provides a  Fill chart elements You can use
variety of useful predefined layouts and colors, textures, pictures, and gradient
styles. However, you can fine-tune a layout or fills to help draw attention to specific
style as needed by making manual changes to chart elements.
the layout and format of individual chart  Change the outline of chart
elements, such as the chart area, plot area, elements You can use colors, line
data series, or legend of the chart. styles, and line weights to emphasize
chart elements.
When you apply a predefined chart layout, a  Add special effects to chart
specific set of chart elements (such as titles, a elements You can apply special
legend, a data table, or data labels) are effects, such as shadow, reflection,
displayed in a specific arrangement in your glow, soft edges, bevel, and 3-D
chart. You can select from a variety of layouts rotation to chart element shapes,
that are provided for each chart type. which gives your chart a finished look.
 Format text and numbers You can
When you apply a predefined chart style, the format text and numbers in titles,
chart is formatted based on the document labels, and text boxes on a chart as
theme that you have applied, so that your you would text and numbers on a
chart matches your organization's or your worksheet. To make text and numbers
own theme colors (a set of colors), theme stand out, you can even apply
fonts (a set of heading and body text fonts), WordArt styles.
and theme effects (a set of lines and fill
effects).

You cannot create your own chart layouts or


styles, but you can create chart templates Reusing charts by creating chart
that include the chart layout and formatting
that you want.
templates

If you want to reuse a chart that you


customized to meet your needs, you can save
that chart as a chart template (*.crtx) in the
Adding eye-catching formatting to a
chart templates folder. When you create a
chart chart, you can then apply the chart template
just as you would any other built-in chart
In addition to applying a predefined chart type. In fact, chart templates are custom
style, you can easily apply formatting to chart types — you can also use them to
individual chart elements such as data
P a g e | 55

change the chart type of an existing chart. If To select Do this


you use a specific chart template frequently, Click the first cell in the
you can save it as the default chart type. range, and then drag to the
last cell, or hold down SHIFT
Step 1: Create a basic chart while you press the arrow
keys to extend the selection.
For most charts, such as column and bar A range of
charts, you can plot the data that you arrange cells You can also select the first
in rows or columns on a worksheet into a cell in the range, and then
chart. However, some chart types (such as pie press F8 to extend the
and bubble charts) require a specific data selection by using the arrow
arrangement. keys. To stop extending the
selection, press F8 again.
1. On the worksheet, arrange the data
Click the first cell in the
that you want to plot in a chart.
range, and then hold down
A large range SHIFT while you click the last
The data can be arranged in rows or
of cells cell in the range. You can
columns — Excel automatically
scroll to make the last cell
determines the best way to plot the
visible.
data in the chart. Some chart types
(such as pie and bubble charts) require Click the Select All button.
a specific data arrangement.

How to arrange data on the


worksheet

2. Select the cells that contain the data


that you want to use for the chart. All cells on a To select the entire
worksheet worksheet, you can also
Tip If you select only one cell, Excel press CTRL+A.
automatically plots all cells that
contain data that is adjacent to that Note If the worksheet
cell into a chart. If the cells that you contains data, CTRL+A selects
want to plot in a chart are not in a the current region. Pressing
continuous range, you can select CTRL+A a second time selects
nonadjacent cells or ranges as long as the entire worksheet.
the selection forms a rectangle. You Select the first cell or range
can also hide the rows or columns that of cells, and then hold down
you do not want to plot in the chart. CTRL while you select the
other cells or ranges.
How to select cells, ranges, rows, or Nonadjacent
columns cells or cell You can also select the first
ranges cell or range of cells, and
To select Do this then press SHIFT+F8 to add
Click the cell, or press the another nonadjacent cell or
A single cell arrow keys to move to the range to the selection. To
cell. stop adding cells or ranges to

Advanced Excel 2013


56 | P a g e

To select Do this To select Do this


the selection, press SHIFT+F8 columns column in your selection;
again. then hold down CTRL while
you click the column or row
Note You cannot cancel the headings of other rows or
selection of a cell or range of columns that you want to
cells in a nonadjacent add to the selection.
selection without canceling Select a cell in the row or
the entire selection. The first or column, and then press
Click the row or column last cell in a CTRL+ARROW key (RIGHT
heading. row or ARROW or LEFT ARROW for
column rows, UP ARROW or DOWN
ARROW for columns).
Press CTRL+HOME to select
The first or the first cell on the
last cell on a worksheet or in an Excel list.
worksheet or
1. Row heading
in a Microsoft Press CTRL+END to select the
Office Excel last cell on the worksheet or
2. Column heading
table in an Excel list that contains
data or formatting.
You can also select cells in a
row or column by selecting Cells to the Select the first cell, and then
last used cell press CTRL+SHIFT+END to
An entire row the first cell and then
pressing on the extend the selection of cells
or column
CTRL+SHIFT+ARROW key worksheet to the last used cell on the
(RIGHT ARROW or LEFT (lower-right worksheet (lower-right
ARROW for rows, UP ARROW corner) corner).
or DOWN ARROW for Select the first cell, and then
columns). Cells to the press CTRL+SHIFT+HOME to
beginning of extend the selection of cells
Note If the row or column the worksheet to the beginning of the
contains data, worksheet.
CTRL+SHIFT+ARROW key Hold down SHIFT while you
selects the row or column to click the last cell that you
the last used cell. Pressing More or fewer
want to include in the new
CTRL+SHIFT+ARROW key a cells than the
selection. The rectangular
second time selects the active
range between the active cell
entire row or column. selection
and the cell that you click
Drag across the row or becomes the new selection.
column headings. Or select
Adjacent rows
the first row or column; then Tip To cancel a selection of cells, click
or columns
hold down SHIFT while you any cell on the worksheet.
select the last row or column.
Nonadjacent Click the column or row 3. On the Insert tab, in the Charts group,
rows or heading of the first row or do one of the following:
P a g e | 57

o Click the chart type, and then Tip If you want to replace the
click a chart subtype that you suggested name for the chart, you
want to use. can type a new name in the New
o To see all available chart types, sheet box.
click to launch the Insert
Chart dialog box, and then click  To display the chart as an
the arrows to scroll through embedded chart in a worksheet,
the chart types. click Object in, and then click a
worksheet in the Object in box.
5. Excel automatically assigns a name to
the chart, such as Chart1 if it is the
first chart that you create on a
worksheet. To change the name of the
chart, do the following:
. Click the chart.
Tip A ScreenTip displays the a. On the Layout tab, in the
chart type name when you rest Properties group, click the Chart
the mouse pointer over any Name text box.
chart type or chart subtype.
For more information about Tip If necessary, click the Properties
the chart types that you can icon in the Properties group to expand
use, see Available chart types. the group.

4. By default, the chart is placed on the b. Type a new name.


worksheet as an embedded chart. If c. Press ENTER.
you want to place the chart in a
separate chart sheet, you can change Notes
its location by doing the following:
a. Click anywhere in the embedded chart  To quickly create a chart that is based
to activate it. on the default chart type, select the
data that you want to use for the
This displays the Chart Tools, chart, and then press ALT+F1 or F11.
adding the Design, Layout, and When you press ALT+F1, the chart is
Format tabs. displayed as an embedded chart;
when you press F11, the chart is
b. On the Design tab, in the Location displayed on a separate chart sheet.
group, click Move Chart.  If you no longer need a chart, you can
delete it. Click the chart to select it,
and then press DELETE.

Step 2: Change the layout or style of a


chart
c. Under Choose where you want the chart
After you create a chart, you can instantly
to be placed, do one of the following:
change its look. Instead of manually adding or
 To display the chart in a chart
changing chart elements or formatting the
sheet, click New sheet.
chart, you can quickly apply a predefined

Advanced Excel 2013


58 | P a g e

layout and style to your chart. Excel provides


a variety of useful predefined layouts and
styles (or quick layouts and quick styles) that
you can select from, but you can customize a Note When the size of the Excel
layout or style as needed by manually window is reduced, chart styles will be
changing the layout and format of individual available in the Chart Quick Styles
chart elements. gallery in the Chart Styles group.

Apply a predefined chart layout Tip To see all predefined chart styles,
click More .
1. Click anywhere in the chart that you
want to format by using a predefined Change the layout of chart elements
chart layout.
manually
This displays the Chart Tools, adding
1. Click the chart element for which you
the Design, Layout, and Format tabs.
want to change the layout, or do the
following to select it from a list of
2. On the Design tab, in the Chart
chart elements.
Layouts group, click the chart layout
a. Click anywhere in the chart to
that you want to use.
display the Chart Tools.
b. On the Format tab, in the
Current Selection group, click
the arrow in the Chart
Elements box, and then click
the chart element that you
Note When the size of the Excel want.
window is reduced, chart layouts will
be available in the Quick Layout
gallery in the Chart Layouts group.

Tip To see all available layouts, click


More . 2. On the Layout tab, in the Labels, Axes,
or Background group, click the chart
Apply a predefined chart style element button that corresponds with
the chart element that you selected,
1. Click anywhere in the chart that you and then click the layout option that
want to format by using a predefined you want.
chart style.

This displays the Chart Tools, adding


the Design, Layout, and Format tabs.

2. On the Design tab, in the Chart Styles


group, click the chart style that you
want to use.
P a g e | 59

group, click the style that you


want, or click Shape Fill, Shape
Outline, or Shape Effects, and
then select the formatting options
that you want.
c. To format the text in a selected
chart element by using WordArt,
in the WordArt Styles group, click
a style. You can also click Text Fill,
Note The layout options that you select are Text Outline, or Text Effects, and
applied to the chart element that you have then select the formatting options
selected. For example, if you have the entire that you want.
chart selected, data labels will be applied to
all data series. If you have a single data point Note After you apply a WordArt style,
selected, data labels will only be applied to you cannot remove the WordArt
the selected data series or data point. format. If you do not want the
WordArt style that you applied,
you can select another WordArt
Change the format of chart elements
style, or you can click Undo on the
manually Quick Access Toolbar to return to
the previous text format.
1. Click the chart element for which you
want to change the style, or do the Tip To use regular text formatting to
following to select it from a list of format the text in chart elements,
chart elements. you can right-click or select the
a. Click anywhere in the chart to text, and then click the formatting
display the Chart Tools. options that you want on the Mini
b. On the Format tab, in the toolbar. You can also use the
Current Selection group, click formatting buttons on the ribbon
the arrow in the Chart (Home tab, Font group).
Elements box, and then click
the chart element that you
Step 3: Add or remove titles or data
want.
labels

To make a chart easier to understand, you can


add titles, such as a chart title and axis titles.
Axis titles are typically available for all axes
that can be displayed in a chart, including
2. On the Format tab, do one or more of depth (series) axes in 3-D charts. Some chart
the following: types (such as radar charts) have axes, but
a. To format any selected chart they cannot display axis titles. Chart types
element, in the Current Selection that do not have axes (such as pie and
group, click Format Selection, and doughnut charts) cannot display axis titles
then select the formatting options either.
that you want.
b. To format the shape of a selected You can also link chart and axis titles to
chart element, in the Shape Styles corresponding text in worksheet cells by

Advanced Excel 2013


60 | P a g e

creating a reference to those cells. Linked Add axis titles


titles are automatically updated in the chart
when you change the corresponding text on 1. Click anywhere in the chart to which you
the worksheet. want to add axis titles.

To quickly identify a data series in a chart, you This displays the Chart Tools, adding the
can add data labels to the data points of the Design, Layout, and Format tabs.
chart. By default, the data labels are linked to
values on the worksheet, and they update 2. On the Layout tab, in the Labels group,
automatically when changes are made to click Axis Titles.
these values.

Add a chart title

1. Click anywhere in the chart to which


you want to add a title.
3. Do one or more of the following:
This displays the Chart Tools, adding o To add a title to a primary horizontal
the Design, Layout, and Format tabs. (category) axis, click Primary Horizontal
Axis Title, and then click the option that
2. On the Layout tab, in the Labels you want.
group, click Chart Title.
Tip If the chart has a secondary horizontal
axis, you can also click Secondary
Horizontal Axis Title.

o To add a title to primary vertical (value)


axis, click Primary Vertical Axis Title, and
3. Click Centered Overlay Title or Above then click the option that you want.
Chart.
4. In the Chart Title text box that appears Tip If the chart has a secondary vertical axis,
in the chart, type the text that you you can also click Secondary Vertical Axis
want. Title.

Tip To insert a line break, click to o To add a title to a depth (series) axis, click
place the pointer where you want to Depth Axis Title, and then click the
break the line, and then press ENTER. option that you want.

5. To format the text, select it, and then Note This option is only available when the
click the formatting options that you selected chart is a true 3-D chart, such as
want on the Mini toolbar. a 3-D column chart.

Tip You can also use the formatting 4. In the Axis Title text box that appears in
buttons on the ribbon (Home tab, the chart, type the text that you want.
Font group). To format the whole title,
you can right-click it, click Format Tip To insert a line break, click to place the
Chart Title, and then select the pointer where you want to break the line,
formatting options that you want. and then press ENTER.
P a g e | 61

5. To format the text, select it, and then o To add a data label to all data
click the formatting options that you points of a data series, click
want on the Mini toolbar. anywhere in the data series that
you want to label.
Tip You can also use the formatting buttons o To add a data label to a single
on the ribbon (Home tab, Font group). To data point in a data series, click
format the whole title, you can right-click the data series that contains the
it, click Format Axis Title , and then select data point that you want to label,
the formatting options that you want. and then click the data point that
you want to label.
Notes
This displays the Chart Tools,
 If you switch to another chart type that adding the Design, Layout, and
does not support axis titles (such as a pie Format tabs.
chart), the axis titles will no longer be
displayed. The titles will be displayed 2. On the Layout tab, in the Labels
again when you switch back to a chart group, click Data Labels, and then click
type that does support axis titles. the display option that you want.
 Axis titles that are displayed for
secondary axes will be lost when you
switch to a chart type that does not
display secondary axes.

Link a title to a worksheet cell


Note Depending on the chart type
1. On a chart, click the chart or axis title that that you used, different data label
you want to link to a worksheet cell. options will be available.
2. On the worksheet, click in the formula
bar, and then type an equal sign (=). Remove titles or data labels from a
3. Select the worksheet cell that contains chart
the data or text that you want to display
in your chart. 1. Click the chart.

Tip You can also type the reference to the This displays the Chart Tools, adding
worksheet cell in the formula bar. Include the Design, Layout, and Format tabs.
an equal sign, the sheet name, followed
by an exclamation point; for example, 2. On the Layout tab, in the Labels
=Sheet1!F2 group, do one of the following:
o To remove a chart title, click Chart
4. Press ENTER. Title, and then click None.
o To remove an axis title, click Axis
Add data labels Title, click the type of axis title
that you want to remove, and
1. On a chart, do one of the following: then click None.
o To add a data label to all data o To remove data labels, click Data
points of all data series, click the Labels, and then click None.
chart area.

Advanced Excel 2013


62 | P a g e

o For additional options, click More


Legend Options, and then select the
display option that you want.

Tip By default, a legend does not overlap


Tip To quickly remove a title or data label, the chart. If you have space
click it, and then press DELETE. constraints, you might be able to
reduce the size of the chart by
Step 4: Show or hide a legend clearing the Show the legend
without overlapping the chart check
When you create a chart, the legend appears, box.
but you can hide the legend or change its
location after you create the chart. Tip When a chart has a legend displayed,
you can modify the individual legend entries
1. Click the chart in which you want to by editing the corresponding data on the
show or hide a legend. worksheet. For additional editing options, or
to modify legend entries without affecting the
This displays the Chart Tools, adding worksheet data, you can change the legend
the Design, Layout, and Format tabs. entries in the Select Data Source dialog box
(Design tab, Data group, Select Data button).
2. On the Layout tab, in the Labels
group, click Legend.

Step 5: Display or hide chart axes or


gridlines

When you create a chart, primary axes are


3. Do one of the following: displayed for most chart types. You can turn
o To hide the legend, click None. them on or off as needed. When you add
axes, you can specify the level of detail that
Tip To quickly remove a legend or a you want the axes to display. A depth axis is
legend entry from a chart, you can displayed when you create a 3-D chart.
select it, and then press DELETE. You
can also right-click the legend or a When the values in a chart vary widely from
legend entry, and then click Delete. data series to data series, or when you have
mixed types of data (for example, price and
o To display a legend, click the display volume), you can plot one or more data series
option that you want. on a secondary vertical (value) axis. The scale
of the secondary vertical axis reflects the
Note When you click one of the display values for the associated data series. After
options, the legend moves, and the you add a secondary vertical axis to a chart,
plot area automatically adjusts to you can also add a secondary horizontal
make room for it. If you move and (category) axis, which might be useful in an xy
size the legend by using the mouse, (scatter) chart or bubble chart.
the plot area does not automatically
adjust. To make a chart easier to read, you can
display or hide the horizontal and vertical
P a g e | 63

chart gridlines that extend from any select the data series from a list of
horizontal and vertical axes across the plot chart elements:
area of the chart. a. Click the chart.

Display or hide primary axes This displays the Chart Tools,


adding the Design, Layout, and
1. Click the chart for which you want to Format tabs.
display or hide axes.
b. On the Format tab, in the
This displays the Chart Tools, adding the Current Selection group, click
Design, Layout, and Format tabs. the arrow in the Chart
Elements box, and then click
2. On the Layout tab, in the Axes group, the data series that you want
click Axes, and then do one of the to plot along a secondary
following: vertical axis.
o To display an axis, click Primary
Horizontal Axis, Primary
Vertical Axis, or Depth Axis (on
a 3-D chart), and then click the
axis display option that you
want.
o To hide an axis, click Primary
2. On the Format tab, in the Current
Horizontal Axis, Primary Selection group, click Format
Vertical Axis, or Depth Axis (on Selection.
a 3-D chart), and then click 3. Click Series Options if it is not
None. selected, and then under Plot Series
o To specify detailed axis display
On, click Secondary Axis and then click
and scaling options, click Close.
Primary Horizontal Axis, 4. On the Layout tab, in the Axes group,
Primary Vertical Axis, or Depth click Axes.
Axis (on a 3-D chart), and then
click More Primary Horizontal
Axis Options, More Primary
Vertical Axis Options, or More
Depth Axis Options.
5. Do one of the following:
o To display a secondary vertical
axis, click Secondary Vertical
Axis, and then click the display
option that you want.
Display or hide secondary axes Tip To help distinguish the
secondary vertical axis, you can
1. In a chart, click the data series that
change the chart type for just
you want to plot along a secondary
one data series. For example,
vertical axis, or do the following to
you can change one data series
to a line chart.

Advanced Excel 2013


64 | P a g e

6. To display a secondary horizontal axis, o To add depth gridlines to a 3-D


click Secondary Horizontal Axis, and chart, point to Depth Gridlines,
then click the display option that you and then click the option that you
want. want. This option is only available
when the selected chart is a true
Note This option is available only 3-D chart, such as a 3-D column
after you display a secondary vertical chart.
axis. o To hide chart gridlines, point to
Primary Horizontal Gridlines,
7. To hide a secondary axis, click Primary Vertical Gridlines, or
Secondary Vertical Axis or Secondary Depth Gridlines (on a 3-D chart),
Horizontal Axis, and then click None. and then click None. If the chart
has a secondary axes, you can also
Tip You can also click the secondary axis click Secondary Horizontal
that you want to delete, and then press Gridlines or Secondary Vertical
DELETE. Gridlines, and then click None.
o To quickly remove chart gridlines,
Display or hide gridlines select them, and then press
DELETE.
1. Click the chart for which you want to
display or hide chart gridlines. Step 6: Move or resize a chart
This displays the Chart Tools, adding You can move a chart to any location on a
the Design, Layout, and Format tabs. worksheet or to a new or existing worksheet.
You can also change the size of the chart for a
2. On the Layout tab, in the Axes group, better fit.
click Gridlines.

Move a chart

 To move a chart, drag it to the location


3. Do the following: that you want.
o To add horizontal gridlines to the
chart, point to Primary Horizontal Resize a chart
Gridlines, and then click the
option that you want. If the chart To resize a chart, do one of the following:
has a secondary horizontal axis,
you can also click Secondary  Click the chart, and then drag the
Horizontal Gridlines. sizing handles to the size that you
o To add vertical gridlines to the want.
chart, point to Primary Vertical  On the Format tab, in the Size group,
Gridlines, and then click the enter the size in the Shape Height and
option that you want. If the chart Shape Width box.
has a secondary vertical axis, you
can also click Secondary Vertical
Gridlines.
P a g e | 65

uses the colors of the chart template — not


the colors of the document theme that is
currently applied to the workbook. To use the
document theme colors instead of the chart
template colors, right-click the chart area, and
Tip For more sizing options, on the Format then click Reset to Match Style.
tab, in the Size group, click to launch the
Format Chart Area dialog box. On the Size Use sparklines to show data trends
tab, you can select options to size, rotate, or
scale the chart. On the Properties tab, you New in Microsoft Excel 2013, a sparkline is a
can specify how you want the chart to move tiny chart in a worksheet cell that provides a
or size with the cells on the worksheet. visual representation of data. Use sparklines
to show trends in a series of values, such as
Step 7: Save a chart as a template seasonal increases or decreases, economic
cycles, or to highlight maximum and minimum
If you want to create another chart such as values. Position a sparkline near its data for
the one that you just created, you can save greatest impact.
the chart as a template that you can use as
the basis for other similar charts "Sparklines enable us to create visual
representations of data with one click. It makes it
1. Click the chart that you want to save as a easier to grasp data, and it’s helping our CFO
template. analyze trends on the spot."
2. On the Design tab, in the Type group, Matt Stuckey, IT Director of Levick Strategic
click Save as Template. Communications

What are sparklines?

Unlike charts on an Excel worksheet,


sparklines are not objects — a sparkline is
actually a tiny chart in the background of a
3. In the File name box, type a name for the cell. The following picture shows a column
template. sparkline in cell F2 and a line sparkline in F3.
Both of these sparklines get their data from
Tip Unless you specify a different folder, the cells A2 through E2 and display a chart inside
template file (.crtx) will be saved in the a cell that shows the performance of a stock.
Charts folder, and the template becomes The charts show the values by quarter,
available under Templates in both the highlight the high value (3/31/08) and the low
Insert Chart dialog box (Insert tab, Charts value (12/31/08), show all the data points,
and show the downward trend for the year.
group, Dialog Box Launcher ) and the
Change Chart Type dialog box (Design
tab, Type group, Change Chart Type).

Note A chart template contains chart


formatting and stores the colors that are in
use when you save the chart as a template.
When you use a chart template to create a A sparkline in cell F6 shows the 5-year
chart in another workbook, the new chart performance for the same stock, but displays

Advanced Excel 2013


66 | P a g e

a Win/Loss bar chart that shows only whether correspond to underlying data, as shown in
the year had a gain (as in the years 2004 the following picture.
through 2007) or a loss (2008). This sparkline
uses values from cells A6 through E6. You can also create sparklines for rows of
data that you add later by using the fill handle
Because a sparkline is a tiny chart embedded on an adjacent cell that contains a sparkline.
in a cell, you can enter text in a cell and use a
sparkline as its background, as shown in the
following picture.

Figure 1: In this sparkline, the high value marker is


green, and the low value marker is orange. All 1. The range of data used by a group of
other markers are shown in black. sparklines

You can apply a color scheme to your 2. A group of sparklines


sparklines by choosing a built-in format from
the Style gallery (Design tab, which becomes One advantage of using sparklines is that,
available when you select a cell that contains unlike charts, sparklines are printed when you
a sparkline). You can use the Sparkline Color print a worksheet that contains them.
or Marker Color commands to choose a color
for the high, low, first, and last values (such as Create a sparkline
green for high, and orange for low).
1. Select an empty cell or group of empty
Why use sparklines? cells in which you want to insert one or
more sparklines.
Data presented in a row or column is useful, 2. On the Insert tab, in the Sparklines
but patterns can be hard to spot at a glance. group, click the type of sparkline that
The context for these numbers can be you want to create: Line, Column, or
provided by inserting sparklines next to the Win/Loss.
data. Taking up a small amount of room, a
sparkline can display a trend based on
adjacent data in a clear and compact
graphical representation. Although it's not
mandatory for a sparkline cell to be directly
next to its underlying data, it is a good
practice. 3. In the Data box, type the range of the
cells that contain the data on which you
You can quickly see the relationship between want to base the sparklines.
a sparkline and its underlying data, and when
your data changes you can see the change in
Note You can click to temporarily
the sparkline immediately. In addition to
collapse the dialog box, select the range
creating a single sparkline for a row or column
of cells that you want on the worksheet,
of data, you can create several sparklines at
the same time by selecting multiple cells that
P a g e | 67

and then click to restore the dialog  To show the highest or the lowest
box to its normal size. values, select the High Point or Low
Point check boxes.
When one or more sparklines are selected,  To show the first or the last values,
the Sparkline Tools appear, displaying the select the First Point or Last Point
Design tab. On the Design tab, you can check boxes.
choose one or more of several commands
from among the following groups: Sparkline, Change the style of or format
Type, Show/Hide, Style, and Group. Use sparklines
these commands to create a new sparkline,
change its type, format it, show or hide data Use the Style gallery on Design tab, which
points on a line sparkline, or format the becomes available when you select a cell that
vertical axis in a sparkline group. These contains a sparkline.
options are described in detail in the
following section. 1. Select a single sparkline or a sparkline
group.
Customize sparklines 2. To apply a predefined style, on the
Design tab, in the Style group, click a
After you create sparklines, you can control style or click the arrow at the lower
which value points are shown (such as the right corner of the box to see
high, low, first, last, or any negative values), additional styles.
change the type of the sparkline (Line,
Column, or Win/Loss), apply styles from a
gallery or set individual formatting options,
set options on the vertical axis, and control
how empty or zero values are shown in the
sparkline.
3. To apply specific formatting to a
Control which value points are shown sparkline, use the Sparkline Color or
the Marker Color commands.
You can highlight individual data markers
(values) in a line sparkline by making some or Show or hide data markers
all of the markers visible.
On a sparkline that has the Line style, you can
show data markers so that you can highlight
individual values.

1. Select a sparkline.
In this sparkline, the high value marker is
2. In the Show/Hide group, on the
green, and the low value marker is orange. All
Design tab, select any of the check
other markers are shown in black.
boxes to show individual markers
(such as high, low, negative, first, or
 To show all values, select the Markers
last), or select the Markers check box
check box.
to show all markers.
 To show negative values, select the
Negative Points check box.
Clearing a check box hides the
specified marker or markers.

Advanced Excel 2013


68 | P a g e

Show and customize axis settings between values is shown in a more


meaningful way.
You can select Date Axis Type (in the Group
group, click Axis) to format the shape of the 1. With the sparkline or sparkline group
chart in a sparkline to reflect any irregular selected, in the Group group, click
time periods in the underlying data. Axis.
2. Under Vertical Axis Minimum Value
Options or Vertical Axis Maximum
Value Options, click Custom Value.
3. Set minimum or maximum values that
you feel will best emphasize the values
in the sparklines.

You can increase the height of the row that


contains the sparkline to more dramatically
In a line sparkline, applying the Date Axis type emphasize the difference in data values if
can change the slope of a plotted line and the some is very small and some is very large.
position of its data points in relation to each
other. You can also use the Plot Data Right-to-Left
option to change the direction in which data
In a column sparkline, applying the Data Axis is plotted in a sparkline or sparkline group.
type can change the width of and increase or
decrease the distance between the columns,
as shown in the following image.

In the example shown here, there are two


column sparklines that use data from the If there are negative values in your data, you
same range. The sparkline with the “Trend” can emphasize this by showing a horizontal
label uses the General Axis type, and the axis in your sparkline.
sparkline with the “Trend (Data Axis Type)”
label uses the Date Axis type. In each 1. With the sparkline or sparkline group
sparkline, the first two data points are selected, in the Group group, click Axis.
separated by two months, and the second 2. Under Horizontal Axis Options, click
and third are separated by seven months. By Show Axis.
applying the Date Axis type, the space Any sparklines that contain negative
between the three columns changes data will display a horizontal axis at 0.
proportionally to reflect the irregular time
periods.

You can also use these Axis options to set


minimum and maximum values for the
vertical axis of a sparkline or sparkline group.
Setting these values explicitly helps you
control the scale so that the relationship
P a g e | 69

Handle empty cells or zero values You can change the settings using different options for
the page setup. To display these options, use one of
the following methods:
You can control how a sparkline handles
empty cells in a range (and thus how the
 On the Page Layout tab, in the Page Setup group,
sparkline is displayed) by using the Hidden click the option to change; or

 on the Page Layout tab, in the Page Setup group,


click the Page Setup Dialog box launcher to
display the Page Setup dialog box for more
options.
and Empty Cell Settings dialog box.

Previewing the Worksheet and Print


Margins The Top, Bottom, Left, and Right
Prior to printing your worksheet, preview it on the
options set the amount of white space
screen so you can make any required changes before
(measured in inches) from the edges of
distributing it to others.
the page around the printed area of
To preview a worksheet, click the File tab, and click the worksheet. The Header sets the
Print distance between the Header and the
top edge of the page, while footer sets
the distance between the Footer and
the bottom edge of the page.
Center Allows you to center the worksheet
on page horizontally or vertically on the page,
or both.

Header/Footer Tab

Excel displays both the print options as well as a


preview of the worksheet with the existing print
options.
The total number of pages in the printout displays at
the bottom left of the preview. This total is based on
the number of pages Excel needs to display the report
using the default page printing sequence of top to
bottom for the length of the worksheet, and then shift
to the right and top to bottom for the width of the
worksheet. As a result, you may need to change the
page setup for your report prior to sending the A header is text printed at the top of every page of the
document to print. worksheet. A footer is text printed at the bottom of
A chart in the worksheet previews or prints based on every page. By default, there is nothing in the header
where it is in the worksheet. You can move the chart to or footer.
a new worksheet, or put a page break between the The Header/Footer tab is located in the Page Setup
data and the chart. If you are using a monochrome dialog box.
printer, the chart will print in varying shades of gray; it
will only print in color if you have a color printer.

Customizing the Printout

Advanced Excel 2013


70 | P a g e

Format Changes the properties for


Picture the picture.

Sheet Tab
The last of the tabs in the Page Setup dialog box is the
Sheet tab. It enables you to change various settings
relating to how the worksheet will print.

Excel provides several standard header or footer


options, or you can create your own.
When you access Custom Header or Custom Footer,
you will see the following:

Each header or footer consists of three sections: Left,


Center, and Right, which represent the left, center, and
right parts of the header or footer. Use the buttons to
insert commonly used variables into the header or
footer.

Format Changes the font and size of the text Print Selects the portion of the worksheet you
Text entered into one of the three sections. area want to print; this is useful when you want to
print only parts of the worksheet. If left
Page The code &[Page] displays in the
empty, a rectangular section of the
Number selected section of the header or footer;
worksheet containing all data and cell
page numbering automatically starts at
formatting will be printed.
1 unless you change the starting page
number in the Page tab. Print Repeats the column or row titles on each
titles printed page; this is useful when you have
Number The code &[Pages] displays
many rows and columns of data that span
of Pages the total number of pages in
more than one page. You can also select this
the document; this is often
command in the Page Setup group of the
used with the Page number
Page Layout tab.
code (i.e., Page 1 of 4).
Print Choose to include what will also print with
Date Inserts the current date into
the report, such as row and column
the report; displays as the
headings, to show someone where to enter
code &[Date].
the data for a report. Note that the gridlines
Time Inserts the current time into in this section are for printing purposes only.
the report; displays as the You can also select these commands in the
code &[Time]. Sheet Options group of the Page Layout tab.
File Path Inserts the current path and Page Changes the order in which multiple pages
file name into the header or order are numbered and printed.
footer; displays as the code
&[Path]&[File]. If you open the Page Setup dialog box from the Print
Preview screen, you cannot make changes to the Print
File Inserts the name of the file area or Print titles section of the Sheet tab.
Name into the header or footer;
displays as the code &[File].
Sheet Inserts the name of the Printing the Worksheet
Name current worksheet; displays Once you have previewed the worksheet on the screen
as the code &[Tab]. and made sure it is ready to print, you can select the
Picture Inserts a picture into the Print option.
header or footer; displays as By default, Excel only prints the current active
the code &[Picture]. worksheet of the workbook. You can also choose to
P a g e | 71

print all worksheets in the workbook, a selected group See the notes below for more.
of worksheets, or only a selected range of cells.

Password protect a workbook Important Write your passwords down and


store them someplace safe. If you lose
Excel gives you several ways to protect a them, we honestly can't help you find
workbook. You can require a password to them.
open it, a password to change data, and a
password for changing the file's structure— 1. Enter your password, enter it again to
adding, deleting, or hiding worksheets. confirm, and click OK.

Remember, though, that this type of Note To remove a password, follow the
protection doesn't encrypt your files. Users steps above and delete the password.
can still use third-party tools to read your Basically, just enter a blank password.
data. You can do that for any type of
password that you use in Excel.
We'll start with requiring passwords for
opening the file and changing data. To protect the structure of your workbook, do
this:
1. Click File > Save As.
2. Click a location, such as Computer or 1. Click Review > Protect Workbook.
your My Site web page. 2. Click Structure.
3. Click a folder, such as Documents or
one of the folders on your OneDrive, or See the notes below for more about this
click Browse. option and the Windows option.
4. In the Save As dialog box, go to the
folder you want to use, then open the 1. Enter a password in the Password box.
Tools list and click General Options.
Important Write your password
down and store it someplace safe. If
you lose it, we really can't help you
find it.

1. Click OK, and retype the password to


confirm it.

Notes
You can enter either of two passwords here,
one to open the file, another to change o If you enter the same password for
the file. opening and changing a workbook,
users only need to enter the password
once.
o If you only require a password for
changing a workbook, users can open
a read-only copy of the file, save it
under another name, and change your
data.
o Selecting the Structure option
prevents other users from viewing

Advanced Excel 2013


72 | P a g e

hidden worksheets, adding, moving,


deleting, or hiding worksheets, and
renaming worksheets.
o You can ignore the Windows option.
It's disabled in this version of Excel.
o You can always tell when you've
protected the workbook's structure.
The Protect Workbook button lights
up:

Protect a worksheet with or without a


password

To help protect your data from deliberate or


unintentional changes, you can protect your
worksheet, with or without a password. A
password prevents other people from
removing the worksheet protection—it needs
to be entered to unprotect the sheet.

When you protect a worksheet, Excel locks all


the cells in that sheet by default. Before you
protect the sheet, unlock any cells you want
anyone to be able to change.

1. Click Review > Protect Sheet.


2. Make sure the Protect worksheet and
contents of locked cells box is
checked.
3. To use a password, enter it in the
Password to unprotect sheet box. If
you don't use a password, anyone can
remove the sheet protection.

Important Write down your password and


store it in a safe location. We honestly can't
help you recover lost passwords.

1. Check or clear any of the boxes under


Allow all users of this worksheet to.

You might also like