Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9
Default Adding a calculated field to a pivot table

I have a pivot table that includes these fields:
1. A count of "Traffic types" (which are text)
2. A count of "Sales Dollars" (which is in currency)

I want to add a calculated field that will take #2 above and divide it by #1.

When I create such a field (= 'Sale '/ 'Traffic Type') I get a divide by
zero error, even though fields are populated. I am trying to get to a
"closing %". Can anyone advise me as to where I am making my error?
Thanks!
Dan
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,696
Default Adding a calculated field to a pivot table

Unfortunately, calculated fields caculate off the original table, not the
pivot table.

An alternate option is to calculate outside the table. So, assuming you have
your headers in A3 through C3, and each subject takes up to rows, Try going
to D5 and typing C5/C4. Highlight D4 to D5, copy, paste down to the bottom.

"DanL" wrote:

I have a pivot table that includes these fields:
1. A count of "Traffic types" (which are text)
2. A count of "Sales Dollars" (which is in currency)

I want to add a calculated field that will take #2 above and divide it by #1.

When I create such a field (= 'Sale '/ 'Traffic Type') I get a divide by
zero error, even though fields are populated. I am trying to get to a
"closing %". Can anyone advise me as to where I am making my error?
Thanks!
Dan

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9
Default Adding a calculated field to a pivot table

Sean:
Thanks for the response, I appreciate it!! When I go to the source table
(not the pivot table, correct?) to add the formula you suggest, that would
now attempt to divide a number by text, would it not? When I did that, it
still returns a 'name' error.

Did I read your instruction correctly?

"Sean Timmons" wrote:

Unfortunately, calculated fields caculate off the original table, not the
pivot table.

An alternate option is to calculate outside the table. So, assuming you have
your headers in A3 through C3, and each subject takes up to rows, Try going
to D5 and typing C5/C4. Highlight D4 to D5, copy, paste down to the bottom.

"DanL" wrote:

I have a pivot table that includes these fields:
1. A count of "Traffic types" (which are text)
2. A count of "Sales Dollars" (which is in currency)

I want to add a calculated field that will take #2 above and divide it by #1.

When I create such a field (= 'Sale '/ 'Traffic Type') I get a divide by
zero error, even though fields are populated. I am trying to get to a
"closing %". Can anyone advise me as to where I am making my error?
Thanks!
Dan

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,979
Default Adding a calculated field to a pivot table

The calculated fields always use the Sum of the pivot fields, even if
you're using another summary function, such as Count. For text fields,
the sum will always be zero, so that's why the calculation isn't working
the way you want it to.

In your source table, you can add two columns -- one to count the
traffic types (TraffCount), and one to count the sales dollars
(SaleCount). You could manually enter a 1 in each column, or use a
formula to calculate the count.

For example, if the Sales Dollars are entered in column G:
=IF(G2=0,0,1)
Do the same for Traffic Types, or if there will always be a Traffic Type
entered, just type a 1 in the Traffic Count column.

Then, in the pivot table, create a calculated field with the formula:
=SaleCount/TraffCount
and format it as percentage.

DanL wrote:
I have a pivot table that includes these fields:
1. A count of "Traffic types" (which are text)
2. A count of "Sales Dollars" (which is in currency)

I want to add a calculated field that will take #2 above and divide it by #1.

When I create such a field (= 'Sale '/ 'Traffic Type') I get a divide by
zero error, even though fields are populated. I am trying to get to a
"closing %". Can anyone advise me as to where I am making my error?
Thanks!
Dan



--
Debra Dalgleish
Contextures
http://www.contextures.com/tiptech.html

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9
Default Adding a calculated field to a pivot table

Debra:
That did it and thank you for the great tip!! I have about an hour into this
trying all kinds of formulas and convoluted thinking and your simple solution
did the trick.
Appreciatively,
Dan

"Debra Dalgleish" wrote:

The calculated fields always use the Sum of the pivot fields, even if
you're using another summary function, such as Count. For text fields,
the sum will always be zero, so that's why the calculation isn't working
the way you want it to.

In your source table, you can add two columns -- one to count the
traffic types (TraffCount), and one to count the sales dollars
(SaleCount). You could manually enter a 1 in each column, or use a
formula to calculate the count.

For example, if the Sales Dollars are entered in column G:
=IF(G2=0,0,1)
Do the same for Traffic Types, or if there will always be a Traffic Type
entered, just type a 1 in the Traffic Count column.

Then, in the pivot table, create a calculated field with the formula:
=SaleCount/TraffCount
and format it as percentage.

DanL wrote:
I have a pivot table that includes these fields:
1. A count of "Traffic types" (which are text)
2. A count of "Sales Dollars" (which is in currency)

I want to add a calculated field that will take #2 above and divide it by #1.

When I create such a field (= 'Sale '/ 'Traffic Type') I get a divide by
zero error, even though fields are populated. I am trying to get to a
"closing %". Can anyone advise me as to where I am making my error?
Thanks!
Dan



--
Debra Dalgleish
Contextures
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
Calculated Field in Pivot Table Jeff Reese Excel Discussion (Misc queries) 0 December 10th 07 10:14 PM
Calculated Field and Calculated Item in Pivot Table Fred Smith Excel Discussion (Misc queries) 0 March 4th 07 09:15 PM
pivot table formulas for calculated field or calculated item Vicky Excel Discussion (Misc queries) 3 June 6th 06 05:06 AM
Calculated field in pivot table Dan Excel Discussion (Misc queries) 1 April 19th 05 11:06 PM
Calculated Field in Pivot Table Edgar Thoemmes Excel Worksheet Functions 0 December 23rd 04 12:59 PM


All times are GMT +1. The time now is 05:03 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"