简体   繁体   English

Excel 根据另一个单元格中的值求和 X 列的数量

[英]Excel Sum X amount of columns depending on a value in another cell

Is there a way that you can use sum() in excel and that sums up x amount of columns depending on number given in another cell.有没有一种方法可以在 excel 中使用 sum() 并根据另一个单元格中给出的数字总结 x 列的数量。

See below for example Example of how it's today例如,请参见下面的示例今天的情况

In this picture I have columns B:M were I put in Actual figures.在这张图片中,我有列 B:M,如果我放入实际数字。 And in columns T:AE I have budget figures.在 T:AE 列中,我有预算数据。

In this example I have actual figures JAN-MAY and would like to compare them vs budget JAN-MAY.在此示例中,我有 1 月至 5 月的实际数字,并想将它们与 1 月至 5 月的预算进行比较。

How I do today is that I go in to column AF and drag so it's =SUM(T6:X6) so it only takes T:X in this case.我今天的做法是,我将 go 放入 AF 列并拖动,所以它是 =SUM(T6:X6) 所以在这种情况下只需要 T:X。 But I would like that cell AF has a formula in it were it looks at cell AH:3 and sees that it's number 5. Therefore AF should sum(T;U;V;W;X(5columns))但我希望单元格 AF 中有一个公式,如果它查看单元格 AH:3 并看到它的编号为 5。因此 AF 应该 sum(T;U;V;W;X(5columns))

Hope you understand my problem and have a solution:!希望您了解我的问题并有解决方案:! :) :)

You can use the OFFSET function to determine the number of columns to SUM.您可以使用 OFFSET function 来确定要求和的列数。 In your example, AH3 is your offset amount.在您的示例中,AH3 是您的抵消金额。

In AF6 you can place this formula:在 AF6 中,您可以放置以下公式:

=SUM(T6:OFFSET(T6,0,AH3-1))

Which breaks down to分解为

=SUM(T6:OFFSET(Start at T6, Offset 0 rows, Offset columns the value of AH3 and subtract one for a total of five columns))

暂无
暂无

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

相关问题 列表中的EXCEL VBA计算总和取决于其他单元格值 - EXCEL VBA calc sum in list depending on other cell value 根据另一个单元格的内容为单元格分配值 - Excel - Assign a value to a cell depending on content of another cell - Excel 使用宏将Excel 2016中另一个单元格的选定单元格值求和 - Sum slected cell value with another cell in Excel 2016 using macro Excel:将一个单元格的值复制到另一个单元格,具体取决于其他单元格的值 - Excel: copy value of a cell to another depending on values of others 强制没有空单元格,取决于Excel中的另一个单元格 - Force no empty cell depending on another cell in Excel 根据ms excel中另一列中的单元格选择,在消息框中显示单元格值(合并的单元格) - display a cell value (merged cell) on message box depending on cell selection in another column in ms excel 当单元格的总和达到 Excel 中另一个单元格的值时突出显示单元格 - Highlight cells when its sum reached the value on another cell in Excel 如何使用参考单元格的值对另一个工作表中的excel数据求和 - How to sum excel data in another worksheet, using the value of a reference cell 如何根据excel中另一个工作表单元格值的特定值填充单元格背景颜色? - How to Fill cell background color depending a specific value from another sheet cell value in excel? Excel Count Ifs取决于2列的总和 - Excel Count Ifs depending on a sum of 2 columns
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM