Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
jcliquidtension
 
Posts: n/a
Default Pivot Table Zero Value

Hi,

I've seen many questions on this subject, but none of the solutions seem to
work for me. I have a pivot table that summarizes billing amounts for 20-25
different data items. Also, the rows have two fields. For Example:

Name I.D. Data
Total
John Smith 7756 U.S. Tax Return $800
John Smith 7756 State Tax Return $250
John Smith 7756 Add'l State Return $0
John Doe 8876 U.S. Tax Return $800
John Doe 8876 State Tax Return $0
John Doe 8876 Add'l State Return $0

I'd like to hide the rows with a zero value. I tried coding the summary
worksheet (from which the pivot table pulls) to return "" rather than 0 if
the service was not performed. I then unchecked "show blank items," and
unchecked the "show blank as...." and "show zero as...." items.

I also tried Debra D's macro, but when I run it, it seems to run
continuously and doens't hide anything. (I have to escape from it to stop
it.)

All I need to do is hide the rows with zero values. Is this possible?
  #2   Report Post  
Jimbola
 
Posts: n/a
Default

2 suggestions would be

a) Can't you untick the £0 value in the pivot table list for that field
b) Can't you use an ordinary filter


HTH

"jcliquidtension" wrote:

Hi,

I've seen many questions on this subject, but none of the solutions seem to
work for me. I have a pivot table that summarizes billing amounts for 20-25
different data items. Also, the rows have two fields. For Example:

Name I.D. Data
Total
John Smith 7756 U.S. Tax Return $800
John Smith 7756 State Tax Return $250
John Smith 7756 Add'l State Return $0
John Doe 8876 U.S. Tax Return $800
John Doe 8876 State Tax Return $0
John Doe 8876 Add'l State Return $0

I'd like to hide the rows with a zero value. I tried coding the summary
worksheet (from which the pivot table pulls) to return "" rather than 0 if
the service was not performed. I then unchecked "show blank items," and
unchecked the "show blank as...." and "show zero as...." items.

I also tried Debra D's macro, but when I run it, it seems to run
continuously and doens't hide anything. (I have to escape from it to stop
it.)

All I need to do is hide the rows with zero values. Is this possible?

  #3   Report Post  
Debra Dalgleish
 
Posts: n/a
Default

Which macro are you using, and what version of Excel do you have?

jcliquidtension wrote:
Hi,

I've seen many questions on this subject, but none of the solutions seem to
work for me. I have a pivot table that summarizes billing amounts for 20-25
different data items. Also, the rows have two fields. For Example:

Name I.D. Data
Total
John Smith 7756 U.S. Tax Return $800
John Smith 7756 State Tax Return $250
John Smith 7756 Add'l State Return $0
John Doe 8876 U.S. Tax Return $800
John Doe 8876 State Tax Return $0
John Doe 8876 Add'l State Return $0

I'd like to hide the rows with a zero value. I tried coding the summary
worksheet (from which the pivot table pulls) to return "" rather than 0 if
the service was not performed. I then unchecked "show blank items," and
unchecked the "show blank as...." and "show zero as...." items.

I also tried Debra D's macro, but when I run it, it seems to run
continuously and doens't hide anything. (I have to escape from it to stop
it.)

All I need to do is hide the rows with zero values. Is this possible?



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

  #4   Report Post  
jcliquidtension
 
Posts: n/a
Default

Hi Debra,

First, thanks in advance for your help. I've read many of your posts, and
they're very informative. However, I still cannot get this pivot table -
zero value thing to work! The macro I tried is below. I changed the sheet
reference to my sheet, and I also changed the column and row references. Row
- Name; Column - Data. When those references did not work, I tried others
(total, amount, etc.), but still cannot get it to work. The best I could do
was to get past the reference errors, and then it just runs continuously.

Again, thanks in advance for your help!
Jason

Sub HideZeroRowTotals()
'hide rows that contain zero totals
Dim r As Integer
Dim rTop As Integer
Dim i As Integer
Dim pt As PivotTable
Dim pf As PivotField
Dim df As PivotField
Dim pi As PivotItem
Dim pd As Range
Dim str As String
Set pt = Sheets("Pivot").PivotTables(1)
Set df = pt.PivotFields("Amount") 'data field
Set pf = pt.PivotFields("Code") 'row field
rTop = 4 'number of rows before data starts
For Each pi In pf.PivotItems
On Error Resume Next
pi.Visible = True
Next pi
i = pf.PivotItems.Count + rTop
For r = i To rTop - 1 Step -1
On Error Resume Next
str = Cells(r, 1).Value
Set pd = pt.GetPivotData(df.Value, pf.Value, str)
If pd.Value = 0 Then
pf.PivotItems(str).Visible = False
End If
Next r

End Sub


