Excel SUMIFS formula not working

Anonymous
2020-05-01T16:21:10+00:00

This is a simplified example of my problem:

I have two columns: category and hours. I want to find the sum of hours for A and C. The answer should be 5.1, but it shows 0. If I use SUMIF formula just for A or C, then it works, but if I use it for both A and C, it shows 0. What am I doing wrong?

Microsoft 365 and Office | Excel | For home | 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
{count} vote
Answer accepted by question author
  1. Anonymous
    2020-05-01T16:37:48+00:00

    I suspect that you want:

    =SUMPRODUCT(SUMIFS(B2:B7, A2:A7, D2:D3))

    That sums values in B2:B7 when the corresponding row in A2:A7 equals the value in D2 __or__ D3.

    Your SUMIFS sums values in B2:B7 when the corresponding row in A2:A7 equals the value in D2 __and__ D3.  Obviously, a value in A2:A7 cannot equal __both__ at the same time.

    My formula above works only if the cells that A2:A7 should equal are contiguous, like D2 and D3.  Suppose you want to compare with D2 and F4.  More generally:

    =SUMPRODUCT(SUMIFS(B2:B7, A2:A7, CHOOSE({1,2}, D2, F4)))

    1 person found this answer helpful.
    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Anonymous
    2020-05-01T16:38:54+00:00

    Your formula's criteria is working like the AND clause. Something cannot be both A and C. You need an OR clause.

    You can hard code the string array and sum the result like this,

    =SUM(SUMIFS(B:B, A:A, {"a","c"}))

    You can use a range of cells for criteria if they are in a different 'direction' than your other ranges. Since B2:B7, A2:A7 and D2:D3 are all in rows, we can TRANSPOSE D2:D3 and enter it as an array formula with Ctrl+Shift+Enter.

    =SUM(SUMIFS(B2:B7, A2:A7, TRANSPOSE(D2:D3)))

    0 comments No comments
  2. Anonymous
    2020-05-01T17:17:58+00:00

    Thanks a lot! It works.

    0 comments No comments
  3. Ashish Mathur 100.8K Reputation points Volunteer Moderator
    2020-05-02T00:06:21+00:00

    Hi,

    In cell D9, enter this formula

    =SUMPRODUCT((ISNUMBER(MATCH($A$2:$A$7,$D$2:$D$3,0)))*($B$2:$B$7))

    Hope this helps.

    0 comments No comments