To count values in a Google Sheets pivot table, drag the field you want to count into the Values section and choose COUNTA (or COUNT for numbers only) from the Summarize by dropdown. This gives you a total count of non-empty cells for each row or column group in seconds, without writing a single formula.
Why Pivot Tables Are the Best Way to Count
Counting is one of the most common data tasks in Google Sheets, and pivot tables handle it far better than manual formulas like =COUNTIF(). A pivot table groups your data by categories (e.g., product, region, date) and then applies a summary function—like count, sum, or average—to each group. The key advantage is that you can change the grouping or the summary function instantly by dragging fields, whereas a formula requires rewriting or copying each time. For example, if you have a list of 5,000 sales orders with a “Region” column, a pivot table lets you see the number of orders per region in about 15 seconds.
Step-by-Step: Creating a Count Pivot Table
Here is the exact process in Google Sheets (works in Chrome, Firefox, or Edge):
- Select any cell inside your data range (e.g., A1:C500).
- Go to Insert > Pivot table.
- In the dialog, choose whether to create it in a new sheet or an existing one, then click Create.
- In the pivot table editor (right side), under Rows, click Add and pick the field you want to group by (e.g., “Region”).
- Under Values, click Add and pick the same field or any other field you want to count (e.g., “Order ID”).
- By default, Google Sheets will show COUNTA of that field. If it shows SUM or something else, click the value’s dropdown arrow, choose Summarize by, and select COUNTA or COUNT.
That’s it. The pivot table now displays a count for each row label. For instance, if your data has 120 orders in “East” and 85 in “West”, the pivot table will show 120 and 85 next to those labels.
COUNTA vs COUNT: Which One Should You Pick?
Google Sheets offers two counting functions in pivot tables, and the difference matters:
- COUNTA counts every non-empty cell, including text, numbers, dates, and even errors. Use this when your field contains labels, names, or IDs.
- COUNT counts only cells that contain numbers. Use this when your field is strictly numeric and you want to ignore text entries.
For example, if you count a “Customer Name” column, COUNTA is correct because names are text. If you count a “Units Sold” column that has some blank cells and some text like “N/A”, COUNT will only count the numeric cells, giving you a lower number. In most real-world counting scenarios, COUNTA is the safer choice because it matches what people expect: “how many rows exist for this group?”
Counting Unique Values (Distinct Count)
A common request is to count how many unique items appear in a group—for example, how many distinct customers ordered from each region. Google Sheets pivot tables do not have a built-in “distinct count” option like Excel’s pivot tables do. Instead, you have two workarounds:
- Add a helper column: Insert a new column next to your data with the formula
=IF(COUNTIF($A$2:$A2,$A2)=1,1,0)(assuming the field to count is in A, with headers in row 1). Then add that helper column to the pivot table’s Values and summarize by SUM. This counts only the first occurrence of each value. - Use a formula outside the pivot: Use
=UNIQUE()and=COUNTA()together. For example,=COUNTA(UNIQUE(A2:A500))gives the total unique count across the whole range, but it won’t break down by group automatically.
For a per-group unique count, the helper column method is the most reliable and doesn’t require scripting.
Common Problems and Fixes
Here are the issues people run into most often when counting in pivot tables:
- Blank cells are not counted: COUNTA ignores blanks by design. If you need to count blanks, add a helper column with a formula like
=IF(A2="",1,0)and sum that. - Wrong count because of hidden rows: Pivot tables ignore manually hidden rows only if you’ve filtered them out of the source range. If you hide rows with right-click > Hide row, the pivot table still includes them. Use a filter view or a query instead.
- Count shows as 1 for every row: This happens when you accidentally put a field in the Values area that has unique values per row (like an ID) and you chose COUNT, but the field is text—so COUNT returns 0 or 1. Switch to COUNTA.
- Pivot table not updating: Google Sheets auto-refreshes pivot tables when you edit the source data, but if you add new rows at the bottom, the range may not expand. Go to the pivot table editor, click the data range field, and extend it manually, or convert your data to a table (Insert > Table) so the range is dynamic.
Comparing with Excel Pivot Tables
Excel’s pivot tables have a built-in “Distinct Count” option (available when you add a field to Values and choose “More options” > “Distinct Count”), which Google Sheets lacks. Also, Excel lets you set the default summarization to COUNT instead of SUM more easily. However, Google Sheets’ pivot editor is more intuitive for beginners—you can drag fields directly from a list, and the layout is simpler. If you are migrating from Excel, remember that Google Sheets uses “Rows” and “Columns” instead of “Row Labels” and “Column Labels”, and the Summarize by dropdown is inside the value field’s settings.
Alternatives to Pivot Tables for Counting
If you only need a single total or a simple count by one category, you can skip pivot tables entirely:
- COUNTIF:
=COUNTIF(B2:B500,"East")counts how many times “East” appears in column B. Works for one criteria at a time. - COUNTIFS: For multiple conditions, e.g.,
=COUNTIFS(B2:B500,"East",C2:C500,">100"). - QUERY:
=QUERY(A1:C500,"select B, count(A) group by B")returns a mini report similar to a pivot table but with more control over formatting. - UNIQUE + COUNTA: As mentioned, for distinct counts.
Pivot tables are still better when you want to interactively explore the data—dragging fields to change groupings, adding multiple value fields, or drilling into details by double-clicking a count.
Frequently Asked Questions
Why does my pivot table show “1” for every row?
This usually means you added a text field to Values and left the summarization as COUNT instead of COUNTA. COUNT only counts numeric cells, and since text cells are not numeric, it returns 0 or 1. Change the Summarize by to COUNTA, or use a numeric field like an order ID.
Can I count rows that meet a condition in a pivot table?
Yes, but not directly. Add a helper column to your source data with a formula like =IF(C2>100,1,0) and then add that helper column to the pivot table’s Values and summarize by SUM. The sum equals the count of rows meeting the condition.
How do I count unique values per group in Google Sheets?
Use a helper column with =IF(COUNTIF($A$2:$A2,$A2)=1,1,0) where A is the field with the values you want to count as unique. Then add that helper column to the pivot table’s Values and summarize by SUM. This gives a per-group distinct count.
Does the pivot table count include hidden rows?
No. If you use the built-in filter (right-click > Filter by values) on the source data, the pivot table only counts visible rows. However, manually hiding rows (right-click > Hide row) does not affect the pivot—it still counts them. Use a filter view or a QUERY formula to exclude manually hidden rows.
What is the difference between COUNT and COUNTA in a pivot table?
COUNT counts only numeric cells, ignoring text, blanks, and errors. COUNTA counts all non-empty cells, including text and numbers. For counting rows or records, COUNTA is almost always the right choice because it matches the number of data entries.
Can I change the count to a percentage of the total?
Yes. In the pivot table editor, under Values, click the dropdown for your count field, then select “Show as” and choose “% of grand total” or “% of column total”. This displays each group’s count as a percentage of the overall count, which is useful for share-of-total analysis.
Related
- Software for Data Entry: Top Tools Compared
- Generate Random Numbers on Casio Calculator
- Cut Shortcut PC: What It Does & How to Use It
Try it: the Percentage Formula Generator: percent of, percent change, increase and decrease, with the formula.
More in Charts & pivot tables
- Power Pivot Not Showing in Ribbon? Fix It in ExcelIf Power Pivot is missing from the Excel ribbon on Windows, first confirm your Excel edition includes the…
- Balloon Chart in Excel: A Step-by-Step TutorialTo make a balloon chart in Excel for Microsoft 365 on Windows, arrange your data in columns for…
- Excel Dashboard Software Templates: How to Choose and UseExcel dashboard software templates are ready-made workbooks that turn spreadsheet data into a visual summary, usually with charts,…
- Excel Spreadsheet Histogram: How to Create, Read, and Fix ItTo make a histogram in Excel for Microsoft 365 on Windows, select a column of numeric observations, then…
- Excel SmartArt Org Charts: Create, Edit, and Fix ThemTo make an org chart in Excel for Microsoft 365 on Windows, choose Insert > SmartArt > Hierarchy…
- Excel Pivot Table Data Range: How to Extend It SafelyTo extend an Excel PivotTable’s source range, select the PivotTable, choose PivotTable Analyze > Change Data Source, enter…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.