"Debra Dalgleish" wrote:

Which macro are you using, and what version of Excel do you have?

jcliquidtension wrote:
Hi,

I've seen many questions on this subject, but none of the solutions seem to
work for me. I have a pivot table that summarizes billing amounts for 20-25
different data items. Also, the rows have two fields. For Example:

Name I.D. Data
Total
John Smith 7756 U.S. Tax Return $800
John Smith 7756 State Tax Return $250
John Smith 7756 Add'l State Return $0
John Doe 8876 U.S. Tax Return $800
John Doe 8876 State Tax Return $0
John Doe 8876 Add'l State Return $0

I'd like to hide the rows with a zero value. I tried coding the summary
worksheet (from which the pivot table pulls) to return "" rather than 0 if
the service was not performed. I then unchecked "show blank items," and
unchecked the "show blank as...." and "show zero as...." items.

I also tried Debra D's macro, but when I run it, it seems to run
continuously and doens't hide anything. (I have to escape from it to stop
it.)

All I need to do is hide the rows with zero values. Is this possible?



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


  #5   Report Post  
Dave Peterson
 
Posts: n/a
Default

PMFJI,

But I tried your code and with a minor tweak, it worked ok:

I changed this line:
str = Cells(r, 1).Value
to
str = Sheets("pivot").Cells(r, 1).Value

But if you had the pivot sheet active, then this suggestion isn't the fix.



jcliquidtension wrote:

Hi Debra,

First, thanks in advance for your help. I've read many of your posts, and
they're very informative. However, I still cannot get this pivot table -
zero value thing to work! The macro I tried is below. I changed the sheet
reference to my sheet, and I also changed the column and row references. Row
- Name; Column - Data. When those references did not work, I tried others
(total, amount, etc.), but still cannot get it to work. The best I could do
was to get past the reference errors, and then it just runs continuously.

Again, thanks in advance for your help!
Jason

Sub HideZeroRowTotals()
'hide rows that contain zero totals
Dim r As Integer
Dim rTop As Integer
Dim i As Integer
Dim pt As PivotTable
Dim pf As PivotField
Dim df As PivotField
Dim pi As PivotItem
Dim pd As Range
Dim str As String
Set pt = Sheets("Pivot").PivotTables(1)
Set df = pt.PivotFields("Amount") 'data field
Set pf = pt.PivotFields("Code") 'row field
rTop = 4 'number of rows before data starts
For Each pi In pf.PivotItems
On Error Resume Next
pi.Visible = True
Next pi
i = pf.PivotItems.Count + rTop
For r = i To rTop - 1 Step -1
On Error Resume Next
str = Cells(r, 1).Value
Set pd = pt.GetPivotData(df.Value, pf.Value, str)
If pd.Value = 0 Then
pf.PivotItems(str).Visible = False
End If
Next r

End Sub

"Debra Dalgleish" wrote:

Which macro are you using, and what version of Excel do you have?

jcliquidtension wrote:
Hi,

I've seen many questions on this subject, but none of the solutions seem to
work for me. I have a pivot table that summarizes billing amounts for 20-25
different data items. Also, the rows have two fields. For Example:

Name I.D. Data
Total
John Smith 7756 U.S. Tax Return $800
John Smith 7756 State Tax Return $250
John Smith 7756 Add'l State Return $0
John Doe 8876 U.S. Tax Return $800
John Doe 8876 State Tax Return $0
John Doe 8876 Add'l State Return $0

I'd like to hide the rows with a zero value. I tried coding the summary
worksheet (from which the pivot table pulls) to return "" rather than 0 if
the service was not performed. I then unchecked "show blank items," and
unchecked the "show blank as...." and "show zero as...." items.

I also tried Debra D's macro, but when I run it, it seems to run
continuously and doens't hide anything. (I have to escape from it to stop
it.)

All I need to do is hide the rows with zero values. Is this possible?



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



--

Dave Peterson


  #6   Report Post  
Debra Dalgleish
 
Posts: n/a
Default

Hi Jason,

Are you using Excel 2002 or Excel 2003, or an earlier version?

Debra

jcliquidtension wrote:
Hi Debra,

First, thanks in advance for your help. I've read many of your posts, and
they're very informative. However, I still cannot get this pivot table -
zero value thing to work! The macro I tried is below. I changed the sheet
reference to my sheet, and I also changed the column and row references. Row
- Name; Column - Data. When those references did not work, I tried others
(total, amount, etc.), but still cannot get it to work. The best I could do
was to get past the reference errors, and then it just runs continuously.

Again, thanks in advance for your help!
Jason

