From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Re: Question on spreadsheet formula Date: Mon, 28 Sep 2009 07:51:36 +0100 Message-ID: <9DB01350-3DB9-43B0-9D88-D5AAB687B179@gmail.com> References: <20090926053409.0f65c53b.andy13@gmx.net> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=UTF-8; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MsAyJ-0008H3-Pc for emacs-orgmode@gnu.org; Mon, 28 Sep 2009 03:48:35 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MsAyE-0008DT-Ru for emacs-orgmode@gnu.org; Mon, 28 Sep 2009 03:48:35 -0400 Received: from [199.232.76.173] (port=37137 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MsAyE-0008DK-Lk for emacs-orgmode@gnu.org; Mon, 28 Sep 2009 03:48:30 -0400 Received: from mx20.gnu.org ([199.232.41.8]:4343) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MsAyD-0005Ed-W3 for emacs-orgmode@gnu.org; Mon, 28 Sep 2009 03:48:30 -0400 Received: from mail-ew0-f208.google.com ([209.85.219.208]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MsAyD-0007Vh-4Q for emacs-orgmode@gnu.org; Mon, 28 Sep 2009 03:48:29 -0400 Received: by ewy4 with SMTP id 4so2290951ewy.31 for ; Mon, 28 Sep 2009 00:48:28 -0700 (PDT) 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: RC Cc: emacs-orgmode@gnu.org Hi RC, On Sep 27, 2009, at 8:35 PM, RC wrote: > Thank you benny and Andreas for your solutions to my question. > > I did notice a couple of things I did not expect and would =20 > appreciate if someone > could tell me what I am missing. > > In the following table, if I change the value in @2$4, I have to run =20= > C-c C-c > twice for the change to be propagated. Turning on formula debugging, =20= > the first > time the first formula gets executed starting only from @3$4 until =20 > the end of > the table, then the second substitution formula is executed for cell =20= > @2#4. This > happens even if cells @2$2 and @2$3 have values in them. Does the =20 > presence of > the substitution formula later in the #+TBLFM line, cause execution =20= > of the first > formula to start only from the succeeding row? > |-----+------+------+-------| > | No. | P | E | B | > |-----+------+------+-------| > | | | | 300 | > | 1 | 5000 | 2000 | 3200 | > | 2 | 7000 | 1000 | 9200 | > | 3 | 5000 | 1000 | 13200 | > #+TBLFM: $4=3D@-1$4+$2-$3::@2$4=3D300 Filed formulas are applied after column formulas, because often these reference fields that have been changed by column formulas. You have here a case where this assumption doe not apply. Note that there is a command org-table-iterate that recomputes the table until it is stable. `C-u C-u C-c C-u' does call this command when the cursor is in table. So far this did not work when the cursor is on the TBLFM line, but I just changed that. C-u C-u C-c C-c from the TBLFM line now also iterates. > > > For the table above, or the following, having a ! in the first =20 > column of the > first row (which I thought was a way to label columns) causes the =20 > calculation > formulas not to be executed. > |---+-----+------+------+-------| > | ! | No. | P | E | B | > |---+-----+------+------+-------| > | | 1 | 5000 | 2000 | 3000 | > | | 2 | 7000 | 1000 | 9000 | > | | 3 | 5000 | 1000 | 13000 | > | | 4 | 5000 | 2000 | 16000 | > #+TBLFM: $5=3Dvsum(@-I$3..@0$3)-vsum(@-I$4..@0$4) If you are using a special first column, only lines with # or * in the first column will be touched by column formulas. This is in the docs, right where you can read about the "!" rows as well. Here is the relevant passage: > Important: please note that for these special tables, recalculating > the table with C-u C-c * will only a=EF=AC=80ect rows that are marked = =20 =E2=80=98#=E2=80=99 > or =E2=80=98*=E2=80=99, and =EF=AC=81elds that have a formula = assigned to the =EF=AC=81eld =20 itself. > The column formulas are not applied in rows with empty =EF=AC=81rst = =EF=AC=81eld. HTH - Carsten > > Thanks, > RC > > > > _______________________________________________ > Emacs-orgmode mailing list > Remember: use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode