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:21:09 +0200 Message-ID: <4A82EBF5.3080109@cs.tu-berlin.de> References: <20090812160618.A958E30520@mailhost.cs.tu-berlin.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MbGhS-0003qY-GN for emacs-orgmode@gnu.org; Wed, 12 Aug 2009 12:29:18 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MbGhN-0003io-Bv for emacs-orgmode@gnu.org; Wed, 12 Aug 2009 12:29:17 -0400 Received: from [199.232.76.173] (port=58856 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MbGhN-0003iJ-5S for emacs-orgmode@gnu.org; Wed, 12 Aug 2009 12:29:13 -0400 Received: from mail.cs.tu-berlin.de ([130.149.17.13]:52669) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MbGhM-0003l6-FU for emacs-orgmode@gnu.org; Wed, 12 Aug 2009 12:29:12 -0400 Received: from localhost (localhost [127.0.0.1]) by localhost-12225.cs.tu-berlin.de (Postfix) with ESMTP id EA98A32A35 for ; Wed, 12 Aug 2009 18:29:09 +0200 (MEST) In-Reply-To: <20090812160618.A958E30520@mailhost.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 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