Sub HideZeroRowTotals()
'hide rows that contain zero totals
Dim r As Integer
Dim rTop As Integer
Dim i As Integer
Dim pt As PivotTable
Dim pf As PivotField
Dim df As PivotField
Dim pi As PivotItem
Dim pd As Range
Dim str As String
Set pt = Sheets("Pivot").PivotTables(1)
Set df = pt.PivotFields("Amount") 'data field
Set pf = pt.PivotFields("Code") 'row field
rTop = 4 'number of rows before data starts
For Each pi In pf.PivotItems
On Error Resume Next
pi.Visible = True
Next pi
i = pf.PivotItems.Count + rTop
For r = i To rTop - 1 Step -1
On Error Resume Next
str = Cells(r, 1).Value
Set pd = pt.GetPivotData(df.Value, pf.Value, str)
If pd.Value = 0 Then
pf.PivotItems(str).Visible = False
End If
Next r

End Sub


"Debra Dalgleish" wrote:


Which macro are you using, and what version of Excel do you have?

jcliquidtension wrote:

Hi,

I've seen many questions on this subject, but none of the solutions seem to
work for me. I have a pivot table that summarizes billing amounts for 20-25
different data items. Also, the rows have two fields. For Example:

Name I.D. Data
Total
John Smith 7756 U.S. Tax Return $800
John Smith 7756 State Tax Return $250
John Smith 7756 Add'l State Return $0
John Doe 8876 U.S. Tax Return $800
John Doe 8876 State Tax Return $0
John Doe 8876 Add'l State Return $0

I'd like to hide the rows with a zero value. I tried coding the summary
worksheet (from which the pivot table pulls) to return "" rather than 0 if
the service was not performed. I then unchecked "show blank items," and
unchecked the "show blank as...." and "show zero as...." items.

I also tried Debra D's macro, but when I run it, it seems to run
continuously and doens't hide anything. (I have to escape from it to stop
it.)

All I need to do is hide the rows with zero values. Is this possible?



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





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

  #7   Report Post  
jcliquidtension
 
Posts: n/a
Default

Hi Debra,

I'm sorry I forgot to include the version. I'm using Excel 2003.

Thanks again,
JAson

"Debra Dalgleish" wrote:

Hi Jason,

Are you using Excel 2002 or Excel 2003, or an earlier version?

Debra

jcliquidtension wrote:
Hi Debra,

First, thanks in advance for your help. I've read many of your posts, and
they're very informative. However, I still cannot get this pivot table -
zero value thing to work! The macro I tried is below. I changed the sheet
reference to my sheet, and I also changed the column and row references. Row
- Name; Column - Data. When those references did not work, I tried others
(total, amount, etc.), but still cannot get it to work. The best I could do
was to get past the reference errors, and then it just runs continuously.

Again, thanks in advance for your help!
Jason

Sub HideZeroRowTotals()
'hide rows that contain zero totals
Dim r As Integer
Dim rTop As Integer
Dim i As Integer
Dim pt As PivotTable
Dim pf As PivotField
Dim df As PivotField
Dim pi As PivotItem
Dim pd As Range
Dim str As String
Set pt = Sheets("Pivot").PivotTables(1)
Set df = pt.PivotFields("Amount") 'data field
Set pf = pt.PivotFields("Code") 'row field
rTop = 4 'number of rows before data starts
For Each pi In pf.PivotItems
On Error Resume Next
pi.Visible = True
Next pi
i = pf.PivotItems.Count + rTop
For r = i To rTop - 1 Step -1
On Error Resume Next
str = Cells(r, 1).Value
Set pd = pt.GetPivotData(df.Value, pf.Value, str)
If pd.Value = 0 Then
pf.PivotItems(str).Visible = False
End If
Next r

End Sub


"Debra Dalgleish" wrote:


Which macro are you using, and what version of Excel do you have?

jcliquidtension wrote:

Hi,

I've seen many questions on this subject, but none of the solutions seem to
work for me. I have a pivot table that summarizes billing amounts for 20-25
different data items. Also, the rows have two fields. For Example:

Name I.D. Data
Total
John Smith 7756 U.S. Tax Return $800
John Smith 7756 State Tax Return $250
John Smith 7756 Add'l State Return $0
John Doe 8876 U.S. Tax Return $800
John Doe 8876 State Tax Return $0
John Doe 8876 Add'l State Return $0

I'd like to hide the rows with a zero value. I tried coding the summary
worksheet (from which the pivot table pulls) to return "" rather than 0 if
the service was not performed. I then unchecked "show blank items," and
unchecked the "show blank as...." and "show zero as...." items.

I also tried Debra D's macro, but when I run it, it seems to run
continuously and doens't hide anything. (I have to escape from it to stop
it.)

All I need to do is hide the rows with zero values. Is this possible?


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





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


  #8   Report Post  
jcliquidtension
 
Posts: n/a
Default

Hi Dave,

