admin管理员组文章数量:1277909
I have a curious issue with excel sum(array = criteria). I'm trying to write a conditional sum for an array with multiple criteria, and to avoid a very long formula, I would want to enter the criteria as a list in curly brackets. I cannot get excel to calculate the result if I enter the criteria, but it works if I double enter and then divide by 2. Any idea why this happens / any around it? I assume there must be something wrong with my syntax, but can't figure out what.
The fomula I wrote that didn't work is: =SUM((A2:A8={"A","B","C"})) A very similar one that did the trick: =SUM((A2:A8={"A","B","C"})+(A2:A8={"A","B","C"}))/2
Screencap has the actual excel version (first formula in B2, result in C2, and second one in B4 / C4.
(.png)
I have a curious issue with excel sum(array = criteria). I'm trying to write a conditional sum for an array with multiple criteria, and to avoid a very long formula, I would want to enter the criteria as a list in curly brackets. I cannot get excel to calculate the result if I enter the criteria, but it works if I double enter and then divide by 2. Any idea why this happens / any around it? I assume there must be something wrong with my syntax, but can't figure out what.
The fomula I wrote that didn't work is: =SUM((A2:A8={"A","B","C"})) A very similar one that did the trick: =SUM((A2:A8={"A","B","C"})+(A2:A8={"A","B","C"}))/2
Screencap has the actual excel version (first formula in B2, result in C2, and second one in B4 / C4.
(https://i.sstatic/9Q5qWh7K.png)
Share Improve this question edited Feb 25 at 9:27 ikelovesexcel asked Feb 25 at 9:23 ikelovesexcelikelovesexcel 11 bronze badge 2- I don't know what Excel version / edition you have, but your formulas cause my Excel (MS 365 Apps for business, v2501) to pop up saying "There's a problem with this formula" followed by basic formula tips... Not your fault, but others may also encounter this. – Peter B Commented Feb 25 at 9:40
- Interesting. I have MS Excel for Microsoft 365 MSO v2412. So desktop, older version based on the numbering at least. – ikelovesexcel Commented Feb 25 at 9:51
1 Answer
Reset to default 0Based on your screencap, it looks like you're trying to use SUM(COUNTIFS())
:
=SUM(COUNTIF(A2:A8,{"A","B","C"}))
Row 1 is using your formula (where you made it work multiplying it by 1);
Row 2 (selected cell) is using SUM(COUNTIFS())
;
Row 3 is just using COUNTIFS
.
本文标签: Excel conditional sum with criteria in curly bracketsStack Overflow
版权声明:本文标题:Excel conditional sum with criteria in curly brackets - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741216691a2360178.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论