From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eddward DeVilla" Subject: Re: table formula question Date: Tue, 5 Jun 2007 20:48:52 -0500 Message-ID: References: <41c818190706051839g4a0a4eax1545bc8e6d3fa7df@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Hvkds-0002Nn-EE for emacs-orgmode@gnu.org; Tue, 05 Jun 2007 21:48:56 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Hvkdq-0002Mc-7l for emacs-orgmode@gnu.org; Tue, 05 Jun 2007 21:48:55 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Hvkdq-0002MZ-2L for emacs-orgmode@gnu.org; Tue, 05 Jun 2007 21:48:54 -0400 Received: from wa-out-1112.google.com ([209.85.146.182]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Hvkdp-0004LD-Er for emacs-orgmode@gnu.org; Tue, 05 Jun 2007 21:48:53 -0400 Received: by wa-out-1112.google.com with SMTP id k34so2434315wah for ; Tue, 05 Jun 2007 18:48:52 -0700 (PDT) In-Reply-To: <41c818190706051839g4a0a4eax1545bc8e6d3fa7df@mail.gmail.com> Content-Disposition: inline List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: William Henney Cc: emacs-orgmode That looks like it will work. I don't have calc on my work system so I'll have to do the elisp equivalent but that won't be hard. Say something like so: * wealth management |--------------------------+---------+---------| | item | amount | balance | |--------------------------+---------+---------| | paid | 50.00 | 50.00 | | baby's new pair of shoes | -25.00 | 25.00 | | chips | -2.50 | 22.50 | | my birthday! | 100.00 | 122.50 | | speeding fine :( | -200.00 | -77.50 | |--------------------------+---------+---------| #+TBLFM: $3=3D'(apply '+ '(@-I$-1..$-1));N%.2f Thanks, Edd On 6/5/07, William Henney wrote: > Hi Eddward > > Does this do what you want? > > * wealth management > |--------------------------+---------+---------| > | item | amount | balance | > |--------------------------+---------+---------| > | paid | 50.00 | 50.00 | > | baby's new part of shoes | -25.00 | 25.00 | > | chip | -2.50 | 22.50 | > | my birthday! | 100.00 | 122.50 | > | speeding fine :( | -200.00 | -77.50 | > |--------------------------+---------+---------| > #+TBLFM: $3=3Dvsum(@-I$-1..$-1);f2 > > By explicitly doing the summation, I avoid any dependence on the order > in which each row is calculated. I think that your version fails > because your formula makes no sense for the first row: you can't add a > string ("total") to a float (50.00). > > Cheers > > Will > > On 6/5/07, Eddward DeVilla wrote: > > Hi, > > > > I'm having trouble trying to figure out what I've got wrong here. > > Given the table > > > > * wealth management > > |--------------------------+--------+-------| > > | item | amount | total | > > |--------------------------+--------+-------| > > | paid | 50.00 | | > > | baby's new part of shoes | -25.00 | | > > | chip | -2.50 | | > > |--------------------------+--------+-------| > > #+TBLFM: $3=3D'(+ @-1 $-1) > > > > > > I would expect to get the results > > > > * wealth management > > |--------------------------+--------+-------| > > | item | amount | total | > > |--------------------------+--------+-------| > > | paid | 50.00 | 50.00 | > > | baby's new part of shoes | -25.00 | 25.00 | > > | chip | -2.50 | 22.50 | > > |--------------------------+--------+-------| > > #+TBLFM: $3=3D'(+ @-1 $-1) > > > > > > But instead I just get > > > > * wealth management > > |--------------------------+--------+--------| > > | item | amount | total | > > |--------------------------+--------+--------| > > | paid | 50.00 | #ERROR | > > | baby's new part of shoes | -25.00 | #ERROR | > > | chip | -2.50 | #ERROR | > > |--------------------------+--------+--------| > > #+TBLFM: $3=3D'(+ @-1 $-1) > > > > > > I'm sure I'm missing something. Is a table like this even possible? > > > > Edd > > > > > > _______________________________________________ > > Emacs-orgmode mailing list > > Emacs-orgmode@gnu.org > > http://lists.gnu.org/mailman/listinfo/emacs-orgmode > > > > > -- > > Dr William Henney, Centro de Radioastronom=EDa y Astrof=EDsica, > Universidad Nacional Aut=F3noma de M=E9xico, Campus Morelia >