Thanks for the input. I tried it both with the pivot table sheet active,
and inactive. Either way, I was receiving the error messages. Thanks though!

Jason

"Dave Peterson" wrote:

PMFJI,

But I tried your code and with a minor tweak, it worked ok:

I changed this line:
str = Cells(r, 1).Value
to
str = Sheets("pivot").Cells(r, 1).Value

But if you had the pivot sheet active, then this suggestion isn't the fix.



jcliquidtension wrote:

Hi Debra,

First, thanks in advance for your help. I've read many of your posts, and
they're very informative. However, I still cannot get this pivot table -
zero value thing to work! The macro I tried is below. I changed the sheet
reference to my sheet, and I also changed the column and row references. Row
- Name; Column - Data. When those references did not work, I tried others
(total, amount, etc.), but still cannot get it to work. The best I could do
was to get past the reference errors, and then it just runs continuously.

Again, thanks in advance for your help!
Jason

Sub HideZeroRowTotals()
'hide rows that contain zero totals
Dim r As Integer
Dim rTop As Integer
Dim i As Integer
Dim pt As PivotTable
Dim pf As PivotField
Dim df As PivotField
Dim pi As PivotItem
Dim pd As Range
Dim str As String
Set pt = Sheets("Pivot").PivotTables(1)
Set df = pt.PivotFields("Amount") 'data field
Set pf = pt.PivotFields("Code") 'row field
rTop = 4 'number of rows before data starts
For Each pi In pf.PivotItems
On Error Resume Next
pi.Visible = True
Next pi
i = pf.PivotItems.Count + rTop
For r = i To rTop - 1 Step -1
On Error Resume Next
str = Cells(r, 1).Value
Set pd = pt.GetPivotData(df.Value, pf.Value, str)
If pd.Value = 0 Then
pf.PivotItems(str).Visible = False
End If
Next r

End Sub

"Debra Dalgleish" wrote:

Which macro are you using, and what version of Excel do you have?

jcliquidtension wrote:
Hi,

I've seen many questions on this subject, but none of the solutions seem to
work for me. I have a pivot table that summarizes billing amounts for 20-25
different data items. Also, the rows have two fields. For Example:

Name I.D. Data
Total
John Smith 7756 U.S. Tax Return $800
John Smith 7756 State Tax Return $250
John Smith 7756 Add'l State Return $0
John Doe 8876 U.S. Tax Return $800
John Doe 8876 State Tax Return $0
John Doe 8876 Add'l State Return $0

I'd like to hide the rows with a zero value. I tried coding the summary
worksheet (from which the pivot table pulls) to return "" rather than 0 if
the service was not performed. I then unchecked "show blank items," and
unchecked the "show blank as...." and "show zero as...." items.

I also tried Debra D's macro, but when I run it, it seems to run
continuously and doens't hide anything. (I have to escape from it to stop
it.)

All I need to do is hide the rows with zero values. Is this possible?


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



--

Dave Peterson

  #9   Report Post  
jcliquidtension
 
Posts: n/a
Default

Hi Debra,

I just realized something else with which I'm having an issue. The column
headings used in the template can change depending upon who uses them. (Each
user selects his/her country from a drop-down, and based on the selection,
certain headings show. The headings that change are always in the data field
of the table. i've noticed that when they change, they drop out of the
table. Is there any way to reference the column by it's location rather than
it's name? Or is there any way to keep them from dropping from the table
when they change?

Thanks again,
Jason

"Debra Dalgleish" wrote:

Hi Jason,

Are you using Excel 2002 or Excel 2003, or an earlier version?

Debra

jcliquidtension wrote:
Hi Debra,

First, thanks in advance for your help. I've read many of your posts, and
they're very informative. However, I still cannot get this pivot table -
zero value thing to work! The macro I tried is below. I changed the sheet
reference to my sheet, and I also changed the column and row references. Row
- Name; Column - Data. When those references did not work, I tried others
(total, amount, etc.), but still cannot get it to work. The best I could do
was to get past the reference errors, and then it just runs continuously.

Again, thanks in advance for your help!
Jason

Sub HideZeroRowTotals()
'hide rows that contain zero totals
Dim r As Integer
Dim rTop As Integer
Dim i As Integer
Dim pt As PivotTable
Dim pf As PivotField
Dim df As PivotField
Dim pi As PivotItem
Dim pd As Range
Dim str As String
Set pt = Sheets("Pivot").PivotTables(1)
Set df = pt.PivotFields("Amount") 'data field
Set pf = pt.PivotFields("Code") 'row field
rTop = 4 'number of rows before data starts
For Each pi In pf.PivotItems
On Error Resume Next
pi.Visible = True
Next pi
i = pf.PivotItems.Count + rTop
For r = i To rTop - 1 Step -1
On Error Resume Next
str = Cells(r, 1).Value
Set pd = pt.GetPivotData(df.Value, pf.Value, str)
If pd.Value = 0 Then
pf.PivotItems(str).Visible = False
End If
Next r

End Sub


"Debra Dalgleish" wrote:


Which macro are you using, and what version of Excel do you have?

jcliquidtension wrote:

Hi,

I've seen many questions on this subject, but none of the solutions seem to
work for me. I have a pivot table that summarizes billing amounts for 20-25
different data items. Also, the rows have two fields. For Example:

Name I.D. Data
Total
John Smith 7756 U.S. Tax Return $800
John Smith 7756 State Tax Return $250
John Smith 7756 Add'l State Return $0
John Doe 8876 U.S. Tax Return $800
John Doe 8876 State Tax Return $0
John Doe 8876 Add'l State Return $0

I'd like to hide the rows with a zero value. I tried coding the summary
worksheet (from which the pivot table pulls) to return "" rather than 0 if
the service was not performed. I then unchecked "show blank items," and
unchecked the "show blank as...." and "show zero as...." items.

I also tried Debra D's macro, but when I run it, it seems to run
continuously and doens't hide anything. (I have to escape from it to stop
it.)

