From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephan Schmitt Subject: Re: $LR syntax in tables Date: Wed, 12 Aug 2009 18:39:02 +0200 Message-ID: <4A82F026.6020701@cs.tu-berlin.de> References: <20090812160618.A958E30520@mailhost.cs.tu-berlin.de> <4A82EBF5.3080109@cs.tu-berlin.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MbGyl-0002HO-EF for emacs-orgmode@gnu.org; Wed, 12 Aug 2009 12:47:11 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MbGyg-0002EY-QX for emacs-orgmode@gnu.org; Wed, 12 Aug 2009 12:47:10 -0400 Received: from [199.232.76.173] (port=59831 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MbGyg-0002ED-FK for emacs-orgmode@gnu.org; Wed, 12 Aug 2009 12:47:06 -0400 Received: from mail.cs.tu-berlin.de ([130.149.17.13]:61292) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MbGyb-0006zQ-8c for emacs-orgmode@gnu.org; Wed, 12 Aug 2009 12:47:05 -0400 Received: from localhost (localhost [127.0.0.1]) by localhost-12225.cs.tu-berlin.de (Postfix) with ESMTP id 9E71433BFB for ; Wed, 12 Aug 2009 18:46:59 +0200 (MEST) In-Reply-To: <4A82EBF5.3080109@cs.tu-berlin.de> 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: emacs-orgmode@gnu.org, Andrew Stribblehill Stephan wrote: > Andrew wrote: >> I'm afraid I can't quite wrap my head around this puzzle. I have a >> little table: >> >> | Budget | 640 | 640 | >> | Some expense | -165 | 475 | >> #+TBLFM: $3=$LR3+$2 >> >> So col C is supposed to add the previous line's col C to the current >> line's col B. >> >> However, it seems that $LR3 is referring to the _subsequent_ line not >> the previous one. Is there a bug or just my misunderstanding? >> >> Thanks. > > Hi Andrew, > > what you need is this: > > | | | 0 | > | Budget | 640 | 640 | > | Some expense | -165 | 475 | > #+TBLFM: $3=@-1+$2::@1$3=0 > > the LR-reference is for the last, that is, the bottom row. > > You need the first row and the field formula for C1 in order to > initialize the cumulative sum properly. > > hth, > Stephan > p.s. another solution would be: | Budget | 640 | 640 | | Some expense | -165 | -165 | #+TBLFM: $3=@-1+$2::@1$3=@1$2 Greetings, Stephan