emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Darlan Cavalcante Moreira <darcamo@gmail.com>
To: Carl Bolduc <carlbolduc@gmail.com>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: monthly budget with year summary using tables
Date: Thu, 03 Jan 2013 11:57:23 -0300	[thread overview]
Message-ID: <50e59c56.0e6d650a.67a9.ffffb53c@mx.google.com> (raw)
In-Reply-To: <CA+gsZcdZgLAQ3aWUjAJ5Ehc+6o8sM9dor2QFtga05WGYKU2Few@mail.gmail.com>


A have a setup similar to the one you ask, using tables, but I don't need
babel for that.

Basically, I have a "Finances" headline in my main org file, whose children
are "years" headlines. In the beginning of each month I create a new
headline for that month in the current year using a template so that I have
something similar to

* Finances
  ...
  * 2013
    * January
      * Food
      * Bills
      * Entertainment
      * Car and transportation
      * Misc
      * Total

Each of the category has a table where I put the expenses for that category
and each table computes its total value. For instance, the table in the
"Food" category is something like

#+TBLNAME: FoodJanuary2013
|   | *Place*    | *Date*           | *Debit (R$)* | *Card (R$)* |
|---+------------+------------------+--------------+-------------|
|   | Some place | [2013-01-03 Qui] |        10.00 |        0.00 |
|---+------------+------------------+--------------+-------------|
| # |            | *Total*          |        10.00 |        0.00 |
#+TBLFM: @3$4=vsum(@2..@-1);%.2f::@3$5=vsum(@2..@-1);%.2f

where I add the expense either to the Debit column (when I pay with cash or
my debit card) or to the Card column (when I pay with the credit card).

Notice that the table has a unique name with the category, month and year
(all of this is created automatically with a template). In the "Total"
category I have a table that uses remote references to get the total value
of each category. This table gives me a glimpse of my expenses so far (I
can even plot it to see how much I spent in each category, for instance,
this is a good use of babel). This table is similar to

#+TBLNAME: ExpensesJanuary2013
|   | *Category*             | *Debit (R$)*  | *Card (R$)*   |
|---+------------------------+---------------+---------------|
| # | Entertainment          |               |               |
| # | Bills                  |               |               |
| # | Food                   |               |               |
| # | Car and transportation |               |               |
| # | Misc                   |               |               |
|---+------------------------+---------------+---------------|
| # | *Total*                |               |               |
| # | Total + Credit         |               |               |
#+TBLFM: @2$3=remote(EntertainimentJaneiro2013,$LR4);%.2f::@2$4=remote(EntertainimentJaneiro2013,$LR5);%.2f::@3$3=remote(BillsJaneiro2013,$LR4);%.2f::@3$4=remote(BillsJaneiro2013,$LR5);%.2f::@4$3=remote(FoodJaneiro2013,$LR4);%.2f::@4$4=remote(FoodJaneiro2013,$LR5);%.2f::@5$3=remote(CarJaneiro2013,$LR4);%.2f::@5$4=remote(CarJaneiro2013,$LR5);%.2f::@6$3=remote(MiscJaneiro2013,$LR4);%.2f::@6$4=remote(MiscJaneiro2013,$LR5);%.2f::@7$3=vsum(@2..@-1);%.2f::@7$4=vsum(@2..@-1);%.2f::@8$3=@-1$3+@-1$4;%.2f
 
In the end, org can do what you want the way you want.

--
Darlan


At Wed, 2 Jan 2013 14:21:12 -0500,
Carl Bolduc wrote:
> 
> I would like to move my budget from MS Excel to Org-Mode. I currently have
> one Excel sheet per month with all the transactions as well as a summary
> sheet that uses sumif functions.
> 
> Assuming the following format for the monthly table:
> 
> #+tblname: january
> | date | transaction | amount | category  |
> |------+-------------+--------+-----------|
> |   01 | iga         |     50 | groceries |
> |   01 | echo        |     30 | car       |
> |   02 | iga         |     47 | groceries |
> 
> How can I get the following summary table?
> 
> | category  | january | february |
> |-----------+---------+----------|
> | groceries |      97 |          |
> | car       |      30 |          |
> 
> I found this post on the mailing list that suggest to use babel:
> http://www.mail-archive.com/emacs-orgmode@gnu.org/msg22736.html
> 
> However, I need help to understand how I can put the resulting sums inside
> the summary table.
> 
> Thanks,
> Carl

  reply	other threads:[~2013-01-03 14:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-02 19:21 monthly budget with year summary using tables Carl Bolduc
2013-01-03 14:57 ` Darlan Cavalcante Moreira [this message]
2013-01-03 15:23   ` Stelian Iancu
2013-01-04 17:23     ` Darlan Cavalcante Moreira

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50e59c56.0e6d650a.67a9.ffffb53c@mx.google.com \
    --to=darcamo@gmail.com \
    --cc=carlbolduc@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).