All I need to do is hide the rows with zero values. Is this possible?


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





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


  #10   Report Post  
Debra Dalgleish
 
Posts: n/a
Default

If the information is summarized on another sheet, do you need to use a
pivot table? Maybe an AutoFilter on the summary sheet would be a better
tool for this.

To maintain all the item headings, you could check the 'show items with
no data' box in the Data Field Settings dialog box.

jcliquidtension wrote:
Hi Debra,

I just realized something else with which I'm having an issue. The column
headings used in the template can change depending upon who uses them. (Each
user selects his/her country from a drop-down, and based on the selection,
certain headings show. The headings that change are always in the data field
of the table. i've noticed that when they change, they drop out of the
table. Is there any way to reference the column by it's location rather than
it's name? Or is there any way to keep them from dropping from the table
when they change?

Thanks again,
Jason

"Debra Dalgleish" wrote:


Hi Jason,

Are you using Excel 2002 or Excel 2003, or an earlier version?

Debra

jcliquidtension wrote:

Hi Debra,

First, thanks in advance for your help. I've read many of your posts, and
they're very informative. However, I still cannot get this pivot table -
zero value thing to work! The macro I tried is below. I changed the sheet
reference to my sheet, and I also changed the column and row references. Row
- Name; Column - Data. When those references did not work, I tried others
(total, amount, etc.), but still cannot get it to work. The best I could do
was to get past the reference errors, and then it just runs continuously.

Again, thanks in advance for your help!
Jason

Sub HideZeroRowTotals()
'hide rows that contain zero totals
Dim r As Integer
Dim rTop As Integer
Dim i As Integer
Dim pt As PivotTable
Dim pf As PivotField
Dim df As PivotField
Dim pi As PivotItem
Dim pd As Range
Dim str As String
Set pt = Sheets("Pivot").PivotTables(1)
Set df = pt.PivotFields("Amount") 'data field
Set pf = pt.PivotFields("Code") 'row field
rTop = 4 'number of rows before data starts
For Each pi In pf.PivotItems
On Error Resume Next
pi.Visible = True
Next pi
i = pf.PivotItems.Count + rTop
For r = i To rTop - 1 Step -1
On Error Resume Next
str = Cells(r, 1).Value
Set pd = pt.GetPivotData(df.Value, pf.Value, str)
If pd.Value = 0 Then
pf.PivotItems(str).Visible = False
End If
Next r

End Sub


"Debra Dalgleish" wrote:



Which macro are you using, and what version of Excel do you have?

jcliquidtension wrote:


Hi,

I've seen many questions on this subject, but none of the solutions seem to
work for me. I have a pivot table that summarizes billing amounts for 20-25
different data items. Also, the rows have two fields. For Example:

Name I.D. Data
Total
John Smith 7756 U.S. Tax Return $800
John Smith 7756 State Tax Return $250
John Smith 7756 Add'l State Return $0
John Doe 8876 U.S. Tax Return $800
John Doe 8876 State Tax Return $0
John Doe 8876 Add'l State Return $0

I'd like to hide the rows with a zero value. I tried coding the summary
worksheet (from which the pivot table pulls) to return "" rather than 0 if
the service was not performed. I then unchecked "show blank items," and
unchecked the "show blank as...." and "show zero as...." items.

I also tried Debra D's macro, but when I run it, it seems to run
continuously and doens't hide anything. (I have to escape from it to stop
it.)

All I need to do is hide the rows with zero values. Is this possible?


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




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





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



  #11   Report Post  
jcliquidtension
 
