简体   繁体   English

Excel公式将一行累加到特定列号

[英]Excel formula to Sum a row up to specific column number

I want to sum a row like 我想总结一下

A          B         C         D         E   
2          4         3         5         5

I want the formula to sum from A1 to some column number like It can be up to column 4 (D1) or up to column 5 (E1). 我希望公式从A1到某个列号求和,例如它可以最多到第4列(D1)或最多第5列(E1)。 I can retrieve column number but how to add up to that column number is what I am asking for. 我可以检索列号,但是我要的是如何添加到该列号。 Start of sum is fixed A1 but end is dynamic (not fixed) 总和的开始是固定的A1,但结束是动态的(不固定)

Any solution will be highly appreciated 任何解决方案将不胜感激

It's probably easiest to sum up the entire row =SUM(2:2) (to sum the values in row 2) or if you have some other data at the beginning (or you want the sum to show up at the beginning) you can do something like =SUM(B2:XFD2) 将整行=SUM(2:2)加起来(对第2行中的值求和=SUM(2:2)可能是最简单的,或者如果您在开始时有其他数据(或者您希望总和显示在开始处),则可以做类似=SUM(B2:XFD2)

I got that last column name here: https://www.quora.com/What-is-the-last-column-name-in-an-Excel-file and checked it was the same as newer versions here: https://support.office.com/en-us/article/excel-specifications-and-limits-1672b34d-7043-467e-8e27-269d656771c3#ID0EBABAAA=Newer_versions 我在这里得到了最后一个列名: https : //www.quora.com/What-is-the-last-column-name-in-an-Excel-file,并检查它是否与此处的较新版本相同: https: //support.office.com/zh-CN/article/excel-specifications-and-limits-1672b34d-7043-467e-8e27-269d656771c3#ID0EBABAAA=Newer_versions

Say we want to sum up part of the first row. 假设我们要总结第一行的一部分

Place the first column number in A2 and the last column number in A3 . 将第一个列号放在A2中 ,最后一个列号放在A3中 Then: 然后:

=SUM(INDEX(1:1,A2):INDEX(1:1,A3))

在此处输入图片说明

In your posted example, you would put 1 in A2 . 在您发布的示例中,您将在A2中放入1。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM