Lab 5: Pivot Tables / Pivot Charts Simon: Chapters 7 & 8 URBPL 5/6010: Urban Analysis University of...

28
Lab 5: Pivot Tables / Pivot Charts Simon: Chapters 7 & 8 URBPL 5/6010: Urban Analysis University of Utah Pam Perlich Rev. 09/27/2006

Transcript of Lab 5: Pivot Tables / Pivot Charts Simon: Chapters 7 & 8 URBPL 5/6010: Urban Analysis University of...

Page 1: Lab 5: Pivot Tables / Pivot Charts Simon: Chapters 7 & 8 URBPL 5/6010: Urban Analysis University of Utah Pam Perlich Rev. 09/27/2006.

Lab 5:Pivot Tables / Pivot ChartsSimon: Chapters 7 & 8

URBPL 5/6010: Urban AnalysisUniversity of Utah

Pam PerlichRev. 09/27/2006

Page 2: Lab 5: Pivot Tables / Pivot Charts Simon: Chapters 7 & 8 URBPL 5/6010: Urban Analysis University of Utah Pam Perlich Rev. 09/27/2006.

Files for this Lab

CreatePivotTable.xlsAddCalcField.xlsGetPivotTable.xls

Optional : PivotChartDB.mdb

Project 4

Page 3: Lab 5: Pivot Tables / Pivot Charts Simon: Chapters 7 & 8 URBPL 5/6010: Urban Analysis University of Utah Pam Perlich Rev. 09/27/2006.

Pivot Tables

Summarize and analyze database filesDatabase files

Record basedEvery column must have a titleMaximum size: 8,000 total items and 256 fields

Data Pivot tableCross tabs of dataRow by Column for Data

Page 4: Lab 5: Pivot Tables / Pivot Charts Simon: Chapters 7 & 8 URBPL 5/6010: Urban Analysis University of Utah Pam Perlich Rev. 09/27/2006.

Create a Pivot Table

Open CreatePivotTable.xlsStudy the rectangular data setNotice the columns with headingsSelect the entire data blockData PivotTable and PivotChartPivot Table / Chart Wizard appears

Page 5: Lab 5: Pivot Tables / Pivot Charts Simon: Chapters 7 & 8 URBPL 5/6010: Urban Analysis University of Utah Pam Perlich Rev. 09/27/2006.

Pivot Table Wizard

Data source is an excel databaseObjective is to create a pivot tableMake sure you have the entire data block selected (including headings)Step 3

Put data in a new worksheetClick “Layout” to specify configuration

Page 6: Lab 5: Pivot Tables / Pivot Charts Simon: Chapters 7 & 8 URBPL 5/6010: Urban Analysis University of Utah Pam Perlich Rev. 09/27/2006.

Click “Layout”

Page 7: Lab 5: Pivot Tables / Pivot Charts Simon: Chapters 7 & 8 URBPL 5/6010: Urban Analysis University of Utah Pam Perlich Rev. 09/27/2006.
Page 8: Lab 5: Pivot Tables / Pivot Charts Simon: Chapters 7 & 8 URBPL 5/6010: Urban Analysis University of Utah Pam Perlich Rev. 09/27/2006.

Double Click Here to Change Computation

Page 9: Lab 5: Pivot Tables / Pivot Charts Simon: Chapters 7 & 8 URBPL 5/6010: Urban Analysis University of Utah Pam Perlich Rev. 09/27/2006.

Click “Options”

Page 10: Lab 5: Pivot Tables / Pivot Charts Simon: Chapters 7 & 8 URBPL 5/6010: Urban Analysis University of Utah Pam Perlich Rev. 09/27/2006.

Insert a Calculated Field

Open AddCalcField.xlsSelect a specific location (cell) for calculation (e.g., F6)Insert Calculated FieldWithin dialogue box

Name the fieldSpecify the formulaInsert variable names if necessary

Notice how Excel automatically adds fields to all products and areas

Page 11: Lab 5: Pivot Tables / Pivot Charts Simon: Chapters 7 & 8 URBPL 5/6010: Urban Analysis University of Utah Pam Perlich Rev. 09/27/2006.

Insert a calculated field

1) Select cell

2) Insert => calculated field

Page 12: Lab 5: Pivot Tables / Pivot Charts Simon: Chapters 7 & 8 URBPL 5/6010: Urban Analysis University of Utah Pam Perlich Rev. 09/27/2006.
Page 13: Lab 5: Pivot Tables / Pivot Charts Simon: Chapters 7 & 8 URBPL 5/6010: Urban Analysis University of Utah Pam Perlich Rev. 09/27/2006.

Link Pivot Table Results to Table

Open GetPivotTable.xlsSpecify desired location of valueInsert Function GETPIVOTDATA

Page 14: Lab 5: Pivot Tables / Pivot Charts Simon: Chapters 7 & 8 URBPL 5/6010: Urban Analysis University of Utah Pam Perlich Rev. 09/27/2006.

Retrieve value from pivot table

1) Insert => Function => GETPIVOTDATA

2) Specify function arguments

3) =GETPIVOTDATA(PivotTable!C4,PivotTable!A5)

Page 15: Lab 5: Pivot Tables / Pivot Charts Simon: Chapters 7 & 8 URBPL 5/6010: Urban Analysis University of Utah Pam Perlich Rev. 09/27/2006.

Pivot Chart

Create with same principlesCapabilities

