Extracting items from a larger transaction

16 views
Skip to first unread message

Tavis Ormandy

unread,
Jan 26, 2023, 11:12:17 AM1/26/23
to ledge...@googlegroups.com
Hello, I'm trying to start tracking my expenses with ledger, but I have
a question about the best way to split transactions.

Is there a variable I can reference that evaluates to the sum of
postings so far?

Let's say I spend $100 at a department store, I could write this:

2023/01/01 Department Store
Expenses:Clothing $8.99 ; T-Shirt
Expenses:Groceries ($100 - $8.99) ; Everything else was food
Liabilities:Credit $-100

My concern is that while extracting 1 item isn't so bad, if I have to do
several it's quite laborious:

2023/01/01 Department Store
Expenses:Clothing $8.99 ; T-Shirt
Expenses:Household $11.99 ; Light Bulbs
Expenses:Coffee $3.99
Expenses:Entertainment $7.99 ; Book
Expenses:Groceries ($100 - $8.99 - $11.99 - $3.99 - $7.99) ; Ugly :(
Liabilities:Credit $-100

If there was a variable like $sum, I could just do ($100 - $sum). Is
there anything like that?

I don't care about the expense buckets being exact (e.g. ignoring sales
tax is okay), so long as the total transaction amount matches my
statement.

Thank you!

Tavis.

--
_o) $ lynx lock.cmpxchg8b.com
/\\ _o) _o) $ finger tav...@sdf.org
_\_V _( ) _( ) @taviso

Yuri Khan

unread,
Jan 26, 2023, 11:22:26 AM1/26/23
to ledge...@googlegroups.com
On Thu, 26 Jan 2023 at 23:12, Tavis Ormandy <tav...@gmail.com> wrote:

> Hello, I'm trying to start tracking my expenses with ledger, but I have
> a question about the best way to split transactions.
>
> Is there a variable I can reference that evaluates to the sum of
> postings so far?
>
> 2023/01/01 Department Store
> Expenses:Clothing $8.99 ; T-Shirt
> Expenses:Household $11.99 ; Light Bulbs
> Expenses:Coffee $3.99
> Expenses:Entertainment $7.99 ; Book
> Expenses:Groceries ($100 - $8.99 - $11.99 - $3.99 - $7.99) ; Ugly :(
> Liabilities:Credit $-100

You can just omit the amount in a single posting. It will be
calculated so that the whole transaction balances.

(Also be aware that you need at least two spaces between the account
name and amount.)

2023/01/01 Department Store
Expenses:Clothing $8.99 ; T-Shirt
Expenses:Household $11.99 ; Light Bulbs
Expenses:Coffee $3.99
Expenses:Entertainment $7.99 ; Book
Expenses:Groceries
Liabilities:Credit $-100

the.so...@gmail.com

unread,
Jan 26, 2023, 11:29:27 AM1/26/23
to Ledger
On Thursday, 26 January, 2023 at 9:52:26 pm UTC+5:30 yuri...@gmail.com wrote:
You can just omit the amount in a single posting. It will be
calculated so that the whole transaction balances.

In this case, that would look like this:

2023-01-01 Department Store

    Expenses:Clothing                $8.99  ; T-Shirt
    Expenses:Household              $11.99  ; Light Bulbs
    Expenses:Coffee                  $3.99
    Expenses:Entertainment           $7.99  ; Book
    Expenses:Groceries
    Liabilities:Credit            $-100.00 

Tavis Ormandy

unread,
Jan 26, 2023, 12:41:10 PM1/26/23
to ledge...@googlegroups.com
Ah-ha! Thank you, I should have tried that!
Reply all
Reply to author
Forward
0 new messages