Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9760

Google Sheets - Query - Sum and group by multiple columns into single column

$
0
0

I have 4 separate column that represents in and out transactions.. Columns A, B, C, D a = transaction out (some dollar amount) b = account type (checking, savings, credit) c = transaction in (some dollar amount) d = account type (checking, savings, credit)

Columns A/B and C/D may have different amounts of transactions as there may be more transactions in or out at any given time.

I am trying to sum A/B transactions by group (checking, savings, credit) and sum C/D transactions by group (checking, savings, credit), and then consolidate those into their own new columns E & F.

In the end, columns E & F will represent the sum'd amounts for account type. e = totaled transactions f = account type

I am able to do this with just A/B to E/F through - =query(TransIn, "select col2,sum(Col1) group by Col2 label sum(Col1) 'Account Balances'")

And I thought I was headed down the right road with - =query({TransIn,TransOut}, "select col2,col4,sum(Col1),sum(Col3) group by Col2 label sum(Col1) 'Account Balances'")

However, I simply dont see how to combine the sums into one column and the account types into another, and then order by the new account column. Maybe wrapping a query in a query?


Viewing all articles
Browse latest Browse all 9760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>