简体   繁体   English

用公式定义求和/求和的范围

[英]Define range for sum/sumif with a formula

I've been going up and down the internet to solve this. 我一直在互联网上上下浮动来解决这个问题。 I think I am not searching with the correct parameters but I still hope you can help me. 我想我没有使用正确的参数进行搜索,但我仍然希望您能为我提供帮助。

Sample table: 样表:

样品表

I have some consolidation forms I need to fill with sums. 我有一些合并表格,需要填写总和。 So, in C19 (which is actually on a new tab) I would like to sum all the values C5-C12 which are mapped to the AB100 account for the consolidation, in production for example. 因此,在C19(实际上是在新选项卡中)中,我想对映射到AB100帐户进行合并的所有值C5-C12求和,例如在生产中。 The AB100 account is not unique to production, so I first need to define the column in which the specific row(s) have to be used to sum the values. AB100帐户不是生产专用的帐户,因此我首先需要定义必须使用特定行进行值求和的列。 Automating that in a formula is my key issue here. 在公式中自动执行此操作是我的主要问题。

I could easily solve this by just selecting column E as range for SUMIF but I want the formula in C19 to be able to recognize which column is to be looked at automatically, eg by using a "Lookup Key". 我只需选择E列作为SUMIF的范围即可轻松解决此问题,但是我希望C19中的公式能够识别要自动查看的列,例如使用“查找键”。 I have many of those consolidation forms and I don't want to manually change the formulas on each tab. 我有许多合并表格,但我不想手动更改每个选项卡上的公式。

It seems to me that all tips I found for nested SUM(IF( or SUM(INDEX( - even as array formulas - have the result value on the intersection of matched row and column. What I have on that intersection is a range of identical account numbers which need to be matched back to their respective $ values in C5-C12. 在我看来,我发现嵌套SUM(IF(或SUM(INDEX(-甚至是数组公式)-的所有技巧-甚至是数组公式的交集)的结果值都在匹配的行和列的交点上。需要与C5-C12中各自的$值匹配的帐号。

Any idea how I can do this with a formula? 知道如何使用公式执行此操作吗?

使用索引/匹配

=SUMIF(INDEX(D5:F12,0,MATCH(C16,D4:F4,0)),B19,C5:C12)

Using an index formula to select the column required in the SUMIFS 使用索引公式选择SUMIFS中所需的列

Hope this helps! 希望这可以帮助!

在此处输入图片说明

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

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