How to sum values in Google Sheets by category?


Often you may want to sum the values of some dataset in Google Sheets based on a category or group.

For example, suppose we have the following dataset and we’d like to sum the total “points” by team:

The following step-by-step example shows how to do so.

Step 1: Enter the Data

First, enter the data values into Google Sheets:

Step 2: Find the Unique Categories

Next, we need to use the =UNIQUE(Range) function to produce a list of unique values in a certain range.

In our example, this will produce a list of unique teams:

Step 3: Find the Sum by Category

Next, we will use the SUMIF(range, criterion, sum_range) function to find the sum of the points scored by each team:

Sum by category in Google Sheets

This tells us:

  • The total points scored by players on the Lakers is 21.6.
  • The total points scored by players on the Mavericks is 56.4.
  • The total points scored by players on the Spurs is 48.8.
  • The total points scored by players on the Warriors is 65.

x