I have a spreadsheet that lists various positions by account at original term to maturity (ex below). For this account the WAM (using SUMPRODUCT) is 128 days.

Account Amount Term
133400101 $75,000,000 182
133400101 $100,000,000 182
133400101 $100,000,000 92
133400101 $150,000,000 91

I would like to extract a WAM for each account. My problem is that the spreadsheet contains over 50 accounts and each account has at least 15 entries (the accounts are in sequence). Thus I need to write a sumproduct that looks only at a specific account. I have tried to write a sumproduct in which IFSUM's are the 1st and 2nd arrays. This does not work. Any ideas?