Change chart typeChange computation (from sum to average, etc.)Add and alter fieldsFormat charts

Page 16: Lab 5: Pivot Tables / Pivot Charts Simon: Chapters 7 & 8 URBPL 5/6010: Urban Analysis University of Utah Pam Perlich Rev. 09/27/2006.

Pivot Chart from Database(Optional – time permitting)

Open a new blank excel workbookDataPivot ChartExternal data sourceDialogue box opens Get DataMS Access DatabaseNavigate to and select PivotChartDB.mdbSelect and import all fieldsDrag fields onto graph to create crosstabulations

Page 17: Lab 5: Pivot Tables / Pivot Charts Simon: Chapters 7 & 8 URBPL 5/6010: Urban Analysis University of Utah Pam Perlich Rev. 09/27/2006.

Project 4 - Overview

Review state estimates (from the Bureau of the Census) to establish control totalsRetrieve and review data and documentationPrepare data set for pivot workBuild pivot tables/chartsReformat and prepare final presentationInterpret results

Page 18: Lab 5: Pivot Tables / Pivot Charts Simon: Chapters 7 & 8 URBPL 5/6010: Urban Analysis University of Utah Pam Perlich Rev. 09/27/2006.

Note state control totals and categories

Race and ethnicity are distinct

2,469,585 is 7/1/2005 estimate for Utah

Page 19: Lab 5: Pivot Tables / Pivot Charts Simon: Chapters 7 & 8 URBPL 5/6010: Urban Analysis University of Utah Pam Perlich Rev. 09/27/2006.

Project 4: Data Retrieval

http://www.census.gov/popest/estimates.php Estimates Data Counties County estimates by demographic category Download entire data set County estimates by demographic characteristics - age, sex, race, and Hispanic Origin Race and Hispanic Origin 6 race groups - 5 race alone groups and one multiple race group State datasets

http://www.census.gov/popest/counties/asrh/CC-EST2005-RACE6.htm

Page 20: Lab 5: Pivot Tables / Pivot Charts Simon: Chapters 7 & 8 URBPL 5/6010: Urban Analysis University of Utah Pam Perlich Rev. 09/27/2006.

Retrieve and Review Layout and Documentation Files

CC_EST2005_6RACE_layout.txtcompraceho.html

Note: The original data set has been reclassified to eliminate the “Some Other Race” category and distribute this across all race categories.

Page 21: Lab 5: Pivot Tables / Pivot Charts Simon: Chapters 7 & 8 URBPL 5/6010: Urban Analysis University of Utah Pam Perlich Rev. 09/27/2006.
Page 22: Lab 5: Pivot Tables / Pivot Charts Simon: Chapters 7 & 8 URBPL 5/6010: Urban Analysis University of Utah Pam Perlich Rev. 09/27/2006.

Reformat the Data Set For Pivot Table Analysis

Change the time labels to match those in the file layout document (e.g., time = POPESTIMATE2001 => July 1, 2001; etc.) Note that there are two entries for April 1, 2000 – the decennial enumeration and an adjusted estimates base. These will vary in some cases.Use search and replace operations (or some other method) to change codes to labels in the sex, origin, and race columns (e.g., search and replace “0” in the sex column with “Total” etc.)

Page 23: Lab 5: Pivot Tables / Pivot Charts Simon: Chapters 7 & 8 URBPL 5/6010: Urban Analysis University of Utah Pam Perlich Rev. 09/27/2006.
Page 24: Lab 5: Pivot Tables / Pivot Charts Simon: Chapters 7 & 8 URBPL 5/6010: Urban Analysis University of Utah Pam Perlich Rev. 09/27/2006.
Page 25: Lab 5: Pivot Tables / Pivot Charts Simon: Chapters 7 & 8 URBPL 5/6010: Urban Analysis University of Utah Pam Perlich Rev. 09/27/2006.
Page 26: Lab 5: Pivot Tables / Pivot Charts Simon: Chapters 7 & 8 URBPL 5/6010: Urban Analysis University of Utah Pam Perlich Rev. 09/27/2006.

2,469,585 is 7/1/2005 estimate for Utah – It matches our result.

Why is “grand total” double this amount?

Page 27: Lab 5: Pivot Tables / Pivot Charts Simon: Chapters 7 & 8 URBPL 5/6010: Urban Analysis University of Utah Pam Perlich Rev. 09/27/2006.

Data Set Tips

Note that if you include all race categories and Hispanic, not Hispanic, and Total, and male, female, and total, that you get a number that is MUCH too large.

Grand total will be 4 times the state total population estimate.

Select only a subset of fields to extract.

Page 28: Lab 5: Pivot Tables / Pivot Charts Simon: Chapters 7 & 8 URBPL 5/6010: Urban Analysis University of Utah Pam Perlich Rev. 09/27/2006.

Error Check Totals

Table 1: Annual Estimates of the Population for the United States and States, and for Puerto Rico: April 1, 2000 to July 1, 2005

Geographic Area

Population estimates April 1, 2000

July 1, 2005

July 1, 2004

July 1, 2003

July 1, 2002

July 1, 2001

July 1, 2000

Estimates base

Census

.Utah 2,469,585 2,420,708 2,378,696 2,336,673 2,287,736 2,243,136 2,233,198 2,233,169

Make sure you “totals” and “grand totals” for all counties match the reported state population estimates: http://www.census.gov/popest/states/tables/NST-EST2005-01.xls