Advanced-Ms-Excel-For-Data-Analysis Note
Advanced-Ms-Excel-For-Data-Analysis Note
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
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.
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
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.
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
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
45. SUM() Returns the sum of a supplied 56. SUMIFS Adds the cells in a supplied
list of numbers range, that satisfy multiple criteria
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
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
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.
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.
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
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.
PMT
10. DAYS360
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.
format to create your own custom number The following characters are displayed
format. without the use of quotation marks.
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.
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
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.
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
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
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.
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
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.
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.
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.
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
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
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.
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.
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.
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 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
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.
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.
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
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.
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
Important
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:
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.
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.
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
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.
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.
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.
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-
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).
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.
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.
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.
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.
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.
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.
Move a chart
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.
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.
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
Header/Footer Tab
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.
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.
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.
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