Pivot Table Formula Disaster

MikeyFB

Board Regular
Joined
Aug 15, 2007
Messages
66
Hello!

Please bare with my images, its a word document, im at work and therefore have no otehr option. The problem is when i enter my YTD formula the table duplicates all the sub categories into all the categories, which is unwanted.

Please help!

http://www.megaupload.com/?d=I2RH593Q
 

Some videos you may like

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
The only solution I know requires VBA - source Debra Dalgleish in:

http://www.pcreview.co.uk/forums/thread-1776326.php

Code:
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
 

MikeyFB

Board Regular
Joined
Aug 15, 2007
Messages
66

ADVERTISEMENT

Ok, so how would I go about entering that code, Im a complete amatur!
 

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
Press Alt+F11 to go to the Visual Basic Editor. Click your workbook in the Project window on the left and choose Insert|Module from the menu. Paste the code I posted in the window on the right. Press Alt+F11 to return to your workbook.

From the menu choose Tools|Macro|Macros, choose the one you want and click Run.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,842
Messages
5,598,394
Members
414,234
Latest member
grlevesq

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
Top