Home » How to Calculate the Sum by Group in Excel

How to Calculate the Sum by Group in Excel

by Tutor Aspire

You can use the following simple formula to calculate the sum of values by group in an Excel spreadsheet:

=SUMIF(group_range, "group name", sum_range)

The following example shows how to use this formula in practice.

Example: Sum by Group in Excel

Suppose we have the following dataset that shows the total points scored by 15 different basketball players:

Now suppose we’d like to find the sum of the points scored, grouped by team.

To do so, we can use the =UNIQUE() function to first create a list of the unique teams. We’ll type the following formula into cell F2:

=UNIQUE(B2:B16)

Once we press enter, a list of unique team names will be displayed:

Next, we can use the =SUMIF() function to find the sum of points scored by players on each team.

We’ll type in the following formula into cell G2:

=SUMIF(B2:B16, F2, C2:C16)

sum by group in Excel

We’ll then copy and paste this formula into the remaining cells in column G:

That’s it!

Column F displays each of the unique teams and column G displays the sum of the points scored by each team.

Additional Resources

How to Calculate a Five Number Summary in Excel
How to Calculate the Mean and Standard Deviation in Excel
How to Calculate the Interquartile Range (IQR) in Excel

You may also like