
How to Sum Each Row in Google Sheets
Have you ever needed to calculate the total of each row in a Google Sheets table? You may have tried using the SUM function, but it only returns a single value and doesn’t provide an expanding array result. In this article, we will explore different methods to sum each row in Google Sheets, including using array formulas, the MMULT function, the Query function, and the ‘+’ sign. Let’s dive in!
The Ultimate Solution to Sum Each Row in Google Sheets
One powerful solution is to use an array formula with the MMULT function. This method allows you to sum columns C to H in each row. Simply follow these steps:
- Create an empty column (column I).
- In cell I1, enter the following MMULT formula:
={"Total";arrayformula(if(len(A2:A),mmult(n(C2:H),transpose(sign(column(C:H)))),))}
This flexible formula dynamically adjusts to include any new columns you may insert between C and H. You can customize it by modifying the range of columns you want to sum. Please refer to the “Google Sheets Functions Guide” for more information on the functions used in this formula.
By using this array formula, you can easily calculate the total for each row in your Google Sheets table.
Other Alternatives to Summing Each Row in Google Sheets
While the MMULT array formula is a powerful solution, there are other methods you can employ:
How to Add a Total Column Using Query in Google Sheets
The Query function is another quick way to add a total column to your table. Simply use the following formula:
=Query(A1:H,"Select C+D+E+F+G+H label C+D+E+F+G+H'Total'",1)
However, keep in mind that the Query formula is not as flexible as the previous array formula. If you insert a new column, the range to sum will not adjust automatically. Despite this limitation, Query allows you to obtain multiple-column outputs by specifying additional columns in the Select clause.
Summing Each Row Using the ‘+’ Sign in Google Sheets
Another option is to use the ‘+’ sign in an array formula, similar to the previous examples. This formula expands down the column and sums the values in columns C to H. However, like the Query formula, this method is also affected by the flexibility issue when inserting new columns.
={"Total";ArrayFormula(if(len(A2:A),C2:C+D2:D+E2:E+F2:F+G2:G+H2:H,))}
Sum Function with Byrow – Recommended
If you prefer a more straightforward approach, you can use the SUM function with the BYROW parameter. This parameter allows the SUM function to spill its result down the column. Here’s how:
={"total";byrow(C2:H,lambda(r,if(counta(r)=0,,sum(r))))}
With this formula, you can easily calculate the sum for each row in your Google Sheets table. The COUNTA function ensures that rows without any values are omitted from the calculation.
In conclusion, depending on your specific needs and requirements, you have various options to sum each row in Google Sheets. Whether you choose the array formula, the Query function, or the ‘+’ sign, you can now perform efficient calculations with ease.
For more information and additional resources on Google Sheets functions and formulas, please visit Mr Reviews.