MEM Excel Workshop
description
Transcript of MEM Excel Workshop
MEM Excel Workshop
Advanced SortingPivot Table Introduction
4.5.2012
http://faculty.fuqua.duke.edu/~pecklund/MEM2012
Our workshop topics
Excel 2010 running in a Windows environment.
Advanced sorting techniques in Excel.
An introduction to Pivot Table techniques.
Material from
INFORMATION MANAGEMENT, DEC483 A Duke MBA elective course.
What is structured data?
Unstructured data
Human-friendly format.
Excel-unfriendly format.
Structured data The same data as on the
previous slide.
Human-unfriendly format.
Excel-friendly format.
A closer look
Nothing is assumed!
4 characteristics of Excel structured data
1. The data is in a contiguous range; there are no entirely blank rows or columns.
2. First row contains column headers.
3. Each row is a record describing one item or transaction. (All cells in the row hold info about the same thing.)
4. Each column holds the same kind of data.
Can you recognize Excel structured data?
Five questions
1/5- Structured data?
2/5 - Structured data?
3/5 - Structured data?
4/5 - Structured data?
5/5 - Structured data?
Why structure is important
Many Excel data management techniques require/look for structured data.
Sort SubtotalAutofilter Pivot TableAdvanced Filter Database FunctionsGroup
Advanced Sorting Techniques in Excel 2010
Workshop topic 1 of 2
Excel has two sorting tools
There are lots of “sorting facts”
Data can be sorted by row as well as by column.Custom sorts can be specified.Excel default sort order is:
- smallest to largest numbers
- special characters then alpha characters A-Z
- FALSE before TRUE
- Error values (all are equal)
- Blanks
With a descending sort, reverse all the above except blanks remain last.
Our sample data to sortWorksheet: Sort Data
About this data:
- 967 records.- All from Arizona.- All fields but “Office Code” are straightforward.
Task 1: Apply 4 sorts to the data
1. Region: Sort ascending.
2. Store Status: Sort in the order NEWVEN, then ESTAB, and then OLDESTAB.
3. Day: Sort by cell color (first purple, then blue, and then green).
4. Quantity: Sort by icon set (first yellow, then green, and then red).
Most important
Least important
Sort the data using the Sort Dialog in this order:
Special: The Day & Quantity columns
These two columns are conditionally formatted* to help the user distinguish the cell contents visually.
Here: By cell color and by icon.
* Home tab, Styles group, “Conditional Formatting” button
For this demo we use Excel’s Sort Dialog
When using the Sort dialog, the first sort described is the dominant sort.
As additional sorts are defined in the dialog, their location indicates their importance in the sort hierarchy.
The most important sort is defined first and the least important sort is defined last.
The first sort: Region
We immediatelyencounter a problem.
Region (and Store Status) are “hidden” inside the
Office Code field.
The 3 elements of data in this column must be separated out before we can
sort by region.
Data granulation
Does each column hold data that is brokendown into its smallest useful component?
The Office Code field holds THREE components.
no
The Office Code field
and its 3 elements
Parse the REGION variables
Use a combination of TEXT category functions from Excel’s function library?
Sometimes the only solution. But not this time.
We can use an easier method because…the data to be parsed is all in a regular pattern.
The regular pattern:
There are 3 elements in each cell.
Each element is separated from the next by a hyphen.
An easy way to parse the Office Code1. Insert 2 empty columns to the right of Office Code.2. Select all Office Code data values (not the header).3. On the Data tab click the Text to Columns button.
Text to Columns Wizard
Set a hyphen as the delimiter
Text-to-Columns resultRename Office Code to Region.
Add Population and Store Status headers.
Population Store status
The Region sort specificationRegion is the first sort to specify in the “Sort” dialog.Specify it first: Excel will sort it last, after the other three sorts.
Region
The 2nd sort: Store StatusSort using this sort order:
NEWVENESTABOLDESTAB
Store status
How can a sort in this orderbe accomplished?
The order we want is NOT A-Z or Z-A.
The 2nd sort (Store Status) SolutionEstablish a custom sort order:
NEWVENESTABOLDESTAB
Define an Excel custom list and then specify a sort by this custom list.
Click the File tab andopen the Excel options.
Store status
Choose to “Edit Custom Lists…”
Advanced
Edit Custom Lists
General
Enter the new list items
Add the 2nd sort to the Sort dialog
Select the customlist for this sort.
The third sort: By DayThe Day column has conditional formatting applied.
Conditional formatting is setin the “Styles” group on the
HOME tab.
Day’s conditional formatting
This is rule-based conditional formatting.Use the “Edit Rule…” button to make changes.Use “New Rule…” to add and “Delete Rule…” to delete.
Condit. format color assignments
Last third of the month
Middle third
First third
The Day falls in the:
Use this color sort order: First color - Purple Second color - Blue Third color - Green
Add the 3rd sort to the dialog
It takes two levels to specify the third sort.
BLUE is by default between On Top and On Bottom.
Sort in the color order First: Purple Second: Blue Third: Green
Add the 4th and final sort: QuantityQuantity is conditionally formatted with an icon set.
2 levels are required for Quantity
Icon set sort order First: Yellow Second: Green Third: Red
Finally: Execute the sort
Sort resultA partial view of the sorted data.
Advanced sort take aways
Make data fields as granular as you need them to be.(TEXT TO COLUMNS)
Create your own custom sort orders.
Sort by Values, Cell Color, Font Color, or Icon.
Introduction to Excel’sPivot Table
Workshop topic 2 of 2
What is a Pivot Table?
Pivot Table Components (some are optional)
At minimum: One row or column field and one value field.All other fields are optional.
Create a 2010 Pivot Table: Steps
1. On the “Insert” tab in the “Tables” group, click “PivotTable”.
2. Identify the source data.
3. Choose a location.
continued
Create a Pivot Table, continued
4 Drag fields from the top of the Field List to the Field List layout area.
Tip: If the Field List isn’t visible, click in the Pivot Table area, choose the“PivotTable Tools/Options” tab, find the “Show/Hide” group, and click “Field List”.
Our sample data
The worksheet in the demo file
We ask four questions about the NorthWind data and answer each question by building a
Pivot Table.
PIVOT TABLE DEMO
Question 1: Which item in the Condiments category has the worst sales?
Answer 1: Which item in the Condiments category has the worst sales?
1. Filter for the Condiments category only.2. Sort Quantity values ascending.
Question 2: Find the total quantity of Confections sold in 2008 and 2009?
Question 2
- Display the Confections category only by filtering “Row Labels” label.
- Group dates by Year.
Part 2: Filter for 2 years only
Answer 2
The total quantity of Confections sold in 08 and 09
Question 3: In 2009 Quarter 1, which Seafood item sold the most units?
- Change the default COMPACT layout to OUTLINE.- Group the Order Date field by both Years and Quarters.- Show the Seafood category only.- Limit Years to the last year (2009).- Limit the Quarter (Order Date) to 1.
In 2009 Quarter 1, Konbu was the seafood itemthat sold the highest quantity.
Answer 3
Points to notice so far
To change the location of items in a Pivot Table (pivot), drag header names in the Field List.
Focus IN or OUT using the drop-down icons to the right of field label names.
If a date field contains many specific dates, group them to make analysis easier.
Q&A 4: Find the max AND average quantities of Produce products sold by Peacock in 2009
Values displayed in rows.
Initial Pivot Table take aways
Pivot Table creation.
Basic filtering .
Setting the Values field summary operation.
Sorting.
Managing Grand Totals for Rows & Columns & Subtotals.
Date grouping.
Stacking multiple summary calculations.
Values field formatting.
We add a custom calculation to a Pivot Table.
PIVOT TABLE DEMO
The worksheet in the demo file
Why create a custom calculation?
Create a custom calculated field
Add a % Growth from Previous” Field
How to
Format the new field
Format the % Growth from Previous field to display as percentages.
Custom calculation take aways
The Pivot Table has built-in calculation
options.
If none of the built-in options suit you, build
your own custom calculations.
View Pivot Table datagraphically (as a chart).
PIVOT TABLE DEMO
The worksheet in the demo file
Pivot Table/Chart take aways
Create a Pivot Chart by clicking anywhere in a Pivot Table and inserting a chart.
Changing the Pivot Table changes the chart and vice-versa.
End of MEM Excel Demo Notes