Posts: n/a
Default

The information is summarized, but I was hoping to have it in a format as
below. The input sheet has one row for each person, and the various services
are in columns. So, a check in C2 returns John Smith U.S. Return, D2 is John
Smith State Return, etc. The next row would be for John Doe, and so on. I
liked the way the pivot table put the info in rows like that, whereas my
summary sheet shows amounts (pulled from a table depending upon which country
performs the service) in the same format as the input page. Is that possible
without a pivot table?

Name I.D. Data
Total

John Smith 7756 U.S. Tax Return $800
John Smith 7756 State Tax Return $250
John Smith 7756 Add'l State Return $0
John Doe 8876 U.S. Tax Return $800
John Doe 8876 State Tax Return $0
John Doe 8876 Add'l State Return $0

THanks again,
Jason

"Debra Dalgleish" wrote:

If the information is summarized on another sheet, do you need to use a
pivot table? Maybe an AutoFilter on the summary sheet would be a better
tool for this.

To maintain all the item headings, you could check the 'show items with
no data' box in the Data Field Settings dialog box.

jcliquidtension wrote:
Hi Debra,

I just realized something else with which I'm having an issue. The column
headings used in the template can change depending upon who uses them. (Each
user selects his/her country from a drop-down, and based on the selection,
certain headings show. The headings that change are always in the data field
of the table. i've noticed that when they change, they drop out of the
table. Is there any way to reference the column by it's location rather than
it's name? Or is there any way to keep them from dropping from the table
when they change?

Thanks again,
Jason

"Debra Dalgleish" wrote:


Hi Jason,

Are you using Excel 2002 or Excel 2003, or an earlier version?

Debra

jcliquidtension wrote:

Hi Debra,

First, thanks in advance for your help. I've read many of your posts, and
they're very informative. However, I still cannot get this pivot table -
zero value thing to work! The macro I tried is below. I changed the sheet
reference to my sheet, and I also changed the column and row references. Row
- Name; Column - Data. When those references did not work, I tried others
(total, amount, etc.), but still cannot get it to work. The best I could do
was to get past the reference errors, and then it just runs continuously.

Again, thanks in advance for your help!
Jason

Sub HideZeroRowTotals()
'hide rows that contain zero totals
Dim r As Integer
Dim rTop As Integer
Dim i As Integer
Dim pt As PivotTable
Dim pf As PivotField
Dim df As PivotField
Dim pi As PivotItem
Dim pd As Range
Dim str As String
Set pt = Sheets("Pivot").PivotTables(1)
Set df = pt.PivotFields("Amount") 'data field
Set pf = pt.PivotFields("Code") 'row field
rTop = 4 'number of rows before data starts
For Each pi In pf.PivotItems
On Error Resume Next
pi.Visible = True
Next pi
i = pf.PivotItems.Count + rTop
For r = i To rTop - 1 Step -1
On Error Resume Next
str = Cells(r, 1).Value
Set pd = pt.GetPivotData(df.Value, pf.Value, str)
If pd.Value = 0 Then
pf.PivotItems(str).Visible = False
End If
Next r

End Sub


"Debra Dalgleish" wrote:



Which macro are you using, and what version of Excel do you have?

jcliquidtension wrote:


Hi,

I've seen many questions on this subject, but none of the solutions seem to
work for me. I have a pivot table that summarizes billing amounts for 20-25
different data items. Also, the rows have two fields. For Example:

Name I.D. Data
Total
John Smith 7756 U.S. Tax Return $800
John Smith 7756 State Tax Return $250
John Smith 7756 Add'l State Return $0
John Doe 8876 U.S. Tax Return $800
John Doe 8876 State Tax Return $0
John Doe 8876 Add'l State Return $0

I'd like to hide the rows with a zero value. I tried coding the summary
worksheet (from which the pivot table pulls) to return "" rather than 0 if
the service was not performed. I then unchecked "show blank items," and
unchecked the "show blank as...." and "show zero as...." items.

I also tried Debra D's macro, but when I run it, it seems to run
continuously and doens't hide anything. (I have to escape from it to stop
it.)

All I need to do is hide the rows with zero values. Is this possible?


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




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





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


  #12   Report Post  
Debra Dalgleish
 
Posts: n/a
Default

A pivot table would be the easiest way to show the return types in a
column. But the name and ID number will only show once, not repeated for
each row.

I assumed the sample showed how your source data was arranged. If this
is how the pivot table is arranged, the HideZero macro won't work. If
you hide a Data item, it would hide it for all names. If you run a macro
that simply hides the rows that contain a zero total, it could hide rows
that contain the Name and ID, leaving many rows unidentified.

