Dovile L.
Dovile L.

Reputation: 17

Sum the rows according the columns?

I have the table which looks:

[![enter image description here][1]][1]

I need to sum sums according to the dates but there is the thing:

The total sum should be in the new table:

[![enter image description here][2]][2]

Is it possible to create this formula in excel or google sheets without macro? It is possible to use if and sumifs in this case?

Thank you [1]: https://i.sstatic.net/0D8u8.png [2]: https://i.sstatic.net/6gsAJ.png

Upvotes: 0

Views: 166

Answers (1)

Mike Steelson
Mike Steelson

Reputation: 15308

Try

=query(arrayformula(split(flatten(A2:B&"|"&C2:C),"|")),"select Col1,sum(Col2) where Col2 is not null group by Col1 label sum(Col2) 'total sum'",0)

enter image description here

edit

=query({arrayformula(if(B2:B="",A2:A,B2:B)),C2:C},"select Col1,sum(Col2) where Col1 is not null group by Col1 label sum(Col2) 'total sum'",0)

enter image description here

Upvotes: 2

Related Questions