简体   繁体   English

Excel:如何创建一个公式来对动态范围的单元格求和?

[英]Excel: How do I create a formula to sum a dynamic range of cells?

I need to create a sum function of every value in a row, starting with the value to the immediate right of the formula cell and summing all the values to the right until the first blank cell.我需要为一行中的每个值创建一个求和函数,从公式单元格右侧的值开始,并将右侧的所有值求和,直到第一个空白单元格。 The number of columns is dynamic.列数是动态的。 So, it would be something like SUM(ROW+1:ROWn) , where 'n' is the last column with a number.因此,它类似于SUM(ROW+1:ROWn) ,其中 'n' 是带有数字的最后一列。 Here's what I tried so far:这是我到目前为止尝试过的:

=SUM(INDIRECT(ADDRESS(ROW(), COLUMN()+1)):OFFSET(INDIRECT(ADDRESS(ROW(),COLUMN()+1)),0,?)

Where '?'在哪里 '?' represents my inability to retrieve a dynamic number of columns.表示我无法检索动态数量的列。

Thanks for your help!谢谢你的帮助!

This should work:这应该有效:

=SUM(OFFSET(J10,0,0,1,MATCH(TRUE,ISBLANK(J10:$XFD10),0)-1))

entered as an array formula ( Ctrl Shift Enter ).作为数组公式输入Ctrl Shift Enter )。

This assumes that your summing values in row 10 starting in column J --- you can customize these value to your situation.这假设您在从J列开始的第10行中求和值 --- 您可以根据您的情况自定义这些值。

The $XFD is the last legal column of a spreadsheet. $XFD是电子表格的最后一个合法列。 If you know your data is in a smaller range, you can probably improve calculation efficiency by choosing something smaller.如果你知道你的数据在一个更小的范围内,你可能可以通过选择更小的东西来提高计算效率。

Hope that helps.希望有帮助。

暂无
暂无

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

相关问题 如何编辑总和公式以选择动态范围的单元格? - How do I edit my sum formula to select a dynamic range of cells? Excel - 创建动态和公式范围 - Excel - Create dynamic sum formula range 如何为公式创建动态Excel范围? - How can I create a dynamic excel range for a formula? 如何在Excel中创建报告,以将空白单元格标记为“ n”,并将任何输入单元格标记为“ y”,以表示一系列单元格? - How do I create a report in Excel marking empty cells as “n” and cells with any input as “y” for a range of cells? 如何使用VBA或公式对Excel范围内具有特定值且具有注释的单元格进行计数? - How do I count cells with in a range in excel with specific value that has a comment using vba or formula? Excel:如果相关键在使用公式的值范围内,则对单元格区域求和 - Excel: Sum a range of cells if a related key is in a range of values using a formula 如何在Excel中创建一个公式来比较单元格中的文本并返回百分比 - How do I create a formula in excel that compares text in cells and returns a percentage 如何在Excel VBA中创建动态范围并跳过空白单元格 - How to create a dynamic range & skip blank cells in excel vba Excel-为数组公式覆盖的一系列单元格设置动态打印区域 - Excel - setting a dynamic print area for a range of cells covered by an array formula 如何使Excel公式跳过空单元格 - How do I make an excel formula skip empty cells
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM