# Sum all values with same month and category

So I have this table where I'm writing down my daily expenses. On one cell I choose the date, the next cell I choose the category and in the third, I insert the amount of money spent. On another sheet I have another table where I want to add the values that have the same months and categories in common:

One cell for "Food" in "January", another for "travel" in "January" then on another table "Food" in "February" and so on...

I tried something like:

``````=LOOKUP("Food",\$E\$16:\$E\$18,\$D\$16:\$D\$18 )
``````

or:

``````=IF(MONTH(B16)=1,
IF(C16="Food",+D16))+
IF(MONTH(B17)=1,
IF(C16="Food",+D17))
``````

or even:

``````=IF(ISBLANK(D2);"";SUM(FILTER(\$B\$2:B;\$A\$2:A=D2)))
``````

and so on...

But none of this is working as I want.

Does anyone have any idea about how to go about doing this?

• Bruno, you're going to want QUERY or FILTER. It's easy enough to set up, but currently, you haven't given enough information. It's always best to share a link to your sheet (or a copy of your sheet), being sure to set permissions to "Anyone with the link can Edit" (not just "... can View"). That way, we can see and access all of the information you can see and access, and most efficiently write a formula solution for you. Commented Jan 27, 2019 at 2:02
``````=IFERROR(QUERY(Daily!\$B:\$D,