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:45:51 +0200 Message-ID: <4A82F1BF.7040706@cs.tu-berlin.de> References: <20090812160618.A958E30520@mailhost.cs.tu-berlin.de> <4A82EBF5.3080109@cs.tu-berlin.de> <4A82F026.6020701@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 1MbH5K-0005ox-5Q for emacs-orgmode@gnu.org; Wed, 12 Aug 2009 12:53:58 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MbH5F-0005lq-DT for emacs-orgmode@gnu.org; Wed, 12 Aug 2009 12:53:57 -0400 Received: from [199.232.76.173] (port=59795 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MbH5F-0005ll-AR for emacs-orgmode@gnu.org; Wed, 12 Aug 2009 12:53:53 -0400 Received: from mail.cs.tu-berlin.de ([130.149.17.13]:63973) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MbH5E-0000IB-BP for emacs-orgmode@gnu.org; Wed, 12 Aug 2009 12:53:52 -0400 Received: from localhost (localhost [127.0.0.1]) by localhost-12225.cs.tu-berlin.de (Postfix) with ESMTP id 9AFAE34225 for ; Wed, 12 Aug 2009 18:53:50 +0200 (MEST) In-Reply-To: <4A82F026.6020701@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: > > 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 > p.p.s. forgot to say: you must evaluate the formulas twice (C-u C-u C-c C-*) | Budget | 640 | 640 | | Some expense | -165 | 475 | #+TBLFM: $3=@-1+$2::@1$3=@1$2