this post was submitted on 11 Jul 2023
8 points (100.0% liked)

Plain Text Accounting

161 readers
1 users here now

Bookkeeping and accounting with plain text files and scriptable, command-line-friendly software, such as Ledger, hledger, or Beancount.

founded 1 year ago
MODERATORS
 

My credit card statement has two kinds of debit entries:

  • Payments from my bank account
  • Refunds from retailers (say because of a return)

In my csv import rule, I have a rule that filters the first item, where I assign account2 to a dummy "transfers" account that I will match payments to from my bank statement.

if %description BPAY PAYMENTS
  account2 transfers:credit:coles

However, I am not sure how to filter the second category. They show up with seemingly random descriptions. I don't see a way to do an if condition on whether the amount if positive or negative. So all of the refunds get assigned to the default "income:unknown" category. I'd ideally like to assign account2 in this case to something like "transfers:credit:refunds".

top 2 comments
sorted by: hot top controversial new old
[โ€“] simonmic 1 points 1 year ago

You can use an if rule with a regular expression pattern to match on positive/negative. Eg

if %theamountfield /^-/

But that doesn't sound helpful here since as you say they are both debits.

The payments from the bank should have fairly consistent descriptions, can't you filter on that ?

[โ€“] [email protected] 1 points 1 year ago* (last edited 1 year ago)

If there is no way of detecting those, but having said that, i'd delve deeper in the if statement. You can also make combo's with and (prefix the next line with & character) and using field matches.