Pivot Table (using average and st.dev

akaitsuki

New Member
Joined
Aug 17, 2016
Messages
8
Hello,

Boy I didn't expect pivot tables to be an issue, but here I am :ROFLMAO:


I got the pivot table to put the fields and calcs where I want them, actually this is almost the powerprogramming example pretty much

Sub CreatePivotTable()
Dim PTCache As PivotCache
Dim PT As PivotTable

Set PTCache = ActiveWorkbook.PivotCaches.Create( _
SourceType:=xlDatabase, _
SourceData:=Range("A1").CurrentRegion)

Worksheets.Add

Set PT = ActiveSheet.PivotTables.Add( _
PivotCache:=PTCache, _
TableDestination:=Range("A3"))

With PT
.PivotFields("Email").Orientation = xlPageField
.PivotFields("Job Category Code").Orientation = xlRowField
.PivotFields("Career Level").Orientation = xlRowField
.PivotFields("Salary").Orientation = xlDataField
.Pivotfields("Salary").Function = xlaverage
.Pivotfields("Salary").Function = xlmedian

.DisplayFieldCaptions = False
End With
End Sub


Could not for the life of my figure out how to get salary to only display average and median, I know it's a function but did not know how to implement

Also out of curiousity two questions.

1. Can I just go back to the add worksheet spot and create another pivot table in the same macro that way? (Meaning copying the code over from that spot, i'll differentiate by adding filters)
2. Anyone have a great resource that will explain how to do filters on the page field that is fairly idiot proof?


Thank you so much.
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

Forum statistics

Threads
1,213,514
Messages
6,114,078
Members
448,547
Latest member
arndtea

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top