Calculated Field on Pivot Tables

zKy

Board Regular
Joined
Oct 22, 2008
Messages
90
I am having trouble implementing a calculated field equal to
Code:
=Left(otherField,3)

It ends up showing as zero even though both the calculated and original fields are formatted as text. I also can't seem to get this calculated field into the column area. It seems to only want to be in the data area.

Any ideas on how to fix this problem and get the field to go into the column area without adding another column into my data set?
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
To the best of my knowledge that is not possible. You can combine data items in the sense of aggregating sums or counts, and customize the calculations of their values -- I.e., you can get calculation for apples and oranges, but you can't get "orangpples".

What would you do with an item that doesn't exist in your dataset anyway? What would you count, sum, multiply or divide?

Alex.
 
Upvote 0
Thanks, Alexander. I was hoping to be able to group my values based on the first three characters of a field. I guess I'll just have to create another field for this in the data.
 
Upvote 0
Usually that's all anyone can come up with here and its the recommended course of action ... Pivot tables are in some ways powerful and in some ways limited (they aren't as flexible as you'd hope but they still do a lot that's very useful).

Alex
 
Upvote 0
Hi,

Try adding the new field in SQL as a step in between the source data and the pivot table.

Best to set this up from a new file to avoid memory leak problems. So, close the data file and from a new file create a pivot table using 'external data' functionality. It can be from either the 'external data' option at the first step of the pivot table wizard or, the way I prefer when doing this manually, from menu data, import external data, new database query. If the source data doesn't have named ranges (not dynamic) and you haven't already selected the 'system tables' option, you'll get a message about no visible tables. OK to this and take the 'options' button and then 'system tables' - now worksheet names show. Continue and go into MS Query when you get the chance, now edit the SQL. It is just text. So, it will be something like,
Code:
SELECT field1, field2, field3
FROM etc
where you will have your field names not field1, etc. And you need to edit it to be, untested,
Code:
SELECT field1, field2, field3, left(field2,3) AS [NewFieldName]
FROM etc

Continue and finish the pivot table and it now has the desired new field without changing the source data.

The resultant worksheet containing the pivot table can be moved back into the source file and all should be OK.

HTH, Fazza
 
Upvote 0

Forum statistics

Threads
1,214,821
Messages
6,121,762
Members
449,048
Latest member
excelknuckles

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