jcliquidtension wrote:
The information is summarized, but I was hoping to have it in a format as
below. The input sheet has one row for each person, and the various services
are in columns. So, a check in C2 returns John Smith U.S. Return, D2 is John
Smith State Return, etc. The next row would be for John Doe, and so on. I
liked the way the pivot table put the info in rows like that, whereas my
summary sheet shows amounts (pulled from a table depending upon which country
performs the service) in the same format as the input page. Is that possible
without a pivot table?

Name I.D. Data
Total

John Smith 7756 U.S. Tax Return $800
John Smith 7756 State Tax Return $250
John Smith 7756 Add'l State Return $0
John Doe 8876 U.S. Tax Return $800
John Doe 8876 State Tax Return $0
John Doe 8876 Add'l State Return $0

THanks again,
Jason

"Debra Dalgleish" wrote:


If the information is summarized on another sheet, do you need to use a
pivot table? Maybe an AutoFilter on the summary sheet would be a better
tool for this.

To maintain all the item headings, you could check the 'show items with
no data' box in the Data Field Settings dialog box.

jcliquidtension wrote:

Hi Debra,

I just realized something else with which I'm having an issue. The column
headings used in the template can change depending upon who uses them. (Each
user selects his/her country from a drop-down, and based on the selection,
certain headings show. The headings that change are always in the data field
of the table. i've noticed that when they change, they drop out of the
table. Is there any way to reference the column by it's location rather than
it's name? Or is there any way to keep them from dropping from the table
when they change?

Thanks again,
Jason

"Debra Dalgleish" wrote:



Hi Jason,

Are you using Excel 2002 or Excel 2003, or an earlier version?

Debra

jcliquidtension wrote:


Hi Debra,

First, thanks in advance for your help. I've read many of your posts, and
they're very informative. However, I still cannot get this pivot table -
zero value thing to work! The macro I tried is below. I changed the sheet
reference to my sheet, and I also changed the column and row references. Row
- Name; Column - Data. When those references did not work, I tried others
(total, amount, etc.), but still cannot get it to work. The best I could do
was to get past the reference errors, and then it just runs continuously.

Again, thanks in advance for your help!
Jason

Sub HideZeroRowTotals()
'hide rows that contain zero totals
Dim r As Integer
Dim rTop As Integer
Dim i As Integer
Dim pt As PivotTable
Dim pf As PivotField
Dim df As PivotField
Dim pi As PivotItem
Dim pd As Range
Dim str As String
Set pt = Sheets("Pivot").PivotTables(1)
Set df = pt.PivotFields("Amount") 'data field
Set pf = pt.PivotFields("Code") 'row field
rTop = 4 'number of rows before data starts
For Each pi In pf.PivotItems
On Error Resume Next
pi.Visible = True
Next pi
i = pf.PivotItems.Count + rTop
For r = i To rTop - 1 Step -1
On Error Resume Next
str = Cells(r, 1).Value
Set pd = pt.GetPivotData(df.Value, pf.Value, str)
If pd.Value = 0 Then
pf.PivotItems(str).Visible = False
End If
Next r

End Sub


"Debra Dalgleish" wrote:




Which macro are you using, and what version of Excel do you have?

jcliquidtension wrote:



Hi,

I've seen many questions on this subject, but none of the solutions seem to
work for me. I have a pivot table that summarizes billing amounts for 20-25
different data items. Also, the rows have two fields. For Example:

Name I.D. Data
Total
John Smith 7756 U.S. Tax Return $800
John Smith 7756 State Tax Return $250
John Smith 7756 Add'l State Return $0
John Doe 8876 U.S. Tax Return $800
John Doe 8876 State Tax Return $0
John Doe 8876 Add'l State Return $0

I'd like to hide the rows with a zero value. I tried coding the summary
worksheet (from which the pivot table pulls) to return "" rather than 0 if
the service was not performed. I then unchecked "show blank items," and
unchecked the "show blank as...." and "show zero as...." items.

I also tried Debra D's macro, but when I run it, it seems to run
continuously and doens't hide anything. (I have to escape from it to stop
it.)

All I need to do is hide the rows with zero values. Is this possible?


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



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




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





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

  #13   Report Post  
jcliquidtension
 
Posts: n/a
Default

Well, again, thanks very much for the help. I guess the pivot table is the
best bet then.

Thanks again,
Jason

"Debra Dalgleish" wrote:

A pivot table would be the easiest way to show the return types in a
column. But the name and ID number will only show once, not repeated for
each row.

I assumed the sample showed how your source data was arranged. If this
is how the pivot table is arranged, the HideZero macro won't work. If
you hide a Data item, it would hide it for all names. If you run a macro
that simply hides the rows that contain a zero total, it could hide rows
that contain the Name and ID, leaving many rows unidentified.

