Monday, December 28, 2015

yogi_Compute Row By Row Running Balance Given Columns Of Debits And Credits In A3:B3 With Starting balance In Cell A2

Google Spreadsheet   Post  #1998
Yogi Anand, D.Eng, P.E.      ANAND Enterprises LLC -- Rochester Hills MI     www.energyefficientbuild.com.   Dec-28-2015
post by  Tippy P:
https://productforums.google.com/forum/#!topic/docs/_ruk1Caxyt0;context-place=forum/docs

Add Formula to Query()

I have a dataset that looks like this:
debitcredit
34.45
32
12.04
33.07
13.65
0.92
19.6
0.92
23.35
7.32
16.68
25.19
9.47
264
13.59
380.29
13.25
14.85
26.48
14.16
1466.36
35.46

I would like to add a running balance column in a Query() function (OR other solution)
debitcreditbalance
34.4534.45
322.45
12.04-9.59
33.07-42.66
13.65-56.31
0.92-57.23
19.6-76.83
0.92-77.75
23.35-101.1
7.32-108.42
16.68-125.1
25.19-150.29
9.47-159.76
264-423.76
13.59-437.35
380.29-57.06
13.25-70.31
14.85-85.16
26.48-111.64
14.16-125.8
1466.361340.56
35.461305.1

The current Query() function looks like this:
=query(A2:B24,"select A, B", -1)

How do I add the running balance column?
=query(A2:B24,"select A, B, C1-A2+B2", -1)

AND/OR include a Function in the Query() Function results?
=query(A2:B24,"select A, B 'SUM(C1,-A2,B2)'", -1)

Is any of this possible within the Query() Function AND/OR other solution?

Thanks,
 -----------------------------------------------------------------------------------------