Help with adjustment transaction

26 views
Skip to first unread message

oliver

unread,
May 16, 2024, 3:04:28 PMMay 16
to Ledger
I am embarrrassed to have to ask for help with this.  Unfortunately, my math skill are non-existant.

I start with savings account equty of $1,348.50. After several months of transactions, ledger balance gives me minus (-) $235.46. According to my bank the balance is $1,828.79.

What adjustment to I have to enter in order for ledger balance to match bank balance and how does one figure that out?

Thamk you

Robin H. Johnson

unread,
May 16, 2024, 6:57:42 PMMay 16
to ledge...@googlegroups.com
On Thu, May 16, 2024 at 11:50:31AM -0700, oliver wrote:
> I am embarrrassed to have to ask for help with this. Unfortunately, my
> math skill are non-existant.
>
> I start with savings account equty of $1,348.50. After several months of
> transactions, ledger balance gives me minus (-) $235.46. According to my
> bank the balance is $1,828.79.
Without seeing more of your ledger, I think you have sign errors rather than
value errors: e.g. debits that should have been credits.

> What adjustment to I have to enter in order for ledger balance to match
> bank balance and how does one figure that out?
Not a direct answer, but a trick I use from Gentoo Foundation's
accounting: Balance Assertions.

Our bank statements give us the opening and closing balances for each
statement, and I enter those as an assertion of the balance.

If I have an error somewhere before that, such as a missing transaction,
or a typo; the assertion flags that something is wrong.

If your bank statements provide a known balance after each transaction,
you can enter that:

2009/04/30 * Interest Earned: AccountName
Assets:Bank:AccountName $ 16.14 = $ 19,016.25
Income:Interest:AccountName

If your bank statements provide an opening or closing balance to the statement,
you can use that:

2023/06/30 * Balance Assertion: AccountName
Assets:Bank:AccountName $ 0.00 = $ 52,289.96

Errors will show up like this (I deliberately introduced an error of one cent
for the example).

====
While parsing file "REDACTED.ledger", line 36:
While parsing posting:
Assets:Bank:AccountName $ 0.00 = $ 52,289.97
^^^^^^^^^^^
Error: Balance assertion off by $0.01 (expected to see $52,289.96)
====

Caveats:
Sometimes such bank statements contain sequences that are only correct with
eventual consistency. Paypal's CSV export is esp. bad if you have events
close-in-time: Events T1, T2.1, T2.2, T3: correct at T1, correct at T2, but
both T2.1 & T2.2 use the balance after T1.

--
Robin Hugh Johnson
Gentoo Linux: Dev, Infra Lead, Foundation President & Treasurer
E-Mail : rob...@gentoo.org
GnuPG FP : 11ACBA4F 4778E3F6 E4EDF38E B27B944E 34884E85
GnuPG FP : 7D0B3CEB E9B85B1F 825BCECF EE05E6F6 A48F6136

Alan Schmitt

unread,
May 17, 2024, 2:48:09 AMMay 17
to Robin H. Johnson, ledge...@googlegroups.com
Hello,

On 2024-05-16 22:57, "Robin H. Johnson" <rob...@gentoo.org> writes:

> Our bank statements give us the opening and closing balances for each
> statement, and I enter those as an assertion of the balance.
>
> If I have an error somewhere before that, such as a missing transaction,
> or a typo; the assertion flags that something is wrong.
>
> If your bank statements provide a known balance after each transaction,
> you can enter that:
>
> 2009/04/30 * Interest Earned: AccountName
> Assets:Bank:AccountName $ 16.14 = $ 19,016.25
> Income:Interest:AccountName
>
> If your bank statements provide an opening or closing balance to the statement,
> you can use that:
>
> 2023/06/30 * Balance Assertion: AccountName
> Assets:Bank:AccountName $ 0.00 = $ 52,289.96

This looks very useful, but I have trouble understanding how it works
with past transactions that are not yet reconciled (i.e., not part of
the balance, yet present and before in the file). Are these transactions
ignored? If so, the balance will break once they are reconciled in the
future, won’t it?

Best,

Alan
signature.asc

oliver

unread,
May 17, 2024, 2:49:06 PMMay 17
to Ledger
I am afraid you are crediting me with more intelligence than I actually have.
I find balance assertion to be very difficult to understand and the few lines in the docs don't make it
any easier.
Follwoing your example, I enter:

