Tải bản đầy đủ - 0 (trang)
Chapter 13. Analyzing Data with Pivot Tables

Chapter 13. Analyzing Data with Pivot Tables

Tải bản đầy đủ - 0trang

13.1.QuickGuidetoPivotTables

Noteveryoneisfamiliarwithpivottables,andtheycanseem

confusingatfirst.Theeasiestwaytoexplainthemisaquick

tutorialtodemonstratehowtheyareuseful.Usethesegeneral

stepstocreateapivottable:

1. CreatethetableusingthePivotTableWizard.

2. Formatthetabletomakeitreadable.

3. Changefieldpropertiessuchashowtotalsarecalculated.

4. Charttheresults(optional).

Thefollowingsectionswalkyouthroughthesestepsusingdata

thataccompaniesthischapter'ssampleworkbook.



13.1.1.CreateaPivotTable

Pivottablesarecommonlyusedtoplotmultipledatavalues

overtime.Forexample,theworksheetinFigure13-1contains

thesalesranksofbookscollectedfromAmazon.com.



Figure13-1.Insourcedata,rowshavemixed

content



I'dliketocompareeachbook'ssalesrankovertime,butthere's

nowaytochartthatusingtheworksheetinFigure13-1

becausetherowscontainmultipleproductnames.Ideally,each

rowshouldreflectadate,eachcolumnshouldbeaproduct

name,andeachcellshouldbethesalesrank.Youcanmake

thosechangesbycreatingapivottablefromthesource

worksheet.

TocreateapivottableinExcel:

1. Selectthecolumnstoincludeinthepivottable(A$:D$in

Figure13-1)andchooseData PivotTableandPivot

ChartReport.ExcelstartsthePivotTableWizard(Figure132).

2. ClickFinishtocreatethepivottableonanewworksheetor

clickNexttowalkthroughthepivottableoptionsusingthe

wizard.Excelcreatesanewpivottable.

3. DragProductNamefromthePivotTableFieldListtothe

columnarea,dragDatetotherowarea,anddrag

SalesRanktothedataitemsareaasshowninFigure13-3.



4. ThedefaultformulafordatafieldsisCount,whichisalways

1inthiscase,soright-clickonthedatafieldintheupperleftcornerofthepivottable,selectFieldSettingsand

changetheformulatoSum,asshowninFigure13-4.

5. Pivottablesdonotautomaticallyupdate,soifthesource

worksheetchanges,clickRefreshDataonthePivotTable

toolbartoupdatethetable,asshowninFigure13-5.



Figure13-2.Step1:usethiswizardtocreatethe

pivottable



Figure13-3.Step3:dragcolumnsontothepivot

table



Figure13-4.Step4:changethedatafield

formulafromCounttoSum



Figure13-5.Step5:refreshtabletogetchanges

fromdatasource



13.1.2.ApplyFormatting

Pivottablesusuallylookprettyawfulwhenyoufirstcreate

them.Intheprecedingexample,theProductNamecolumnsare

verywideatfirst(seeFigure13-3).Iadjustedthemmanually

togetanicescreenshotforFigure13-5,butifyouclickRefresh

Datathecolumnsreverttowide.

Therearetwowaystochangepivottableformatting:

Settableformattingmanually.

Applyanautoformattothetable.

Tosettheformattingmanually:



1. SelectthepivottableandchoosePivotTable Table

Optionsfromthepivottabletoolbar.ExceldisplaysFigure

13-6.

2. CleartheAutoFormatTableoptionandclickOKtoclosethe

dialog.

3. Setcolumnwidthsandcellformattingintheusualway.

Thosechangesarenowpreservedwhenyourefreshthe

table.



Figure13-6.DeselectAutoFormatTableto

preservemanualformatting



ThePreserveFormattingoptioninFigure13-6preservescell

formatting,suchasfontsandcolors.Thatoptionisonbydefault,so

youdon'thavetochangeit.



Evenwithreasonablecolumnwidths,thepivottableinFigure

13-5isn'tasreadableasitcouldbe.Toautoformatthetable:

1. SelectthepivottableandclicktheFormatReportbuttonon

thePivotTabletoolbar.ExceldisplaystheAutoFormatdialog

box.

