How do I create a pie chart / circle graph from a more complex table with multiple columns? (categories in expense report)

I have a sheet for an expense report with the following setup:


DateExpense AmountCategoryDetails/Notes
January 23

$ 10

client dinnerrestaurant A
January 31$15duesorganization F (annual)
March 2nd$7client lunchrestaurant A
April 5th$100travelcompany C



I'm trying to create a pie chart using the categories, i.e. showing that 50% of the expenses went to client dinners, 15% to client lunches, 5% to dues, 30% to travel. I realize I may have to make a separate sheet in order to make the pie chart, but I still can't figure out what to do. Is there an easy formula to create to add up the category totals without doing it manually? I know there must be an easier way to set this up, but I'm not well-versed in Numbers. I've looked around the community/google for answers, but I'm only finding ways to do it if you have a very basic two column sheet.


Thanks in advance!

Posted on Jan 25, 2017 3:01 PM

Reply
10 replies

Jan 25, 2017 3:20 PM in response to bananaforsale

I suggest adding a second table that summarizes the data by category. This does two things:

1) arranges the data and categories into a single table already "set up" for use in a chart

2) allows you to continue adding entries in the original data table while being able to plot as a pie chart



User uploaded file


Assuming the data you enter is in a table named "Table 1", create a second table (I named it "Data Summary").


Make the first row and the first column Headers.

Copy the categories to column A (remember to add new categories if you add an additional ones)

B2=SUMIF(Table 1::C, A2, Table 1::B)


this is shorthand for... select cell B2, then type (or copy and paste from here) the formula:

=SUMIF(Table 1::C, A2, Table 1::B)


to fill down:

select cell B2, copy

select cells B2 thru the end of column B, or as needed, paste


now select columns A and B and add the pie chart from the charts menu

Jan 25, 2017 11:59 PM in response to bananaforsale

Hi B'


Some Numbers vocabulary:


Spreadsheet: Also called 'Document' or 'Spreadsheet Document': The entire document contained in a Numbers file.

Sheet: a large 'canvas' which can contain one or more Tables, plus other objects such as text boxes, Charts or Images.

Every Document contains at least one Sheet.

Each Sheet has a name, which is displayed on a Tab above the workspace.

The Tab contains nothing except the name of the Sheet to which it is attached (plus a pop-up menu marked v).

The default name of a Sheet is "Sheet n" where "n" is a serial number starting with 1 for the first Sheet.
The names can be changed to give a better indication of what work the Tables on that sheet do.


Table: A set of one or more Cells, arranged in columns and rows.

Each Sheet, when created, contains at least one Table.
Each Table has a Name. The default name of the first table on a Sheet is Table 1. It is recommended that each

Table in a document be given a distinct name, as this makes formulas shorter by removing the need to include

the Sheet name when addressing cells on another Sheet.


Data is placed in Cells in Tables. The Tables are placed on Sheets.

The full address of a cell has three parts, separated by double colons: sheetname::tablename::column and row

Numbers needs only enough of the full address to locate the cell, and will drop the unneeded parts automatically.


Here is an example using the data table you provided, and a second small table to summarize the data and feed it to the pie chart. All three objects, the two tables and the chart, are on the same table. Because the tables have distinct names, the formula used on the summary table will work without change if that table is placed on a separate sheet.


User uploaded file

The formula in B2 of Expense Summary is:

SUMIF(Expense log::C,A2,Expense log::B)


"Expense log" is the name of the data table.


The formula is filled down to B3 an B4.


Category names in column A of Expense Summary must exactly match the category names in column C of Expense log.


The chart was created by selecting cells B2-B4 of Expense summary, then clicking the Charts button and choosing the Pie Chart. I made no changes to the chart except to reduce the size to make it fit in the space under the Expense summary table.


Regards,

Barry

Jan 26, 2017 6:23 AM in response to bananaforsale

bananaforsale wrote:


I will check this out, thanks!


edit: It appears to be the same issue; the categories are already totaled in that template, but they are not in my table. Is there a way to have the individual entries totaled by category instead of doing it by hand?


The categories are not already totaled in the template.


Here's the pie chart, showing the data source in column C of the Summary table.


User uploaded file


Here's how the Summary table gets its values (from the Transactions table on the second sheet (tab):


User uploaded file



And here's the Transactions table on the second sheet:


User uploaded file



Notice how the Summary table used the SUMIF formula to automatically total the two items under the category Food.


In that template you already have a working document and all that needs to be done is change the Category names in the Pop-up Menu in column C of the Transactions table and enter matching category names in the Summary table. No need to reinvent the wheel, unless you like doing that.🙂


SG

Jan 25, 2017 6:52 PM in response to Wayne Contello

Sorry, I should have explained better. There are a dozen entries per category so it isn't as straightforward. Also, I copied and pasted that formula into the Data Summary chart and I got the following error: "This formula can't reference its own cell, or depend on another formula that references this cell."


Thank you for responding!


Date

Expense AmountCategoryDetails/Notes
January 23

$10

client dinner
January 31$15dues
March 2$7client lunch
April 5$100travel
April 15$6travel
June 1$9client dinner
June 2$35client dinner
July 1$105travel
July 3$20travel

Jan 25, 2017 8:16 PM in response to Wayne Contello

I must not be understanding.


Maybe this is the problem: I have a Numbers sheet that is what you refer to as "Table 1". Does this have to be a table within the sheet? Or in the formula you provided (below) should "Table 1" be changed to "Expense Report, which is the name of the tab with the data.


=SUMIF(Table 1::C, A2, Table 1::B)


I use a new sheet/tab for the "Data Summary" information and in the B2 cell on that sheet I inputed the formula you gave me. That's where I am getting the error.


edit: I noticed that you just provided a sample table in your last reply. I'm looking at that now!

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How do I create a pie chart / circle graph from a more complex table with multiple columns? (categories in expense report)

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.