This post explains how to get a total column in Google Sheets using an array formula. You can sum each row in Google Sheets using functions like SUM
, MMULT
, QUERY
, DSUM
, or even the +
operator.
There’s also a modern way to do this using LAMBDA functions. So, creating a dynamic total column per row has become easier than ever.
To sum values, many users reach for the SUM
function. However, while SUM
accepts arrays, it does not return a dynamic array result (i.e., it won’t spill results down a column). To sum each row in Google Sheets dynamically, we need to explore other methods.
I’ll use function combinations in this tutorial. If you’re unfamiliar with any function used, please refer to my Google Sheets Functions Guide.
How to Get a Total Column in Google Sheets Manually
To sum each row manually, enter this formula in cell I2
and drag it down:
=SUM(C2:H2)

This method works but is not dynamic. If your dataset grows, you’ll need to copy the formula again. It’s not ideal for dashboards or automated workflows.
Sum Each Row Using BYROW
To get a total column in Google Sheets that spills automatically, use BYROW
:
=VSTACK("Total", BYROW(C2:H, LAMBDA(r, IF(COUNTA(r)=0,, SUM(r)))))
Enter this formula in I1
.
Explanation:
LAMBDA(r, IF(COUNTA(r)=0,, SUM(r)))
: Custom LAMBDA function that sums each row unless it’s empty.BYROW
: Applies the LAMBDA to every row inC2:H
.VSTACK
: Adds a header row to the result.
This is a clean and dynamic solution to sum each row in Google Sheets.
Sum Each Row Using MMULT
To get a total column using matrix multiplication, try this formula in I1
:
=ARRAYFORMULA(LET(
header, "Total",
result, MMULT(N(C2:H), TRANSPOSE(SIGN(COLUMN(C2:H)))),
VSTACK(header, IF(result=0,, result))
))
Explanation:
N(C2:H)
: Converts values to numbers (treats blanks as 0).TRANSPOSE(SIGN(COLUMN(C2:H)))
: Creates a column of 1s to multiply with.MMULT
: Performs matrix multiplication to sum across each row.LET
: Improves readability by naming parts.IF(result=0,, result)
: Replaces zeros with blanks to suppress them in the output.
This formula is flexible and adjusts when you add rows and insert columns.
Sum Each Row Using DSUM
DSUM is less common but powerful. Enter this formula in I1
:
=ARRAYFORMULA(LET(
result, DSUM(TRANSPOSE(HSTACK(CHOOSECOLS(C2:H, 1), C2:H)), SEQUENCE(COLUMNS(C2:H)), {IF(,,); IF(,,)}),
VSTACK("Total", IF(result=0,, result))
))
Explanation:
DSUM
typically returns column totals, but by transposing the data, we turn them into row totals.HSTACK
andCHOOSECOLS
: Prepares the input format.VSTACK
: Adds the “Total” header.
Limitations of Non-Dynamic Alternatives
The three solutions above adjust to inserted rows or columns. But some simpler methods don’t. For example:
Sum Each Row Using QUERY
=ARRAYFORMULA(LET(
result, QUERY(N(C2:H), "SELECT Col1+Col2+Col3+Col4+Col5+Col6 LABEL Col1+Col2+Col3+Col4+Col5+Col6 'Total'", 0),
IF(result=0,, result)
))
QUERY
is readable but not dynamic. If you insert a column between C and H, the formula returns incorrect results.- Use
N(C2:H)
to convert blanks to 0.
Note: While we can make QUERY dynamic, it complicates the formula significantly.
Sum Each Row Using the ‘+’ Sign
=ARRAYFORMULA(LET(
result, C2:C + D2:D + E2:E + F2:F + G2:G + H2:H,
VSTACK("total", IF(result=0,"", result))
))
This is easy to read but must be manually updated if columns are added or removed. Like QUERY, it’s not ideal for dynamic reports.
Summary: Best Ways to Sum Each Row in Google Sheets
To sum each row in Google Sheets dynamically and efficiently:
- Use
BYROW
withLAMBDA
for clean and readable code. - Use
MMULT
for a matrix-based, flexible approach. - Use
DSUM
with transposition for advanced control (you can include criteria in this method if needed).
These formulas help you get a total column in Google Sheets that updates automatically with your data—perfect for dashboards and reporting.
Additional Resources
- How to Use the SUMIF Function Horizontally in Google Sheets
- Sum Multiple Columns Dynamically Across Rows in Google Sheets
- Using MIN in Arrays in Google Sheets: A Complete Guide
- How to Find Max Value in Each Row in Google Sheets
- Average Array Formula Across Rows in Google Sheets
- PRODUCT Array Formula for Row-Wise Products in Google Sheets
- Expand Count Results in Google Sheets