<colgroup><col><col span="3"></colgroup><tbody></tbody>
Table 1 | |
Sub Account number | Amount |
SDFG | 1 |
D | 2 |
FG | 3 |
D | 6 |
GH | 8 |
T | 854 |
RH | 565 |
H | 45 |
GH | 546 |
GH | 54 |
J | 5 |
GH | 2 |
<colgroup><col><col></colgroup><tbody>
</tbody>
Table 2 | |||
Master account 1 | GH | J | T |
<colgroup><col><col span="3"></colgroup><tbody>
</tbody>
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!!!