I have a list of payments where I would like to sum up the costs which description equals to one of the elements in my array.
EMTE € 120,00
Bread € 35,24
Lidl € 0,89
Plus € 5,19
Aldi € 2,29
Jumbo € 4,70
So with an array of {"Lidl", "Aldi"}
, It would give me the total of (2,29+0,89) 3,18.
I tried Sum.If
, but I don't seem how to use the or
statement in it properly and combine it with an array kind of input.
Wrap the SUMIF / SUMIFS function in a SUMPRODUCT function to provide an extra level of cyclic calculation.
=SUMPRODUCT(SUMIFS(B:B, A:A, {"Lidl","Aldi"}))
You could use a pivot table to get the result. The advantage of this solution is that it does not require complex formulas and is easy to change.
To create the pivot table:
- Select your data and use Insert > PivotTable
- Drag your first column to ROW, your second column to VALUES
- Make sure the VALUES are aggregated using a SUM
- In the top row of your PivotTable you see a DropDown that allows you to select the values that should be included in your report
- Make sure a grand total is displayed for all rows