Pinterest Pixel

Sum vs Count in Pivot Table

Sum vs Count in Pivot Table Ever faced the problem – The values show as a Count... read more

Bryan
Posted on

Overview

Sum vs Count in Pivot Table | MyExcelOnline Sum vs Count in Pivot Table | MyExcelOnline

Sum vs Count in Pivot Table

Ever faced the problem – The values show as a Count of rather than a Sum in a Pivot Table?

This is one of the most common complaints encountered when dealing with Pivot Tables.

In this article, you will be provided a detailed guide on:

Let’s go through each of these points one-by-one!

 

Summarize value as SUM, COUNT in Pivot Table

Pivot Table in Excel is one of the most powerful features within Excel that allows you to analyze more than 1 million rows of data with just a few mouse clicks.

Let’s explore the power of analyzing using a Pivot Table with the help of an example.

In the table below, you have sales data containing salesperson name, region, order date and sales amount.

Sum vs Count in Pivot Table

Using this data, you can create a Pivot Table that tells you the number of sales achieved by each salesperson. Follow the steps below to calculate Pivot Table sum.

STEP 1: Select the Data Table.

Sum vs Count in Pivot Table

STEP 2: Go to Insert > Pivot Table

Sum vs Count in Pivot Table

STEP 3: In the Create PivotTable dialog box, Excel will automatically select the table for you and the default location will be New Worksheet. Press OK.

Sum vs Count in Pivot Table

STEP 4: PivotTable panel will be created in a new worksheet.

Sum vs Count in Pivot Table

STEP 5: You can drag and drop the Sales Person field under Row area and Sales field under the Values area.

Sum vs Count in Pivot Table

STEP 6: Below is the Pivot Table that summarizes the total sales amount by each salesperson.

Sum vs Count in Pivot Table

By default, Pivot Table shows the summation of the sales amount. You can easily change the calculation type from Sum to one of the 11 different functions (like count, average, maximum or minimum, etc).

Right-click on the Pivot Table and select Summarize Value By > Count.

Sum vs Count in Pivot Table

The summarization has now changed from Sum to Count Pivot Table.

Sum vs Count in Pivot Table

Why the Pivot Table values show as Count instead of Sum

As you have seen in the previous section when you drag and drop an item in the Value field, it automatically shows the sum of the value.

But if it shows Count instead of Sum. Well, there are three reasons why this is the case:

1. There are blank cells in your values column within your data set; or

2. There are “text” cells in your values column within your data set; or

3. A Values field is Grouped within your Pivot Table.

1. BLANK CELL(S):

So if you have at least one blank cell in a Values column, Excel automatically thinks that the whole column is text-based.  Pretty stupid but that’s the way it thinks.

Top 3 Excel Pivot Table Issues Resolved

2. TEXT CELL(S):

Also if you have a cell that is formatted as Text within your Values column, then it will also cause it to Count rather than Sum.  This usually happens when you download data from your ERP or external system and it throws in numbers that are formatted as text e.g. 382821P

Top 3 Excel Pivot Table Issues Resolved

We get the annoying Sales Count in Pivot table below:

Top 3 Excel Pivot Table Issues Resolved

 

3. GROUPED VALUES:

Let’s say that you put a Values field (e.g. Sales) in the Row/Column Labels and then you Group it.

When you drop in the same Values field in the Values area, you will also get a Count of…

Top 3 Excel Pivot Table Issues Resolved

PivotTable basically has a set of rules which is very simple – If all the cells in the field selected contains number, the calculation type will default to SUM.

Now that you know the reason for the error, let’s learn how to fix it!

How to fix this issue

If you can clean up your data and make sure there are no cells that contain a blank, text, error, or grouped data. This will prevent the default calculation type to turn to Count in Pivot Table instead of Sum.

There are 4 ways to make sure that calculation type is set to Sum:

METHOD 1: Replace Blank with Zero

Sales column in this data table contains blank cells. Let’s use this table to create a pivot table that summarises the total sales amount by each salesperson.

Sum vs Count in Pivot Table

When you drag and drop the Sales column to the Values area, it shows the Sales Count in Pivot Table instead of sum.

Sum vs Count in Pivot Table

To show the summation of the sales instead of Excel Pivot Table count, you can replace the blank cells with zero.

If all the cells in the column field contains numbers, the calculation type will default to SUM.

Follow the steps below to replace blank with zero:

STEP 1: Select the entire column that contains a blank. Press Ctrl + Space Bar to select the entire column.

Sum vs Count in Pivot Table

STEP 2: Press Ctrl + H to open the Find and Replace dialog box.

Sum vs Count in Pivot Table

STEP 3: Delete everything in the Find what box and type 0 in Replace with box.

Sum vs Count in Pivot Table

STEP 4: Press Replace All. This will replace all the blank cells with 0.

Sum vs Count in Pivot Table

Now you can create a Pivot Table as all the values will contain a number!

METHOD 2: Replace Error with Zero

To replace the error message with zero, you can add an IFERROR formula.

IFERROR function is used to display custom text when a formula generates an error, and a standard result when no error is detected.

It has two arguments – value and value_if_error.

  • Value – Value to be used to check error.
  • Value_if_error – Value to be displayed if an error.

So if the source column contains an error, you can use the IFERROR formula to return a zero instead of the error.

METHOD 3: Convert Text to Numbers

If a cell contains numbers but is stored as text, you will have to convert it.

To do that click on the small yellow icon on the left, and select Convert to Number.

Sum vs Count in Pivot Table

METHOD 4: Ungroup values in the Pivot Table

STEP 1: Right Click on the Grouped values in the Pivot Table and choose Ungroup:

Top 3 Excel Pivot Table Issues Resolved

STEP 2: Drag the Count of SALES out of the Values area and let go to remove it

STEP 3: Drop in the SALES field in the Values area once again

It will now show a Sum of SALES!

Top 3 Excel Pivot Table Issues Resolved

N.B. Sometimes you will need to locate the Pivot Table that has the Grouped values.  The SALES field may not be evident that it is Grouped, especially if it is not selected in the Row/Column labels.

You may need to drag and drop this field from the PivotTable Fields and into the Row/Column Labels area to confirm that it is Grouped.

Conclusion

In this article, you have learned how to summarize value in Pivot Table and how to make the Sum as default calculation type instead of Count when all values in the column contains numbers.

To unveil other powerful features of Excel Pivot Table, Click Here.

Further Learning:

Automatically Refresh a Pivot Table

If you like this Excel tip, please share it
Sum vs Count in Pivot Table | MyExcelOnline Sum vs Count in Pivot Table | MyExcelOnline
Sum vs Count in Pivot Table | MyExcelOnline
Bryan

Bryan Hong is an IT Software Developer for more than 10 years and has the following certifications: Microsoft Certified Professional Developer (MCPD): Web Developer, Microsoft Certified Technology Specialist (MCTS): Windows Applications, Microsoft Certified Systems Engineer (MCSE) and Microsoft Certified Systems Administrator (MCSA).

He is also an Amazon #1 bestselling author of 4 Microsoft Excel books and a teacher of Microsoft Excel & Office at the MyExecelOnline Academy Online Course.

See also  Frequency Distribution with Excel Pivot Tables

Get Video Training

Advance your Microsoft Excel & Office Skills with the MyExcelOnline Academy!

Dramatically Reduce Repetition, Stress, and Overtime!
Exponentially Increase Your Chances of a Promotion, Pay Raise or New Job!

Learn in as little as 5 minutes a day or on your schedule.

Learn More!

Share to...