Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

SUM with IF and AND

I am using SUMIFS with references to another workbook, which only works when that workbook is open. Based on this article, I tried to rewrite the SUMIFS to a combination of SUM, IF and AND to avoid this issue, however I can’t get it to work.

Here a sample table:

  | A | B | C |
1 | x | m | 3 |
2 | x | m | 4 |
3 | y | n | 6 |
4 | y | n | 7 |

My original formula returns 7:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

=SUMIFS(C:C;A:A;"a";B:B;"m")

The following formula with only one criteria works and returns 7:

=SUM(IF(A:A="x",C:C,0))

However, if I try to add a second criteria with AND (as recommended in the article), it always returns 0.

=SUM(IF(AND(A:A="a";B:B="m");C:C;0))

Any idea of how I could get this to work (without using the flawed SUMIFS)?

>Solution :

A multiply will help something like this

=SUM(IF((A:A="a")*(B:B="m");C:C;0))

AND function does the evaluation for all the items in the result.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading