简体   繁体   English

我可以在SUMPRODUCT中使用INDIRECT吗?

[英]Can I use INDIRECT within SUMPRODUCT?

This is my second question and so far you all have been very helpful! 这是我的第二个问题,到目前为止,你们都非常有帮助!

I currently have this formula in place and it works great: 我目前有这个公式,效果很好:

=SUMPRODUCT((H2:H415=R63)*(K2:K415=R63))

Column H = 5 unique text H栏= 5个唯一文字

Column K = The same 5 unique text. K列=相同的5个唯一文本。

I added the 5 unique text into R63:R67 我在R63:R67中添加了5个唯一的文本

Right now I am counting to see how many times R63 shows up in H2:H415 AND K2:K415. 现在,我正在计数,以查看R63在H2:H415和K2:K415中出现了多少次。

The issue I'm having is the H415 and K415 are going to be forever increment in size. 我遇到的问题是H415和K415的尺寸将永远增加。 IE: 415, 416, 417, 418 etc. IE:415、416、417、418等。

In the past I have used INDIRECT as a method for 415 being in an updated/variable cell. 在过去,我使用INDIRECT作为更新/可变单元格中415的方法。

Is there a way I can have something similar within SUMPRODUCT ? 有什么办法可以使SUMPRODUCT拥有类似的功能?

Please note that Column H and K may be BLANK cells. 请注意,列H和K可能是空白单元格。

Thank you in advanced for the tips, suggestions and help! 在此先感谢您的提示,建议和帮助!

Why not COUNTIFS ? 为什么不选择COUNTIFS More efficient than SUMPRODUCT , ie SUMPRODUCT更有效,即

=COUNTIFS(H:H,R63,K:K,R63)

You can still take the whole column... 您仍然可以整列...

=SUMPRODUCT((H:H=R63)*(K:K=R63))

It will take some time to evaluate but if you want to use INDIRECT , you can use: 评估需要一些时间,但是如果要使用INDIRECT ,则可以使用:

=SUMPRODUCT((INDIRECT("H2:H"&D2)=R63)*(INDIRECT("K2:K"&D2)=R63))

assuming that the last column number is stored in cell D2 like in your previous question. 像上一个问题一样,假设最后一个列号存储在单元格D2中。 You'll have to update cell D2 constantly, however. 但是,您必须不断更新单元格D2。

If there is nothing "below" the 415, change it to something large enough to encompass further expansion, yet small enough to not slow down worksheet calculation. 如果415下方没有任何内容,请将其更改为足以容纳进一步扩展的大小,但又应足够小以至于不会减慢工作表的计算速度。 Something like: 就像是:

=SUMPRODUCT((H2:H9999=R63)*(K2:K9999=R63)) = SUMPRODUCT((H2:H9999 = R63)*(K2:K9999 = R63))

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

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