Search code examples
excelexcel-formulasumifs

Sum quantities based on two columns and multiple rows


In excel, I have three columns. Column A contains receipt numbers, Column B contains item numbers, and Column C contains the quantity of each item. Example ("Receipt#" is in cell A1):

╔══════════╦═══════╦══════════╗
║ Receipt  ║ Item# ║ Quantity ║
╠══════════╬═══════╬══════════╣
║ x        ║ a     ║       14 ║
║ x        ║ a     ║       26 ║
║ x        ║ b     ║       30 ║
║ x        ║ c     ║       68 ║
║ y        ║ a     ║       79 ║
║ y        ║ c     ║        3 ║
║ y        ║ c     ║       24 ║
║ z        ║ b     ║       91 ║
║ z        ║ a     ║        5 ║
║ z        ║ a     ║        1 ║
╚══════════╩═══════╩══════════╝

I would like to sum the quantities belonging to the same Receipt# AND Item# in Column D.

I've tried SUMIFS(C:C,A:A,A3=A2,B:B,B3=B2) which returns 0.

I've tried IF(A3=A2,(IF(B3=B4,SUM(C5,C4),"")),"") which sums but not like I want, I only want one total per Item# AND Receipt#.


Solution

  • You might be using wrong criterias. See formula below.

    =SUMIFS(C:C,A:A,A1,B:B,B1)