使用标题索引/匹配从两个或多个表中汇总行和列

时间:2016-08-17 18:12:44

标签: excel vba excel-formula

如何从两个表中汇总行和列?公式应匹配每个表的行号和列标题,找到交集并求它。 我只能使用sumif手动执行此操作,但我想要一个实际的公式,所以我不需要搜索表2的标题。我可以打开forumla或vba

基本上这个公式是这样的: =SUMIF("Table 3 ID Column",Table 1 ID,"Table 2 Income")

这不正确,但寻找这样的事情: =SUMIF("Table 3 Col", Value, ADDRESS(MATCH(Value,Col array,0) , MATCH(header Value ,header array,0),1))

实施例

Table 1
ID  Name
25173   Blue
25710   Debbie
64092   John
64094   Apples
6959    Oranges
6983    Amy


Table 2
ID  Income
25173   142
6983    298
64092   2205
25173   462
25173   346
64092   644


Table 3
Desired Output      
ID  Name    Income
25173   Blue    950
25710   Debbie  0
64092   John    2849
64094   Apples  0
6959    Oranges 0
6983    Amy 0

[[更新]] [enter image description here] 1

1 个答案:

答案 0 :(得分:1)

如果表格是Excel表格(主页>格式表格),那么您可以复制表格 2 并添加一个包含此公式的新表格列

= SUMIF( Table2[ID], [ID], Table2[Income] )

相关问题