Adding a calculated field to a pivot table

D

DanL

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
 
S

Sean Timmons

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.
 
D

DanL

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?
 
D

Debra Dalgleish

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.
 
D

DanL

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top