求和的可变范围

问题描述 投票:0回答:2

我需要弄清楚如何总结计数谁是依赖于从其他列的标准长度的变化。我结合多个电子表格的结果。有将在列A和B的重复,我需要组再添加列计数C一起一共拿到两个总需求在分组的最后一行中得到体现。来源例如:

Building#     Room#   Count    
1350          210      4    
1350          210      6    
1350          210      2    
1350          100      3    
1352          105      7    
1352          105      3    
1352          201      10

我需要得到需求看起来像下面的结果:

Building#     Room#   Count    Total    
1350          210      4    
1350          210      6    
1350          210      2        12    
1350          100      3         3    
1352          105      7    
1352          105      3        10    
1352          201      10       10
excel vba excel-formula sum sumifs
2个回答
2
投票

在D2使用这个公式,把它拉下来:

=IF(COUNTIFS(A3:$A$1048576,A2,B3:$B$1048576,B2)=0,SUMIFS(C:C,A:A,A:A,B:B,B:B),"")

enter image description here


3
投票

在D2和下拉:

=IF(OR(A2<>A3,B2<>B3),SUM($C$2:C2)-SUM($D$1:D1),"")

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.