From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: making flexible table formulas Date: Mon, 28 Feb 2011 13:18:30 -0500 Message-ID: <26098.1298917110@alphaville.dokosmarshall.org> References: Reply-To: nicholas.dokos@hp.com Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=59889 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pu7gm-0006nd-Qz for emacs-orgmode@gnu.org; Mon, 28 Feb 2011 13:19:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pu7gd-0006O6-VI for emacs-orgmode@gnu.org; Mon, 28 Feb 2011 13:19:13 -0500 Received: from vms173013pub.verizon.net ([206.46.173.13]:54772) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pu7gd-0006NX-Px for emacs-orgmode@gnu.org; Mon, 28 Feb 2011 13:19:11 -0500 Received: from alphaville.dokosmarshall.org ([unknown] [173.76.32.106]) by vms173013.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0LHC00HDYAUUI1U0@vms173013.mailsrvcs.net> for emacs-orgmode@gnu.org; Mon, 28 Feb 2011 12:18:44 -0600 (CST) In-reply-to: Message from Rustom Mody of "Mon\, 28 Feb 2011 23\:05\:07 +0530." 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: Rustom Mody Cc: nicholas.dokos@hp.com, emacs-orgmode Rustom Mody wrote: > When using orgmode for hacking on data in a table (org a la spreadsheet)= =C2=A0 I have this situation > Say I am concentrating on column 2 and I want the bottom cell to be the s= um of the above cells > For a 7 row table with 8th row having the total I get >=20 > =C2=A0 #+TBLFM: @8$2=3Dvsum(@1$2..@7$2) >=20 > But now I have a problem: If say I add a row to the table then the next t= ime I recompute the formula > (s) the ninth row is not affected and the 8th row which is now data gets = overwritten with a > computation. >=20 > So basically I want the @1 and @7 which are hardcoded above to be replace= d by something to the > effect: "everything above..." and the @8$2 should be something to the tun= e of "bottom of $2" >=20 > I guess this may not be a reasonable request -- but with org you never kn= ow :-) so asking if there > is some way. >=20 >=20 Of course it's reasonable - and of course, org implements it :-) #+TBLFM: $LR2=3Dvsum(@1..@-1) In words: column 2 of the last row is the sum of all the rows (implicitly in column 2) from row 1 to the row above the last one. See section 3.5.1, "Tables>The spreadsheet>References" for more details. Nick