← Level 4 – Sorter

8 / 12 ⏱ 21 minutes Premium

Count answers with COUNTIF

How many people said sandwich? The spreadsheet counts it by itself.

Counting tally marks

On the Survey sheet, you have vote counts that you counted by hand. But now the Answers sheet has each answer separately. The spreadsheet can count them by itself.

That’s what the COUNTIF function is for. It counts the cells that meet a condition.

=COUNTIF(where to look, what to look for)

Count the sandwiches

  1. On the Survey sheet, click on B2 (the votes for sandwich).

  2. Change it to =COUNTIF(Answers!C2:C21,A2).

  3. You’ll see 8. The spreadsheet counted how many times the word from A2 (sandwich) appears in column C on the Answers sheet.

  4. Drag B2 down to B6. All the counts are now formulas.

That’s why we cleaned up! If there were a sandwhich typo in there, COUNTIF wouldn’t count it. A clean column C matters.

💡

Now everything is connected: you change an answer on the Answers sheet → the count on Survey changes → the chart changes → the Dashboard changes.

The check

B8 on Survey (Total votes) must be 20, the same as the number of answers. If it’s less, some answer didn’t match the list (a typo, for example).

A pivot table

Google Sheets and Excel can also make a summary without formulas. That’s called a pivot table.

  1. On the Answers sheet, select A1:C21.

  2. Insert → Pivot table → New sheet → Create.

  3. In the editor on the right, next to Rows, click Add and choose Clean answer.

  4. Next to Values, click Add, choose Number, and set it to COUNTA.

  5. You have a summary: each answer and how many times it appeared.

Your turn 💪

  1. The counts on Survey are COUNTIF formulas.
  2. The total is 20.
  3. You tried a pivot table.
✅

Done when: the spreadsheet counts the answers by itself.

What to take away from this lesson