jcliquidtension wrote:
The information is summarized, but I was hoping to have it in a format as
below. The input sheet has one row for each person, and the various services
are in columns. So, a check in C2 returns John Smith U.S. Return, D2 is John
Smith State Return, etc. The next row would be for John Doe, and so on. I
liked the way the pivot table put the info in rows like that, whereas my
summary sheet shows amounts (pulled from a table depending upon which country
performs the service) in the same format as the input page. Is that possible
without a pivot table?

Name I.D. Data
Total

John Smith 7756 U.S. Tax Return $800
John Smith 7756 State Tax Return $250
John Smith 7756 Add'l State Return $0
John Doe 8876 U.S. Tax Return $800
John Doe 8876 State Tax Return $0
John Doe 8876 Add'l State Return $0

THanks again,
Jason

"Debra Dalgleish" wrote:


If the information is summarized on another sheet, do you need to use a
pivot table? Maybe an AutoFilter on the summary sheet would be a better
tool for this.

To maintain all the item headings, you could check the 'show items with
no data' box in the Data Field Settings dialog box.

jcliquidtension wrote:

Hi Debra,

I just realized something else with which I'm having an issue. The column
headings used in the template can change depending upon who uses them. (Each
user selects his/her country from a drop-down, and based on the selection,
certain headings show. The headings that change are always in the data field
of the table. i've noticed that when they change, they drop out of the
table. Is there any way to reference the column by it's location rather than
it's name? Or is there any way to keep them from dropping from the table
when they change?

Thanks again,
Jason

"Debra Dalgleish" wrote:



Hi Jason,

Are you using Excel 2002 or Excel 2003, or an earlier version?

Debra

jcliquidtension wrote:


Hi Debra,

First, thanks in advance for your help. I've read many of your posts, and
they're very informative. However, I still cannot get this pivot table -
zero value thing to work! The macro I tried is below. I changed the sheet
reference to my sheet, and I also changed the column and row references. Row
- Name; Column - Data. When those references did not work, I tried others
(total, amount, etc.), but still cannot get it to work. The best I could do
was to get past the reference errors, and then it just runs continuously.

Again, thanks in advance for your help!
Jason

Sub HideZeroRowTotals()
'hide rows that contain zero totals
Dim r As Integer
Dim rTop As Integer
Dim i As Integer
Dim pt As PivotTable
Dim pf As PivotField
Dim df As PivotField
Dim pi As PivotItem
Dim pd As Range
Dim str As String
Set pt = Sheets("Pivot").PivotTables(1)
Set df = pt.PivotFields("Amount") 'data field
Set pf = pt.PivotFields("Code") 'row field
rTop = 4 'number of rows before data starts
For Each pi In pf.PivotItems
On Error Resume Next
pi.Visible = True
Next pi
i = pf.PivotItems.Count + rTop
For r = i To rTop - 1 Step -1
On Error Resume Next
str = Cells(r, 1).Value
Set pd = pt.GetPivotData(df.Value, pf.Value, str)
If pd.Value = 0 Then
pf.PivotItems(str).Visible = False
End If
Next r

End Sub


"Debra Dalgleish" wrote:




Which macro are you using, and what version of Excel do you have?

jcliquidtension wrote:



Hi,

I've seen many questions on this subject, but none of the solutions seem to
work for me. I have a pivot table that summarizes billing amounts for 20-25
different data items. Also, the rows have two fields. For Example:

Name I.D. Data
Total
John Smith 7756 U.S. Tax Return $800
John Smith 7756 State Tax Return $250
John Smith 7756 Add'l State Return $0
John Doe 8876 U.S. Tax Return $800
John Doe 8876 State Tax Return $0
John Doe 8876 Add'l State Return $0

I'd like to hide the rows with a zero value. I tried coding the summary
worksheet (from which the pivot table pulls) to return "" rather than 0 if
the service was not performed. I then unchecked "show blank items," and
unchecked the "show blank as...." and "show zero as...." items.

I also tried Debra D's macro, but when I run it, it seems to run
continuously and doens't hide anything. (I have to escape from it to stop
it.)

All I need to do is hide the rows with zero values. Is this possible?


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



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




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





--
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
Date Selection for Pivot Table Burak Emer Excel Discussion (Misc queries) 0 December 15th 04 09:19 AM
How to create a calculated field formula based on Pivot Table resu dha17 Excel Discussion (Misc queries) 1 December 15th 04 06:39 AM
create space in line chart between points, linked to pivot table Mike -Z- Charts and Charting in Excel 1 December 7th 04 10:39 PM
pivot table multi line chart souris Charts and Charting in Excel 2 December 7th 04 04:56 AM
convert excel list to pivot table GI Excel Discussion (Misc queries) 0 December 6th 04 07:45 PM


All times are GMT +1. The time now is 12:27 AM.

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"