Combining Column Values in an Excel Pivot Table

跟風遠走 提交于 2020-01-24 18:03:06

问题


In order to simplify a stacked bar chart, I am looking to sum up the counts of multiple columns I have in my pivot table. For example, in this sample table, I would like to combine Fruits and Vegetables into one column, so that each bar will comprised of three colors: one for Meats, one for Grains, and one for Fruits+Vegetables.

Pivot Table and Stacked Chart

For reference, this is the data source:

Data Source table

I tried adding a Calculated Field, but I'm not sure if I can use specific values from a column in the Formulas field. Is there a way to create something like this from a pivot table, or should I be taking a different approach to this all together?


回答1:


I'm using Excel 2016, -- pretty sure it's the same with older versions, but the premise is the same.

In your pivot table, Select the Pivot Table Tools> Analyze tab, then "Fields, Items",then pull down to"Calculated fields". Enter a name for the generated field, and the formula you want to use:

In my example, I added the fields Fruit and Vegi's from my available pivot table fields (which is based on my data table).

Then select the calculated field as you would any other..

and create the chart as usual.

Hope this helps.



来源:https://stackoverflow.com/questions/50336509/combining-column-values-in-an-excel-pivot-table

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!