Excel:优化一堆非常重的 SUMIFS
我想要根据某些条件对一些数据进行求和
示例数据:
A B C D
Id Id2 Id3 Val
1 1 8 6
1 2 7 7
1 3 3 8
1 4 6 4
1 4 78 7
1 1 2 9
1 3 1 4
1 4 3 6
1 1 5 8
1 4 7 2
现在我希望根据每个 的特定条件(例如 Id2=4 和 Id3=2)对每个 Id 求和 Val Id 有 100 个值,但我想避免为每个 Id 重新运行 sumif,因为表很重。
到目前为止我一直在做的是
= SUMIFS(D:D, A:A, "=1", B:B, "=4", C:C, "=2")
= SUMIFS(D:D, A:A, "=2", B:B, "=4", C:C, "=2")
= SUMIFS(D:D, A:A, "=3", B:B, "=4", C:C, "=2")
= SUMIFS(D:D, A:A, "=4", B:B, "=4", C:C, "=2") ...
(如果我正确记住了 sumifs 的语法)
是否有一种更快的方法可以避免为每个 Id 重新运行 sumifs ?
I have some data that I want summed matching certain criteria
Example data:
A B C D
Id Id2 Id3 Val
1 1 8 6
1 2 7 7
1 3 3 8
1 4 6 4
1 4 78 7
1 1 2 9
1 3 1 4
1 4 3 6
1 1 5 8
1 4 7 2
Now I want the Val summed for every Id, based on certain criteria (e.g. Id2=4 and Id3=2) for every Id which has 100 values, but I want to avoid rerunning the sumifs for every Id since the table is heavy.
What I have been doing so far is to
= SUMIFS(D:D, A:A, "=1", B:B, "=4", C:C, "=2")
= SUMIFS(D:D, A:A, "=2", B:B, "=4", C:C, "=2")
= SUMIFS(D:D, A:A, "=3", B:B, "=4", C:C, "=2")
= SUMIFS(D:D, A:A, "=4", B:B, "=4", C:C, "=2") ...
(if I remember the syntax of sumifs correctly)
Is there a faster way that avoids rerunning the sumifs for each Id ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您想以这种方式计算大量
SUM
,最好使用 数据透视表。您也可以尝试
DSUM
,但我怀疑它会比 SUMIF 更快。If you want to figure lots of
SUM
s in this way, it's best done with a pivot table.You may also try
DSUM
, but I doubt it's going to be any faster than SUMIF.您还可以执行 数组公式 这也应该快如闪电。
因此,请选择您想要的结果范围,然后按
F2
输入您想要第一个公式的位置。然后输入以下数组公式:或者
其中
G1
到G4
包含您要迭代的值。这将使它只获取数据一次而不是多次,并且一次返回所有值而不是多次。
如果您想从左到右迭代,请在数组中使用
逗号
而不是分号
。当您输入数组公式时,请按以下方式输入:
You could also do an array formula which should also be lightning fast.
So select the range that you want your results, then push
F2
to enter where you want your first formula. Then put in the below array formula:or
where
G1
toG4
have your values you want to iterate over.This will make it so it only grabs the data only once rather than multiple times and will return all the values one time rather than multiple times.
If you want to iterate from left to right use a
comma
instead of asemicolon
in your array.When you enter an array formula enter it this way: