# Maintain correct Balance when sorting differently.

1. ## Maintain correct Balance when sorting differently.

Dear Forum.
Looking for assistance with the following…
Basically looking to have a very basic bookkeeping workbook. Please see attached dummy sample similar to what I have configured.
What I would like however is to be able to sort by various headers but for the balance column (F) to maintain what would have been the correct balance for that date. Currently for all but the first row I have a basic formula for the “Balance” (column F), that looks to the row above and adds/subtracts the transaction amount for that row. The first date/row has a different formula such that it is looking at the opening balance (F10) and adding/subtracting the first transaction. This all works fine so long as I don’t sort differently. In order to be able to sort by something other than date and maintain the correct balance for that date, it would require a more intelligent formula such that it is looking at the balance of the previous date. Any ideas on a formula that would accomplish that for column F?

2. ## Re: Maintain correct Balance when sorting differently.

In F13 try:
Formula:
`Please Login or Register  to view this content.`

As your data are in Excel table, the formula will be automatically copied down.

The only disadvantage I see (at first glance) is that it gives balance "at the end of the day" so if you have a couple of rows for the same date then the balance in each of them will be the same (as for the last row with that date).

3. ## Re: Maintain correct Balance when sorting differently.

That worked great Kaper. The issue regarding the multiple transactions on same day was a consideration I hadn't thought about. I did want it such that it would make mathematical sense for each transaction so I have now added a time column and another column to combine the date and time. I then modified your formula such that it looks up the combined date and time column for determining the balance. Works a treat.
Thank you very much!!!

4. ## Re: Maintain correct Balance when sorting differently.

You are welcome!
And thanks for sharing your solution for date duplicates, as well as for marking thread solved and for rep+

5. ## Re: Maintain correct Balance when sorting differently.

Very welcome for the rep+

I guess if I had thought more about it at the time, another way to overcome the duplicate date entries would have been to have a column to the very left with a simple number for each row. Then have the formula lookup the balance in the row number before that number to add/subtract the pay in/out (hindsight is 20:20 )

Thank you again for your help. Have put some tweaks on my actual workbook and it's shaping up really nice (by my standards anyway )

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1