Share via

Table Lookup Formula

Anonymous
2022-06-16T19:54:18+00:00

I need help with a formula to complete cells C21-C25 and D21-D25 in the table below.

The Cells in C4-J4 are the names of banks. These are the same names that appear in column B21-25. In Cells C21-C25 I want a count of the number of accounts that we have at each bank, even if the account has no money in it. In Cells D21-D25 I'd like the number of accounts at each bank that have a balance.

Any suggestions would be appreciated.

Microsoft 365 and Office | Excel | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

  1. Anonymous
    2022-06-17T12:33:58+00:00

    Formula in cell 21:

    =COUNT(IF($C$5:$J$17<>"",IF($B21=$C$4:$J$4,$C$5:$J$17,""),""))

    Formula in cell D21:

    =COUNT(IF($C$5:$J$17<>0,IF($B21=$C$4:$J$4,$C$5:$J$17,""),""))

    Enter as array formula if not using Excel 365.

    Regards,

    Amit Tandon

    http://www.excelanytime.com/

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments

4 additional answers

Sort by: Most helpful
  1. Ashish Mathur 101.8K Reputation points Volunteer Moderator
    2022-06-18T02:11:15+00:00

    Hi,

    Enter this formula in cell C21 and drag down

    =SUM(MMULT(($C$5:$J$17<>"")*($C$4:$J$4=$B21),{1;1;1;1;1;1;1;1}))

    Enter this formula in cell D21 and drag down

    =SUM(MMULT(($C$5:$J$17>0)*($C$4:$J$4=$B21),{1;1;1;1;1;1;1;1}))

    Hope this helps.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2022-06-17T14:27:32+00:00

    Excellent... exactly what I needed. Thanks so much.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2022-06-16T21:39:09+00:00

    Good try but that only works for the first column for each bank. Your formula for bank "BBB" returns the number 2. Which is correct for column D, but Bank BBB also has accounts in columns E&F so the correct number of total BBB accounts is 11 and 6 of them have money in them.

    Thanks for trying though.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2022-06-16T20:33:11+00:00

    In D21:

    =COUNTIF(INDEX($C$5:$J$17,,MATCH(B21,$C$4:$J$4,FALSE)),">0")

    In C21:

    =COUNTIF(INDEX($C$5:$J$17,,MATCH(B21,$C$4:$J$4,FALSE)),"-")+D21

    Copied down

    Was this answer helpful?

    0 comments No comments