2. ChooseaformatandclickOKtoapplyittothetable.Figure

13-7showstheresult.



Figure13-7.Applyanautoformattocreatea

nice-lookingreport



13.1.3.ChangeTotals

ThetotalsshowninFigure13-7arethesumsofthesalesrank

foreachbook.Itmakesmoresensetodisplaytheaverage

salesrank.Tochangethetotal:



1. Right-clickonthetotalfieldandchooseFieldSettings.Excel

displaysthePivotTableFielddialogforthetotal(similarto

Figure13-4).

2. SelectAverageandclickOK.Excelchangesthetotal

formulafromSumtoAverage.

Itdoesn'tmatterwhichProductNametotalyouselectinStep1.

Changingtheformulaforonetotalchangesalloftheequivalent

totalfieldsinthetable.



13.1.4.CharttheData

Thefinalstepistodisplaythedatagraphicallyusingachart.To

chartthedatafromapivottable:

1. SelectthepivottableandclicktheChartWizardbuttonon

thePivotTabletoolbar.Excelcreatesadefaultpivotchart.

2. Selectthechartareaandchangethecharttypetoaline

chart.

3. DragtheProductNamefieldtothechartlegend.Figure13-8

showstheresultofthesechanges.



Figure13-8.Apivotchartcreatedwiththe

PivotChartWizard



Thatlaststepillustrateshowpivotchartsaredifferentfrom

ordinaryExcelcharts:youcanrepositionthefieldstoget

differentviewsofthedata.Changingthefieldlayoutonthe

chartalsochangesthelayoutontheoriginalpivottable.Ifyou

wanttopreservethepivottablelayout,createanewpivot

chartbasedontheoriginalsourcedata.

Tocreateanindependentpivotchart:

1. Selectthecolumnstochartonthesourceworksheet

(Figure13-1).

2. ChooseData PivotTableandPivotChartReport;select

"PivotChartreport"onthewizard(Figure13-2)andclick

NexttofollowthewizardstepsorjustclickFinishtocreate

thechartquickly.Excelcreatesanewpivottableandpivot

chartbasedontheoriginalsourcedata.

3. DragfieldsfromtheFieldListontothechart,selectthe

charttype,andformatthechartasyouwouldnormally.

Eachpivotchartmusthaveanunderlyingpivottable.Ifyou



clickNextinStep2,Excelasksifyouwanttobaseyournew

pivottableontheexistingpivottable,asshowninFigure13-9.

IfyouchooseYes,Excelusesthesamepivotcacheforboththe

originalpivottableandthenewonethatwillbeusedbythe

chart.



Figure13-9.Excelasksifyouwanttosharethe

pivotcache



Thepivotcacheisahiddendatastoreusedtorefresheach

pivottable.Thereareseveraladvantagestosharingthepivot

cacheamongpivottables:

Refreshingapivottablerefreshesthepivotcache,soother

tablesthatsharethatpivotcachearealsoautomatically

refreshed.

Thelayoutofeachpivottableorpivotchartcanbeunique,

eventhoughtheysharethesamesource.Thatletsyou

movethefieldsonapivotchartwithoutchangingthelayout

ofyourpivotreport.

Theamountofmemoryrequiredbytheworkbookandthe

sizeoftheworkbookondiskarereduced.

Don'tuseasharedpivotcacheifyouwanttorefreshpivot



tablesindependently.Also,youcan'tuseasharedpivotcacheif

thepivottablesdon'tusethesamesource.Pivottablesbased

onworksheetsmustuseexactlythesamerangeinorderto

shareapivotcache.



13.1.5.ChangetheLayout

TheprocessofdraggingfieldsfromtheFieldListontothepivot

tableasshowninFigure13-3iscalledsettingthepivottable

layout.Youcanchangethatlayoutbydraggingfieldsto

differentlocationsonthepivottable.Figure13-10showsthe

areastowhichyoucandragfields.



Exceldoesn'tcallthesepartsofthepivottableareas.Itjustrefersto

fieldsinthoselocationsaspagefields,columnfields,rowfields,ordata

fields.



Figure13-10.Settingpivottablelayout



Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Chapter 13. Analyzing Data with Pivot Tables

Tải bản đầy đủ ngay(0 tr)

×