Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Liny
 
Posts: n/a
Default calculated field/item in pivot tables

I have a pivot table that summarizes instructor rank by gender for each
Faculty and department.
Prof Assoc Prof Assist Prof
Instructor Lecturer Total Faculty Dept M F M F
M F M F M F

Arts Arch
Arts Psyc
Sci Math
Sci Phys

The pivot table will show a grand total for each row (ie for each
department). However, it is a single number and not broken down by gender.
When I click on 'rank' and try to add a calculated item called 'Grand Total'
with the formula: Professor + 'Associate Professor' + 'Assistant Professor' +
Instructor + Lecturer, I do get a new column called 'Grand Total' with a male
and female breakdown. But now each Faculty shows all possible departments
instead of just the departments that belong in that Faculty. For example,
Math shows up in all Faculties but should just show up under Faculty of
Science. The data are blank for all Math rows except for the one in Science.
How do I get rid of all the blank Math rows except for the one in the
Faculty of Science?
Thanks,
Liny.
  #2   Report Post  
Debra Dalgleish
 
Posts: n/a
Default

You can use programming to hide the rows with a zero total. For example:

'======================================
Sub HidePivotZeroRows()
'hide worksheet rows that contain all zeros
Dim rng As Range
For Each rng In ActiveSheet _
.PivotTables(1).DataBodyRange.Rows
If Application.Sum(rng) = 0 Then
rng.EntireRow.Hidden = True
Else
'unhide any previously hidden rows
rng.EntireRow.Hidden = False
End If
Next rng
End Sub
'================================
Sub UnhidePivotRows()
'unhide all rows
Dim rng As Range
For Each rng In ActiveSheet _
.PivotTables(1).DataBodyRange.Rows
rng.EntireRow.Hidden = False
Next rng
End Sub
'====================================

Liny wrote:
I have a pivot table that summarizes instructor rank by gender for each
Faculty and department.
Prof Assoc Prof Assist Prof
Instructor Lecturer Total Faculty Dept M F M F
M F M F M F

Arts Arch
Arts Psyc
Sci Math
Sci Phys

The pivot table will show a grand total for each row (ie for each
department). However, it is a single number and not broken down by gender.
When I click on 'rank' and try to add a calculated item called 'Grand Total'
with the formula: Professor + 'Associate Professor' + 'Assistant Professor' +
Instructor + Lecturer, I do get a new column called 'Grand Total' with a male
and female breakdown. But now each Faculty shows all possible departments
instead of just the departments that belong in that Faculty. For example,
Math shows up in all Faculties but should just show up under Faculty of
Science. The data are blank for all Math rows except for the one in Science.
How do I get rid of all the blank Math rows except for the one in the
Faculty of Science?
Thanks,
Liny.



--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using a Pivot Table Calculated Field to get a Unique Count Mike Struckman Excel Worksheet Functions 1 November 22nd 05 05:32 PM
pivot tables - calculated fields Esche Excel Worksheet Functions 3 May 26th 05 05:25 PM
Macro for Pivot Tables Thomas Excel Discussion (Misc queries) 1 March 15th 05 01:03 AM
How does the term 'pivot' apply to Excel's Pivot tables and Pivot. stvermont Excel Discussion (Misc queries) 1 February 17th 05 01:34 AM
Pivot Tables, calculated fields Excel GuRu Excel Discussion (Misc queries) 1 December 21st 04 12:08 AM


All times are GMT +1. The time now is 06:52 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"