11.1 C
London
Sunday, July 7, 2024
HomeSoftware TutorialsGoogle SheetsGoogle Sheets Query: How to Sum Multiple Columns

Google Sheets Query: How to Sum Multiple Columns

Related stories

Learn About Opening an Automobile Repair Shop in India

Starting a car repair shop is quite a good...

Unlocking the Power: Embracing the Benefits of Tax-Free Investing

  Unlocking the Power: Embracing the Benefits of Tax-Free Investing For...

Income Splitting in Canada for 2023

  Income Splitting in Canada for 2023 The federal government’s expanded...

Can I Deduct Home Office Expenses on my Tax Return 2023?

Can I Deduct Home Office Expenses on my Tax...

Canadian Tax – Personal Tax Deadline 2022

  Canadian Tax – Personal Tax Deadline 2022 Resources and Tools...

You can use the following syntax to calculate the sum of multiple columns within a Google Sheets query:

=QUERY(A1:D8,"select A,B+C+D",1)

This particular example will return the values in column A along with a column that shows the sum of values in columns B, C, and D.

We also specify a 1 to indicate that there is 1 header row at the top of the dataset.

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

Example: Sum Multiple Columns in Google Sheets Query

Suppose we have the following dataset in Google Sheets that shows the total points scored by various basketball teams during different games:

We can use the following query to return each team name along with the sum of points scored in all three of their games:

=QUERY(A1:D8,"select A,B+C+D",1)

The following screenshot shows how to use this query in practice:

Google Sheets query sum multiple columns

From the results we can see:

  • The Mavs scored a total of 302 points across all three games.
  • The Warriors scored a total of 293 points across all three games.
  • The Lakers scored a total of 293 points across all three games.

And so on.

Note that we could also use the label clause to give a specific label to the results of the summed columns:

=QUERY(A1:D8,"select A,B+C+D label B+C+D 'Total Points'",1)

The following screenshot shows how to use this query in practice:

The three columns that we summed together now have a “Total Points” label.

Additional Resources

The following tutorials explain how to perform other common tasks in Google Sheets

Google Sheets Query: How to Query From Another Sheet
Google Sheets Query: Select Rows that Contain String
Google Sheets Query: How to Use Group By

Subscribe

- Never miss a story with notifications

- Gain full access to our premium content

- Browse free from up to 5 devices at once

Latest stories