[TABLE="width: 354"]
<colgroup><col><col span="3"></colgroup><tbody></tbody>[/TABLE]
I have a Table 1 which contained the sub account number and the related amount. The sub account numbers are then grouped to a master account number which is presented in Table 2. Table 2 is like a directory to guide what sub account numbers need to be added together.
[TABLE="width: 226"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD]Table 1[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]Sub Account number[/TD]
[TD]Amount[/TD]
[/TR]
[TR]
[TD]SDFG[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]D[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]FG[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD]D[/TD]
[TD="align: right"]6[/TD]
[/TR]
[TR]
[TD]GH[/TD]
[TD="align: right"]8[/TD]
[/TR]
[TR]
[TD]T[/TD]
[TD="align: right"]854[/TD]
[/TR]
[TR]
[TD]RH[/TD]
[TD="align: right"]565[/TD]
[/TR]
[TR]
[TD]H[/TD]
[TD="align: right"]45[/TD]
[/TR]
[TR]
[TD]GH[/TD]
[TD="align: right"]546[/TD]
[/TR]
[TR]
[TD]GH[/TD]
[TD="align: right"]54[/TD]
[/TR]
[TR]
[TD]J[/TD]
[TD="align: right"]5[/TD]
[/TR]
[TR]
[TD]GH[/TD]
[TD="align: right"]2[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 354"]
<colgroup><col><col span="3"></colgroup><tbody>[TR]
[TD]Table 2[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]Master account 1[/TD]
[TD]GH[/TD]
[TD]J[/TD]
[TD]T[/TD]
[/TR]
</tbody>[/TABLE]
I would like to do a sum if formula to sum the amount in table 1 if column A of Table 1 (the sub account number) matches any of the account number in row 1 of Table 2.
The number of sub account number in the Master account is variable.
I have tried to build array formula like {=SUM(IF(A:A={"GH","J","T"},B:B,0))}
But then the account number would need to be keyed in manually and there are a lot of sub account numbers that needed to be built into the formula.
I would like to ask if there is anyway to build formula, e.g. match, address, lookup, index and etc to do the work (adding the amount in table 1 of any sub account numbers that belong to the same master account).
Thank you very much for any help!!!
<colgroup><col><col span="3"></colgroup><tbody></tbody>[/TABLE]
I have a Table 1 which contained the sub account number and the related amount. The sub account numbers are then grouped to a master account number which is presented in Table 2. Table 2 is like a directory to guide what sub account numbers need to be added together.
[TABLE="width: 226"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD]Table 1[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]Sub Account number[/TD]
[TD]Amount[/TD]
[/TR]
[TR]
[TD]SDFG[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]D[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]FG[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD]D[/TD]
[TD="align: right"]6[/TD]
[/TR]
[TR]
[TD]GH[/TD]
[TD="align: right"]8[/TD]
[/TR]
[TR]
[TD]T[/TD]
[TD="align: right"]854[/TD]
[/TR]
[TR]
[TD]RH[/TD]
[TD="align: right"]565[/TD]
[/TR]
[TR]
[TD]H[/TD]
[TD="align: right"]45[/TD]
[/TR]
[TR]
[TD]GH[/TD]
[TD="align: right"]546[/TD]
[/TR]
[TR]
[TD]GH[/TD]
[TD="align: right"]54[/TD]
[/TR]
[TR]
[TD]J[/TD]
[TD="align: right"]5[/TD]
[/TR]
[TR]
[TD]GH[/TD]
[TD="align: right"]2[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 354"]
<colgroup><col><col span="3"></colgroup><tbody>[TR]
[TD]Table 2[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]Master account 1[/TD]
[TD]GH[/TD]
[TD]J[/TD]
[TD]T[/TD]
[/TR]
</tbody>[/TABLE]
I would like to do a sum if formula to sum the amount in table 1 if column A of Table 1 (the sub account number) matches any of the account number in row 1 of Table 2.
The number of sub account number in the Master account is variable.
I have tried to build array formula like {=SUM(IF(A:A={"GH","J","T"},B:B,0))}
But then the account number would need to be keyed in manually and there are a lot of sub account numbers that needed to be built into the formula.
I would like to ask if there is anyway to build formula, e.g. match, address, lookup, index and etc to do the work (adding the amount in table 1 of any sub account numbers that belong to the same master account).
Thank you very much for any help!!!