J Edmondson wrote:
I keep a running tally of my checking account. Column A is date of transaction. Column B is description. Column C is amt of transaction and column D is a running balance. Column D is a formula that takes the previous cell above and adds or subtracts to Column C to keep the balance. When I add transactions sometimes out of date order, I go to re-sort A by date. Numbers messes up the formula. It sorts the formula weirdly and knocks the totals out of whack. I am sorting on selected cells. Is there something special I should be doing?
Hi J,
Welcome to Apple Discussions and the Numbers '09 forum.
Numbers keeps track of cells referenced in formulas, and maintains the reference to the same cell at its new address. What you need to do special is write the formulas so that they are independent of that full address cell reference.
If all cells referenced are in the same row as the cell containing the formula, that's a simple matter of omitting the row part of the address. For references to cells in a different row, it requires some form of indirect addressing.
Here's an example. It requires at least one header row to provide a fixed location for the base cell ($A$1) from which an offset is specified. I would suggest using two header rows to allow the starting balance to be placed in a non-sorting (header) row.
I'm assuming that the amounts in column C will be negative for withdrawals and positive for deposits.
Enter the formula below in D3, and fill down to the last row of the table.
=IF(ISBLANK(C),"",OFFSET($A$1,ROW()-2,COLUMN()-1,1,1)+OFFSET($A$1,ROW()-1,COLUMN ()-2,1,1))
Regards,
Barry
PS:
OFFSET is discussed (with examples) on p. 219 of the iWork Formulas and Functions User Guide. This guide, and the Numbers '09 User Guide may be downloaded via the help menu in Numbers. Both are recommended.
B