在电子表格中查找每一行的总和 [英] Find the sum of each row in a spreadsheet

查看:81
本文介绍了在电子表格中查找每一行的总和的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Sheets的新手,我还不知道任何术语,所以我不确定该如何查找. 如果我有:

I'm new to Sheets and I don't know any terminology yet so I wasn't sure how to look this up. If I have:

A1[=SUM(B1:1)]

如何将其自动复制到A2,以便:

How do I automatically copy that to A2 so that:

A2[=SUM(B2:2)]

同样的事情会无限期地持续下去,或者直到我声明一个停止点为止.

And the same thing continues either indefinitely or until I declare a stopping point?

推荐答案

首先,如果您只是简单地将公式从A1复制粘贴到A2(或下面的几个单元格),它将根据需要自动更改.这就是相对引用的工作方式.

First of all, if you simply copy-paste the formula from A1 to A2 (or several cells below), it will automatically change as you want. This is how relative references work.

但是也可以使用一个公式来获得所有和. 在A1中输入的以下公式将创建A列中前7行的总和.要更改求和的行数,请用另一个数字替换B1:7中的7.

But it's also possible to get all the sums with one formula. The following formula, entered in A1, will create sums of the first seven row in column A. To change the number of rows summed, replace 7 in B1:7 with another number.

=arrayformula(mmult(B1:7 + 0, transpose(B1:1 * 0 + 1)))

说明:

  • B1:7 + 0将条目强制为数字(以使空白单元格变为0).
  • transpose(B1:1 * 0 + 1)创建一个大小合适的1s列向量.
  • 矩阵乘以mmult的1s列等于对每一行求和.
  • 包装器arrayformula表示要对数组执行操作.
  • B1:7 + 0 coerces the entries to numbers (so that blank cells become 0).
  • transpose(B1:1 * 0 + 1) creates a column vector of 1s of suitable size.
  • matrix multiplication mmult by a column of 1s amounts to summing each row.
  • the wrapper arrayformula indicates that the operations are to be done on arrays.

这篇关于在电子表格中查找每一行的总和的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