Create pie chart of occurences of an item in that column

Hey guys, desperately trying to find an answer to this!

So... I download raw data from my telephone system which presents data in columns about an incoming call, like so:


What I want to do (which I can do very easily using Google sheets) is select column K, and create a pie chart to show what percentage of the calls were Reschedules, what percentage were cancellations, what percentage were sales calls etc.

Please bear in mind that I have seen the help articles which state that the data has to be presented like "Reschedules = 30... Cancellation = 12..." etc, but my data does not download in that fashion (as you can see above), and it defeats the point if I am supposed to somehow create a separate table of data from which to make the pie chart from. How would I go through 300+ entries of phone logs, add the occurences of the tags up, just to create a separate table to make a pie chart from? It would take me hours!! I simply need to be able to select the column and it will add up the occurences of each tag for me. How can I do this? It's got to be possible if it's so easy on Google Sheets! I much prefer using numbers but this has been bugging me for over a year now! I will be sooooooooo happy and grateful if someone could tell me what I'm doing wrong! Thank you :)

MacBook, macOS 10.13

Posted on Dec 20, 2019 10:34 AM

Reply
Question marked as Top-ranking reply

Posted on Dec 20, 2019 1:37 PM

Numbers builds charts using the data you supply.


To create a chart showing the summarized data, you will need a table containing that summarized data.


For your case, the summary table needs two columns.


A: A Header column containing the list of possible tags (or of the tags you want included on the pie chart, plus "other" to include the portion of calls that don't fit into the categories you are tracking.


B: A column containing a formula that counts the occurrences of each tag listed in column A, entered i the row containing the first tag in the list, then filled down to the row containing the last listed tag.


One extra row, containing "Other" in column A and a second formula that calculates the number of calls whose category does not match any of the tags.


COUNTIF and COUNTA are your friends here.

The formula shown is entered in B2 of Summary, then filled down to B5, the last row containing a tag that is to be charted.


B6 contains the formula below:


COUNTA(Log::K)−SUM(B$2:B5)


COUNTA counts all cells in column K of the table "Log" that contain any value.

SUM(B$2:B5 calculates the sum of the tag counts in rows 2 to 5 of column B of Summary.

If new rows are inserted above row 5 to accommodate more tags to be included in the list in column A, B5 will adjust to include the counts of these tags.


The chart was created by:

  • Selecting cells B2 - B6 of Summary.
  • Selecting the pie chart icon from the Charts button menu.


I made one edit to the chart, selecting the text box containing the chart's legend, decreasing the width of the box to change the horizontal list to a vertical one, then dragging the (conveniently shaped) list into the position shown.


Regards,

Barry


PS: If row 6 (the bottom row) of Summary is converted to a Footer row, the formula in B6 can be revised to:


COUNTA(Log::K)−SUM(B)


And will automatically accommodate aded rows for new tags.



8 replies
Question marked as Top-ranking reply

Dec 20, 2019 1:37 PM in response to isobellaaa

Numbers builds charts using the data you supply.


To create a chart showing the summarized data, you will need a table containing that summarized data.


For your case, the summary table needs two columns.


A: A Header column containing the list of possible tags (or of the tags you want included on the pie chart, plus "other" to include the portion of calls that don't fit into the categories you are tracking.


B: A column containing a formula that counts the occurrences of each tag listed in column A, entered i the row containing the first tag in the list, then filled down to the row containing the last listed tag.


One extra row, containing "Other" in column A and a second formula that calculates the number of calls whose category does not match any of the tags.


COUNTIF and COUNTA are your friends here.

The formula shown is entered in B2 of Summary, then filled down to B5, the last row containing a tag that is to be charted.


B6 contains the formula below:


COUNTA(Log::K)−SUM(B$2:B5)


COUNTA counts all cells in column K of the table "Log" that contain any value.

SUM(B$2:B5 calculates the sum of the tag counts in rows 2 to 5 of column B of Summary.

If new rows are inserted above row 5 to accommodate more tags to be included in the list in column A, B5 will adjust to include the counts of these tags.


The chart was created by:

  • Selecting cells B2 - B6 of Summary.
  • Selecting the pie chart icon from the Charts button menu.


I made one edit to the chart, selecting the text box containing the chart's legend, decreasing the width of the box to change the horizontal list to a vertical one, then dragging the (conveniently shaped) list into the position shown.


Regards,

Barry


PS: If row 6 (the bottom row) of Summary is converted to a Footer row, the formula in B6 can be revised to:


COUNTA(Log::K)−SUM(B)


And will automatically accommodate aded rows for new tags.



Dec 20, 2019 11:52 PM in response to isobellaaa

isobellaaa wrote:

I simply need to be able to select the column and it will add up the occurences of each tag for me. How can I do this? It's got to be possible if it's so easy on Google Sheets!


That is easy to do without formulas in most modern spreadsheet applications, including Numbers! In Numbers just use the 'Smart Category' feature, like this:


Click the 'gear' icon:



Choose 'Count':



Giving you something like this:

Then, if you want you can go further and chart the counts you can choose "Collapse Peer Groups", select the visible cells after the collapse, and insert a chart:





You'll have to make a few adjustments to clean up the chart labels and legend, etc.


If you have a nice looking "report" that you need to produce at regular intervals to give to someone then you may find the COUNTIF or COUNTIFS approach better. But if you want quick and easy analysis of the data then you will probably find Smart Categories can save you a lot of time.


SG




Jan 16, 2020 9:16 AM in response to Barry

Hi Barry,


Thanks so much for your effort but it's still not displaying correctly - I've made the table using the countif formula (thank you so much for that), I've omitted the column for tags who don't match (as there won't be any - I only have a select few to choose from), but when I try to create the graph in the manner you described, the data references are all over the place and don't display correctly? I've recorded a video of what happens but I can't seem to attach it - I'll attach screenshots:



I select B2 onwards like you suggest....


... and it firstly doesn't select all the references, and doesn't display correctly for the ones it has selected?!


Thank you for your help, I'm nearly there!!!

B



Jan 17, 2020 10:20 PM in response to isobellaaa

".(The chart) doesn't display correctly for the (categories) it has selected?!"


The categories shown as 'selected' in your screen shot (those with colour fill in the cells in the "Count" column) are correctly displayed on the pie chart.


Of the nine selected categories, seven have a count of 0 occurrences. The other two each have a count of 1 occurrence.

Each of those two values represent one half, or 50% of the total count of two occurrences of any of the selected categories. Each of the non-zero categories is represented on the chart by a shade of green.


" and it firstly doesn't select all the references"


I can't explain why not all of the 13 listed categories in your example are selected. Testing with a mockup of the table shown in your example,I hd no difficulty selecting all 13, and producing th pie chart shown below:



Regards,

Barry

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.

Create pie chart of occurences of an item in that column

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