Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我有这些数据
4 1 4 0 4 1 3 0 5 1
SUM如果右侧的值为 1 或 true,我如何编写一个函数(使用或类似的东西)来添加左侧的所有值
SUM
总数应该是 13
假设使用 A 列和 B 列...
仅检查 1:
=SUMIF(B1:B5,"=1",A1:A5)
如果您还想检查 TRUE:
=SUMIF(B1:B5,"=1",A1:A5) + SUMIF(B1:B5,"=TRUE",A1:A5)
按 b 列排序,然后自动求和 a 列中所需的值。便宜又懒惰的解决方案。