How to Do a Pivot Table in Excel to Count

Cody Schneider9 min read

Tired of manually counting rows or writing complicated COUNTIFS formulas in Excel? A Pivot Table is one of the fastest and most flexible ways to summarize your data, and using it to count items is a foundational skill that can save you hours of work. This guide will walk you through exactly how to do a pivot table in Excel to count, from simple totals to more complex scenarios.

GraphedGraphed

Build AI Agents for Marketing

Build virtual employees that run your go to market. Connect your data sources, deploy autonomous agents, and grow your company.

Watch Graphed demo video

What is a Pivot Table, and Why Use it For Counting?

A pivot table is an interactive tool that allows you to quickly summarize large datasets. You can slice, dice, rearrange, and aggregate your data without changing the source information at all. Instead of writing formulas to count how many times a name, product, or category appears in a list, you can do it in just a few clicks.

Here’s why it’s a better approach than manual formulas:

  • It’s fast. For datasets with thousands of rows, pivot tables perform calculations almost instantly.
  • It’s flexible. Want to see the count by region? Now by sales rep? How about both? You can "pivot" your data by dragging and dropping fields to see different summaries in seconds.
  • It's interactive. You can easily filter, sort, and group items to dig deeper into your counts.
  • It’s less error-prone. With formulas like COUNTIF or COUNTIFS, it’s easy to make a small syntax error or miss a range, which can throw off your entire analysis. Pivot tables handle the calculations for you.

Step 1: Get Your Data Ready for a Pivot Table

Before you build your pivot table, your source data needs to be organized properly. Garbage in, garbage out. A clean dataset ensures your pivot table works without a hitch.

Follow these simple rules for your data:

  • Use a tabular format. Your data should be organized in columns and rows, with each row representing a single record.
  • Every column needs a header. Make sure the first row contains a unique, descriptive name for each column (e.g., "Date," "Region," "Product").
  • No blank rows or columns. Your data should be a single, continuous block. A blank row or column can cause Excel to miss part of your data when creating the pivot table.
  • Consistent data. Ensure entries are consistent. For example, "CA" and "California" would be treated as two separate items. Tidy up misspellings and formatting issues first.

Free PDF · the crash course

AI Agents for Marketing Crash Course

Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.

Pro Tip: Format Your Data as an Excel Table

This is a game-changer. By formatting your data as an official Excel Table, your pivot table will automatically include new rows of data when you refresh it. This means you don't have to manually adjust the data range every time you add information.

Here’s how:

  1. Click anywhere inside your data range.
  2. Go to the Home tab and click Format as Table, or just press the shortcut Ctrl + T.
  3. A small dialog box will appear. Ensure the box for "My table has headers" is checked and click OK.

Step 2: Create a Basic Pivot Table to Count Items

Once your data is clean and formatted as a Table, creating the pivot table is the easy part. We’ll start with a simple goal: count the number of sales transactions per region.

  1. Click on any cell inside your data table.
  2. Go to the Insert tab on the Ribbon and click PivotTable.
  3. The "Create PivotTable" dialog box will pop up. Since you formatted your data as an Excel Table, the Table/Range should already be filled in with your table's name (e.g., "Table1").
  4. Choose where you want to place the pivot table. We recommend selecting New Worksheet to keep things clean. Click OK.

Excel will open a new sheet with the PivotTable Fields pane on the right. This is your control panel.

Here is what the different areas do:

  • Fields List: Shows all the column headers from your data source.
  • Rows: Fields dragged here will appear as row labels. We'll put "Region" here.
  • Columns: Fields dragged here appear as column labels.
  • Values: This is where Excel performs calculations like counting, summing, or averaging. This is the most important area for our goal.
  • Filters: Allows you to apply a high-level filter to your entire pivot table.

Now, let's build the report:

  1. Find the Region field in your Fields List. Drag it down to the Rows area. You’ll see the unique regions from your data appear as rows in your pivot table.
  2. Next, drag the Region field again, but this time drop it into the Values area.

That's it! Because "Region" contains text, Excel will automatically default to counting it. Your pivot table will now show a count of how many times each region appears in your data, giving you the total number of transactions per region.

Step 3: How to Count Using a Numeric Field

What if you drag a field with numbers into the Values area, like Units Sold or Revenue? By default, Excel will try to SUM (add up) the numbers instead of counting them. Not to worry, changing this is simple.

