From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: making flexible table formulas Date: Tue, 1 Mar 2011 10:08:52 +0100 Message-ID: <0DA892CF-1356-48EE-AEDD-B7AB9E84862F@gmail.com> References: Mime-Version: 1.0 (Apple Message framework v1078) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=60705 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PuMky-0001Io-D5 for emacs-orgmode@gnu.org; Tue, 01 Mar 2011 05:24:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PuMkx-0000WT-Ae for emacs-orgmode@gnu.org; Tue, 01 Mar 2011 05:24:40 -0500 Received: from mail-wy0-f169.google.com ([74.125.82.169]:47088) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PuMkx-0000VN-5A for emacs-orgmode@gnu.org; Tue, 01 Mar 2011 05:24:39 -0500 Received: by wyi11 with SMTP id 11so5367517wyi.0 for ; Tue, 01 Mar 2011 02:24:37 -0800 (PST) In-Reply-To: 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: emacs-orgmode On 28.2.2011, at 18:35, Rustom Mody wrote: > When using orgmode for hacking on data in a table (org a la = spreadsheet) I have this situation > Say I am concentrating on column 2 and I want the bottom cell to be = the sum of the above cells > For a 7 row table with 8th row having the total I get >=20 > #+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 time I recompute the formula(s) the ninth row is not affected and = the 8th row which is now data gets overwritten with a computation. Hi Rustom, in addition to the excellent advice you have already gotten in this = thread, I would like to add the following piece of information (if only to make the thread a more complete online reference): Apparently you have been inserting new rows with normal editing commands = like RET or `C-o'. If you use Org's special commands to insert new rows, for = example M-S- on the last row, the row references in the formula will be = adjusted to @9$2=3Dvsum(@1$2..@7$2) So you see that the @8 has become a @9. However, the @7 has not been adjusted because Org has no way of telling what you meant. So even if you write your formula with @8$2=3D, you should use relative references = to refer to the fields when summing: @8$2=3D=3Dvsum(@1$2..@-1$2) Anyhow, the methods proposed by Nick and Luke are much better in this = case. Hope this helps - Carsten >=20 > So basically I want the @1 and @7 which are hardcoded above to be = replaced by something to the effect: "everything above..." and the @8$2 = should be something to the tune of "bottom of $2" >=20 > I guess this may not be a reasonable request -- but with org you never = know :-) so asking if there is some way. > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode