Hiding certain values in a single column within a 2010 pivot table.

Darren Bartrup

Well-known Member
Joined
Mar 13, 2006
Messages
1,297
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I'm hoping this is harder to explain than it is to implement - pivot tables aren't my strongest point.

On an Excel 2010 pivot table I'd like to show the subtotal and grand total of a column formatted as [h]:mm:ss, but I want to hide the values making up those totals while keeping the actual row visible.

The data source is an Access query exported to Excel.

My data table consists of five columns:
  • Employee_Name - an employee works on different sections through the day, so the name is repeated for for each section.
  • Section_Name - each section will appear a maximum of once per employee.
  • Shift_Duration - a total for the employee for the day, but appears on each row that the Employee_Name appears on.
  • Allocation - per section.
  • Complete - per section.

The Employee_Name and Section_Name are row labels (in that order).
Allocation and Complete are summed in the values.

The Shift_Duration is per employee and not per section so I'd like to show this only on the employee level where the subtotals for the different sections are shown.

At the moment I put the Max of Shift_Duration in the values and it appears correctly in the subtotals, but I'd like to hide it in the values part of the pivot table, leaving just the allocated and completed for each section showing.

I tried putting in a dummy section to hold the duration and took it off of the other section rows in the raw data - this made it disappear from the sections but it vanished from the subtotal when I hid the <blank> section row.

I could use a VLOOKUP to return the time from the raw data, but then it won't be included in the pivot table and will cause more work for me.

To make it easier on myself I'm also building the spreadsheet from within Access before turning the final report into HTML and placing it in an email (until the rest of the department upgrades from 2003).

Code:
    '''''''''''''''''''''''    
    'Add the pivot table. '
    '''''''''''''''''''''''
    With oXLWrkSht_TMP
        ''''''''''''''''''''''''''''''''''''
        'SourceType 1 = xlDatabase         '
        'Version 4 = xlPivotTableVersion14 '
        ''''''''''''''''''''''''''''''''''''
        oXLWrkBk.PivotCaches.Create( _
            SourceType:=1, _
            SourceData:=.Range(.Cells(1, 1), oXLLastCell_TMP), _
            Version:=4).CreatePivotTable _
            TableDestination:=oXLWrkSht_PVT.Cells(1, 1), _
            TableName:="TeamBreakDown", _
            DefaultVersion:=4
    End With
    With oXLWrkSht_PVT
        With .PivotTables("TeamBreakDown")
            With .PivotFields("Employee_Name")
                .Orientation = 1 'xlRowField
                .Position = 1
            End With
            With .PivotFields("Section_Name")
                .Orientation = 1 'xlRowField
                .Position = 2
            End With
            .AddDataField .PivotFields("Allocated"), "Allocated ", -4157 'xlSum
            .AddDataField .PivotFields("Complete"), "Complete ", -4157 'xlSum

'Duration will be added here as soon as I can work it out.


        End With
    
    End With

Thanks in advance for any input.</blank>
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Forum statistics

Threads
1,215,197
Messages
6,123,581
Members
449,108
Latest member
rache47

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