Let's find out how many sales transactions involved a specific product. This requires counting, not summing.

  1. Drag the Product field into the Rows area.
  2. Now drag a numeric field, like Units Sold, into the Values area. You’ll see it defaults to "Sum of Units Sold," which is not what we want.
  3. To change it to a count, click on "Sum of Units Sold" in the Values area. A menu will appear. Select Value Field Settings.
  4. In the Value Field Settings window, choose Count from the list under "Summarize value by."
  5. Click OK. Your pivot table now correctly shows the number of sales transactions for each product.

When you use Count on numeric values, Excel counts the number of cells that contain a number. This tells you how many orders (rows) there were, not the total quantity sold (the sum).

GraphedGraphed

Build AI Agents for Marketing

Build virtual employees that run your go to market. Connect your data sources, deploy autonomous agents, and grow your company.

Watch Graphed demo video

Step 4: Count Unique Items in a Pivot Table (Distinct Count)

A standard count tells you how many rows match a category. But what if you need to answer a more nuanced question, like, "How many different sales reps sold something in each region?" Simply counting the 'Sales Rep' field would give you the total number of sales, not the number of unique reps.

This is where Distinct Count comes in. To use it, you need to add your data to Excel’s Data Model when you first create the pivot table.

Here’s how to do it:

  1. When you first create your pivot table (Insert > PivotTable), look for a small checkbox at the bottom of the dialog box that says “Add this data to the Data Model.” Check it before you click OK.
  2. Now, build your pivot table as usual. Let’s solve our question: "How many unique sales reps sold in each region?"
  3. Drag Region to the Rows area.
  4. Drag Sales Rep to the Values area. It will default to "Count of Sales Rep."
  5. Click on it, go to Value Field Settings.
  6. Scroll to the very bottom of the "Summarize value by" list. You will now see an option for Distinct Count. Select it and click OK.

Your pivot table will now show the count of unique individuals who made sales in each region, a much more powerful insight than a simple row count.

Step 5: Counting with Multiple Criteria

The real power of pivot tables is how easily you can add more layers to your analysis. For instance, what if you want to know the number of sales for each product, broken down by sales rep?

Nothing changes in the Values area. You just use the Rows and Columns areas to create the structure.

Example 1: Using Two Row Fields

  1. Drag Sales Rep to the Rows area.
  2. Drag Product to the Rows area, right underneath Sales Rep.
  3. Drag Product (or any text field) into the Values area to get your counts.

Your pivot table will now have a nested structure, showing sales for each product listed under the salesperson who sold them.

Free PDF · the crash course

AI Agents for Marketing Crash Course

Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.

Example 2: Using Both Rows and Columns

Let’s try a different view: Count sales of each product, broken down by region, in a cross-tabular format.

  1. Drag Product to the Rows area.
  2. Drag Region to the Columns area.
  3. Drag Product to the Values area.

This creates a clear matrix showing exactly how many sales transactions of each product occurred in each region, with grand totals automatically calculated.

Bonus Tips for Perfection

  • Freshen Up Your Data: Pivot tables don’t update automatically when you change your source data. You must refresh them. Right-click anywhere in your pivot table and select Refresh, or go to the PivotTable Analyze tab and click Refresh.
  • Rename Headers: Excel defaults to names like "Count of Region." You can make your reports clearer by clicking into the header cell and typing a better name, such as "Number of Transactions."
  • Use Slicers for Filtering: Make your pivot table interactive for others by adding slicers. With your pivot table selected, go to the PivotTable Analyze tab and click Insert Slicer. Choose a field like 'Sales Reps', and you'll get a clickable button-based filter that's much more user-friendly than the dropdowns.

Final Thoughts

Learning how to do a pivot table in Excel to count opens up a new level of data analysis. It lets you move beyond tedious manual formulas and quickly answer key questions about your data by summarizing it in clear, digestible formats. With just a few drags and drops, you can see counts by category, find unique values, and analyze performance across multiple criteria.

While Excel is fantastic, pulling together data from different sources - like Google Analytics, Shopify, Facebook Ads, and Salesforce - and manually building reports can still be a major time-sink. We created Graphed to solve this by automating the entire process. Instead of downloading CSVs and building pivot tables, you can connect your accounts and ask a question like "show me the count of transactions in Shopify by marketing channel from GA for the last quarter." Graphed generates an interactive, real-time dashboard for you in seconds, letting you get insights without the busywork.

Related Articles