mem excel workshop advanced sorting pivot table introduction 4.5.2012

80
MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

Upload: sharleen-hunter

Post on 15-Jan-2016

221 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

MEM Excel Workshop

Advanced SortingPivot Table Introduction

4.5.2012

Page 2: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

http://faculty.fuqua.duke.edu/~pecklund/MEM2012

Page 3: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012
Page 4: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

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.

Page 5: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012
Page 6: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

What is structured data?

Page 7: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

Unstructured data

Human-friendly format.

Excel-unfriendly format.

Page 8: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

Structured data The same data as on the

previous slide.

Human-unfriendly format.

Excel-friendly format.

Page 9: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

A closer look

Nothing is assumed!

Page 10: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

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.

Page 11: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

Can you recognize Excel structured data?

Five questions

Page 12: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

1/5- Structured data?

Page 13: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

2/5 - Structured data?

Page 14: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

3/5 - Structured data?

Page 15: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

4/5 - Structured data?

Page 16: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

5/5 - Structured data?

Page 17: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

Why structure is important

Many Excel data management techniques require/look for structured data.

Sort Subtotal

Autofilter Pivot Table

Advanced Filter Database Functions

Group

Page 18: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

Advanced Sorting Techniques in Excel 2010

Workshop topic 1 of 2

Page 19: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

Excel has two sorting tools

Page 20: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

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.

Page 21: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012
Page 22: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

Our sample data to sortWorksheet: Sort Data

About this data:

- 967 records.- All from Arizona.- All fields but “Office Code” are straightforward.

Page 23: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

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:

Page 24: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

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

Page 25: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

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.

Page 26: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

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.

Page 27: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

Data granulation

Does each column hold data that is brokendown into its smallest useful component?

The Office Code field holds THREE components.

no

Page 28: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

The Office Code field

and its 3 elements

Page 29: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

Parse the REGION variables

Use a combination of TEXT category functions from Excel’s function library?

Sometimes the only solution. But not this time.

Page 30: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

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.

Page 31: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

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.

Page 32: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

Text to Columns Wizard

Page 33: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

Set a hyphen as the delimiter

Page 34: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

Text-to-Columns resultRename Office Code to Region.

Add Population and Store Status headers.

Population Store status

Page 35: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

The Region sort specification

Region is the first sort to specify in the “Sort” dialog.Specify it first: Excel will sort it last, after the other three sorts.

Region

Page 36: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

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.

Page 37: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

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

Page 38: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

Choose to “Edit Custom Lists…”

Advanced

Edit Custom Lists

General

Page 39: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

Enter the new list items

Page 40: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

Add the 2nd sort to the Sort dialog

Select the customlist for this sort.

Page 41: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

The third sort: By DayThe Day column has conditional formatting applied.

Conditional formatting is setin the “Styles” group on the

HOME tab.

Page 42: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

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.

Page 43: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

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

Page 44: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

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

Page 45: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

Add the 4th and final sort: QuantityQuantity is conditionally formatted with an icon set.

Page 46: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012
Page 47: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

2 levels are required for Quantity

Icon set sort order First: Yellow Second: Green Third: Red

Page 48: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

Finally: Execute the sort

Page 49: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

Sort result

A partial view of the sorted data.

Page 50: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

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.

Page 51: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

Introduction to Excel’sPivot Table

Workshop topic 2 of 2

Page 52: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

What is a Pivot Table?

Page 53: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

Pivot Table Components (some are optional)

At minimum: One row or column field and one value field.All other fields are optional.

Page 54: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

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

Page 55: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

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”.

Page 56: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

Our sample data

Page 57: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

The worksheet in the demo file

Page 58: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

We ask four questions about the NorthWind data and answer each question by building a

Pivot Table.

PIVOT TABLE DEMO

Page 59: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

Question 1: Which item in the Condiments category has the worst sales?

Page 60: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

Answer 1: Which item in the Condiments category has the worst sales?

1. Filter for the Condiments category only.2. Sort Quantity values ascending.

Page 61: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

Question 2: Find the total quantity of Confections sold in 2008 and 2009?

Page 62: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

Question 2

- Display the Confections category only by filtering “Row Labels” label.

- Group dates by Year.

Page 63: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

Part 2: Filter for 2 years only

Page 64: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

Answer 2

The total quantity of Confections sold in 08 and 09

Page 65: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

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.

Page 66: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

In 2009 Quarter 1, Konbu was the seafood itemthat sold the highest quantity.

Answer 3

Page 67: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

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.

Page 68: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

Q&A 4: Find the max AND average quantities of Produce products sold by Peacock in 2009

Values displayed in rows.

Page 69: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

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.

Page 70: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

We add a custom calculation to a Pivot Table.

PIVOT TABLE DEMO

Page 71: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

The worksheet in the demo file

Page 72: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

Why create a custom calculation?

Page 73: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

Create a custom calculated field

Add a % Growth from Previous” Field

Page 74: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

How to

Page 75: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

Format the new field

Format the % Growth from Previous field to display as percentages.

Page 76: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

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.

Page 77: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

View Pivot Table datagraphically (as a chart).

PIVOT TABLE DEMO

Page 78: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

The worksheet in the demo file

Page 79: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

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.

Page 80: MEM Excel Workshop Advanced Sorting Pivot Table Introduction 4.5.2012

End of MEM Excel Demo Notes