2024/04/08 * Balance Assertion:Ally_Savings
    Assets:Ally_Savings $0.00 = $47.19
($47.19 being the ending balance in the account as of April 8).

In return I get:
Warning: "home/oliver/ledger.dat", line 1003: Unknown account 'Assets:Ally_Savings $0.00 = $47.19'

Obviously, I am doing something wrong, but what?

Thanks

Robin H. Johnson

unread,
May 17, 2024, 7:29:22 PMMay 17
to ledge...@googlegroups.com
On Fri, May 17, 2024 at 06:55:12AM -0700, oliver wrote:
> I am afraid you are crediting me with more intelligence than I actually
> have.
> I find balance assertion to be very difficult to understand and the few
> lines in the docs don't make it
> any easier.
> Follwoing your example, I enter:
>
> 2024/04/08 * Balance Assertion:Ally_Savings
> Assets:Ally_Savings $0.00 = $47.19
> ($47.19 being the ending balance in the account as of April 8).
>
> In return I get:
> Warning: "home/oliver/ledger.dat", line 1003: Unknown account
> 'Assets:Ally_Savings $0.00 = $47.19'
>
> Obviously, I am doing something wrong, but what?
You need more whitespace.
- An account name on the entry line must be prefixed with at least one space.
- An account name must end with two or more spaces, or one or more tabs.

Per the docs:
| There must be at least two spaces, or a tab, between the amount and the
| account. If you do not have adequate separation between the amount and the
| account Ledger will give an error and stop calculating.

So easy fix for you:
2024/04/08 * Balance Assertion:Ally_Savings
Assets:Ally_Savings $0.00 = $47.19

Robin H. Johnson

unread,
May 17, 2024, 7:40:28 PMMay 17
to ledge...@googlegroups.com
On Fri, May 17, 2024 at 08:48:04AM +0200, Alan Schmitt wrote:
> > 2023/06/30 * Balance Assertion: AccountName
> > Assets:Bank:AccountName $ 0.00 = $ 52,289.96
>
> This looks very useful, but I have trouble understanding how it works
> with past transactions that are not yet reconciled (i.e., not part of
> the balance, yet present and before in the file). Are these transactions
> ignored? If so, the balance will break once they are reconciled in the
> future, won’t it?

TL;DR: you insert balance assertions when you know the balance based on
some source of truth.

My ideal workflow:
- enter transactions, w/ uncleared and/or pending states.
- get the latest bank statement
- add assertions based on bank statement as part of the work to
reconcile the statement vs the ledger.
- If needed (rare), use intermediate accounts to represent uncleared
funds. This should only happen if you've made a payment in such a way
that the bank statement doesn't reflect it yet. The only times for
Gentoo had previously been cheques that the recipient had deposited
yet; and those transactions can be moved later to reflect the fact
that the recipient didn't deposit the cheque for a long time.

My practical workflow:
- I enter data primarily from the bank & paypal transactions in the
first place, and reconcile vs other sources.

Alan Schmitt

unread,
May 18, 2024, 7:04:13 AMMay 18
to ledge...@googlegroups.com
On 2024-05-17 23:40, "Robin H. Johnson" <rob...@gentoo.org> writes:

> TL;DR: you insert balance assertions when you know the balance based on
> some source of truth.

Thank you, this is very useful to know.

Alan
signature.asc

psionl0

unread,
May 18, 2024, 10:50:36 AMMay 18
to Ledger
This is where bank reconciliations come in.
When you enter a bank transaction into your file, you don't set the cleared flag (yet).
When you receive your bank statement, you go through it and for each line in  the bank statement that matches an entry in your ledger file, you set the cleared flag. You also enter (and clear) any lines in the bank statement (interest, fees etc) that are not already in your ledger file. If you then run your report on the ledger file with the -C option set, all of the transactions listed should match those in the bank statement and the two totals should match.
By running the report with the -U option set, you should see all of the transactions that have not yet been processed by the bank.

oliver

unread,
May 18, 2024, 11:13:10 AMMay 18
to Ledger
Thank you. You have been very helpful. It is much appreciated.
Now to go read the docs again.

Oliver
Reply all
Reply to author
Forward
0 new messages