18

I have a spreadsheet that is filled by a form. It contains values like the following:

Timestamp           Person  Category
2012-02-13 10.31.22 a       x
2012-02-13 11.06.37 b       y
2012-02-13 11.34.32 c       x
2012-02-14 09.22.35 d       z
2012-02-14 09.24.01 e       w
2012-02-14 11.06.20 f       x
2012-02-14 22.39.33 g       y

I would like to make a bar chart that shows a bar for each category, with the value the number of rows per category.

Should I calculate new columns in a new table before creating the chart, or could it be done in one step, and how?

3 Answers 3

18

This is an excellent time to use a pivot table.

Select columns B and C, then click on DataPivot table...

In the Pivot table editor sidebar on the right side:

  • In the Columns section, add the Category field. Uncheck Show totals if you do not want the Grand Total column.
  • In the Values section, add the Category field and summarize by COUNTA.

Now select the pivot table data on the sheet and click on InsertChart. Select Column chart for the Chart type.

New form submissions will update the pivot table and the updated pivot table will update the chart. This is what the pivot table and chart look like using the example data you provided in your question:

Pivot table and chart

3

This is possible using the following steps:

  1. Select column C
  2. Open the Chart Editor from the menu Insert > Chart
  3. The chart should be correctly setup, if not, the settings are:
    • Stacking: None
    • Data range: C1:C1000
      customize to your needs
    • X-axis: Category
    • Aggregate: checked
    • Use row 1 as headers: checked

You can reverse the order of the X-axis using Customise > Horizontal Axis > Reverse axis order

2024 Google Sheets example

1
  • 1
    @Piran great update! I removed your note about the x-axis being sorted, as it isn't clear to me that it's in fact the case. The categories appear to be ordered as they appear in the data (once you account for aggregation). i.e. 'unsorted'. The adt'l option you mention reverses the order while presumably not sorting. If sorted, I would expect wxyz or zyxw not the order displayed xyzw I'll remove this comment once you read and acknowledged. If I've misunderstood, edit the answer with adt'l details.
    – Blindspots
    Commented May 30 at 14:40
1

I would put the count column in a new sheet that way if you start sorting the rows of data you won't mess up the columns with the data for the chart.

I am assuming that you are using countif to make the data for the bar chart.

Not the answer you're looking for? Browse other questions tagged or ask your own question.